Java Code Examples for org.alfresco.service.cmr.dictionary.PropertyDefinition

The following examples show how to use org.alfresco.service.cmr.dictionary.PropertyDefinition. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private void validateDeleteProperty(QName modelName, QName propertyQName, boolean sharedModel)
{
    String tenantDomain = TenantService.DEFAULT_DOMAIN;
    if (sharedModel)
    {
        tenantDomain = " for tenant [" + tenantService.getCurrentUserDomain() + "]";
    }

    PropertyDefinition prop = dictionaryDAO.getProperty(propertyQName);
    if(prop != null && prop.getName().equals(propertyQName) && prop.getModel().getName().equals(modelName))
    {
        validateDeleteProperty(tenantDomain, prop);
    }
    else
    {
        throw new AlfrescoRuntimeException("Cannot delete model " + modelName + " in tenant " + tenantDomain
                + " - property definition '" + propertyQName + "' not defined in model '" + modelName + "'");
    }
}
 
Example 2
private List<CustomModelProperty> convertToCustomModelProperty(ClassDefinition classDefinition, boolean includeInherited)
{
    Collection<PropertyDefinition> ownProperties = null;
    ClassDefinition parentDef = classDefinition.getParentClassDefinition();
    if (!includeInherited && parentDef != null)
    {
        // Remove inherited properties
        ownProperties = removeRightEntries(classDefinition.getProperties(), parentDef.getProperties()).values();
    }
    else
    {
        ownProperties = classDefinition.getProperties().values();
    }

    List<CustomModelProperty> customProperties = new ArrayList<>(ownProperties.size());
    for (PropertyDefinition propDef : ownProperties)
    {
        customProperties.add(new CustomModelProperty(propDef, dictionaryService));
    }

    return customProperties;
}
 
Example 3
protected PropertyDefinition getPropertyImpl(QName propertyName)
{
	PropertyDefinition propDef = null;

    List<CompiledModel> models = getModelsForUri(propertyName.getNamespaceURI());
    if(models != null && models.size() > 0)
    {
     for (CompiledModel model : models)
     {
     	propDef = model.getProperty(propertyName);
     	if(propDef != null)
     	{
     		break;
     	}
     }
    }

    return propDef;
}
 
Example 4
@Override
public <Q, S, E extends Throwable> String getLuceneSortField(LuceneQueryParserAdaptor<Q, S, E> lqpa) throws E
{
    String field = getLuceneFieldName();
    // need to find the real field to use
    PropertyDefinition propertyDef = dictionaryService.getProperty(QName.createQName(field.substring(1)));

    if (propertyDef.getDataType().getName().equals(DataTypeDefinition.CONTENT))
    {
        throw new CmisInvalidArgumentException("Order on content properties is not curently supported");
    }
    else if ((propertyDef.getDataType().getName().equals(DataTypeDefinition.MLTEXT)) || (propertyDef.getDataType().getName().equals(DataTypeDefinition.TEXT)))
    {
        field = lqpa.getSortField(field);
    }
    else if (propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME))
    {
        field = lqpa.getDatetimeSortField(field, propertyDef);
    }        

    return field;
}
 
Example 5
private Object getDefaultValue(QName name, ContentModelItemData<?> data)
{
    PropertyDefinition propDef = data.getPropertyDefinition(name);
    if (propDef != null)
    {
        QName typeQName = propDef.getDataType().getName();
        String strDefaultValue = propDef.getDefaultValue();
        if (NodePropertyValue.isDataTypeSupported(typeQName))
        {
            // convert to the appropriate type
            NodePropertyValue pv = new NodePropertyValue(typeQName, strDefaultValue);
            return pv.getValue(typeQName);
        }
        return strDefaultValue;
    }
    return null;
}
 
Example 6
private NodeDefinitionProperty fromPropertyDefinitionToProperty(PropertyDefinition propertyDefinition,
        MessageLookup messageLookup)
{
    NodeDefinitionProperty property = new NodeDefinitionProperty();
    property.setId(propertyDefinition.getName().toPrefixString());
    property.setTitle(propertyDefinition.getTitle(messageLookup));
    property.setDescription(propertyDefinition.getDescription(messageLookup));
    property.setDefaultValue(propertyDefinition.getDefaultValue());
    property.setDataType(propertyDefinition.getDataType().getName().toPrefixString());
    property.setIsMultiValued(propertyDefinition.isMultiValued());
    property.setIsMandatory(propertyDefinition.isMandatory());
    property.setIsMandatoryEnforced(propertyDefinition.isMandatoryEnforced());
    property.setIsProtected(propertyDefinition.isProtected());
    property.setConstraints(getConstraints(propertyDefinition.getConstraints(), messageLookup));
   
    return property;
}
 
