Dear All,
I created a document validator as an SBO, deployed the validator on the repository, and used it as the document validator for my form.
But, when i run the form and click on any button, i get the following error message:
com.documentum.tools.adaptor.AdaptorException: java.lang.ClassCastException: org.bibalex.cms.hrApps.bof.modules.sbo.LeaveRequestValidator cannot be cast to com.documentum.xforms.engine.adaptor.IServiceAdaptorMSG_ERR_FORM_INVALID
The interface code for the module is:
package org.bibalex.cms.hrApps.bof.modules.sbo;import com.documentum.fc.client.IDfService;import com.documentum.xforms.engine.adaptor.IServiceAdaptor;import com.documentum.xforms.engine.adaptor.validator.IDocumentValidator;import org.w3c.dom.*;import com.documentum.xforms.engine.*;public interface ILeaveRequestValidator extends IDfService,IServiceAdaptor,IDocumentValidator { public boolean validate(Document document) throws XFormsProcessorException;}And the implementation code for the module is:
package org.bibalex.cms.hrApps.bof.modules.sbo;import java.text.DateFormat;import java.util.Date;import org.w3c.dom.*;import com.documentum.tools.adaptor.AdaptorException;import com.documentum.tools.adaptor.configuration.IAdaptorConfiguration;import com.documentum.xforms.engine.*;import com.documentum.xforms.engine.adaptor.IServiceAdaptor;import com.documentum.xforms.engine.adaptor.validator.*;import com.documentum.fc.client.DfService;import com.documentum.fc.client.IDfService;import java.text.*;public class LeaveRequestValidator extends DfService implements IDocumentValidator,IServiceAdaptor,IDfService { public void init(IAdaptorConfiguration adaptor) throws AdaptorException {} public void destroy() throws AdaptorException {} public boolean validate(Document document) throws XFormsProcessorException { boolean result = true; DateFormat formatter ; Date dStartDate,dEndDate; String strStartDate,strEndDate; strStartDate = document.getElementsByTagName("leave_start_date").item(0).getTextContent().trim(); strEndDate = document.getElementsByTagName("leave_end_date").item(0).getTextContent().trim(); formatter = new SimpleDateFormat("MMM dd,yyyy"); try { dStartDate = (Date)formatter.parse(strStartDate); dEndDate = (Date)formatter.parse(strEndDate); if(dEndDate.compareTo(dStartDate)<0) { result = false; } } catch (ParseException e) { System.out.println("Exception :"+e); } return result; } @Override public void setDocbaseName(String arg0) { // TODO Auto-generated method stub }}Can anyone explain what if the cause of this issue?
Thanks in advance.