Search in sources :

Example 1 with SystemType

use of net.opengis.sensorML.x101.SystemType 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 SystemType

use of net.opengis.sensorML.x101.SystemType 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 SystemType

use of net.opengis.sensorML.x101.SystemType 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 SystemType

use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method encodeSystem.

private SystemType encodeSystem(final SensorML sensorMl) throws EncodingException {
    final XmlObject encodedSml = sensorMLEncoderv101.encode(sensorMl);
    assertThat(encodedSml, instanceOf(SensorMLDocument.class));
    final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSml = ((SensorMLDocument) encodedSml).getSensorML();
    assertThat(xbSml.getMemberArray().length, is(1));
    assertThat(xbSml.getMemberArray()[0].getProcess(), instanceOf(SystemType.class));
    return (SystemType) xbSml.getMemberArray()[0].getProcess();
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) XmlObject(org.apache.xmlbeans.XmlObject) SystemType(net.opengis.sensorML.x101.SystemType)

Example 5 with SystemType

use of net.opengis.sensorML.x101.SystemType 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)

Aggregations

SystemType (net.opengis.sensorML.x101.SystemType)24 Test (org.junit.Test)18 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)15 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)13 System (org.n52.shetland.ogc.sensorML.System)11 SensorML (org.n52.shetland.ogc.sensorML.SensorML)9 IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)6 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)5 SmlPerson (org.n52.shetland.ogc.sensorML.SmlPerson)5 Capabilities (net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities)4 Component (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component)4 ResponsibleParty (net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty)4 XmlObject (org.apache.xmlbeans.XmlObject)4 SmlResponsibleParty (org.n52.shetland.ogc.sensorML.SmlResponsibleParty)4 ComponentType (net.opengis.sensorML.x101.ComponentType)3 ContactList (net.opengis.sensorML.x101.ContactListDocument.ContactList)3 Person (net.opengis.sensorML.x101.PersonDocument.Person)3 SmlComponent (org.n52.shetland.ogc.sensorML.elements.SmlComponent)3 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)3 ComponentList (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList)2