Example 7
/**
 * Generates a list of property fields with values.
 * 
 * @param propDefs List of property definitions to generate
 * @param values Map containing the values to use for each property
 * @param group The group the field belongs to
 * @param namespaceService NamespaceService instance
 * @return List of generated Field objects
 */
public static List<Field> makePropertyFields(
            Collection<PropertyDefinition> propDefs,
            Map<PropertyDefinition, Object> values,
            FieldGroup group,
            NamespaceService namespaceService,
            DictionaryService dictionaryService)
{
    PropertyFieldProcessor processor = new PropertyFieldProcessor(namespaceService, dictionaryService);
    ArrayList<Field> fields = new ArrayList<Field>(propDefs.size());
    for (PropertyDefinition propDef : propDefs)
    {
        Object value = values == null ? null : values.get(propDef);
        Field field = processor.makeField(propDef, value, group);
        fields.add(field);
    }
    return fields;
}
 
Example 8
private void afterPropertiesSet_setupChangePolicies()
{
    if (this.moveStoresOnChangeOptionPropertyName != null)
    {
        this.moveStoresOnChangeOptionPropertyQName = QName.resolveToQName(this.namespaceService,
                this.moveStoresOnChangeOptionPropertyName);
        PropertyCheck.mandatory(this, "moveStoresOnChangeOptionPropertyQName", this.moveStoresOnChangeOptionPropertyQName);

        final PropertyDefinition moveStoresOnChangeOptionPropertyDefinition = this.dictionaryService
                .getProperty(this.moveStoresOnChangeOptionPropertyQName);
        if (moveStoresOnChangeOptionPropertyDefinition == null
                || !DataTypeDefinition.BOOLEAN.equals(moveStoresOnChangeOptionPropertyDefinition.getDataType().getName())
                || moveStoresOnChangeOptionPropertyDefinition.isMultiValued())
        {
            throw new IllegalStateException(this.moveStoresOnChangeOptionPropertyName
                    + " is not a valid content model property of type single-valued d:boolean");
        }
    }

    if (this.moveStoresOnChange || this.moveStoresOnChangeOptionPropertyQName != null)
    {
        this.policyComponent.bindClassBehaviour(OnSetNodeTypePolicy.QNAME, ContentModel.TYPE_BASE,
                new JavaBehaviour(this, "onSetNodeType", NotificationFrequency.EVERY_EVENT));
    }
}
 
Example 9
public void testLabels()
{
    QName model = QName.createQName(TEST_URL, "dictionarydaotest");
    ModelDefinition modelDef = service.getModel(model);
    assertEquals("Model Description", modelDef.getDescription(service));
    QName type = QName.createQName(TEST_URL, "base");
    TypeDefinition typeDef = service.getType(type);
    assertEquals("Base Title", typeDef.getTitle(service));
    assertEquals("Base Description", typeDef.getDescription(service));
    QName prop = QName.createQName(TEST_URL, "prop1");
    PropertyDefinition propDef = service.getProperty(prop);
    assertEquals("Prop1 Title", propDef.getTitle(service));
    assertEquals("Prop1 Description", propDef.getDescription(service));
    QName assoc = QName.createQName(TEST_URL, "assoc1");
    AssociationDefinition assocDef = service.getAssociation(assoc);
    assertEquals("Assoc1 Title", assocDef.getTitle(service));
    assertEquals("Assoc1 Description", assocDef.getDescription(service));
    QName datatype = QName.createQName(TEST_URL, "datatype");
    DataTypeDefinition datatypeDef = service.getDataType(datatype);
    assertEquals("alfresco/model/dataTypeAnalyzers", datatypeDef.getAnalyserResourceBundleName());
}
 
