Search in sources :

Example 1 with System

use of org.n52.shetland.ogc.sensorML.System in project arctic-sea by 52North.

the class SensorMLEncoderv101 method createSensorMLDescription.

protected SensorMLDocument createSensorMLDescription(final SensorML smlSensorDesc) throws EncodingException {
    final SensorMLDocument sensorMLDoc = SensorMLDocument.Factory.newInstance(getXmlOptions());
    final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSensorML = sensorMLDoc.addNewSensorML();
    xbSensorML.setVersion(SensorMLConstants.VERSION_V101);
    if (smlSensorDesc.isSetMembers()) {
        for (final AbstractProcess sml : smlSensorDesc.getMembers()) {
            if (sml instanceof System) {
                final SystemType xbSystem = (SystemType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_SYSTEM), SystemType.type);
                final System smlSystem = (System) sml;
                addAbstractProcessValues(xbSystem, smlSystem);
                addSystemValues(xbSystem, smlSystem);
            } else if (sml instanceof ProcessModel) {
                final ProcessModelType xbProcessModel = (ProcessModelType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_PROCESS_MODEL), ProcessModelType.type);
                final ProcessModel smlProcessModel = (ProcessModel) sml;
                addAbstractProcessValues(xbProcessModel, smlProcessModel);
                addProcessModelValues(xbProcessModel, smlProcessModel);
            } else if (sml instanceof org.n52.shetland.ogc.sensorML.Component) {
                final ComponentType xbCompontent = (ComponentType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_COMPONENT), ComponentType.type);
                final org.n52.shetland.ogc.sensorML.Component smlComponent = (org.n52.shetland.ogc.sensorML.Component) sml;
                addAbstractProcessValues(xbCompontent, smlComponent);
                addComponentValues(xbCompontent, smlComponent);
            }
        }
    }
    return sensorMLDoc;
}
Also used : ProcessModel(org.n52.shetland.ogc.sensorML.ProcessModel) ComponentType(net.opengis.sensorML.x101.ComponentType) AbstractDataComponentType(net.opengis.swe.x101.AbstractDataComponentType) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) QName(javax.xml.namespace.QName) SystemType(net.opengis.sensorML.x101.SystemType) System(org.n52.shetland.ogc.sensorML.System) SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) Component(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) ProcessModelType(net.opengis.sensorML.x101.ProcessModelType)

Example 2 with System

use of org.n52.shetland.ogc.sensorML.System in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method should_encode_multiple_contacts_in_contactList.

@Test
public void should_encode_multiple_contacts_in_contactList() throws EncodingException {
    final SensorML sensorML = new SensorML();
    final System system = new System();
    sensorML.addMember(system);
    final SmlPerson contact1 = createPerson("1");
    final SmlPerson contact2 = createPerson("2");
    system.addContact(contact1);
    system.addContact(contact2);
    final SystemType xbSystem = encodeSystem(sensorML);
    assertThat(xbSystem.sizeOfContactArray(), is(1));
    assertThat(xbSystem.getContactArray(0).isSetContactList(), is(true));
    final ContactList xbContactList = xbSystem.getContactArray(0).getContactList();
    assertThat(xbContactList.sizeOfMemberArray(), is(2));
    final Member member = xbContactList.getMemberArray(0);
    final Member member2 = xbContactList.getMemberArray(1);
    assertThat(member.isSetPerson(), is(true));
    assertThat(member2.isSetPerson(), is(true));
    if (member.getPerson().getName().equals(contact1.getName())) {
        checkPerson(contact1, member.getPerson());
        checkPerson(contact2, member2.getPerson());
    } else {
        checkPerson(contact1, member2.getPerson());
        checkPerson(contact2, member.getPerson());
    }
}
Also used : SystemType(net.opengis.sensorML.x101.SystemType) ContactList(net.opengis.sensorML.x101.ContactListDocument.ContactList) SensorML(org.n52.shetland.ogc.sensorML.SensorML) Member(net.opengis.sensorML.x101.ContactListDocument.ContactList.Member) System(org.n52.shetland.ogc.sensorML.System) SmlPerson(org.n52.shetland.ogc.sensorML.SmlPerson) Test(org.junit.Test)

Example 3 with System

use of org.n52.shetland.ogc.sensorML.System in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method should_set_identifier.

