Search in sources :

Example 1 with ProcessType

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");
        }
    }
}
Also used : InspireId(eu.europa.ec.inspire.schemas.ompr.x30.ProcessType.InspireId)

Example 2 with ProcessType

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;
    }
}
Also used : ProcessType(eu.europa.ec.inspire.schemas.ompr.x30.ProcessType) EncodingException(org.n52.svalbard.encode.exception.EncodingException) XmlException(org.apache.xmlbeans.XmlException) ProcessPropertyType(eu.europa.ec.inspire.schemas.ompr.x30.ProcessPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) ProcessDocument(eu.europa.ec.inspire.schemas.ompr.x30.ProcessDocument) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)

Aggregations

ProcessDocument (eu.europa.ec.inspire.schemas.ompr.x30.ProcessDocument)1 ProcessPropertyType (eu.europa.ec.inspire.schemas.ompr.x30.ProcessPropertyType)1 ProcessType (eu.europa.ec.inspire.schemas.ompr.x30.ProcessType)1 InspireId (eu.europa.ec.inspire.schemas.ompr.x30.ProcessType.InspireId)1 XmlException (org.apache.xmlbeans.XmlException)1 XmlObject (org.apache.xmlbeans.XmlObject)1 EncodingException (org.n52.svalbard.encode.exception.EncodingException)1 UnsupportedEncoderInputException (org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)1