53 lines
2.0 KiB
Plaintext
Executable File
53 lines
2.0 KiB
Plaintext
Executable File
package com.fp.armas.task;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import com.fp.persistence.commondb.PersistenceHelper;
|
|
import com.fp.persistence.parmas.param.TarmCentroControl;
|
|
import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail;
|
|
import com.fp.simple.action.TaskAction;
|
|
|
|
/**
|
|
* Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar
|
|
* una tarea.
|
|
*
|
|
* @version 2.1
|
|
*/
|
|
public class ObtieneCentroControl extends TaskAction {
|
|
|
|
/*
|
|
* (non-Javadoc)
|
|
*
|
|
* @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request)
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
@Override
|
|
public void assignOwner(Object pParam) throws Exception {
|
|
|
|
System.out.println("ingresa a actualizar a la clase");
|
|
HashMap<String, Object> m = (HashMap<String, Object>) pParam;
|
|
Map<String, Object> mrequest = (Map<String, Object>) m.get("request");
|
|
|
|
if (mrequest.get("ccentrocontrol") == null) {
|
|
return;
|
|
}
|
|
String codigoCentroControl=mrequest.get("ccentrocontrol").toString();
|
|
//datos del decomiso
|
|
//consulta del centro de control
|
|
TarmCentroControl centroControl=TarmCentroControl.find(PersistenceHelper.getEntityManager(), codigoCentroControl);
|
|
//lista de las armas decomisadas por el codigo de recepcion
|
|
TgeneCatalogDetail tgeneCatalogDetail = PersistenceHelper.getEntityManager().
|
|
createQuery("select o from TgeneCatalogDetail o where o.pk.catalog=:catalog and o.pk.catalogcode=:catalogcode",TgeneCatalogDetail.class)
|
|
.setParameter("catalog", centroControl.getInstitucion())
|
|
.setParameter("catalogcode", centroControl.getInstituciontipo())
|
|
.getSingleResult();
|
|
if(!tgeneCatalogDetail.getLegalcode().equals("C")){
|
|
m.put("corganismo","D");
|
|
return;
|
|
}
|
|
m.put("corganismo",tgeneCatalogDetail.getLegalcode());
|
|
}
|
|
|
|
}
|