public Attribute convert(AttributeModel model) { Attribute attribute = new Attribute(); attribute.setName(model.getName()); attribute.setDisplayName(model.getDisplayName()); attribute.setDescription(model.getDescription()); attribute.setAliases(model.getAliases()); attribute.setId(model.getId()); attribute.setCatalogId(model.getCatalogId()); attribute.setIndexed(model.isIndexed()); attribute.setSortable(model.isSortable()); attribute.setRequestContext(model.isRequestContext()); attribute.setRequired(model.isRequired()); attribute.setDataType(model.getDataType()); Set<ConstraintModel> constraintModels = model.getConstraints(); Set<Constraint> constraints = new HashSet<>(); if (constraintModels != null) { for (ConstraintModel constraintModel : constraintModels) { Constraint constraint = new Constraint(); constraint.setId(constraintModel.getId()); constraint.setConstraintType(ConstraintPlugins.getInstance().findByName(constraintModel.getConstraintType())); constraint.setValue(constraintModel.getValue()); constraints.add(constraint); } } attribute.setConstraints(constraints); return attribute; } }