@Test
public void should_set_identifier() throws EncodingException {
    final SensorML sensorMl = new SensorML();
    final System system = new System();
    sensorMl.addMember(system);
    system.addIdentifier(new SmlIdentifier(TEST_NAME_1, OGCConstants.URN_UNIQUE_IDENTIFIER, TEST_ID_1));
    final SystemType xbSystem = encodeSystem(sensorMl);
    assertThat(xbSystem.getIdentificationArray().length, is(1));
    final IdentifierList xbIdentifierList = xbSystem.getIdentificationArray()[0].getIdentifierList();
    assertThat(xbIdentifierList.sizeOfIdentifierArray(), is(1));
    final Identifier xbIdentifier = xbIdentifierList.getIdentifierArray(0);
    assertThat(xbIdentifier.getName(), is(TEST_NAME_1));
    assertThat(xbIdentifier.getTerm().getDefinition(), is(OGCConstants.URN_UNIQUE_IDENTIFIER));
    assertThat(xbIdentifier.getTerm().getValue(), is(TEST_ID_1));
}
Also used : SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) Identifier(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier) SystemType(net.opengis.sensorML.x101.SystemType) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList) SensorML(org.n52.shetland.ogc.sensorML.SensorML) System(org.n52.shetland.ogc.sensorML.System) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) Test(org.junit.Test)

Example 4 with System

use of org.n52.shetland.ogc.sensorML.System in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method should_encode_single_contact_responsibleParty.

@Test
public void should_encode_single_contact_responsibleParty() throws EncodingException {
    final SensorML sensorML = new SensorML();
    final System system = new System();
    sensorML.addMember(system);
    final SmlResponsibleParty responsibleParty = createResponsibleParty("");
    system.addContact(responsibleParty);
    final SystemType xbSystem = encodeSystem(sensorML);
    assertThat(xbSystem.sizeOfContactArray(), is(1));
    assertThat(xbSystem.getContactArray(0).getContactList().getMemberArray(0).isSetResponsibleParty(), is(true));
    final ResponsibleParty xbResponsibleParty = xbSystem.getContactArray(0).getContactList().getMemberArray(0).getResponsibleParty();
    checkResponsibleParty(responsibleParty, xbResponsibleParty);
}
Also used : SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) SystemType(net.opengis.sensorML.x101.SystemType) SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) ResponsibleParty(net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty) SensorML(org.n52.shetland.ogc.sensorML.SensorML) System(org.n52.shetland.ogc.sensorML.System) Test(org.junit.Test)

Example 5 with System

use of org.n52.shetland.ogc.sensorML.System in project arctic-sea by 52North.

the class SensorMLDecoderV101 method parseComponents.

private List<SmlComponent> parseComponents(final Components components) throws DecodingException {
    final List<SmlComponent> sosSmlComponents = Lists.newLinkedList();
    if (components.isSetComponentList() && components.getComponentList().getComponentArray() != null) {
        for (final Component component : components.getComponentList().getComponentArray()) {
            if (component.isSetProcess() || component.isSetHref()) {
                final SmlComponent sosSmlcomponent = new SmlComponent(component.getName());
                AbstractProcess abstractProcess = null;
                if (component.isSetProcess()) {
                    if (component.getProcess() instanceof SystemType) {
                        abstractProcess = new System();
                        parseSystem((SystemType) component.getProcess(), (System) abstractProcess);
                    } else {
                        abstractProcess = new AbstractProcess();
                        parseAbstractProcess(component.getProcess(), abstractProcess);
                    }
                } else {
                    abstractProcess = new AbstractProcess();
                    abstractProcess.setIdentifier(component.getHref());
                }
                sosSmlcomponent.setProcess(abstractProcess);
                sosSmlComponents.add(sosSmlcomponent);
            }
        }
    }
    return sosSmlComponents;
}
Also used : AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SystemType(net.opengis.sensorML.x101.SystemType) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) AbstractComponent(org.n52.shetland.ogc.sensorML.AbstractComponent) Component(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) System(org.n52.shetland.ogc.sensorML.System)

Aggregations

SystemType (net.opengis.sensorML.x101.SystemType)11 System (org.n52.shetland.ogc.sensorML.System)11 Test (org.junit.Test)8 SensorML (org.n52.shetland.ogc.sensorML.SensorML)8 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)4 SmlPerson (org.n52.shetland.ogc.sensorML.SmlPerson)4 Component (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component)3 ResponsibleParty (net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty)3 XmlObject (org.apache.xmlbeans.XmlObject)3 SmlResponsibleParty (org.n52.shetland.ogc.sensorML.SmlResponsibleParty)3 SmlComponent (org.n52.shetland.ogc.sensorML.elements.SmlComponent)3 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)3 ComponentType (net.opengis.sensorML.x101.ComponentType)2 ContactList (net.opengis.sensorML.x101.ContactListDocument.ContactList)2 Member (net.opengis.sensorML.x101.ContactListDocument.ContactList.Member)2 Person (net.opengis.sensorML.x101.PersonDocument.Person)2 ProcessModelType (net.opengis.sensorML.x101.ProcessModelType)2 AbstractDataComponentType (net.opengis.swe.x101.AbstractDataComponentType)2 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)2 ProcessModel (org.n52.shetland.ogc.sensorML.ProcessModel)2