private static void addResourceIdentifierSet(SolrInputDocument doc, Collection<DcsResourceIdentifier> set) { if( set == null || set.size() == 0){ return; } for( DcsResourceIdentifier id : set){ setadd(doc, ResourceIdentifierField.AUTHORITY, id.getAuthorityId()); setadd(doc, ResourceIdentifierField.TYPE, id.getTypeId()); setadd(doc, ResourceIdentifierField.VALUE, id.getIdValue()); } }
public DcsResourceIdentifier createAlternateId(){ DcsResourceIdentifier id = new DcsResourceIdentifier(); id.setAuthorityId(randomString(10, true)); id.setIdValue(randomString(20, false)); id.setTypeId(randomString(5, true)); return id; }
DcsResourceIdentifier res = new DcsResourceIdentifier(); res.setIdValue(id); statedu.addAlternateId(res);
/** * Places the supplied entities in the backing map, keyed by their alternate identifiers. * * @param entities the entities to add in the backing map */ protected void mapAlternateIds(DcsEntity... entities) { for (DcsEntity e : entities) { for (DcsResourceIdentifier altId : e.getAlternateIds()) { Set<DcsEntity> value; if (entityMap.containsKey(altId.getIdValue())) { value = entityMap.get(altId.getIdValue()); } else { value = new HashSet<DcsEntity>(); } value.add(e); entityMap.put(altId.getIdValue(), value); } } }
du.addAlternateId(new DcsResourceIdentifier("", key, registryEntry.getType()));
/** * Places the supplied entities in the backing map, keyed by their alternate identifiers. * * @param entities the entities to add in the backing map */ protected void mapAlternateIds(DcsEntity... entities) { for (DcsEntity e : entities) { for (DcsResourceIdentifier altId : e.getAlternateIds()) { Set<DcsEntity> value; if (entityMap.containsKey(altId.getIdValue())) { value = entityMap.get(altId.getIdValue()); } else { value = new HashSet<DcsEntity>(); } value.add(e); entityMap.put(altId.getIdValue(), value); } } }
dcs_file.setId("datafile0"); dcs_file.addAlternateId( new DcsResourceIdentifier(Id.getAuthority(), dataFile.getId(), Types.DATA_FILE.name())); dcs_file.addAlternateId(new DcsResourceIdentifier(Id .getAuthority(), dataFile.getId(), Types.DATA_FILE.name())); dcpRootDu.addFormerExternalRef(dataFile.getId()); dcpRootDu.addAlternateId( new DcsResourceIdentifier(Id.getAuthority(), dataFile.getId(), Types.DATA_FILE.name()));
public DcsFile findFile(String business_id, String type) { for (Set<DcsEntity> entities : archiveUtil.getEntities().values()) { for (DcsEntity entity : entities) { if (!(entity instanceof DcsFile)) { continue; } DcsFile file = (DcsFile) entity; for (DcsResourceIdentifier res : file.getAlternateIds()) { if (res.getIdValue().equals(business_id) && Id.getAuthority().equals(res.getAuthorityId()) && type.equals(res.getTypeId())) { return file; } } } } return null; } }
private static Set<DcsResourceIdentifier> getResourceIdentifierSet(SolrDocument doc){ Set<DcsResourceIdentifier> idSet = new HashSet<DcsResourceIdentifier>(); String[] authorities = setgetAll(doc, ResourceIdentifierField.AUTHORITY); String[] types = setgetAll(doc, ResourceIdentifierField.TYPE); String[] values = setgetAll(doc, ResourceIdentifierField.VALUE); for( int i = 0; i < values.length; i++) { DcsResourceIdentifier id = new DcsResourceIdentifier(); id.setAuthorityId(authorities[i]); id.setTypeId(types[i]); id.setIdValue(values[i]); idSet.add(id); } return idSet; }
dcs_file.addAlternateId(new DcsResourceIdentifier(Id .getAuthority(), metadataFile.getId(), Types.METADATA_FILE.name()));
@Override public DcsFile findDataSetFile(String business_id) { for (Set<DcsEntity> entities : archiveUtil.getEntities().values()) { for (DcsEntity entity : entities) { if (!(entity instanceof DcsFile)) { continue; } DcsFile file = (DcsFile) entity; for (DcsResourceIdentifier res : file.getAlternateIds()) { if (res.getIdValue().equals(business_id) && Id.getAuthority().equals(res.getAuthorityId()) && Types.DATA_SET.name().equals(res.getTypeId())) { return file; } } } } return null; } }
@Override public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { final DcsResourceIdentifier rid = new DcsResourceIdentifier(); final String authorityId = (String) reader.getValue(); if (authorityId != null) { rid.setAuthorityId(authorityId); final String typeId = (String) reader.getValue(); if (typeId != null) { rid.setTypeId(typeId); final String idValue = (String) reader.getValue(); if (idValue != null) { rid.setIdValue(idValue);
if (!isEmptyOrNull(rid.getAuthorityId())) { writer.startNode(E_AUTHORITYID); writer.setValue(rid.getAuthorityId()); writer.endNode(); if (!isEmptyOrNull(rid.getTypeId())) { writer.startNode(E_TYPEID); writer.setValue(rid.getTypeId()); writer.endNode(); if (!isEmptyOrNull(rid.getIdValue())) { writer.startNode(E_IDVALUE); writer.setValue(rid.getIdValue()); writer.endNode();
if (id.getAuthorityId() != null && id.getAuthorityId().equals(Id.getAuthority()) && id.getTypeId() != null && id.getTypeId() .equals(Types.METADATA_FILE.name())) { metadataFile.setId(id.getIdValue());