當前位置: 首頁>>代碼示例>>Java>>正文


Java FitsIdentity類代碼示例

本文整理匯總了Java中edu.harvard.hul.ois.fits.identity.FitsIdentity的典型用法代碼示例。如果您正苦於以下問題:Java FitsIdentity類的具體用法?Java FitsIdentity怎麽用?Java FitsIdentity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FitsIdentity類屬於edu.harvard.hul.ois.fits.identity包,在下文中一共展示了FitsIdentity類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: build

import edu.harvard.hul.ois.fits.identity.FitsIdentity; //導入依賴的package包/類
/**
 * Creates an object <code>FileFormat</code> based upon output returned by FITS.
 * 
 * @return file format
 */
public FileFormat build() {
    List<FitsIdentity> identities = fitsOutput.getIdentities();
    if (identities == null || identities.size() == 0) {
        return null;
    }
    FileFormat fileFormat = new FileFormat();
    fileFormat.setFileType(new FileTypeBuilder(fitsOutput).build());
    fileFormat.setMimeType(identities.get(0).getMimetype());
    List<FormatVersion> formatVersions = identities.get(0).getFormatVersions();
    if (formatVersions != null && formatVersions.size() > 0) {
        Collections.sort(formatVersions, new FitsFormatVersionComparator());
        fileFormat.setFormatVersion(formatVersions.get(0).getValue());
    }
    fileFormat.setPuid(getPuidFromIdentity(identities.get(0)));
    String firstPuid = fileFormat.getPuid();
    Set<String> formatNames = new HashSet<String>();
    for (FitsIdentity identity : identities) {
        if (fileFormat.getPuid() == null && identity.getMimetype() != null
                && identity.getMimetype().equals(fileFormat.getMimeType())) {
            fileFormat.setPuid(getPuidFromIdentity(identity));
        }
        if (identity.getMimetype() != null && identity.getMimetype().equals(fileFormat.getMimeType())) {
            formatNames.add(identity.getFormat());
        }
        if (firstPuid == null) {
            firstPuid = getPuidFromIdentity(identity);
        }
    }
    fileFormat.setNames(formatNames);
    if (fileFormat.getPuid() == null) {
        fileFormat.setPuid(firstPuid);
    }
    return fileFormat;
}
 
開發者ID:psnc-dl,項目名稱:darceo,代碼行數:40,代碼來源:FileFormatBuilder.java

示例2: getPuidFromIdentity

import edu.harvard.hul.ois.fits.identity.FitsIdentity; //導入依賴的package包/類
/**
 * Gets PUID from FITS identity section.
 * 
 * @param identity
 *            FITS identity section
 * @return PUID or null
 */
private String getPuidFromIdentity(FitsIdentity identity) {
    List<ExternalIdentifier> externalIdentifiers = identity.getExternalIdentifiers();
    if (externalIdentifiers != null && externalIdentifiers.size() > 0) {
        Collections.sort(externalIdentifiers, new FitsExternalIdentifierComparator());
        ExternalIdentifier externalIdentifier = externalIdentifiers.get(0);
        if (externalIdentifier.getName().equals("puid")) {
            return externalIdentifier.getValue();
        }
    }
    return null;
}
 
開發者ID:psnc-dl,項目名稱:darceo,代碼行數:19,代碼來源:FileFormatBuilder.java

示例3: indexFitsIdentities

import edu.harvard.hul.ois.fits.identity.FitsIdentity; //導入依賴的package包/類
private void indexFitsIdentities(FitsOutput fitsOutput, SolrInputDocument solrDoc) {
    for (FitsIdentity fitsIdentity : fitsOutput.getIdentities()) {
        solrDoc.addField("format", fitsIdentity.getFormat());
    }
}
 
開發者ID:little9,項目名稱:SolrFits,代碼行數:6,代碼來源:FitsExaminer.java


注:本文中的edu.harvard.hul.ois.fits.identity.FitsIdentity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。