Search in sources :

Example 11 with ServiceType

use of eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType in project ddf by codice.

the class RegistryPackageConverter method getRegistryObjectMetacard.

public static Metacard getRegistryObjectMetacard(RegistryObjectType registryObject, MetacardType metacardType) throws RegistryConversionException {
    MetacardImpl metacard = null;
    if (registryObject == null) {
        return metacard;
    }
    validateIdentifiable(registryObject);
    metacard = new MetacardImpl(metacardType);
    parseTopLevel(registryObject, metacard);
    if (registryObject instanceof RegistryPackageType) {
        parseRegistryPackage((RegistryPackageType) registryObject, metacard);
    } else if (registryObject instanceof ExtrinsicObjectType) {
        parseNodeExtrinsicObject(registryObject, metacard);
    } else if (registryObject instanceof ServiceType) {
        parseRegistryService((ServiceType) registryObject, metacard);
    } else if (registryObject instanceof OrganizationType) {
        parseRegistryOrganization((OrganizationType) registryObject, metacard);
    } else if (registryObject instanceof PersonType) {
        parseRegistryPerson((PersonType) registryObject, metacard);
    } else {
        LOGGER.debug("Unexpected object found: {}", registryObject);
    }
    return metacard;
}
Also used : RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) ServiceType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType) OrganizationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType) MetacardImpl(ddf.catalog.data.impl.MetacardImpl)

Example 12 with ServiceType

use of eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType in project ddf by codice.

the class RegistryObjectListWebConverter method convert.

/**
     * This method creates a Map<String, Object> representation of the RegistryObjectListType provided.
     * The following keys will be added to the map (Taken from EbrimConstants):
     * <p>
     * ASSOCIATION_KEY = "Association";
     * EXTRINSIC_OBJECT_KEY = "ExtrinsicObject";
     * ORGANIZATION_KEY = "Organization";
     * PERSON_KEY = "Person";
     * SERVICE_KEY = "Service";
     * <p>
     * <p>
     * Uses:
     * AssociationWebConverter
     * ExtrinsicObjectWebConverter
     * OrganizationWebConverter
     * PersonWebConverter
     * ServiceWebConverter
     *
     * @param registryObjectList the RegistryObjectListType to be converted into a map, null returns empty Map
     * @return Map<String, Object> representation of the RegistryObjectListType provided
     */
public Map<String, Object> convert(RegistryObjectListType registryObjectList) {
    Map<String, Object> registryObjectListMap = new HashMap<>();
    if (registryObjectList == null) {
        return registryObjectListMap;
    }
    List<Map<String, Object>> associations = new ArrayList<>();
    List<Map<String, Object>> extrinsicObjects = new ArrayList<>();
    List<Map<String, Object>> organizations = new ArrayList<>();
    List<Map<String, Object>> people = new ArrayList<>();
    List<Map<String, Object>> services = new ArrayList<>();
    AssociationWebConverter associationConverter = new AssociationWebConverter();
    ExtrinsicObjectWebConverter extrinsicObjectConverter = new ExtrinsicObjectWebConverter();
    OrganizationWebConverter organizationConverter = new OrganizationWebConverter();
    PersonWebConverter personConverter = new PersonWebConverter();
    ServiceWebConverter serviceConverter = new ServiceWebConverter();
    for (JAXBElement<? extends IdentifiableType> identifiable : registryObjectList.getIdentifiable()) {
        RegistryObjectType registryObject = (RegistryObjectType) identifiable.getValue();
        Map<String, Object> identifiableMap;
        if (registryObject instanceof ExtrinsicObjectType) {
            identifiableMap = extrinsicObjectConverter.convert((ExtrinsicObjectType) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                extrinsicObjects.add(identifiableMap);
            }
        } else if (registryObject instanceof ServiceType) {
            identifiableMap = serviceConverter.convert((ServiceType) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                services.add(identifiableMap);
            }
        } else if (registryObject instanceof OrganizationType) {
            identifiableMap = organizationConverter.convert((OrganizationType) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                organizations.add(identifiableMap);
            }
        } else if (registryObject instanceof PersonType) {
            identifiableMap = personConverter.convert((PersonType) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                people.add(identifiableMap);
            }
        } else if (registryObject instanceof AssociationType1) {
            identifiableMap = associationConverter.convert((AssociationType1) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                associations.add(identifiableMap);
            }
        }
    }
    webMapHelper.putIfNotEmpty(registryObjectListMap, ASSOCIATION_KEY, associations);
    webMapHelper.putIfNotEmpty(registryObjectListMap, EXTRINSIC_OBJECT_KEY, extrinsicObjects);
    webMapHelper.putIfNotEmpty(registryObjectListMap, ORGANIZATION_KEY, organizations);
    webMapHelper.putIfNotEmpty(registryObjectListMap, PERSON_KEY, people);
    webMapHelper.putIfNotEmpty(registryObjectListMap, SERVICE_KEY, services);
    return registryObjectListMap;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType) OrganizationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType) ServiceType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType) HashMap(java.util.HashMap) Map(java.util.Map) RegistryObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)

Example 13 with ServiceType

use of eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType in project midpoint by Evolveum.

the class RService method toJAXB.

@Override
public ServiceType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
    ServiceType object = new ServiceType();
    RService.copyToJAXB(this, object, prismContext, options);
    RUtil.revive(object, prismContext);
    return object;
}
Also used : ServiceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType)

Example 14 with ServiceType

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

the class ExchangeServiceBean method registerService.

/**
 * {@inheritDoc}
 *
 * @param data
 * @throws ExchangeServiceException
 */
@Override
public ServiceResponseType registerService(ServiceType data, CapabilityListType capabilityList, SettingListType settingList, String username) throws ExchangeServiceException {
    LOG.info("Register service invoked in service layer: {} {}", data, username);
    try {
        ServiceResponseType serviceResponseType = serviceRegistryModel.registerService(data, capabilityList, settingList, username);
        sendAuditLogMessageForRegisterService(compressServiceClassName(serviceResponseType.getServiceClassName()), username);
        return serviceResponseType;
    } catch (ExchangeModelMapperException ex) {
        throw new ExchangeServiceException(ex.getMessage());
    } catch (ExchangeModelException e) {
        throw new ExchangeServiceException(e.getMessage());
    }
}
Also used : ExchangeModelMapperException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMapperException) ServiceResponseType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException) ExchangeServiceException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)

Example 15 with ServiceType

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

the class MapperTest method testEntityAndModelToEntity.

@Test
public void testEntityAndModelToEntity() throws ExchangeDaoException, ExchangeDaoMappingException {
    Integer id = 1;
    Service entity = MockData.getEntity(id);
    ServiceType service = MockData.getModel(1);
    CapabilityListType capabilityListType = MockData.getCapabilityList();
    SettingListType settingListType = MockData.getSettingList();
    // mockDaoToEntity();
    Service result = mapper.toServiceEntity(entity, service, capabilityListType, settingListType, "TEST");
    assertSame(entity.getName(), result.getName());
    assertSame(entity.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)

Aggregations

ServiceType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType)7 Service (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service)5 ArrayList (java.util.ArrayList)5 ServiceType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType)5 Test (org.junit.Test)5 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)4 OrganizationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType)4 PersonType (oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)4 CapabilityListType (eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType)3 ServiceResponseType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType)3 SettingListType (eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType)3 ServiceCapability (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability)3 ServiceSetting (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting)3 AssociationType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)3 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)3 ExchangeModelException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)2 ExchangeServiceException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)2 HashMap (java.util.HashMap)2 ServiceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType)1 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1