Search in sources :

Example 1 with CapabilityListType

use of eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType in project UVMS-ExchangeModule-APP by UnionVMS.

the class MapperTest method testModelToEntity.

@Test
public void testModelToEntity() throws ExchangeDaoException, ExchangeDaoMappingException {
    Integer id = 1;
    ServiceType model = MockData.getModel(id);
    CapabilityListType capabilityListType = MockData.getCapabilityList();
    SettingListType settingListType = MockData.getSettingList();
    // mockDaoToEntity();
    Service result = mapper.toServiceEntity(model, capabilityListType, settingListType, "TEST");
    assertSame(model.getName(), result.getName());
    assertSame(model.getServiceClassName(), result.getServiceClassName());
}
Also used : CapabilityListType(eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType) ServiceType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType) Service(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service) SettingListType(eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType) Test(org.junit.Test)

Example 2 with CapabilityListType

use of eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType in project UVMS-ExchangeModule-APP by UnionVMS.

the class DomainModelBeanTest method testCreateModel.

@Ignore
@Test
public void testCreateModel() throws ExchangeModelException, ExchangeDaoException, ExchangeDaoMappingException {
    Long id = 1L;
    ServiceType serviceType = MockData.getModel(id.intValue());
    CapabilityListType capabilityListType = MockData.getCapabilityList();
    SettingListType settingListType = MockData.getSettingList();
    Service service = new Service();
    service.setId(id);
    service.setActive(false);
    List<ServiceCapability> serviceCapabilityList = new ArrayList<>();
    service.setServiceCapabilityList(serviceCapabilityList);
    List<ServiceSetting> serviceSettingList = new ArrayList<>();
    service.setServiceSettingList(serviceSettingList);
    when(dao.getServiceByServiceClassName(any(String.class))).thenReturn(null);
    // when(dao.updateService(any(Service.class))).thenReturn(service);
    ServiceResponseType result = model.registerService(serviceType, capabilityListType, settingListType, "TEST");
// assertEquals(id.toString(), result.getId());
}
Also used : CapabilityListType(eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType) ServiceType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType) ServiceResponseType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType) ArrayList(java.util.ArrayList) Service(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service) ServiceCapability(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability) SettingListType(eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType) ServiceSetting(eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with CapabilityListType

use of eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType in project UVMS-ExchangeModule-APP by UnionVMS.

the class MockData method getCapabilityList.

public static CapabilityListType getCapabilityList() {
    CapabilityListType dto = new CapabilityListType();
    CapabilityType capability = new CapabilityType();
    capability.setType(CapabilityTypeType.POLLABLE);
    capability.setValue("TRUE");
    dto.getCapability().add(capability);
    return dto;
}
Also used : CapabilityListType(eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType) CapabilityType(eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityType)

Example 4 with CapabilityListType

use of eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType in project UVMS-ExchangeModule-APP by UnionVMS.

the class ServiceMapper method toServiceModel.

public static ServiceResponseType toServiceModel(Service entity) {
    ServiceResponseType model = new ServiceResponseType();
    model.setDescription(entity.getDescription());
    model.setName(entity.getName());
    model.setServiceClassName(entity.getServiceClassName());
    CapabilityListType capabilityList = toCapabilityListModel(entity.getServiceCapabilityList());
    model.setCapabilityList(capabilityList);
    model.setServiceResponseMessageName(entity.getServiceResponse());
    model.setPluginType(entity.getType());
    model.setSatelliteType(entity.getSatelliteType());
    model.setStatus(mapStatus(entity.getStatus()));
    model.setActive(entity.getActive());
    SettingListType settingList = toSettingListModel(entity.getServiceSettingList());
    model.setSettingList(settingList);
    return model;
}
Also used : CapabilityListType(eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType) ServiceResponseType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType) SettingListType(eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType)

Example 5 with CapabilityListType

use of eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType in project arctic-sea by 52North.

the class SensorMLEncoderv20 method createCapability.

private Capabilities createCapability(final SmlCapabilities capabilities) throws EncodingException {
    Capabilities xbCapabilities = null;
    if (capabilities.isSetAbstractDataComponents()) {
        xbCapabilities = Capabilities.Factory.newInstance(getXmlOptions());
        if (capabilities.isSetName()) {
            xbCapabilities.setName(capabilities.getName());
        }
        CapabilityListType capabilityList = xbCapabilities.addNewCapabilityList();
        if (capabilities.isSetCapabilities()) {
            for (SmlCapability capability : capabilities.getCapabilities()) {
                XmlObject encodeObjectToXml = encodeObjectToXmlSwe20(capability.getAbstractDataComponent());
                Capability c = capabilityList.addNewCapability();
                if (capability.isSetName()) {
                    c.setName(NcName.makeValid(capability.getName()));
                } else if (capability.getAbstractDataComponent().isSetName()) {
                    capability.setName(NcName.makeValid(capability.getAbstractDataComponent().getName().getValue()));
                } else {
                    capability.setName(NcName.makeValid(capability.getAbstractDataComponent().getDefinition()));
                }
                XmlObject substituteElement = XmlHelper.substituteElement(c.addNewAbstractDataComponent(), encodeObjectToXml);
                substituteElement.set(encodeObjectToXml);
            }
        } else if (capabilities.isSetAbstractDataComponents()) {
            for (SweAbstractDataComponent component : capabilities.getAbstractDataComponents()) {
                XmlObject encodeObjectToXml = encodeObjectToXmlSwe20(component);
                Capability capability = capabilityList.addNewCapability();
                if (component.isSetName()) {
                    capability.setName(NcName.makeValid(component.getName().getValue()));
                } else {
                    capability.setName(NcName.makeValid(component.getDefinition()));
                }
                XmlObject substituteElement = XmlHelper.substituteElement(capability.addNewAbstractDataComponent(), encodeObjectToXml);
                substituteElement.set(encodeObjectToXml);
            }
        }
    }
    return xbCapabilities;
}
Also used : CapabilityListType(net.opengis.sensorml.x20.CapabilityListType) SmlCapability(org.n52.shetland.ogc.sensorML.elements.SmlCapability) Capability(net.opengis.sensorml.x20.CapabilityListType.Capability) Capabilities(net.opengis.sensorml.x20.DescribedObjectType.Capabilities) SmlCapabilities(org.n52.shetland.ogc.sensorML.elements.SmlCapabilities) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) XmlObject(org.apache.xmlbeans.XmlObject) SmlCapability(org.n52.shetland.ogc.sensorML.elements.SmlCapability)

Aggregations

CapabilityListType (eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType)5 SettingListType (eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType)4 ServiceResponseType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType)3 ServiceType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType)3 Service (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service)3 Test (org.junit.Test)3 CapabilityType (eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityType)2 ServiceCapability (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability)2 ArrayList (java.util.ArrayList)2 CapabilityListType (net.opengis.sensorml.x20.CapabilityListType)2 Capability (net.opengis.sensorml.x20.CapabilityListType.Capability)2 Capabilities (net.opengis.sensorml.x20.DescribedObjectType.Capabilities)2 XmlObject (org.apache.xmlbeans.XmlObject)2 SmlCapabilities (org.n52.shetland.ogc.sensorML.elements.SmlCapabilities)2 SmlCapability (org.n52.shetland.ogc.sensorML.elements.SmlCapability)2 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)2 ServiceSetting (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting)1 ExchangeModelException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)1 ExchangeModelMapperException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMapperException)1 ExchangeServiceException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)1