Commit f777636a2a573c59c00893f3c2e56735562ee857

Authored by Carlos Alberto
1 parent 11efbb8f
Exists in master

Correções nos métodos dataObject

cit-esi-api/src/main/java/br/com/centralit/esi/api/data/service/impl/DataManager.java
... ... @@ -246,8 +246,6 @@ public class DataManager {
246 246 throw new EsiExecutionException("SQL de INSERT não encontrado");
247 247 }
248 248  
249   - this.validateData(dataObject, map);
250   -
251 249 Connection connection = this.dataSourceService.connect(dataObject.getDataSource());
252 250  
253 251 try{
... ... @@ -257,6 +255,8 @@ public class DataManager {
257 255  
258 256 dataObjectService.incrementSequences(connection, dataObject);
259 257  
  258 + this.validateData(dataObject, map);
  259 +
260 260 DataObjectUtil.executeSQL(dataObject, connection, sql, map);
261 261 DataObjectUtil.verifyIdentity(dataObject, connection, map);
262 262  
... ... @@ -280,8 +280,6 @@ public class DataManager {
280 280 throw new EsiExecutionException("SQL de UPDATE não encontrado");
281 281 }
282 282  
283   - this.validateData(dataObject, map);
284   -
285 283 Connection connection = this.dataSourceService.connect(dataObject.getDataSource());
286 284  
287 285 try{
... ... @@ -289,6 +287,8 @@ public class DataManager {
289 287 map = this.executeBusinessRule(connection, dataObject, map, dataObject.getUpdateRule());
290 288 }
291 289  
  290 + this.validateData(dataObject, map);
  291 +
292 292 DataObjectUtil.executeSQL(dataObject, connection, sql, map);
293 293 this.dataSourceService.commit(connection);
294 294  
... ... @@ -333,8 +333,6 @@ public class DataManager {
333 333 throw new EsiExecutionException("SQL de INSERT não encontrado");
334 334 }
335 335  
336   - this.validateData(dataObject, map);
337   -
338 336 Connection connection = this.dataSourceService.connect(dataObject.getDataSource());
339 337  
340 338 try{
... ... @@ -344,6 +342,8 @@ public class DataManager {
344 342  
345 343 dataObjectService.incrementSequences(connection, dataObject);
346 344  
  345 + this.validateData(dataObject, map);
  346 +
347 347 DataObjectUtil.executeSQL(dataObject, connection, sql, map);
348 348 DataObjectUtil.verifyIdentity(dataObject, connection, map);
349 349  
... ... @@ -368,13 +368,13 @@ public class DataManager {
368 368  
369 369 Connection connection = this.dataSourceService.connect(dataObject.getDataSource());
370 370  
371   - this.validateData(dataObject, map);
372   -
373 371 try{
374 372 if (dataObject.getUpdateRule() != null) {
375 373 map = this.executeBusinessRule(connection, dataObject, map, dataObject.getUpdateRule());
376 374 }
377 375  
  376 + this.validateData(dataObject, map);
  377 +
378 378 DataObjectUtil.executeSQL(dataObject, connection, sql, map);
379 379 this.dataSourceService.commit(connection);
380 380  
... ...
cit-esi-api/src/main/java/br/com/centralit/esi/api/data/service/impl/DataObjectServiceImpl.java
... ... @@ -200,7 +200,7 @@ public class DataObjectServiceImpl extends GenericServiceImpl<DataObject, Long>
200 200 throw new EsiBusinessException("Tipo de dados não definido para a coluna '"+column.getName()+"' do objeto de dados '"+dataObject.getName()+"' ");
201 201 }
202 202 if (UtilString.isNullOrEmpty(column.getDatabaseType())) {
203   - throw new EsiBusinessException("Tipo de columna BD não definido para a coluna '"+column.getName()+"' do objeto de dados '"+dataObject.getName()+"' ");
  203 + throw new EsiBusinessException("Tipo de coluna do BD não definido para a coluna '"+column.getName()+"' do objeto de dados '"+dataObject.getName()+"' ");
204 204 }
205 205 }
206 206  
... ... @@ -635,8 +635,6 @@ public class DataObjectServiceImpl extends GenericServiceImpl<DataObject, Long>
635 635 public DataObject save(DataObject sourceObject, boolean replace) {
636 636 sourceObject.setId(null);
637 637  
638   - this.validate(sourceObject);
639   -
640 638 DataObject dataObject = this.findByDataSourceAndName(sourceObject.getDataSource().getConnectionName(), sourceObject.getName());
641 639 if (dataObject != null) {
642 640 if (!replace) {
... ... @@ -671,6 +669,9 @@ public class DataObjectServiceImpl extends GenericServiceImpl<DataObject, Long>
671 669 }
672 670 }
673 671 }
  672 +
  673 + this.validate(sourceObject);
  674 +
674 675 if (sourceObject.getSqls() != null) {
675 676 for (CustomSQL sql : sourceObject.getSqls()) {
676 677 sql.setId(null);
... ...
cit-esi-api/src/main/java/br/com/centralit/esi/api/design/service/impl/FlowVersionServiceImpl.java
... ... @@ -465,14 +465,9 @@ public class FlowVersionServiceImpl extends GenericServiceImpl<FlowVersion, Long
465 465 if (flowVersion.getVariables() != null) {
466 466 List<FlowVariable> variables = new ArrayList<FlowVariable>();
467 467 for (FlowVariable flowVariable : flowVersion.getVariables()) {
468   - if (flowVariable.getStatusVariable() == null) {
469   - flowVariable.setStatusVariable(false);
470   - }
471   - if (!flowVariable.getStatusVariable()) {
472   - flowVariable.setFlowVersion(flowVersion);
473   - mapObj.put(""+flowVariable.getId(), flowVariable);
474   - variables.add(flowVariable);
475   - }
  468 + flowVariable.setFlowVersion(flowVersion);
  469 + mapObj.put(""+flowVariable.getId(), flowVariable);
  470 + variables.add(flowVariable);
476 471 }
477 472 flowVersion.setVariables(variables);
478 473 }
... ... @@ -769,19 +764,14 @@ public class FlowVersionServiceImpl extends GenericServiceImpl&lt;FlowVersion, Long
769 764 if (oldFlowVersion.getVariables() != null) {
770 765 currentFlowVersion.setVariables(new ArrayList<FlowVariable>());
771 766 for (FlowVariable flowVariable : oldFlowVersion.getVariables()) {
772   - if (flowVariable.getStatusVariable() == null) {
773   - flowVariable.setStatusVariable(false);
774   - }
775   - if (!flowVariable.getStatusVariable()) {
776   - try {
777   - FlowVariable newFlowVariable = (FlowVariable) BeanUtils.cloneBean(flowVariable);
778   - newFlowVariable.setId(null);
779   - newFlowVariable.setFlowVersion(currentFlowVersion);
780   - currentFlowVersion.getVariables().add(newFlowVariable);
781   - } catch (Exception e) {
782   - e.printStackTrace();
783   - throw new EsiBusinessException(e);
784   - }
  767 + try {
  768 + FlowVariable newFlowVariable = (FlowVariable) BeanUtils.cloneBean(flowVariable);
  769 + newFlowVariable.setId(null);
  770 + newFlowVariable.setFlowVersion(currentFlowVersion);
  771 + currentFlowVersion.getVariables().add(newFlowVariable);
  772 + } catch (Exception e) {
  773 + e.printStackTrace();
  774 + throw new EsiBusinessException(e);
785 775 }
786 776 }
787 777 }
... ...