Search in sources :

Example 1 with NodeDefinitionConstraint

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;
}
Also used : NodeDefinitionConstraint(org.alfresco.rest.api.model.NodeDefinitionConstraint)

Example 2 with NodeDefinitionConstraint

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"));
}
Also used : JSONObject(org.json.simple.JSONObject) NodeDefinitionConstraint(org.alfresco.rest.api.model.NodeDefinitionConstraint)

Aggregations

NodeDefinitionConstraint (org.alfresco.rest.api.model.NodeDefinitionConstraint)2 JSONObject (org.json.simple.JSONObject)1