Example 10
private void afterPropertiesSet_setupHandleContentProperties()
{
    if (this.handleContentPropertyNames != null && !this.handleContentPropertyNames.isEmpty())
    {
        this.handleContentPropertyQNames = new HashSet<>();
        for (final String facadePropertyName : this.handleContentPropertyNames)
        {
            final QName routePropertyQName = QName.resolveToQName(this.namespaceService, facadePropertyName);
            ParameterCheck.mandatory("routePropertyQName", routePropertyQName);

            final PropertyDefinition contentPropertyDefinition = this.dictionaryService.getProperty(routePropertyQName);
            if (contentPropertyDefinition == null
                    || !DataTypeDefinition.CONTENT.equals(contentPropertyDefinition.getDataType().getName()))
            {
                throw new IllegalStateException(facadePropertyName + " is not a valid content model property of type d:content");
            }
            this.handleContentPropertyQNames.add(routePropertyQName);
        }
    }
}
 
Example 11
@Test
public void destructuringCanBeAppliedOnlyToDateOrDatetimeFields()
{
    Stream.of(ANY,ENCRYPTED,TEXT,MLTEXT,CONTENT,INT,LONG,FLOAT,DOUBLE,
            BOOLEAN,QNAME,CATEGORY,NODE_REF,CHILD_ASSOC_REF,ASSOC_REF,
            PATH,LOCALE,PERIOD)
            .map(qname -> {
                PropertyDefinition propertyThatCannotBeDestructured = mock(PropertyDefinition.class);
                DataTypeDefinition def = Mockito.mock(DataTypeDefinition.class);
                when(def.getName()).thenReturn(qname);
                when(propertyThatCannotBeDestructured.getDataType()).thenReturn(def);
                return propertyThatCannotBeDestructured;})
            .forEach(property -> assertFalse(
                            "Destructuring must be supported only on Date or Datetime fields!",
                            infoServer.canBeDestructured(property, "[email protected]@{http://www.alfresco.org/model/content/1.0}somefield")));
}
 
Example 12
/**
 * Given the field name, returns the name of the property definition.
 * If the property definition is not found, Empty optional is returned.
 *
 * @param field the field name.
 * @return the name of the associated property definition if present, Optional.Empty() otherwise
 */
static Optional<QName> getShardProperty(String field)
{
    if (StringUtils.isBlank(field))
    {
        throw new IllegalArgumentException("Sharding property " + SHARD_KEY_KEY + " has not been set.");
    }

    AlfrescoSolrDataModel dataModel = AlfrescoSolrDataModel.getInstance();
    NamespaceDAO namespaceDAO = dataModel.getNamespaceDAO();
    DictionaryService dictionaryService = dataModel.getDictionaryService(CMISStrictDictionaryService.DEFAULT);
    PropertyDefinition propertyDef = QueryParserUtils.matchPropertyDefinition("http://www.alfresco.org/model/content/1.0",
            namespaceDAO,
            dictionaryService,
            field);

    return ofNullable(propertyDef).map(PropertyDefinition::getName);
}
 
Example 13
protected Object convertPropertyValue(PropertyDefinition propDef, Serializable value)
{
    Object newValue = value;
    // Convert property value using a default type converter
    if (value instanceof Collection<?>)
    {
        // Convert a collecion of values
        newValue =typeConverter.convert(propDef.getDataType(), (Collection<?>) value);
    }
    else
    {
        // Convert a single value
        newValue = typeConverter.convert(propDef.getDataType(), value);
    }

    // Convert NodeRefs to ActivitiScriptNodes
    DataTypeDefinition dataTypeDef = propDef.getDataType();
    if (dataTypeDef.getName().equals(DataTypeDefinition.NODE_REF))
    {
        newValue = nodeConverter.convertNodes(newValue, propDef.isMultiValued());
    }
    return newValue;
}
 
Example 14
protected Object handleDefaultProperty(Object task, TypeDefinition type, QName key, Serializable value)
{
    PropertyDefinition propDef = type.getProperties().get(key);
    if (propDef != null)
    {
        return handleProperty(value, propDef);
    }
    else
    {
        AssociationDefinition assocDef = type.getAssociations().get(key);
        if (assocDef != null)
        {
            return handleAssociation(value, assocDef);
        }
        else if (value instanceof NodeRef)
        {
            return nodeConverter.convertNode((NodeRef)value, false);
        }
    }
    return value;
}
 
Example 15
/**
 * Adds a collection property to the node
 * 
 * @param property QName
 */
