本文整理匯總了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;
}
示例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;
}
示例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());
}
}