목차

Search

  1. 서문
  2. 비즈니스 항목 서비스 소개
  3. Enterprise Java Bean 비즈니스 항목 서비스 호출
  4. Representational State Transfer 비즈니스 항목 서비스 호출
  5. Simple Object Access Protocol 비즈니스 항목 서비스 호출
  6. 교차 참조 레코드 및 BVT 계산을 위한 서비스
  7. 기업 연결 서비스 지원
  8. 데이터 정리, 분석 및 변환을 위한 외부 호출
  9. REST API를 사용하여 레코드 추가
  10. REST API를 사용하여 파일 업로드
  11. REST API를 사용하여 보고서 관리

비즈니스 항목 서비스 가이드

비즈니스 항목 서비스 가이드

생성된 SDO 클래스가 포함된 Java 코드 예

생성된 SDO 클래스가 포함된 Java 코드 예

이 예에서는 MDM Hub가 비즈니스 항목 및 비즈니스 항목 서비스 구성에 따라 생성하는 Java 클래스를 기반으로 EJB(Enterprise Java Bean) 호출을 실행하는 Java 코드를 보여 줍니다.
이 예는 리소스 키트의 다음 파일에 있습니다.
C:\<
MDM Hub 설치 디렉터리
>\hub\resourcekit\samples\COS\source\java\com\informatica\mdm\sample\cs\GeneratedSDO.java
다음 Java 코드는 생성된 클래스를 기반으로 하며, person 기본 개체 레코드를 작성하고, 여러 하위 레코드를 추가하고, 하나의 하위 레코드를 삭제한 다음 person 레코드와 그 모든 하위 레코드를 삭제하는 EJB 비즈니스 항목 서비스 호출을 실행합니다.
package com.informatica.mdm.sample.cs; import com.informatica.mdm.cs.CallContext; import com.informatica.mdm.cs.api.CompositeServiceException; import com.informatica.mdm.cs.client.CompositeServiceClient; import com.informatica.mdm.sdo.cs.base.CoFilter; import com.informatica.mdm.sdo.cs.base.CoFilterNode; import com.informatica.mdm.sdo.cs.base.Key; import com.siperian.sif.client.EjbSiperianClient; import com.siperian.sif.client.SiperianClient; import commonj.sdo.DataObject; import commonj.sdo.helper.DataFactory; import commonj.sdo.helper.HelperContext; import mdm.informatica.co_ors.*; import mdm.informatica.cs_ors.*; import java.io.PrintStream; import java.util.Arrays; import java.util.Properties; public class GeneratedSDO { public static void main(String[] args) throws CompositeServiceException { if(args.length != 3) { System.err.println("USAGE: GeneratedSDO <ors> <user> <pass>"); return; } new GeneratedSDO(args[0], args[1], args[2]).execute(); } private String orsId; private String user; private String pass; private HelperContext helperContext; private PrintStream out = System.out; public GeneratedSDO(String orsId, String user, String pass) { this.orsId = orsId; this.user = user; this.pass = pass; } public void execute() throws CompositeServiceException { String systemName = "Admin"; Properties config = new Properties(); config.put(SiperianClient.SIPERIANCLIENT_PROTOCOL, EjbSiperianClient.PROTOCOL_NAME); CompositeServiceClient client = CompositeServiceClient.newCompositeServiceClient(config); CallContext callContext = new CallContext(orsId, user, pass); helperContext = client.getHelperContext(callContext); DataFactory dataFactory = helperContext.getDataFactory(); // 1. Create new person WritePerson createPerson = (WritePerson)dataFactory.create(WritePerson.class); WritePersonParameters createPersonParameters = (WritePersonParameters)dataFactory.create(WritePersonParameters.class); createPersonParameters.setSystemName(systemName); createPerson.setParameters(createPersonParameters); Person person = (Person)dataFactory.create(Person.class); createPerson.setObject(person); person.getChangeSummary().beginLogging(); PersonRoot personRoot = (PersonRoot)dataFactory.create(PersonRoot.class); personRoot.setFirstName("John"); personRoot.setLastName("Smith"); person.setPerson(personRoot); person.getChangeSummary().endLogging(); dump("*** CREATE NEW PERSON ...", createPerson); WritePersonReturn createPersonResponse = (WritePersonReturn)client.process(callContext, (DataObject)createPerson); dump("*** PERSON CREATED:", createPersonResponse); String personRowId = createPersonResponse.getObject().getPerson().getRowidObject(); Key key = (Key)dataFactory.create(Key.class); key.setRowid(personRowId); CoFilterNode coFilterNode = (CoFilterNode)dataFactory.create(CoFilterNode.class); coFilterNode.setName(Person.class.getSimpleName()); coFilterNode.setKey(key); CoFilter coFilter = (CoFilter)dataFactory.create(CoFilter.class); coFilter.setObject(coFilterNode); ReadPersonParameters readPersonParameters = (ReadPersonParameters)dataFactory.create(ReadPersonParameters.class); readPersonParameters.setCoFilter(coFilter); ReadPerson readPerson = (ReadPerson)dataFactory.create(ReadPerson.class); readPerson.setParameters(readPersonParameters); dump("*** READ CREATED PERSON...", readPerson); ReadPersonReturn readPersonResponse = (ReadPersonReturn)client.process(callContext, (DataObject)readPerson); dump("*** READ RESULT:", readPersonResponse); person = readPersonResponse.getObject(); ((DataObject)person).detach(); person.getChangeSummary().beginLogging(); personRoot = person.getPerson(); // add new 'one' child LUGenderLookup genderCd = (LUGenderLookup)dataFactory.create(LUGenderLookup.class); genderCd.setGenderCode("M"); personRoot.setGenderCd(genderCd); // add two 'many' children PersonTelephoneNumbersPager phonePager = (PersonTelephoneNumbersPager)dataFactory.create(PersonTelephoneNumbersPager.class); PersonTelephoneNumbers phone1 = (PersonTelephoneNumbers)dataFactory.create(PersonTelephoneNumbers.class); phone1.setPhoneNumber("111-11-11"); PersonTelephoneNumbers phone2 = (PersonTelephoneNumbers)dataFactory.create(PersonTelephoneNumbers.class); phone2.setPhoneNumber("222-22-22"); phonePager.setItem(Arrays.asList(phone1, phone2)); personRoot.setTelephoneNumbers(phonePager); person.getChangeSummary().endLogging(); WritePerson updatePerson = (WritePerson)dataFactory.create(WritePerson.class); updatePerson.setObject(person); WritePersonParameters updatePersonParameters = (WritePersonParameters)dataFactory.create(WritePersonParameters.class); updatePersonParameters.setSystemName(systemName); updatePersonParameters.setInteractionId(""); updatePerson.setParameters(updatePersonParameters); dump("*** UPDATE PERSON...", updatePerson); WritePersonReturn updatePersonResponse = (WritePersonReturn)client.process(callContext, (DataObject)updatePerson); dump("*** PERSON UPDATED:", updatePersonResponse); coFilterNode.setDepth(3); readPersonParameters.setReadSystemFields(true); dump("*** READ UPDATED PERSON WITH CHILDREN (with system fields)...", readPerson); readPersonResponse = (ReadPersonReturn)client.process(callContext, (DataObject)readPerson); dump("*** READ RESULT:", readPersonResponse); person = readPersonResponse.getObject(); ((DataObject)person).detach(); person.getChangeSummary().beginLogging(); // delete one phone person.getPerson().getTelephoneNumbers().getItem().remove(0); // change gender genderCd = (LUGenderLookup)dataFactory.create(LUGenderLookup.class); genderCd.setGenderCode("F"); personRoot.setGenderCd(genderCd); person.getChangeSummary().endLogging(); WritePerson deletePhone = (WritePerson)dataFactory.create(WritePerson.class); deletePhone.setObject(person); WritePersonParameters deletePhoneParameters = (WritePersonParameters)dataFactory.create(WritePersonParameters.class); deletePhoneParameters.setSystemName(systemName); deletePhone.setParameters(deletePhoneParameters); dump("*** DELETE CHILD...", deletePhone); WritePersonReturn deletePhoneResponse = (WritePersonReturn)client.process(callContext, (DataObject)deletePhone); dump("*** CHILD DELETED:", deletePhoneResponse); readPersonParameters.setReadSystemFields(false); dump("*** READ PERSON AFTER CHILD WAS DELETEED...", readPerson); readPersonResponse = (ReadPersonReturn)client.process(callContext, (DataObject)readPerson); dump("*** READ RESULT:", readPersonResponse); person = readPersonResponse.getObject(); ((DataObject)person).detach(); person.getChangeSummary().beginLogging(); ((DataObject)person.getPerson()).delete(); person.getChangeSummary().endLogging(); WritePerson deletePerson = (WritePerson)dataFactory.create(WritePerson.class); deletePerson.setObject(person); WritePersonParameters deletePersonParameters = (WritePersonParameters)dataFactory.create(WritePersonParameters.class); deletePersonParameters.setSystemName(systemName); deletePerson.setParameters(deletePersonParameters); dump("*** DELETE PERSON...", deletePerson); WritePersonReturn deletePersonResponse = (WritePersonReturn)client.process(callContext, (DataObject)deletePerson); dump("*** PERSON DELETED:", deletePersonResponse); dump("*** TRY TO READ PERSON AFTER DELETE", readPerson); try { readPersonResponse = (ReadPersonReturn)client.process(callContext, (DataObject)readPerson); dump("*** READ RESULT:", readPersonResponse); } catch (CompositeServiceException e) { out.println("*** READ RESULT: " + e.getLocalizedMessage()); } } private void dump(String title, Object object) { DataObject dataObject = (DataObject)object; String xml = helperContext.getXMLHelper().save( dataObject, dataObject.getType().getURI(), dataObject.getType().getName()); out.println(title); out.println(xml); out.println(); } }