Java Code Examples for org.alfresco.service.cmr.dictionary.DictionaryService#getType()

The following examples show how to use org.alfresco.service.cmr.dictionary.DictionaryService#getType() . 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
Source File: DocumentTypeDefinitionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void updateDefinition(DictionaryService dictionaryService)
{
    TypeDefinition typeDef = dictionaryService.getType(alfrescoName);

    if (typeDef != null)
    {
        setTypeDefDisplayName(typeDef.getTitle(dictionaryService));
        setTypeDefDescription(typeDef.getDescription(dictionaryService));
    }
    else
    {
        super.updateDefinition(dictionaryService);
    }
    
    updateTypeDefInclProperties();
}
 
Example 2
Source File: FolderTypeDefintionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void updateDefinition(DictionaryService dictionaryService)
{
    TypeDefinition typeDef = dictionaryService.getType(alfrescoName);

    if (typeDef != null)
    {
        setTypeDefDisplayName(typeDef.getTitle(dictionaryService));
        setTypeDefDescription(typeDef.getDescription(dictionaryService));
    }
    else
    {
        super.updateDefinition(dictionaryService);
    }
    
    updateTypeDefInclProperties();
}
 
Example 3
Source File: ItemTypeDefinitionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void updateDefinition(DictionaryService dictionaryService)
{
    TypeDefinition typeDef = dictionaryService.getType(alfrescoName);

    if (typeDef != null)
    {
        setTypeDefDisplayName(typeDef.getTitle(dictionaryService));
        setTypeDefDescription(typeDef.getDescription(dictionaryService));
    }
    else
    {
        super.updateDefinition(dictionaryService);
    }
    
    updateTypeDefInclProperties();
}
 
Example 4
Source File: DBQuery.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static TypeDefinition matchTypeDefinition(String string, NamespacePrefixResolver namespacePrefixResolver, DictionaryService dictionaryService)
{
    QName search = QName.createQName(expandQName(string, namespacePrefixResolver));
    TypeDefinition typeDefinition = dictionaryService.getType(search);
    QName match = null;
    if (typeDefinition == null)
    {
        for (QName definition : dictionaryService.getAllTypes())
        {
            if (definition.getNamespaceURI().equalsIgnoreCase(search.getNamespaceURI()))
            {
                if (definition.getLocalName().equalsIgnoreCase(search.getLocalName()))
                {
                    if (match == null)
                    {
                        match = definition;
                    }
                    else
                    {
                        throw new QueryModelException("Ambiguous data datype " + string);
                    }
                }
            }
        }
    }
    else
    {
        return typeDefinition;
    }
    if (match == null)
    {
        return null;
    }
    else
    {
        return dictionaryService.getType(match);
    }
}
 
Example 5
Source File: Workflow.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @return the resources from the package attached to this workflow task
 */
public List<TemplateContent> getPackageResources()
{
    List<TemplateContent> resources = new ArrayList<TemplateContent>();
    List<NodeRef> contents = this.services.getWorkflowService().getPackageContents(this.task.id);
    
    NodeService nodeService = this.services.getNodeService();
    DictionaryService ddService = this.services.getDictionaryService();
    
    for(NodeRef nodeRef : contents)
    {
        QName type = nodeService.getType(nodeRef);

        // make sure the type is defined in the data dictionary
        if (ddService.getType(type) != null)
        {
            // look for content nodes or links to content
            // NOTE: folders within workflow packages are ignored for now
            if (ddService.isSubClass(type, ContentModel.TYPE_CONTENT) || 
                    ApplicationModel.TYPE_FILELINK.equals(type))
            {
                resources.add(new TemplateNode(nodeRef, this.services, this.resolver));
            }
        }
    }
    return resources;
}
 
Example 6
Source File: AuditablePropertiesEntity.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @param typeQName             a node type
 * @return                      <tt>true</tt> if the type given has the <b>cm:auditable</b> aspect by default
 */
public static boolean hasAuditableAspect(QName typeQName, DictionaryService dictionaryService)
{
    TypeDefinition typeDef = dictionaryService.getType(typeQName);
    if (typeDef == null)
    {
        return false;
    }
    return typeDef.getDefaultAspectNames().contains(ContentModel.ASPECT_AUDITABLE);
}
 
Example 7
Source File: QueryParserUtils.java    From alfresco-data-model with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static TypeDefinition matchTypeDefinition(String defaultNameSpaceUri, NamespacePrefixResolver namespacePrefixResolver, DictionaryService dictionaryService, String string) 
{
    QName search = QName.createQName(expandQName(defaultNameSpaceUri, namespacePrefixResolver, string));
    TypeDefinition typeDefinition = dictionaryService.getType(QName.createQName(expandQName(defaultNameSpaceUri, namespacePrefixResolver, string)));
    QName match = null;
    if (typeDefinition == null)
    {
        for (QName definition : dictionaryService.getAllTypes())
        {
            if (definition.getNamespaceURI().equalsIgnoreCase(search.getNamespaceURI()))
            {
                if (definition.getLocalName().equalsIgnoreCase(search.getLocalName()))
                {
                    if (match == null)
                    {
                        match = definition;
                    }
                    else
                    {
                        throw new DictionaryException("Ambiguous data datype " + string);
                    }
                }
            }
        }
    }
    else
    {
        return typeDefinition;
    }
    if (match == null)
    {
        return null;
    }
    else
    {
        return dictionaryService.getType(match);
    }
}