37 lines
1.0 KiB
Plaintext
Executable File
37 lines
1.0 KiB
Plaintext
Executable File
package com.fp.armas.rules.query.solicitud;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import com.fp.dto.query.QueryRequest;
|
|
import com.fp.dto.rules.QueryRule;
|
|
import com.fp.sessionbeans.helper.Sequence;
|
|
|
|
/**
|
|
* Genera un número secuencial de solicitud
|
|
* @author dcruz
|
|
*
|
|
*/
|
|
public class SolicitudSecuencial extends QueryRule {
|
|
|
|
/**
|
|
* prefijo base solicitud
|
|
*/
|
|
private static final String PRESOL_BASE = "SOL";
|
|
|
|
private static final long serialVersionUID = 5722213865460295851L;
|
|
|
|
/**
|
|
* Obtiene el secuencial de la solicitud y lo reserva para posteriores validaciones
|
|
*/
|
|
@Override
|
|
public QueryRequest process(QueryRequest pQueryRequest) throws Exception {
|
|
// TODO Auto-generated method stub
|
|
System.out.println("Ingresa al secuencial armas");
|
|
Sequence sequence = new Sequence();
|
|
Integer nextValue = Integer.valueOf(sequence.getNextValue("CNUMEROSOLICITUD").toString());
|
|
pQueryRequest.getResponse().put("SECUENCIALSOLICITUD", PRESOL_BASE+"-"+StringUtils.leftPad(String.valueOf(nextValue), 10, '0'));
|
|
return pQueryRequest;
|
|
}
|
|
|
|
}
|