本文整理汇总了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());
}
}