org.dataconservancy.ui.model.DataItem.getName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中org.dataconservancy.ui.model.DataItem.getName()方法的一些代码示例,展示了DataItem.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataItem.getName()方法的具体详情如下:
包路径:org.dataconservancy.ui.model.DataItem
类名称:DataItem
方法名:getName

DataItem.getName介绍

[英]Retrieves the name of the dataset.
[中]检索数据集的名称。

代码示例

代码示例来源:origin: org.dataconservancy.ui/dcs-ui-mapper

/**
 * Asserts that the parameters provided to the {@link #toDcp(String, org.dataconservancy.ui.model.DataItem) Dcp
 * mapping method} contain all of the information required to produce a meaningful archival (DCP) package.
 *
 * @param collectionTransactionId the identifier of the Collection UI object that this DataItem belongs to
 * @param dataItem                 the DataItem itself
 * @throws IllegalArgumentException if any of the parameters are invalid or don't contain the required information
 */
private void assertValidity(String collectionTransactionId, DataItem dataItem) {
  if (collectionTransactionId == null || collectionTransactionId.trim().isEmpty()) {
    throw new IllegalArgumentException("Collection identifier must not be empty or null.");
  }
  if (dataItem.getId() == null || dataItem.getId().isEmpty()) {
    throw new IllegalArgumentException("DataItem identifier must not be empty or null.");
  }
  if (dataItem.getName() == null || dataItem.getName().isEmpty()) {
    throw new IllegalArgumentException("DataItem (" + dataItem.getId() + ") name must not be empty or null.");
  }
}

代码示例来源:origin: org.dataconservancy.dcs/dcs-mhf-finders-impl

@Override
protected MetadataAttributeSet findCoreMetadata(BusinessObject bo) {
  checkObjectType(bo);
  final DataItem dataItem = (DataItem) bo;
  final MetadataAttributeSet attributeSet = super.findCoreMetadata(dataItem);
  attributeSet.setName(MetadataAttributeSetName.DATAITEM_CORE_METADATA);
  if (dataItem.getName() != null) {
    attributeSet.addAttribute(new MetadataAttribute(MetadataAttributeName.TITLE, dataItem.getName().getClass().getSimpleName(), dataItem.getName()));
  }
  if (dataItem.getDescription() != null) {
    attributeSet.addAttribute(new MetadataAttribute(MetadataAttributeName.DESCRIPTION, dataItem.getDescription().getClass().getSimpleName(), dataItem.getDescription()));
  }
  //TODO: should be removed, as business id is already set by the super class's method.
  if (dataItem.getId() != null) {
    attributeSet.addAttribute(new MetadataAttribute(MetadataAttributeName.BUSINESS_ID, MetadataAttributeType.STRING, dataItem.getId()));
  }
  return attributeSet;
}

代码示例来源:origin: org.dataconservancy.mhf/dcs-mhf-finders-impl

@Override
protected MetadataAttributeSet findCoreMetadata(BusinessObject bo) {
  checkObjectType(bo);
  final DataItem dataItem = (DataItem) bo;
  final MetadataAttributeSet attributeSet = super.findCoreMetadata(dataItem);
  attributeSet.setName(MetadataAttributeSetName.DATAITEM_CORE_METADATA);
  if (dataItem.getName() != null) {
    attributeSet.addAttribute(new MetadataAttribute(MetadataAttributeName.TITLE, dataItem.getName().getClass().getSimpleName(), dataItem.getName()));
  }
  if (dataItem.getDescription() != null) {
    attributeSet.addAttribute(new MetadataAttribute(MetadataAttributeName.DESCRIPTION, dataItem.getDescription().getClass().getSimpleName(), dataItem.getDescription()));
  }
  //TODO: should be removed, as business id is already set by the super class's method.
  if (dataItem.getId() != null) {
    attributeSet.addAttribute(new MetadataAttribute(MetadataAttributeName.BUSINESS_ID, MetadataAttributeType.STRING, dataItem.getId()));
  }
  return attributeSet;
}

代码示例来源:origin: org.dataconservancy.dcs/dcs-ui-model

/**
 * @param object
 * @return human readable name for business object or null on failure to
 *         find a name
 */
private static String getName(BusinessObject object) {
  if (object instanceof Project) {
    Project p = (Project) object;
    return p.getName();
  }
  if (object instanceof Collection) {
    Collection c = (Collection) object;
    return c.getTitle();
  }
  if (object instanceof DataItem) {
    DataItem di = (DataItem) object;
    return di.getName();
  }
  if (object instanceof DataFile) {
    DataFile df = (DataFile) object;
    return df.getName();
  }
  return null;
}

代码示例来源:origin: org.dataconservancy.model/dcs-ui-model

/**
 * @param object
 * @return human readable name for business object or null on failure to
 *         find a name
 */
private static String getName(BusinessObject object) {
  if (object instanceof Project) {
    Project p = (Project) object;
    return p.getName();
  }
  if (object instanceof Collection) {
    Collection c = (Collection) object;
    return c.getTitle();
  }
  if (object instanceof DataItem) {
    DataItem di = (DataItem) object;
    return di.getName();
  }
  if (object instanceof DataFile) {
    DataFile df = (DataFile) object;
    return df.getName();
  }
  return null;
}

