protected void setupVisibility() { Constraint item = getItem(); asList(groovyScript, groovyScriptLabel) .forEach(component -> component.setVisible(item.getCheckType().memory())); asList(joinClause, joinClauseLabel, whereClause, whereClauseLabel) .forEach(component -> component.setVisible(item.getCheckType().database() && item.getOperationType() != ConstraintOperationType.CREATE && item.getOperationType() != ConstraintOperationType.DELETE && item.getOperationType() != ConstraintOperationType.UPDATE)); asList(code, codeLabel) .forEach(component -> component.setVisible(item.getOperationType() == ConstraintOperationType.CUSTOM)); if (item.getOperationType() != ConstraintOperationType.ALL && item.getOperationType() != ConstraintOperationType.CUSTOM && item.getOperationType() != ConstraintOperationType.READ) { item.setCheckType(ConstraintCheckType.MEMORY); type.setEnabled(false); } else { type.setEnabled(true); } if (!item.getCheckType().database()) { item.setJoinClause(null); item.setWhereClause(null); } }
protected void internalOpenEditor(Constraint constraint) { LocalizedConstraintMessage localization = constraintLocalizationService.findLocalizedConstraintMessage( constraint.getEntityName(), constraint.getOperationType()); if (localization == null) { localization = metadata.create(LocalizedConstraintMessage.class); localization.setEntityName(constraint.getEntityName()); localization.setOperationType(constraint.getOperationType()); } openEditor(localization, openType); }
public ConstraintData(Constraint constraint) { this.id = constraint.getId(); this.code = constraint.getCode(); this.join = constraint.getJoinClause(); this.whereClause = constraint.getWhereClause(); this.groovyScript = constraint.getGroovyScript(); this.operationType = constraint.getOperationType(); this.checkType = constraint.getCheckType(); }
protected Constraint cloneConstraint(Constraint constraint, Group group) { Constraint resultConstraint = metadata.create(Constraint.class); resultConstraint.setEntityName(constraint.getEntityName()); resultConstraint.setCode(constraint.getCode()); resultConstraint.setCheckType(constraint.getCheckType()); resultConstraint.setOperationType(constraint.getOperationType()); resultConstraint.setJoinClause(constraint.getJoinClause()); resultConstraint.setWhereClause(constraint.getWhereClause()); resultConstraint.setGroovyScript(constraint.getGroovyScript()); resultConstraint.setFilterXml(constraint.getFilterXml()); resultConstraint.setIsActive(constraint.getIsActive()); resultConstraint.setGroup(group); return resultConstraint; }