use of eu.europa.ec.inspire.schemas.ompr.x30.ProcessType in project arctic-sea by 52North.
the class ProcessTypeEncoder method checkForInspireId.
private void checkForInspireId(ProcessType pt, Process process) throws EncodingException {
if (pt.getInspireId() == null) {
if (process.isSetIdentifier()) {
addInspireId(pt, process);
} else {
InspireId iId = pt.addNewInspireId();
iId.setNil();
iId.setNilReason("unknown");
}
}
}
use of eu.europa.ec.inspire.schemas.ompr.x30.ProcessType in project arctic-sea by 52North.
the class ProcessTypeEncoder method createProcess.
protected ProcessType createProcess(Process process) throws EncodingException {
if (process.isSetXml()) {
XmlObject encodedObject = null;
try {
encodedObject = XmlObject.Factory.parse(process.getXml());
if (encodedObject instanceof ProcessType) {
ProcessType pt = (ProcessType) encodedObject;
checkForInspireId(pt, process);
return pt;
} else if (encodedObject instanceof ProcessDocument) {
return ((ProcessDocument) encodedObject).getProcess();
} else if (encodedObject instanceof ProcessPropertyType) {
return ((ProcessPropertyType) encodedObject).getProcess();
} else {
throw new UnsupportedEncoderInputException(this, process);
}
} catch (final XmlException xmle) {
throw new EncodingException(xmle);
}
} else {
ProcessType pt = ProcessType.Factory.newInstance();
if (!process.isSetGmlID()) {
process.setGmlId("p_" + JavaHelper.generateID(process.toString()));
}
pt.setId(process.getGmlId());
addInspireId(pt, process);
addName(pt, process);
addType(pt, process);
addDocumentation(pt, process);
addProcessParameter(pt, process);
addResponsibleParty(pt, process);
return pt;
}
}
Aggregations