Hello,
The form must pass some conditions in order to be submitted. The validation must get two values from the xform and run a query against the database. For achieving this I created a DocumentValidator as an SBO and set it as a Validation Adaptor in the form. Then I tested the form but the adaptor is not called (I forced it to return always false and print the steps in Tomcat, obviuoslly I got no trace in the stdout).
This is my interface:
package ****.adaptors;
import com.documentum.xforms.engine.adaptor.IServiceAdaptor;
import com.documentum.xforms.engine.adaptor.validator.IItemValidator;
import com.documentum.xforms.engine.adaptor.validator.IStringValidator;
public interface IValidatorCalificacion extends IServiceAdaptor {}
This is the implementation class:
package ****.adaptors.impl;
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.Pointer;
import org.w3c.dom.Document;
import ****.adaptors.IValidatorCalificacion;
import com.documentum.fc.client.DfQuery;
import com.documentum.fc.client.DfService;
import com.documentum.fc.client.IDfCollection;
import com.documentum.fc.client.IDfFolder;
import com.documentum.fc.client.IDfQuery;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.common.DfId;
import com.documentum.tools.adaptor.AdaptorException;
import com.documentum.tools.adaptor.configuration.IAdaptorConfiguration;
import com.documentum.xforms.engine.XFormsProcessorException;
public class ValidatorCalifacionAdaptor extends DfService implements IValidatorCalificacion{
private String repositorio;
public void destroy() throws AdaptorException {
}
public void init(IAdaptorConfiguration arg0) throws AdaptorException {
}
public void setDocbaseName(String arg0) {
this.repositorio = arg0;
}
public boolean validate(Document doc) throws XFormsProcessorException {
boolean ret = false;
JXPathContext validateContext = JXPathContext.newContext(doc);
Pointer npIdFolder = validateContext.getPointer("/Activity/ProcessData/Variables/idFolderCalificacion");
Pointer npDecision = validateContext.getPointer("/Activity/ProcessData/Variables/objCalificacionSDT/CalificacionSDT/decisionCalificacion");
ret = validarExistencia(npDecision.getValue().toString(), npIdFolder.getValue().toString());
return ret;
}
public boolean validarExistencia(String calificacion, String idFolderCalificacion){
boolean ret = false;
String ruta = null;
IDfSession dfSession = null;
final String DENEGADO = "DENEGADO";
if (calificacion.trim().toUpperCase().contains(DENEGADO)){
try {
dfSession = getSession(repositorio);
.... Execute DQL and process result
ret = false;
} catch (Exception e){
e.printStackTrace();
return false;
}
}else{
ret = false;
}
return ret;
}
}
Am I missing something?
Btw I'm using Content Server 6.5 SP3 and Forms Builder 6.5 SP3