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(); }
String entityName = constraint.getEntityName(); if (validateAll()) { if (!Strings.isNullOrEmpty(constraint.getWhereClause())) { String baseQueryString = "select e from " + entityName + " e"; try { QueryTransformer transformer = QueryTransformerFactory.createTransformer(baseQueryString); if (StringUtils.isNotBlank(constraint.getJoinClause())) { transformer.addJoinAndWhere(constraint.getJoinClause(), constraint.getWhereClause()); } else { transformer.addWhere(constraint.getWhereClause());
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; }