Search in sources :

Example 1 with ProcessPropertyType

use of eu.europa.ec.inspire.schemas.ompr.x30.ProcessPropertyType in project arctic-sea by 52North.

the class ProcessPropertyTypeEncoder method encode.

@Override
public XmlObject encode(Process process, EncodingContext ex) throws EncodingException {
    ProcessPropertyType ppt = ProcessPropertyType.Factory.newInstance();
    ppt.setProcess(createProcess(process));
    return ppt;
}
Also used : ProcessPropertyType(eu.europa.ec.inspire.schemas.ompr.x30.ProcessPropertyType)

Example 2 with ProcessPropertyType

use of eu.europa.ec.inspire.schemas.ompr.x30.ProcessPropertyType 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

ProcessPropertyType (eu.europa.ec.inspire.schemas.ompr.x30.ProcessPropertyType)2 ProcessDocument (eu.europa.ec.inspire.schemas.ompr.x30.ProcessDocument)1 ProcessType (eu.europa.ec.inspire.schemas.ompr.x30.ProcessType)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