maia/.svn/pristine/a7/a7a492caff29dc941791f9137c3...

115 lines
2.7 KiB
Plaintext
Executable File

package com.fp.frontend.controller.armas.parametros;
import java.util.ArrayList;
import java.util.HashMap;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import com.fp.dto.Request;
import com.fp.dto.Response;
import com.fp.dto.save.DtoSave;
import com.fp.frontend.controller.AbstractController;
import com.fp.frontend.helper.MessageHelper;
import com.fp.persistence.parmas.fun.TarmSolicitudImportacion;
/**
* Clase controladora del bean TarmSolicitudImportacion.
*
* @author Andres Cevallos.
* @version 2.1
*/
@SuppressWarnings("serial")
@ManagedBean
@ViewScoped
public class SolicitudImportacionArmasController extends AbstractController<TarmSolicitudImportacion> {
public SolicitudImportacionArmasController() throws Exception {
super(TarmSolicitudImportacion.class);
}
@PostConstruct
private void postconstruct() {
this.init();
// Inicializa autoconsulta
super.startQuery();
//Ingreso de Datos Quemados
}
/**
* Incializa el controlador, cuando se esta utilizando una pagina que utliza
* el controlador.
*/
private void init() {
try {
this.recperpage = 15; // Cambiar al # reg a mirar.
this.lrecord = new ArrayList<>();
// record = new TarmSolicitudImportacion();
this.beanalias = "TDIRECCIONES";
this.create();
} catch (Exception e) {
MessageHelper.setMessageError(e);
}
}
@Override
public void save() {
try {
DtoSave dtosave = super.getDtoSave();
dtosave.setReturnpk(true); // Para que el core devuelva el pk de los
// registros nuevos.
HashMap<String, DtoSave> msave = new HashMap<String, DtoSave>();
Request request = this.callerhelper.getRequest();
msave.put(this.beanalias, dtosave); // adicionar metadata de
// mantenimiento para cada
// tabla.
request.setSaveTables(msave);
Response resp = this.callerhelper.executeSave(request);
if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) {
this.postCommit(resp);
MessageHelper.setMessageInfo(resp);
} else {
MessageHelper.setMessageError(resp);
}
} catch (Throwable e) {
MessageHelper.setMessageError(e);
}
}
public void executeProvincia() {
}
@Override
public void postCommit(Response response) throws Exception {
super.postCommitGeneric(response, this.beanalias);
}
@Override
protected void querydatabase() {
// TODO Auto-generated method stub
}
public void update(TarmSolicitudImportacion bean) throws Exception {
record=bean;
update();
}
}