58 lines
1.9 KiB
Plaintext
Executable File
58 lines
1.9 KiB
Plaintext
Executable File
package com.fp.general.security.rules.query.code;
|
|
|
|
import java.util.List;
|
|
|
|
import com.fp.bpm.query.Query;
|
|
import com.fp.dto.query.DtoQuery;
|
|
import com.fp.dto.query.QueryBean;
|
|
import com.fp.dto.query.QueryCriteria;
|
|
import com.fp.dto.query.QueryRequest;
|
|
import com.fp.dto.rules.QueryRule;
|
|
|
|
/**
|
|
*
|
|
* @author scastillo
|
|
*/
|
|
public class SearchUser extends QueryRule {
|
|
|
|
/**
|
|
* Metodo que ejecuta la consulta dado el nombre del cliente
|
|
*
|
|
* @param pQueryRequest
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
@Override
|
|
public QueryRequest process(QueryRequest pQueryRequest) throws Exception {
|
|
if (pQueryRequest.isJsf()) {
|
|
this.searchjsf(pQueryRequest);
|
|
return pQueryRequest;
|
|
}
|
|
QueryBean queryBean = (QueryBean) pQueryRequest.get("TSAFEUSERDETAILLOV");
|
|
List<QueryCriteria> criterios = queryBean.getCriteria();
|
|
for (int i = 0; i < criterios.size(); i++) {
|
|
QueryCriteria queryCriteria = criterios.get(i);
|
|
String propiedad = queryCriteria.getProperty();
|
|
if ((propiedad.compareTo("pk.personcode") == 0) && (queryCriteria.getValue() != null)) {
|
|
String operador = "=";
|
|
queryCriteria.setOperation("in");
|
|
String valor = (String) queryCriteria.getValue();
|
|
if (valor.indexOf("%") >= 0) {
|
|
operador = "like";
|
|
}
|
|
queryCriteria
|
|
.setValue("select s.pk.personcode from com.fp.persistence.pcustomer.gene.TcustPersonDetail s where s.pk.dateto=t.pk.dateto and s.name "
|
|
+ operador + " '" + valor + "'");
|
|
}
|
|
}
|
|
Query query = new Query();
|
|
query.process(pQueryRequest);
|
|
return pQueryRequest;
|
|
}
|
|
|
|
private void searchjsf(QueryRequest pQueryRequest) throws Exception {
|
|
DtoQuery dto = pQueryRequest.getQueryTables().get("USERLOV");
|
|
|
|
}
|
|
}
|