use of org.alfresco.rest.api.model.NodeDefinitionConstraint in project alfresco-remote-api by Alfresco.
the class NodeDefinitionMapperImpl method fromConstraintDefinitionToConstraint.
private NodeDefinitionConstraint fromConstraintDefinitionToConstraint(ConstraintDefinition constraintDefinition, MessageLookup messageLookup) {
NodeDefinitionConstraint constraint = new NodeDefinitionConstraint();
constraint.setId(constraintDefinition.getConstraint().getShortName());
constraint.setType(constraintDefinition.getConstraint().getType());
constraint.setTitle(constraintDefinition.getTitle(messageLookup));
constraint.setDescription(constraintDefinition.getDescription(messageLookup));
constraint.setParameters(constraintDefinition.getConstraint().getParameters());
return constraint;
}
use of org.alfresco.rest.api.model.NodeDefinitionConstraint in project alfresco-remote-api by Alfresco.
the class NodeApiTest method checkPropertyConstraints.
private void checkPropertyConstraints(List<NodeDefinitionConstraint> constraints) {
assertNotNull(constraints);
NodeDefinitionConstraint nodeDefinitionConstraint = constraints.stream().filter(constraint -> constraint.getId().equals("cm:filename")).findFirst().get();
assertNotNull(nodeDefinitionConstraint);
assertEquals("REGEX", nodeDefinitionConstraint.getType());
Map<String, Object> constraintParameters = nodeDefinitionConstraint.getParameters();
assertNotNull(constraintParameters);
assertNull(nodeDefinitionConstraint.getDescription());
assertNull(nodeDefinitionConstraint.getTitle());
assertEquals(2, constraintParameters.size());
assertEquals("(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$)", constraintParameters.get("expression"));
assertFalse((Boolean) constraintParameters.get("requiresMatch"));
}
Aggregations