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;
}
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());
}
}
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));
}
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();
}
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);
}
Aggregations