Created
January 15, 2020 17:28
-
-
Save gomezgleonardob/6076107802e9c7ee0b8614960bf58feb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Respuesta crear() throws NoSuchMethodException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException { | |
//Objeto.setRolid(cargarSecuencial()); | |
Controlador control = null; | |
IniciarTransaccion(); | |
for (Object objeto : (List<Object>) convertirToObjectList(clase, convertirToJson(this.detail))) { | |
String abreviaturas[] = this.abreviatura.split("-"); | |
if (abreviaturas.length > 1) { | |
this.modelo = clase.getDeclaredMethod("getEntidad").invoke(objeto).toString(); | |
String columnas = ""; | |
String values = ""; | |
if (control == null) { | |
control = new Controlador(); | |
} | |
for (String ab : abreviaturas) { | |
String column = ab.toLowerCase().replace("(pk)", ""); | |
if (!columnas.equals("")) { | |
columnas = columnas + ","; | |
values = values + ","; | |
} | |
columnas = columnas + column; | |
values = values + "'" + control.convertObjectString(clase.getDeclaredMethod("get" + column.substring(0, 1).toUpperCase() + column.substring(1)), objeto) + "'"; | |
} | |
this.InsertarQuery(this.modelo, columnas, values); //la clase debe tener un campo entidad que me indique el nombre en la base de datos para realizar la eliminacion | |
} else { | |
if (this.generarId) { | |
Method metodo = clase.getDeclaredMethod("set" + this.abreviatura.substring(0, 1).toUpperCase() + this.abreviatura.substring(1) + "id", String.class); | |
metodo.invoke(objeto, cargarSecuencial()); | |
} | |
this.Insertar(objeto); | |
} | |
this.detailAuditoria.add(objeto); | |
} | |
respuesta = CerrarTransaccion(Transaccion.crear.getTipo()); | |
auditoria(Transaccion.crear); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment