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

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

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

DataItem.getId介绍

暂无

代码示例

代码示例来源:origin: org.dataconservancy.frontend/dcs-ui-services-impl

private static String create(DataItem dataItem) {
  return dataItem.getId().intern();
}

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

private static String create(DataItem dataItem) {
  return dataItem.getId().intern();
}

代码示例来源:origin: org.dataconservancy.frontend/dcs-ui-services-impl

private static String create(DataItem dataItem, Collection collection) {
  StringBuilder sb = new StringBuilder(dataItem.getId());
  sb.append(collection.getId());
  return sb.toString().intern();
}

代码示例来源:origin: org.dataconservancy.frontend/dcs-ui-services-impl

private static String create(DataFile dataFile, DataItem dataItem) {
    StringBuilder sb = new StringBuilder(dataFile.getId());
    sb.append(dataItem.getId());
    return sb.toString().intern();
  }
}

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

private static String create(DataItem dataItem, Collection collection) {
  StringBuilder sb = new StringBuilder(dataItem.getId());
  sb.append(collection.getId());
  return sb.toString().intern();
}

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

private static String create(DataFile dataFile, DataItem dataItem) {
    StringBuilder sb = new StringBuilder(dataFile.getId());
    sb.append(dataItem.getId());
    return sb.toString().intern();
  }
}

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

@Override
public DateTime getLastModifiedDate(String id) throws RelationshipConstraintException {
  DateTime lastModifiedDate = null;
  DataItem ds = relService.getDataSetForDataFileId(id);
  if (ds != null && ds.getId() != null && !ds.getId().isEmpty()) {
    List<ArchiveDepositInfo> depositInfo = null;
    
    try {
      depositInfo = archiveService.listDepositInfo(ds.getId(), Status.DEPOSITED);
    } catch (ArchiveServiceException e) {
      log.warn("Failed to list deposit info for " + ds.getId());
    }
    if (depositInfo != null && !depositInfo.isEmpty()) {
      lastModifiedDate = depositInfo.get(0).getDepositDateTime();
    }
  }
  return lastModifiedDate;
}

代码示例来源:origin: org.dataconservancy.frontend/dcs-ui-services-impl

private DateTime retrieveInitialDepositDate(DataItem dataItem) {
  if (dataItem == null) {
    return null;
  }
  List<ArchiveDepositInfo> infoList = null;
  
  try {
    infoList = archiveService.listDepositInfo(dataItem.getId(), ArchiveDepositInfo.Status.DEPOSITED);
  } catch (ArchiveServiceException e) {
    log.warn("Failed to list deposit info for " + dataItem.getId());
  }
  
  if (infoList == null || infoList.isEmpty()) {
    return null;
  }
  return infoList.get(infoList.size() - 1).getDepositDateTime();
}

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

private DateTime retrieveInitialDepositDate(DataItem dataItem) {
  if (dataItem == null) {
    return null;
  }
  List<ArchiveDepositInfo> infoList = null;
  
  try {
    infoList = archiveService.listDepositInfo(dataItem.getId(), ArchiveDepositInfo.Status.DEPOSITED);
  } catch (ArchiveServiceException e) {
    log.warn("Failed to list deposit info for " + dataItem.getId());
  }
  
  if (infoList == null || infoList.isEmpty()) {
    return null;
  }
  return infoList.get(infoList.size() - 1).getDepositDateTime();
}

代码示例来源:origin: org.dataconservancy.frontend/dcs-ui-services-impl

private ArchiveDepositInfo.Status retrieveDepositStatus(DataItem dataItem)
    throws ArchiveServiceException {
  if (dataItem == null) {
    return null;
  }
  archiveService.pollArchiveByBusinessId(dataItem.getId());
  List<ArchiveDepositInfo> infoList =
      archiveService.listDepositInfo(dataItem.getId(), null);
  if (infoList == null || infoList.isEmpty()) {
    return null;
  }
  return infoList.get(0).getDepositStatus();
}

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

private ArchiveDepositInfo.Status retrieveDepositStatus(DataItem dataItem)
    throws ArchiveServiceException {
  if (dataItem == null) {
    return null;
  }
  archiveService.pollArchiveByBusinessId(dataItem.getId());
  List<ArchiveDepositInfo> infoList =
      archiveService.listDepositInfo(dataItem.getId(), null);
  if (infoList == null || infoList.isEmpty()) {
    return null;
  }
  return infoList.get(0).getDepositStatus();
}

代码示例来源:origin: org.dataconservancy.frontend/dcs-ui-services-impl

