Multidomain MDM
- Multidomain MDM 10.4 HotFix 3
- Todos los productos
public class ValidatePerson implements CustomLogic { private CompositeServiceClient besClient; private CallContext callContext; public ValidatePerson(CompositeServiceClient besClient, CallContext callContext) { this.besClient = besClient; this.callContext = callContext; } @Override public DataObject process(HelperContext helperContext, DataObject inputSdo, Map < String, Object > inParams, Map < String, Object > outParams) throws StepException { try { List < ValidationError > errorList = new ArrayList < > (); DataFactory dataFactory = helperContext.getDataFactory(); // Ensure that the Person SDO has at least one Address item List<?> list = inputSdo.getList("Person/Addresses/item"); if ((list == null) || list.isEmpty()) { String personId = inputSdo.getString("Person/rowidObject"); if(personId != null) { // Verify if an address already exists DataObject readEntity = dataFactory.create(ReadEntity.class); DataObject personFilter = readEntity.createDataObject("parameters").createDataObject("coFilter").createDataObject("object"); personFilter.setString("name", "Person"); personFilter.createDataObject("key").setString("rowid", personId); DataObject addressFilter = personFilter.createDataObject("object"); addressFilter.setString("name", "Addresses"); addressFilter.createDataObject("pager").setInt("recordsToReturn", 1); DataObject readEntityReturn = besClient.process(callContext, readEntity); List existingList = readEntityReturn.getList("object/Person/Addresses/item"); if (existingList == null || existingList.isEmpty()) { errorList.add(createValidationError(dataFactory, "CUSTOM-00001", "You must enter at least one Address.", "Person.Addresses")); }
public class CustomLogicFactoryImpl implements CustomLogicFactory { public static final String PERSON = "Person"; private static final CustomLogic EMPTY_LOGIC = new EmptyLogic(); private CompositeServiceClient besClient; public CustomLogicFactoryImpl(CompositeServiceClient besClient) { this.besClient = besClient; } @Override public CustomLogic create(ExternalCallRequest externalCallRequest, CallContext callContext) throws StepException { // Interest is in the Person business entity. The logic can handle a few service phases. Trigger trigger = externalCallRequest.getTrigger(); String businessEntity = trigger.getBusinessEntity(); ServicePhase phase = trigger.getServicePhase(); switch (phase) { case WRITE_CO_BEFORE_VALIDATE: if (PERSON.equals(businessEntity)) { return new ValidatePerson(besClient, callContext); } break; case PREVIEW_MERGE_CO_BEFORE_EVERYTHING: case MERGE_CO_BEFORE_EVERYTHING: if (PERSON.equals(businessEntity)) { return new MergePerson(); } break; default: // } return EMPTY_LOGIC; // This one does nothing }
/** * Web service implementation. * It must accept a {urn:bes-external-call.informatica.mdm}ExternalCallRequest as an operation input * and return a {urn:bes-external-call.informatica.mdm}ExternalCallResponse as output. */ @WebServiceProvider( targetNamespace = "http://cs.sample.mdm.informatica.com/", serviceName = "CustomLogicService", portName = "CustomLogicServicePort", wsdlLocation = "WEB-INF/wsdl/custom-logic-service.wsdl" ) @ServiceMode(Mode.PAYLOAD) public class CustomLogicService implements Provider<Source> { @Override public Source invoke(Source request) { CompositeServiceClient compositeServiceClient = createCompositeServiceClient(); CustomLogicFactory customLogicFactory = new CustomLogicFactoryImpl(compositeServiceClient); String appName = "<trusted_user>"; // replace with proper application user name // Create a processor instance and let the instance perform the job. // Provide a custom logic factory implementation. ExternalCallProcessor externalCallProcessor = new ExternalCallProcessor(compositeServiceClient, appName, customLogicFactory); return externalCallProcessor.invoke(request); }
Nombre de archivo
| Descripción
| Ubicación
|
---|---|---|
bes-external-call.xsd
| Define los tipos de solicitud y respuesta para todas las llamadas externas. Una operación de servicio web externo debe usar los tipos de solicitud y respuesta para los elementos de entrada y salida.
| <MDM installation directory>/hub/server/lib/mdm-spi.jar
|
custom-logic-service.wsdl
| Archivo WSDL para el servicio web de ejemplo. Define los servicios, operaciones, métodos y tipos de datos externos que intercambian los métodos de servicio.
| <Directorio de instalación de MDM>/hub/resourcekit/samples/BESExternalCall/source/resources/webapp/WEB-INF/wsdl/
|
ValidatePerson.java y MergePerson.java
| Ejemplos de operaciones personalizadas de validación y fusión que se ejecutan con el servicio web de ejemplo.
Este ejemplo usa archivos .java, pero su servicio web externo puede requerir un estándar de codificación diferente.
| <Directorio de instalación de MDM>/hub/resourcekit/samples/BESExternalCall/source/java/
|
build.xml
| Construye el archivo bes-external-call.ear .
| <Directorio de instalación de MDM>/hub/resourcekit/samples/BESExternalCall/
|
bes-external-call.ear
| El archivo .ear que implementa en el servidor de aplicaciones para ejecutar este ejemplo.
| <Directorio de instalación de MDM>/hub/resourcekit/samples/BESExternalCall/build/
|