use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType in project nhin-d by DirectProject.
the class DefaultXdmXdsTransformerTest method testGetDocId_SubmitObjectsRequest.
/**
* Test the getDocId(SubmitObjectsRequest) method.
*/
public void testGetDocId_SubmitObjectsRequest() {
DefaultXdmXdsTransformer transformer = new DefaultXdmXdsTransformer();
QName qname = null;
String output = null;
SubmitObjectsRequest input = null;
ExternalIdentifierType eit = null;
RegistryObjectListType registryObject = null;
RegistryPackageType registryPackageType = null;
ExtrinsicObjectType extrinsicObjectType = null;
List<ExternalIdentifierType> externalIdentifiers = null;
JAXBElement<ExtrinsicObjectType> jaxbExtrinsicObject = null;
JAXBElement<RegistryPackageType> jaxbRegistryPackageTypeObject = null;
List<JAXBElement<? extends IdentifiableType>> identifiableList = null;
registryObject = new RegistryObjectListType();
identifiableList = registryObject.getIdentifiable();
eit = new ExternalIdentifierType();
eit.setIdentificationScheme("urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab");
eit.setValue("eitValue");
extrinsicObjectType = new ExtrinsicObjectType();
externalIdentifiers = extrinsicObjectType.getExternalIdentifier();
externalIdentifiers.add(eit);
qname = new QName("urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0", "ExtrinsicObject");
jaxbExtrinsicObject = new JAXBElement<ExtrinsicObjectType>(qname, ExtrinsicObjectType.class, extrinsicObjectType);
registryPackageType = new RegistryPackageType();
qname = new QName("urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0", "RegistryPackage");
jaxbRegistryPackageTypeObject = new JAXBElement<RegistryPackageType>(qname, RegistryPackageType.class, registryPackageType);
identifiableList.add(jaxbRegistryPackageTypeObject);
identifiableList.add(jaxbExtrinsicObject);
input = new SubmitObjectsRequest();
input.setRegistryObjectList(registryObject);
output = transformer.getDocId(input);
assertEquals("Output does not match expected", "eitValue", output);
registryObject = new RegistryObjectListType();
input = new SubmitObjectsRequest();
input.setRegistryObjectList(registryObject);
output = transformer.getDocId(input);
assertEquals("Output does not match expected", null, output);
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType in project ddf by codice.
the class RegistryPackageWebConverterTest method getSecondExternalIdentifier.
private ExternalIdentifierType getSecondExternalIdentifier() {
ExternalIdentifierType externalIdentifier = RIM_FACTORY.createExternalIdentifierType();
externalIdentifier.setId(RegistryConstants.REGISTRY_MCARD_ID_ORIGIN);
externalIdentifier.setRegistryObject("urn:uuid:2014ca7f59ac46f495e32b4a67a51276");
externalIdentifier.setIdentificationScheme("MetacardId");
externalIdentifier.setValue("someUUID");
return externalIdentifier;
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType in project ddf by codice.
the class RegistryPackageWebConverterTest method getFirstExternalIdentifier.
private ExternalIdentifierType getFirstExternalIdentifier() {
ExternalIdentifierType externalIdentifier = RIM_FACTORY.createExternalIdentifierType();
externalIdentifier.setId(RegistryConstants.REGISTRY_MCARD_ID_LOCAL);
externalIdentifier.setRegistryObject("urn:uuid:2014ca7f59ac46f495e32b4a67a51276");
externalIdentifier.setIdentificationScheme("MetacardId");
externalIdentifier.setValue("someUUID");
return externalIdentifier;
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType in project ddf by codice.
the class RegistryStoreImpl method setMetacardExtID.
private void setMetacardExtID(Metacard metacard, String newId) throws ParserException {
RegistryPackageType registryPackage = metacardMarshaller.getRegistryPackageFromMetacard(metacard);
List<ExternalIdentifierType> currentExtIdList = registryPackage.getExternalIdentifier();
currentExtIdList.stream().filter(extId -> extId.getId().equals(RegistryConstants.REGISTRY_MCARD_ID_LOCAL)).findFirst().ifPresent(extId -> extId.setValue(newId));
metacardMarshaller.setMetacardRegistryPackage(metacard, registryPackage);
}
use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType in project ddf by codice.
the class IdentificationPlugin method updateIdentifiers.
private void updateIdentifiers(Metacard metacard, boolean create) throws StopProcessingException {
boolean extOriginFound = false;
boolean extRegIdFound = false;
String metacardID = metacard.getId();
String registryID = RegistryUtility.getRegistryId(metacard);
String systemRegId = System.getProperty(RegistryConstants.REGISTRY_ID_PROPERTY);
try {
RegistryPackageType registryPackage = metacardMarshaller.getRegistryPackageFromMetacard(metacard);
List<ExternalIdentifierType> extIdList = new ArrayList<>();
//check if external ids are already present
if (registryPackage.isSetExternalIdentifier()) {
List<ExternalIdentifierType> currentExtIdList = registryPackage.getExternalIdentifier();
for (ExternalIdentifierType extId : currentExtIdList) {
extId.setRegistryObject(registryID);
if (extId.getId().equals(RegistryConstants.REGISTRY_MCARD_ID_LOCAL)) {
if (isInternal(metacard) && create) {
metacard.setAttribute(new AttributeImpl(RegistryObjectMetacardType.REMOTE_METACARD_ID, extId.getValue()));
}
extId.setValue(metacardID);
} else if (extId.getId().equals(RegistryConstants.REGISTRY_MCARD_ID_ORIGIN)) {
extOriginFound = true;
} else if (extId.getId().equals(RegistryConstants.REGISTRY_ID_ORIGIN)) {
if (!systemRegId.equals(extId.getValue()) && isInternal(metacard)) {
metacard.setAttribute(new AttributeImpl(RegistryObjectMetacardType.REMOTE_REGISTRY_ID, extId.getValue()));
}
extId.setValue(systemRegId);
extRegIdFound = true;
}
extIdList.add(extId);
}
if (!extOriginFound) {
extIdList.add(createExternalIdentifier(RegistryConstants.REGISTRY_MCARD_ID_ORIGIN, registryID, RegistryConstants.REGISTRY_METACARD_ID_CLASS, metacardID));
}
if (!extRegIdFound) {
extIdList.add(createExternalIdentifier(RegistryConstants.REGISTRY_ID_ORIGIN, registryID, RegistryConstants.REGISTRY_ID_CLASS, systemRegId));
}
} else {
extIdList.add(createExternalIdentifier(RegistryConstants.REGISTRY_MCARD_ID_LOCAL, registryID, RegistryConstants.REGISTRY_METACARD_ID_CLASS, metacardID));
extIdList.add(createExternalIdentifier(RegistryConstants.REGISTRY_MCARD_ID_ORIGIN, registryID, RegistryConstants.REGISTRY_METACARD_ID_CLASS, metacardID));
extIdList.add(createExternalIdentifier(RegistryConstants.REGISTRY_ID_ORIGIN, registryID, RegistryConstants.REGISTRY_ID_CLASS, systemRegId));
}
registryPackage.setExternalIdentifier(extIdList);
metacardMarshaller.setMetacardRegistryPackage(metacard, registryPackage);
} catch (ParserException e) {
throw new StopProcessingException("Unable to access Registry Metadata. Parser exception caught");
}
}
Aggregations