代码示例来源:origin: org.dataconservancy.ui/dcs-ui-mapper

private DcsDeliverableUnit mapDataSetStateDu(String rootDuId, String predecesorDuId, DataItem dataItem) {
  final DcsDeliverableUnit dataSetStateDu = new DcsDeliverableUnit();
  dataSetStateDu.setId("DataItemStateDu-" + UUID.randomUUID().toString());
  dataSetStateDu.addFormerExternalRef(dataItem.getId());
  dataSetStateDu.setType(DataItemProfile.DATASET_STATE_TYPE);
  dataSetStateDu.addParent(new DcsDeliverableUnitRef(rootDuId));
  dataSetStateDu.setTitle(dataItem.getName());
  if (predecesorDuId != null) {
    DcsRelation isSuccessorOf = new DcsRelation(DcsRelationship.IS_SUCCESSOR_OF, predecesorDuId);
    dataSetStateDu.addRelation(isSuccessorOf);
  }
  return dataSetStateDu;
}

代码示例来源:origin: org.dataconservancy.ui/dcs-ui-mapper

/**
 * Maps a DataItem to a Deliverable Unit.
 *
 * @param dataItem the DataItem to map
 * @return the DcsDeliverableUnit representing the DataItem
 * @throws DcpMappingException 
 */
private DcsDeliverableUnit mapDataSetDu(String collectionId, DataItem dataItem) throws DcpMappingException {
  // Map DataItem and File identifiers to the DcsDeliverableUnit formerExternalRef
  final DcsDeliverableUnit dataSetDu = new DcsDeliverableUnit();
  dataSetDu.setId(dataItem.getId());
  dataSetDu.addFormerExternalRef(dataItem.getId());
  // Set the type of the DcsDeliverableUnit, indicating that this DU is carrying business information
  // for a DataItem object
  dataSetDu.setType(DataItemProfile.DATASET_TYPE);
  // Set the title of the DcsDeliverableUnit to the DataItem name
  dataSetDu.setTitle(dataItem.getName());
  // Set the Collection that this dataSetDu belongs to
  dataSetDu.addParent(new DcsDeliverableUnitRef(collectionId));
  
  return dataSetDu;
}

代码示例来源:origin: org.dataconservancy.dcs/dcs-ui-model

/**
 * Constructs a DataItem, initializing this state with {@code toCopy}.
 */
public DataItem(DataItem toCopy) {
  this.name = toCopy.getName();
  this.description = toCopy.getDescription();
  this.id = toCopy.getId();
  this.depositorID = toCopy.getDepositorId();
  this.depositDate = toCopy.getDepositDate();
  this.files = toCopy.getFiles();
  this.parentId = toCopy.getParentId();
  this.alternateIds = toCopy.getAlternateIds();
  this.citableLocator = toCopy.getCitableLocator();
  this.contentModel = toCopy.getContentModel();
  this.creators = toCopy.getCreators();
  this.contactInfos = toCopy.getContactInfos();
  this.createdDate = toCopy.getCreatedDate();
  this.modifiedDate = toCopy.getModifiedDate();
}

代码示例来源:origin: org.dataconservancy.model/dcs-ui-model

/**
 * Constructs a DataItem, initializing this state with {@code toCopy}.
 */
public DataItem(DataItem toCopy) {
  this.name = toCopy.getName();
  this.description = toCopy.getDescription();
  this.id = toCopy.getId();
  this.depositorID = toCopy.getDepositorId();
  this.depositDate = toCopy.getDepositDate();
  this.files = toCopy.getFiles();
  this.parentId = toCopy.getParentId();
  this.alternateIds = toCopy.getAlternateIds();
  this.citableLocator = toCopy.getCitableLocator();
  this.contentModel = toCopy.getContentModel();
  this.creators = toCopy.getCreators();
  this.contactInfos = toCopy.getContactInfos();
  this.createdDate = toCopy.getCreatedDate();
  this.modifiedDate = toCopy.getModifiedDate();
}

代码示例来源:origin: org.dataconservancy.model/dcs-ui-model-builder-xstream

if (!isEmptyOrNull(dataItemSource.getName())) {
  writer.startNode(E_NAME);
  writer.setValue(dataItemSource.getName());
  writer.endNode();

代码示例来源:origin: org.dataconservancy.dcs/dcs-ui-model-builder-xstream

if (!isEmptyOrNull(dataItemSource.getName())) {
  writer.startNode(E_NAME);
  writer.setValue(dataItemSource.getName());
  writer.endNode();

代码示例来源:origin: org.dataconservancy.model/dcs-ui-model-builder-xstream

if (!isEmptyOrNull(dataItemSource.getName())) {
  writer.startNode(E_NAME);
  writer.setValue(dataItemSource.getName());
  writer.endNode();

代码示例来源:origin: org.dataconservancy.dcs/dcs-ui-model-builder-xstream

if (!isEmptyOrNull(dataItemSource.getName())) {
  writer.startNode(E_NAME);
  writer.setValue(dataItemSource.getName());
  writer.endNode();

相关文章