public void addPropertyCollection(QName property)
{
    // Do not import properties of sys:referenceable or cm:versionable or cm:copiedfrom
    // TODO: Make this configurable...
    PropertyDefinition propDef = getDictionaryService().getProperty(property);
    ClassDefinition classDef = (propDef == null) ? null : propDef.getContainerClass();
    if (classDef != null)
    {
        if (!isImportableClass(classDef.getName()))
        {
            return;
        }
    }
    
    // create collection and assign to property
    List<Serializable>values = new ArrayList<Serializable>();
    nodeProperties.put(property, (Serializable)values);
}
 
Example 16
/**
 * Actually tests if the priority is the default value.  This is based on the assumption that custom
 * tasks are defaulted to a priority of 50 (which is invalid).  I'm testing that the code I wrote decides this is an
 * invalid number and sets it to the default value (2).
 */
@Test
public void testPriorityIsValid()
{
    WorkflowDefinition definition = deployDefinition("activiti/testCustomActiviti.bpmn20.xml");
    
    personManager.setUser(USER1);
    
    // Start the Workflow
    WorkflowPath path = workflowService.startWorkflow(definition.getId(), null);
    String instanceId = path.getInstance().getId();

    // Check the Start Task is completed.
    WorkflowTask startTask = workflowService.getStartTask(instanceId);
    assertEquals(WorkflowTaskState.COMPLETED, startTask.getState());
    
    List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(path.getId());
    for (WorkflowTask workflowTask : tasks)
    {
        Map<QName, Serializable> props = workflowTask.getProperties();
        TypeDefinition typeDefinition = workflowTask.getDefinition().getMetadata();
        Map<QName, PropertyDefinition> propertyDefs = typeDefinition.getProperties();        
        PropertyDefinition priorDef =  propertyDefs.get(WorkflowModel.PROP_PRIORITY);
        assertEquals(props.get(WorkflowModel.PROP_PRIORITY),Integer.valueOf(priorDef.getDefaultValue()));        
    }
}
 
Example 17
protected Map<QName, Serializable> getProperties(Long nodeId)
{
    Map<QName, Serializable> props = null;

    // ALF-10641
    // Residual properties are un-indexed -> break serlialisation
    nodeDAO.setCheckNodeConsistency();
    Map<QName, Serializable> sourceProps = nodeDAO.getNodeProperties(nodeId);
    props = new HashMap<QName, Serializable>((int)(sourceProps.size() * 1.3));
    for(QName propertyQName : sourceProps.keySet())
    {
        PropertyDefinition propDef = dictionaryService.getProperty(propertyQName);
        if(propDef != null)
        {
            props.put(propertyQName, sourceProps.get(propertyQName));
        }
    }

    return props;
}
 
Example 18
public void testPropertyOverride()
{
    TypeDefinition type1 = service.getType(QName.createQName(TEST_URL, "overridetype1"));
    Map<QName, PropertyDefinition> props1 = type1.getProperties();
    PropertyDefinition prop1 = props1.get(QName.createQName(TEST_URL, "propoverride"));
    String def1 = prop1.getDefaultValue();
    assertEquals("one", def1);
    
    TypeDefinition type2 = service.getType(QName.createQName(TEST_URL, "overridetype2"));
    Map<QName, PropertyDefinition> props2 = type2.getProperties();
    PropertyDefinition prop2 = props2.get(QName.createQName(TEST_URL, "propoverride"));
    String def2 = prop2.getDefaultValue();
    assertEquals("two", def2);

    TypeDefinition type3 = service.getType(QName.createQName(TEST_URL, "overridetype3"));
    Map<QName, PropertyDefinition> props3 = type3.getProperties();
    PropertyDefinition prop3 = props3.get(QName.createQName(TEST_URL, "propoverride"));
    String def3 = prop3.getDefaultValue();
    assertEquals("three", def3);
}
 
Example 19
@Override
public Collection<PropertyDefinition> getProperties(QName modelName,
        QName dataType)
{
    HashSet<PropertyDefinition> properties = new HashSet<PropertyDefinition>();

    Collection<PropertyDefinition> props = getProperties(modelName);
    for (PropertyDefinition prop : props)
    {
        if ((dataType == null)
                || prop.getDataType().getName().equals(dataType))
        {
            properties.add(prop);
        }
    }
    return properties;
}
 