@Override
public void removeDataSetFromCollection(DataItem dataItem, Collection collection) {
  synchronized (IdBasedMutexFactory.create(dataItem, collection)) {
    relDao.removeRelation(dataItem.getId(), collection.getId(), IS_AGGREGATED_BY);
    relDao.removeRelation(collection.getId(), dataItem.getId(), AGGREGATES);
  }
}

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

@Override
public void removeDataFileFromDataSet(DataFile dataFile, DataItem dataItem) {
  synchronized (IdBasedMutexFactory.create(dataFile, dataItem)) {
    relDao.removeRelation(dataFile.getId(), dataItem.getId(), IS_AGGREGATED_BY);
    relDao.removeRelation(dataItem.getId(), dataFile.getId(), AGGREGATES);
  }
}

代码示例来源:origin: org.dataconservancy.frontend/dcs-ui-services-impl

@Override
public void removeDataFileFromDataSet(DataFile dataFile, DataItem dataItem) {
  synchronized (IdBasedMutexFactory.create(dataFile, dataItem)) {
    relDao.removeRelation(dataFile.getId(), dataItem.getId(), IS_AGGREGATED_BY);
    relDao.removeRelation(dataItem.getId(), dataFile.getId(), AGGREGATES);
  }
}

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

@Override
public void removeDataSetFromCollection(DataItem dataItem, Collection collection) {
  synchronized (IdBasedMutexFactory.create(dataItem, collection)) {
    relDao.removeRelation(dataItem.getId(), collection.getId(), IS_AGGREGATED_BY);
    relDao.removeRelation(collection.getId(), dataItem.getId(), AGGREGATES);
  }
}

代码示例来源:origin: org.dataconservancy.frontend/dcs-ui-services-impl

@Override
public void addDataFileToDataSet(DataFile dataFile, DataItem dataItem) throws RelationshipConstraintException {
  synchronized (IdBasedMutexFactory.create(dataFile, dataItem)) {
    final Set<Relationship> existingRelations = relDao.getRelations(dataFile.getId(), IS_AGGREGATED_BY);
    
    // Make sure the DataFile doesn't already belong to another DataItem
    if (!existingRelations.isEmpty()) {
      Relationship rel = existingRelations.iterator().next();
      if (!rel.getTarget().equals(dataItem.getId())) {
        final String msg = String.format(ERR_CONSTRAINT_DATAFILE, dataFile.getId(), dataItem.getId(),
            rel.getTarget());
        throw new RelationshipConstraintException(msg);
      }
    }
    relDao.addRelation(dataFile.getId(), dataItem.getId(), IS_AGGREGATED_BY);
    relDao.addRelation(dataItem.getId(), dataFile.getId(), AGGREGATES);
  }
}

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

@Override
public void addDataFileToDataSet(DataFile dataFile, DataItem dataItem) throws RelationshipConstraintException {
  synchronized (IdBasedMutexFactory.create(dataFile, dataItem)) {
    final Set<Relationship> existingRelations = relDao.getRelations(dataFile.getId(), IS_AGGREGATED_BY);
    
    // Make sure the DataFile doesn't already belong to another DataItem
    if (!existingRelations.isEmpty()) {
      Relationship rel = existingRelations.iterator().next();
      if (!rel.getTarget().equals(dataItem.getId())) {
        final String msg = String.format(ERR_CONSTRAINT_DATAFILE, dataFile.getId(), dataItem.getId(),
            rel.getTarget());
        throw new RelationshipConstraintException(msg);
      }
    }
    relDao.addRelation(dataFile.getId(), dataItem.getId(), IS_AGGREGATED_BY);
    relDao.addRelation(dataItem.getId(), dataFile.getId(), AGGREGATES);
  }
}

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

@Override
public void addDataSetToCollection(DataItem dataItem, Collection collection) throws RelationshipConstraintException {
  synchronized (IdBasedMutexFactory.create(dataItem, collection)) {
    final Set<Relationship> existingRelations = relDao.getRelations(dataItem.getId(), IS_AGGREGATED_BY,
        RelationshipDAO.RelEnd.SOURCE);
    
    // Make sure the DataItem doesn't already belong to another Collection
    if (!existingRelations.isEmpty()) {
      Relationship rel = existingRelations.iterator().next();
      if (!rel.getTarget().equals(collection.getId())) {
        final String msg = String.format(ERR_CONSTRAINT_DATASET, dataItem.getId(), collection.getId(),
            rel.getTarget());
        throw new RelationshipConstraintException(msg);
      }
      
    } else {         
      relDao.addRelation(dataItem.getId(), collection.getId(), IS_AGGREGATED_BY);
      relDao.addRelation(collection.getId(), dataItem.getId(), AGGREGATES);
    }
  }
}

代码示例来源: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.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;
}

相关文章