#1 2012-05-27 22:42:20

diddy
Member
Registered: 2012-02-15
Posts: 34

How to check for duplicates -- error with BeforeSaving Trigger

Hi,
I want to check the uniqueness of records before they get submitted. The validation is based on an attribute called LensName.
I created a beforeSaving process with the standard plugins: The Update Report is retrieved with the data row, decoded and then finally the job gets called. Please see screenshots for details.
My DI job will received the XML document via the tXMLReceive component. I do a lookup if the record already exists (using tMap and tMDMInput) and in case the record exists an error message gets created, otherwise the new record is passed on tMDMOutput component. I've played around now with this and other scenarios for a bit and don't seem to get this running properly. Is there anything wrong in my approach?

In another thread Cyril suggested to use a tBufferOuput component instead of the tMDMOutput I am using here in this example, but how exactly do I feed this back to the process? Is there an additional plugin I have to add so that the data points in the buffer can be recognized?
Is the process actually supposed to return the data record or just an OK message?

Thanks,
Diddy


Uploaded Images

Last edited by diddy (2012-05-27 22:54:59)

Offline

 

#2 2012-05-30 18:17:09

diddy
Member
Registered: 2012-02-15
Posts: 34

Re: How to check for duplicates -- error with BeforeSaving Trigger

Ok, I kept on testing various approaches. (new screenshots attached)
1) The process only needs a calljob step to pass the UpdateReport/data row XML doc to the job. I have verified that this works by having my DI job spit out this doc as a text file.
2) By looking at old examples I came to the conclusion that the BeforeSaving process is only supposed to return an error or success message. As I am using TOS MDM version 5, I made sure that on success this is returned:
<report><message type="info">Record for Asahi Super Takumar 55 1.8 was successfully saved</message></report>
And on error this is returned:
<report><message type="error">Error: Record for Asahi Super Takumar 55 1.8 is a duplicated</message></report>
I tested my DI job by using tLogRow and I can see that this is in fact happening.

3) I deployed everything on the server and added a new record and I get following error message:

Could not retrieve the validation process result. An error might have occurred. The record was not saved.

Error msg from log:

17:09:29,827 INFO  [SimpleLoginModule] Logged Out User 'admin' in Universe [HEAD]
17:09:29,854 INFO  [STDOUT] 17:09:29,854 ERROR [BrowseRecordsAction] Could not retrieve the validation process result. An error might have occurred. The record was not saved.
org.talend.mdm.webapp.base.client.exception.ServiceException: Could not retrieve the validation process result. An error might have occurred. The record was not saved.
    at org.talend.mdm.webapp.browserecords.server.actions.BrowseRecordsAction.saveItem(BrowseRecordsAction.java:1604)
    at org.talend.mdm.webapp.browserecords.server.actions.BrowseRecordsAction.saveItem(BrowseRecordsAction.java:1638)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.talend.mdm.webapp.general.gwt.GWTRPC.invokeAndEncodeResponse(GWTRPC.java:251)
    at org.talend.mdm.webapp.general.gwt.ProxyGWTServiceImpl.doProcessCall(ProxyGWTServiceImpl.java:146)
    at org.talend.mdm.webapp.base.server.AbstractService.processCall(AbstractService.java:52)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:420)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:662)


Can somebody tell me what is still wrong?


Uploaded Images

Last edited by diddy (2012-05-30 18:17:57)

Offline

 

#3 2012-06-04 18:59:39

diddy
Member
Registered: 2012-02-15
Posts: 34

Re: How to check for duplicates -- error with BeforeSaving Trigger

Ok, I solved the problem.

Offline

 

#4 2012-07-19 07:59:59

ahuja.preeti
New member
Registered: 2012-07-19
Posts: 1

Re: How to check for duplicates -- error with BeforeSaving Trigger

pls explain what did you do and how did you achieve de-duplication?

Offline

 

Board footer

Powered by FluxBB