private void columnValidation(InstanceValidatable<SIComposite> validatable) { Optional<SIBoolean> databaseFieldInstance = validatable.getInstance().findNearest(foundDataBase); Optional<SIBoolean> hibernateFieldInstance = validatable.getInstance().findNearest(foundHibernate); // Encontrado no hibernate e nao no banco if (hibernateFieldInstance.isPresent() && hibernateFieldInstance.get().getValue() && databaseFieldInstance.isPresent() && !databaseFieldInstance.get().getValue()) { validatable.error("Inconsistency between database and Hibernate!"); } else { // Encontrado no banco e nao no hibernate Optional<SIBoolean> nullableFieldInstance = validatable.getInstance().findNearest(nullable); Optional<SIList<SIString>> listObj = validatable.getInstance().findNearest(userPrivs); List<Object> listPrivs = listObj.map(SIList::getValue).orElse(Collections.emptyList()); List<String> vals = new ArrayList<>(); listPrivs.forEach(obj -> vals.add((String) obj)); if (nullableFieldInstance.isPresent() && !nullableFieldInstance.get().getValue() && (!vals.contains("INSERT") || !vals.contains("UPDATE"))) { validatable.error("Column NOT NULL without SELECT or UPDATE permissions"); } } }
private void columnValidation(InstanceValidatable<SIComposite> validatable) { Optional<SIBoolean> databaseFieldInstance = validatable.getInstance().findNearest(foundDataBase); Optional<SIBoolean> hibernateFieldInstance = validatable.getInstance().findNearest(foundHibernate); // Encontrado no hibernate e nao no banco if (hibernateFieldInstance.isPresent() && hibernateFieldInstance.get().getValue() && databaseFieldInstance.isPresent() && !databaseFieldInstance.get().getValue()) { validatable.error("Inconsistency between database and Hibernate!"); } else { // Encontrado no banco e nao no hibernate Optional<SIBoolean> nullableFieldInstance = validatable.getInstance().findNearest(nullable); Optional<SIList<SIString>> listObj = validatable.getInstance().findNearest(userPrivs); List<Object> listPrivs = listObj.map(SIList::getValue).orElse(Collections.emptyList()); List<String> vals = new ArrayList<>(); listPrivs.forEach(obj -> vals.add((String) obj)); if (nullableFieldInstance.isPresent() && !nullableFieldInstance.get().getValue() && (!vals.contains("INSERT") || !vals.contains("UPDATE"))) { validatable.error("Column NOT NULL without SELECT or UPDATE permissions"); } } }
private void tableValidation(InstanceValidatable<SIComposite> validatable) { Optional<SIBoolean> foundTableInstance = validatable.getInstance().findNearest(found); if (!foundTableInstance.isPresent() || !foundTableInstance.get().getValue()) { validatable.error("Table not found!"); } Optional<SIString> foundSchemaField = validatable.getInstance().findNearest(schema); Optional<SIList<SIString>> listObj = validatable.getInstance().findNearest(userPrivs); List<Object> listPrivs = listObj.map(SIList::getValue).orElse(Collections.emptyList()); List<String> vals = new ArrayList<>(); listPrivs.forEach(obj -> vals.add((String) obj)); if (foundSchemaField.isPresent()) { SIString foundSchemaFieldInstance = foundSchemaField.get(); if (SqlUtil.isSingularSchema(foundSchemaFieldInstance.getValue()) && SqlUtil.hasCompleteCrud(vals)) { validatable.error("Singular table without complete CRUD!"); } } } }
private void columnValidation(InstanceValidatable<SIComposite> validatable) { Optional<SIBoolean> databaseFieldInstance = validatable.getInstance().findNearest(foundDataBase); Optional<SIBoolean> hibernateFieldInstance = validatable.getInstance().findNearest(foundHibernate); // Encontrado no hibernate e nao no banco if (hibernateFieldInstance.isPresent() && hibernateFieldInstance.get().getValue() && databaseFieldInstance.isPresent() && !databaseFieldInstance.get().getValue()) { validatable.error("Inconsistency between database and Hibernate!"); } else { // Encontrado no banco e nao no hibernate Optional<SIBoolean> nullableFieldInstance = validatable.getInstance().findNearest(nullable); Optional<SIList<SIString>> listObj = validatable.getInstance().findNearest(userPrivs); List<Object> listPrivs = listObj.map(SIList::getValue).orElse(Collections.emptyList()); List<String> vals = new ArrayList<>(); listPrivs.forEach(obj -> vals.add((String) obj)); if (nullableFieldInstance.isPresent() && !nullableFieldInstance.get().getValue() && (!vals.contains("INSERT") || !vals.contains("UPDATE"))) { validatable.error("Column NOT NULL without SELECT or UPDATE permissions"); } } }
private void tableValidation(InstanceValidatable<SIComposite> validatable) { Optional<SIBoolean> foundTableInstance = validatable.getInstance().findNearest(found); if (!foundTableInstance.isPresent() || !foundTableInstance.get().getValue()) { validatable.error("Table not found!"); } Optional<SIString> foundSchemaField = validatable.getInstance().findNearest(schema); Optional<SIList<SIString>> listObj = validatable.getInstance().findNearest(userPrivs); List<Object> listPrivs = listObj.map(SIList::getValue).orElse(Collections.emptyList()); List<String> vals = new ArrayList<>(); listPrivs.forEach(obj -> vals.add((String) obj)); if (foundSchemaField.isPresent()) { SIString foundSchemaFieldInstance = foundSchemaField.get(); if (SqlUtil.isSingularSchema(foundSchemaFieldInstance.getValue()) && SqlUtil.hasCompleteCrud(vals)) { validatable.error("Singular table without complete CRUD!"); } } } }
private void tableValidation(InstanceValidatable<SIComposite> validatable) { Optional<SIBoolean> foundTableInstance = validatable.getInstance().findNearest(found); if (!foundTableInstance.isPresent() || !foundTableInstance.get().getValue()) { validatable.error("Table not found!"); } Optional<SIString> foundSchemaField = validatable.getInstance().findNearest(schema); Optional<SIList<SIString>> listObj = validatable.getInstance().findNearest(userPrivs); List<Object> listPrivs = listObj.map(SIList::getValue).orElse(Collections.emptyList()); List<String> vals = new ArrayList<>(); listPrivs.forEach(obj -> vals.add((String) obj)); if (foundSchemaField.isPresent()) { SIString foundSchemaFieldInstance = foundSchemaField.get(); if (SqlUtil.isSingularSchema(foundSchemaFieldInstance.getValue()) && SqlUtil.hasCompleteCrud(vals)) { validatable.error("Singular table without complete CRUD!"); } } } }
final Optional<SIList<SIComposite>> lista = ins.findNearest(demonstrativos); for (int i = 0; i < 5; i++) { final SIComposite siComposite = lista.get().addNew(); siComposite.findNearest(ano).get().setValue(LocalDate.now().getYear() + i); final SIList<SIComposite> receitas_ = siComposite.findNearest(receitas).get(); final SIList<SIComposite> despesas_ = siComposite.findNearest(despesas).get(); TIPOS_RECEITA.stream().forEach(tipo -> receitas_.addNew().setValue("tipo", tipo)); TIPOS_DESPESA.stream().forEach(tipo -> despesas_.addNew().setValue("tipo", tipo));
final Optional<SIList<SIComposite>> lista = ins.findNearest(demonstrativos); for (int i = 0; i < 5; i++) { final SIComposite siComposite = lista.get().addNew(); siComposite.findNearest(ano).get().setValue(LocalDate.now().getYear() + i); final SIList<SIComposite> receitas_ = siComposite.findNearest(receitas).get(); final SIList<SIComposite> despesas_ = siComposite.findNearest(despesas).get(); TIPOS_RECEITA.stream().forEach(tipo -> receitas_.addNew().setValue("tipo", tipo)); TIPOS_DESPESA.stream().forEach(tipo -> despesas_.addNew().setValue("tipo", tipo));
Optional<SIBoolean> foundTableInstance = validatable.getInstance().findNearest(foundTableField); if (!foundTableInstance.isPresent() || !foundTableInstance.get().getValue()) { validatable.error("Table not found!"); Optional<SIString> foundSchemaField = validatable.getInstance().findNearest(schemaField); Optional<SIList<SIString>> listObj = validatable.getInstance().findNearest(privs); List<Object> listPrivs = listObj.get().getValue(); List<String> vals = new ArrayList<>(); Optional<SIBoolean> databaseFieldInstance = validatable.getInstance().findNearest(foundDatabaseField); Optional<SIBoolean> hibernateFieldInstance = validatable.getInstance().findNearest(foundHibernateField); }else{ Optional<SIBoolean> nullableFieldInstance = validatable.getInstance().findNearest(nullableField); Optional<SIList<SIString>> listObj = validatable.getInstance().findNearest(privs); List<Object> listPrivs = listObj.get().getValue(); List<String> vals = new ArrayList<>();
Integer idDescricao = validatable.getInstance().findNearest(descricaoDinamizada).get().findNearest(idDescricaoDinamizada).get().getValue(); final Integer value = validatable.getInstance().getValue(); final Triple t = dominioService(validatable.getInstance()).diluicao(idDescricao);
ins.findNearest(empresaPropria.razaoSocial).ifPresent(ins2 -> ins2.setValue("Empresa de teste")); ins.findNearest(empresaPropria.cnpj).ifPresent(ins2 -> ins2.setValue("11111111000191")); ins.findNearest(empresaPropria.endereco).ifPresent(ins2 -> ins2.setValue("SCLN 211 BLOCO B SUBSOLO"));
Integer idNomenclatura = validatable.getInstance().findNearest(nomenclaturaBotanica).get().findNearest(idNomenclaturaBotanica).get().getValue(); final BigDecimal value = validatable.getInstance().getValue(); final Optional<SIList<SIComposite>> lista = ins.findNearest(ensaios); siComposite.findNearest(ensaio.idTipoEnsaio).get().setValue(tipoEnsaioControleQualidade.getId()); siComposite.findNearest(ensaio.descricaoTipoEnsaio).get().setValue(tipoEnsaioControleQualidade.getDescricao());