Example 20
@Test
public void destructuringCanBeAppliedToDateTimeFields()
{
    PropertyDefinition propertyThatCanBeDestructured = mock(PropertyDefinition.class);
    when(propertyThatCanBeDestructured.isMultiValued()).thenReturn(false);

    DataTypeDefinition datetime = mock(DataTypeDefinition.class);
    when(datetime.getName()).thenReturn(DataTypeDefinition.DATETIME);
    when(propertyThatCanBeDestructured.getDataType()).thenReturn(datetime);

    assertTrue(
            "Destructuring must be supported in Datetime fields!",
            infoServer.canBeDestructured(propertyThatCanBeDestructured, "[email protected]@{http://www.alfresco.org/model/content/1.0}created"));
}
 
Example 21
private void validateDeleteProperty(final String tenantDomain, final PropertyDefinition propDef)
{
    final QName propName = propDef.getName();

    // We need a separate transaction to do the qname delete "check"
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
    {
        @Override
        public Void execute() throws Throwable
        {
            return TenantUtil.runAsTenant(new TenantRunAsWork<Void>()
            {
                @Override
                public Void doWork() throws Exception
                {
                    try
                    {
                        // The property QName may not have been created in the database if no
                        // properties have been created that use it, so check first and then
                        // try to delete it.
                        if(qnameDAO.getQName(propName) != null)
                        {
                            qnameDAO.deleteQName(propName);
                        }
                    }
                    catch(DataIntegrityViolationException e)
                    {
                        // catch data integrity violation e.g. foreign key constraint exception
                        logger.debug(e);
                        throw new ModelInUseException("Failed to validate property delete, property " + propName + " is in use");
                    }

                    return null;
                }
            }, tenantDomain);
        }
    }, false, true);
}
 
Example 22
private ContentModelItemData<Void> makeItemData()
{
    Map<QName, PropertyDefinition> propDefs = makePropertyDefs();
    Map<QName, AssociationDefinition> assocDefs = makeAssociationDefs();
    
    Map<QName, Serializable> propValues = new HashMap<QName, Serializable>();
    Map<QName, Serializable> assocValues = new HashMap<QName, Serializable>();
    Map<String, Object> transientValues = new HashMap<String, Object>();
    return new ContentModelItemData<Void>(null, propDefs, assocDefs, propValues, assocValues, transientValues);
}
 
Example 23
protected Serializable getPropertyValueToPersist(QName qName, Object value)
{
    PropertyDefinition propDef = itemData.getPropertyDefinition(qName);
    if (propDef == null)
    {
        propDef = dictionaryService.getProperty(qName);
    }
    if (propDef != null)
    {
        return valueGetter.getValue(value, propDef);
    }
    return (Serializable) value;
}
 
Example 24
private void addFacetSearchFields(PropertyDefinition propertyDefinition, IndexedField indexedField)
{
    if(propertyDefinition.getDataType().getName().equals(DataTypeDefinition.TEXT))
    {
        if (!isIdentifierTextProperty(propertyDefinition.getName()))
        {
            if(propertyDefinition.getFacetable() == Facetable.TRUE)
            {
                indexedField.addField(getFieldForText(false, false, false, propertyDefinition), false, false);
            }
        }
    }


    if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE)
            || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)
            || isIdentifierTextProperty(propertyDefinition.getName()))
    {

        indexedField.addField(getFieldForText(false, false, false, propertyDefinition), false, false);
    }
    else
    {
        if(crossLocaleSearchDataTypes.contains(propertyDefinition.getDataType().getName()) || crossLocaleSearchProperties.contains(propertyDefinition.getName()))
        {
            indexedField.addField(getFieldForText(false, true, false, propertyDefinition), false, false);
        }
        else
        {
            indexedField.addField(getFieldForText(true, true, false, propertyDefinition), false, false);
        }
    }
}
 
