44 lines
1.5 KiB
Plaintext
Executable File
44 lines
1.5 KiB
Plaintext
Executable File
package com.fp.armas.rules.query.webservices;
|
|
|
|
import static com.fp.armas.rules.query.webservices.util.ColaImpresionUtil.QUERY_SOLICITUD_NUM;
|
|
|
|
import java.util.List;
|
|
|
|
import javax.persistence.Query;
|
|
|
|
import com.fp.dto.query.QueryRequest;
|
|
import com.fp.dto.rules.QueryRule;
|
|
import com.fp.persistence.commondb.PersistenceHelper;
|
|
import com.fp.persistence.parmas.soli.TarmSolicitud;
|
|
|
|
/**
|
|
* Consulta el xpath del documento habilitante y dicho xpath
|
|
* @author dcruz
|
|
*
|
|
*/
|
|
public class ConsultaXpathDocumento extends QueryRule {
|
|
|
|
private static final long serialVersionUID = 7391996435678161968L;
|
|
|
|
@SuppressWarnings("unchecked")
|
|
@Override
|
|
public QueryRequest process(QueryRequest pRequest) throws Exception {
|
|
String numerosolicitud = (String) pRequest.get("NUMEROSOLICITUD");
|
|
Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_SOLICITUD_NUM);
|
|
query.setParameter("numerosolicitud", numerosolicitud);
|
|
List<TarmSolicitud> ltarmSolicitud = query.getResultList();
|
|
if(ltarmSolicitud != null && !ltarmSolicitud.isEmpty()){
|
|
TarmSolicitud tarmSolicitud = ltarmSolicitud.iterator().next();
|
|
Query queryDoc = PersistenceHelper.createQuery("SELECT o.xpath FROM TarmDocumentoHabilitante o WHERE o.csolicitud=:csolicitud ");
|
|
queryDoc.setParameter("csolicitud", tarmSolicitud.getPk());
|
|
List<String> lxpath = queryDoc.getResultList();
|
|
if(lxpath != null && !lxpath.isEmpty()){
|
|
String xpath = lxpath.iterator().next();
|
|
pRequest.getResponse().put("XPATHDOCUMENTOSOLICITUD", xpath);
|
|
}
|
|
}
|
|
return pRequest;
|
|
}
|
|
|
|
}
|