Example 25
private Map<String, String> buildPropertyLabels(WorkflowTask task, Map<String, Object> properties)
{
    TypeDefinition taskType = task.getDefinition().getMetadata();
    final Map<QName, PropertyDefinition> propDefs = taskType.getProperties();
    return CollectionUtils.transform(properties, new Function<Entry<String, Object>, Pair<String, String>>()
    {
        @Override
        public Pair<String, String> apply(Entry<String, Object> entry)
        {
            String propName = entry.getKey();
            PropertyDefinition propDef = propDefs.get(qNameConverter.mapNameToQName(propName));
            if(propDef != null )
            {
                List<ConstraintDefinition> constraints = propDef.getConstraints();
                for (ConstraintDefinition constraintDef : constraints)
                {
                    Constraint constraint = constraintDef.getConstraint();
                    if (constraint instanceof ListOfValuesConstraint)
                    {
                        ListOfValuesConstraint listConstraint = (ListOfValuesConstraint) constraint;
                        String label = listConstraint.getDisplayLabel(String.valueOf(entry.getValue()), dictionaryService);
                        return new Pair<String, String>(propName, label);
                    }
                }
            }
            return null;
        }
    });
}
 
Example 26
private List <NodeDefinitionProperty> getProperties(Map<QName, PropertyDefinition> propertiesMap, MessageLookup messageLookup)
{
    return propertiesMap.values().stream()
            .filter(p -> !isPropertyExcluded(p.getName()))
            .map(p -> fromPropertyDefinitionToProperty(p , messageLookup))
            .collect(Collectors.toList());
}
 
Example 27
/**
 * Generates a list of property fields with values.
 * 
 * @param propDefAndValue Map of property definitions and corresponding values
 * @param group The group the field belongs to
 * @param namespaceService NamespaceService instance
 * @return List of generated Field objects
 */
public static List<Field> makePropertyFields(
            Map<PropertyDefinition, Object> propDefAndValue,
            FieldGroup group,
            NamespaceService namespaceService,
            DictionaryService dictionaryService)
{
    return makePropertyFields(propDefAndValue.keySet(), propDefAndValue, group, namespaceService, dictionaryService);
}
 
Example 28
/**
 * Removes the inline constraints (i.e. defined within the property) from
 * all constraints. The result will be constraints that have been defined
 * within the model (Top level) itself.
 *
 * @param compiledModel the compiled model
 * @return list of model defined constraints
 */
public static List<ConstraintDefinition> removeInlineConstraints(CompiledModel compiledModel)
{
    List<ConstraintDefinition> modelConstraints = new ArrayList<>();

    Set<QName> propertyConstraints = new HashSet<>();
    for(PropertyDefinition propDef : compiledModel.getProperties())
    {
        if (propDef.getConstraints().size() > 0)
        {
            for (ConstraintDefinition propConst : propDef.getConstraints())
            {
                propertyConstraints.add(propConst.getName());
            }
        }
    }

    for (ConstraintDefinition constraint : compiledModel.getConstraints())
    {
        if (!propertyConstraints.contains(constraint.getName()))
        {
            modelConstraints.add(constraint);
        }
    }

    return modelConstraints;
}
 
Example 29
@Override
public void onUpdateProperties(NodeRef commentNodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{
    NodeRef discussableNodeRef = getDiscussableAncestor(commentNodeRef);
    if (discussableNodeRef != null)
    {
        if (behaviourFilter.isEnabled(ContentModel.ASPECT_LOCKABLE)
                && isWorkingCopyOrLocked(discussableNodeRef)
                && !isLockOwner(discussableNodeRef))
        {
            List<QName> changedProperties = getChangedProperties(before, after);

            // check if comment updated (rather than some other change, eg. addition of lockable aspect only)
            boolean commentUpdated = false;
            for (QName changedProperty : changedProperties)
            {
                PropertyDefinition propertyDef = dictionaryService.getProperty(changedProperty);
                if (propertyDef != null)
                {
                    if (propertyDef.getContainerClass().getName().equals(ContentModel.TYPE_CONTENT))
                    {
                        commentUpdated = true;
                        break;
                    }
                }
            }

            if (commentUpdated)
            {
                throw new NodeLockedException(discussableNodeRef);
            }
        }

        boolean canEdit = canEditPermission(commentNodeRef);
        if (! canEdit)
        {
            throw new AccessDeniedException("Cannot edit comment");
        }
    }
}
 
Example 30
public Collection<QName> getProperties(QName model, QName dataType)
{
    Collection<PropertyDefinition> propDefs = dictionaryDAO.getProperties(model, dataType);
    HashSet<QName> props = new HashSet<QName>(propDefs.size());
    for(PropertyDefinition def : propDefs)
    {
        props.add(def.getName());
    }
    return props;
    
}