当前位置: 首页>>代码示例>>Java>>正文


Java ClassDefinition.isAspect方法代码示例

本文整理汇总了Java中org.alfresco.service.cmr.dictionary.ClassDefinition.isAspect方法的典型用法代码示例。如果您正苦于以下问题:Java ClassDefinition.isAspect方法的具体用法?Java ClassDefinition.isAspect怎么用?Java ClassDefinition.isAspect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.service.cmr.dictionary.ClassDefinition的用法示例。


在下文中一共展示了ClassDefinition.isAspect方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isExcludedAspectProperty

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * Is the property unexportable?
 */
private boolean isExcludedAspectProperty(QName[] excludeAspects, QName propertyQName)
{
    PropertyDefinition propDef = dictionaryService.getProperty(propertyQName);
    if (propDef == null)
    {
        return false;
    }
    
    ClassDefinition classDef = propDef.getContainerClass();
    if (classDef == null || !classDef.isAspect())
    {
        return false;
    }
    
    return isExcludedAspect(excludeAspects, classDef.getName());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ExporterComponent.java

示例2: isExcludedAspectAssociation

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * Is the association unexportable?
 */
private boolean isExcludedAspectAssociation(QName[] excludeAspects, QName associationQName)
{
    AssociationDefinition assocDef = dictionaryService.getAssociation(associationQName);
    if (assocDef == null)
    {
        return false;
    }
    
    ClassDefinition classDef = assocDef.getSourceClass();
    if (classDef == null || !classDef.isAspect())
    {
        return false;
    }
    
    return isExcludedAspect(excludeAspects, classDef.getName());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ExporterComponent.java

示例3: createIsNotNull

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
protected Query createIsNotNull(String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException
{
    PropertyDefinition pd = matchPropertyDefinition(queryText);
    if (pd != null)
    {
        ClassDefinition containerClass = pd.getContainerClass();
        QName container = containerClass.getName();
        BooleanQuery query = new BooleanQuery();
        String classType = containerClass.isAspect() ? FIELD_ASPECT : FIELD_TYPE;
        Query typeQuery = getFieldQuery(classType, container.toString(), analysisMode, luceneFunction);
        Query presenceQuery = getWildcardQuery(PROPERTY_FIELD_PREFIX + pd.getName().toString(), "*");
        if ((typeQuery != null) && (presenceQuery != null))
        {
            // query.add(typeQuery, Occur.MUST);
            query.add(presenceQuery, Occur.MUST);
        }
        return query;
    }
    else
    {
        return getFieldQueryImpl(FIELD_ISNOTNULL, queryText, analysisMode, luceneFunction);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:24,代码来源:AbstractLuceneQueryParser.java

示例4: createIsUnsetQuery

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
protected Query createIsUnsetQuery(String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException
{
    PropertyDefinition pd = matchPropertyDefinition(queryText);
    if (pd != null)
    {
        ClassDefinition containerClass = pd.getContainerClass();
        QName container = containerClass.getName();
        BooleanQuery query = new BooleanQuery();
        String classType = containerClass.isAspect() ? FIELD_ASPECT : FIELD_TYPE;
        Query typeQuery = getFieldQuery(classType, container.toString(), analysisMode, luceneFunction);
        Query presenceQuery = getWildcardQuery(PROPERTY_FIELD_PREFIX + pd.getName().toString(), "*");
        if ((typeQuery != null) && (presenceQuery != null))
        {
            query.add(typeQuery, Occur.MUST);
            query.add(presenceQuery, Occur.MUST_NOT);
        }
        return query;
    }
    else
    {
        return getFieldQueryImpl(FIELD_ISUNSET, queryText, analysisMode, luceneFunction);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:24,代码来源:AbstractLuceneQueryParser.java

示例5: init

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
public void init()
{
    super.init();
    DictionaryService dictionaryService = serviceRegistry.getDictionaryService();
    aspects.clear();
    types.clear();
    for (QName contentClass : contentClasses)
    {
        ClassDefinition classDef = dictionaryService.getClass(contentClass);
        if (classDef == null)
        {
            continue;
        }
        if (classDef.isAspect())
        {
            aspects.add(contentClass);
            if (!directOnly)
            {
                aspects.addAll(dictionaryService.getSubAspects(contentClass, true));
            }
        }
        else
        {
            types.add(contentClass);
            if (!directOnly)
            {
                types.addAll(dictionaryService.getSubTypes(contentClass, true));
            }
        }

    }
    initialised = true;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:ContentClassFilter.java

示例6: copyProperties

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * Copies the properties for the node type or aspect onto the destination node.
 */
private void copyProperties(
        CopyDetails copyDetails, 
        NodeRef targetNodeRef,
        QName classQName,
        Map<QName, CopyBehaviourCallback> callbacks)
{
    ClassDefinition targetClassDef = dictionaryService.getClass(classQName);
    if (targetClassDef == null)
    {
        return;                        // Ignore unknown types
    }
    // First check if the aspect must be copied at all
    CopyBehaviourCallback callback = callbacks.get(classQName);
    if (callback == null)
    {
        throw new IllegalStateException("Source node class has no callback: " + classQName);
    }
    // Ignore if not present or if not scheduled for a copy
    if (!callback.getMustCopy(classQName, copyDetails))
    {
        // Do nothing with this
        return;
    }
    // Compile the properties to copy, even if they are empty
    Map<QName, Serializable> classProperties = buildCopyProperties(
            copyDetails,
            Collections.singleton(classQName),
            callbacks);
    // We don't need permissions as we've just created the node
    if (targetClassDef.isAspect())
    {
        internalNodeService.addAspect(targetNodeRef, classQName, classProperties);
    }
    else
    {
        internalNodeService.addProperties(targetNodeRef, classProperties);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:CopyServiceImpl.java

示例7: isSubClass

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
public boolean isSubClass(QName className, QName ofClassName)
{
    // Validate arguments
    ParameterCheck.mandatory("className", className);
    ParameterCheck.mandatory("ofClassName", ofClassName);
    ClassDefinition classDef = getClass(className);
    if (classDef == null)
    {
        return false;
    }
    ClassDefinition ofClassDef = getClass(ofClassName);
    if (ofClassDef == null)
    {
        return false;
    }
    
    // Only check if both ends are either a type or an aspect
    boolean subClassOf = false;
    if (classDef.isAspect() == ofClassDef.isAspect())
    {
        while (classDef != null)
        {
            if (classDef.equals(ofClassDef))
            {
                subClassOf = true;
                break;
            }
            
            // No match yet, so go to parent class
            QName parentClassName = classDef.getParentName();
            classDef = (parentClassName == null) ? null : getClass(parentClassName);
        }
    }        
    return subClassOf;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:36,代码来源:DictionaryComponent.java

示例8: afterPropertiesSet_setupChangePolicies

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
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(OnUpdatePropertiesPolicy.QNAME, this.selectorClassQName,
                new JavaBehaviour(this, "onUpdateProperties", NotificationFrequency.EVERY_EVENT));

        final ClassDefinition classDefinition = this.dictionaryService.getClass(this.selectorClassQName);
        if (classDefinition.isAspect())
        {
            this.policyComponent.bindClassBehaviour(BeforeRemoveAspectPolicy.QNAME, this.selectorClassQName,
                    new JavaBehaviour(this, "beforeRemoveAspect", NotificationFrequency.EVERY_EVENT));
            this.policyComponent.bindClassBehaviour(OnAddAspectPolicy.QNAME, this.selectorClassQName,
                    new JavaBehaviour(this, "onAddAspect", NotificationFrequency.EVERY_EVENT));
        }
    }
}
 
开发者ID:Acosix,项目名称:alfresco-simple-content-stores,代码行数:35,代码来源:SelectorPropertyContentStore.java

示例9: executeImpl

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache)
 */
@Override
public Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
    Map<String, Object> model = new HashMap<String, Object>();

    Set<QName> qnames = rmAdminService.getCustomisable();
    ArrayList<Item> items = new ArrayList<Item>(qnames.size());
    for (QName qname : qnames)
    {
        ClassDefinition definition = dictionaryService.getClass(qname);
        if (definition != null)
        {
            String name = qname.toPrefixString(namespaceService);
            String title = definition.getTitle(dictionaryService);
            if (title == null || title.length() == 0)
            {
                title = qname.getLocalName();
            }
            boolean isAspect = definition.isAspect();

            items.add(new Item(name, isAspect, title));
        }
    }

    // Sort the customisable types and aspects by title
    Collections.sort(items, new Comparator<Item>()
    {
        @Override
        public int compare(Item o1, Item o2)
        {
            return o1.title.compareToIgnoreCase(o2.title);
        }});

    model.put("items", items);
    return model;
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:40,代码来源:CustomisableGet.java

示例10: isRecordMetadata

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * Helper method that indicates whether a property is considered record metadata or not.
 *
 * @param property  property
 * @return boolea   true if record metadata, false otherwise
 */
private boolean isRecordMetadata(NodeRef filePlan, QName property)
{
    boolean result = false;

    // grab the information about the properties parent type
    ClassDefinition parent = null;
    PropertyDefinition def = dictionaryService.getProperty(property);
    if (def != null)
    {
        parent = def.getContainerClass();
    }

    // non-electronic record is considered a special case
    // TODO move non-electronic record support to a separate model namespace
    if (parent != null && TYPE_NON_ELECTRONIC_DOCUMENT.equals(parent.getName()))
    {
        result = false;
    }
    else
    {
        // check the URI's
        result = RECORD_MODEL_URIS.contains(property.getNamespaceURI());

        // check the custom model
        if (!result && !ArrayUtils.contains(NON_RECORD_MODEL_URIS, property.getNamespaceURI()))
        {
            if (parent != null && parent.isAspect())
            {
                result = getRecordMetadataAspects(filePlan).contains(parent.getName());
            }
        }
    }

    return result;
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:42,代码来源:RecordServiceImpl.java

示例11: getAllPermissionsImpl

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
private Set<PermissionReference> getAllPermissionsImpl(QName type, boolean exposedOnly)
{
    Map<QName, Set<PermissionReference>> cache;
    if (exposedOnly)
    {
        cache = cachedTypePermissionsExposed;
    }
    else
    {
        cache = cachedTypePermissionsUnexposed;
    }
    Set<PermissionReference> permissions = cache.get(type);
    if (permissions == null)
    {
        boolean hadWriteLock = lock.isWriteLockedByCurrentThread();
        if (!hadWriteLock)
        {                
            lock.readLock().unlock();
            lock.writeLock().lock();
        }
        try
        {
            permissions = cache.get(type);
            if (permissions == null)
            {                
                permissions = new LinkedHashSet<PermissionReference>(256, 1.0f);
                ClassDefinition cd = dictionaryService.getClass(type);
                if (cd != null)
                {
                    if (cd.isAspect())
                    {
                        addAspectPermissions(type, permissions, exposedOnly);
                    }
                    else
                    {
                        mergeGeneralAspectPermissions(permissions, exposedOnly);
                        addTypePermissions(type, permissions, exposedOnly);
                    }
                }
                permissions = Collections.unmodifiableSet(permissions);
                cache.put(type, permissions);
            }
        }
        finally
        {
            if (!hadWriteLock)
            {                
                lock.readLock().lock();
                lock.writeLock().unlock();
            }
        }
    }
    return permissions;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:55,代码来源:PermissionModel.java

示例12: getMissingAspects

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * Get any aspects that should be added given the type, properties and existing aspects.
 * Note that this <b>does not</b> included a search for properties required for the missing
 * aspects.
 * 
 * @param classQName    the type, aspect or association
 * @return              Returns any aspects that should be added
 */
private Set<QName> getMissingAspects(
        Set<QName> existingAspects,
        Map<QName, Serializable> existingProperties,
        QName classQName)
{
    // Copy incoming existing values so that we can modify appropriately
    existingAspects = new HashSet<QName>(existingAspects);
    
    ClassDefinition classDefinition = dictionaryService.getClass(classQName);
    if (classDefinition == null)
    {
        return Collections.emptySet();
    }

    Set<QName> missingAspects = new HashSet<QName>(7);
    // Check that the aspect itself is present (only applicable for aspects)
    if (classDefinition.isAspect() && !existingAspects.contains(classQName))
    {
        missingAspects.add(classQName);
    }
    
    // Find all aspects that should be present on the class
    List<AspectDefinition> defaultAspectDefs = classDefinition.getDefaultAspects();
    for (AspectDefinition defaultAspectDef : defaultAspectDefs)
    {
        QName defaultAspect = defaultAspectDef.getName();
        if (!existingAspects.contains(defaultAspect))
        {
            missingAspects.add(defaultAspect);
        }
    }
    // Find all aspects that should be present given the existing properties
    for (QName existingPropQName : existingProperties.keySet())
    {
        PropertyDefinition existingPropDef = dictionaryService.getProperty(existingPropQName);
        if (existingPropDef == null || !existingPropDef.getContainerClass().isAspect())
        {
            continue;           // Property is undefined or belongs to a class
        }
        QName existingPropDefiningType = existingPropDef.getContainerClass().getName();
        if (!existingAspects.contains(existingPropDefiningType))
        {
            missingAspects.add(existingPropDefiningType);
        }
    }
    // If there were missing aspects, recurse to find further missing aspects
    //    Don't re-add ones we know about or we can end in infinite recursion.
    //    Don't send any properties because we don't want to reprocess them each time
    Set<QName> allTypesAndAspects = new HashSet<QName>(13);
    allTypesAndAspects.add(classQName);
    allTypesAndAspects.addAll(existingAspects);
    allTypesAndAspects.addAll(missingAspects);
    Set<QName> missingAspectsCopy = new HashSet<QName>(missingAspects);
    for (QName missingAspect : missingAspectsCopy)
    {
        Set<QName> furtherMissingAspects = getMissingAspects(
                    allTypesAndAspects,
                    Collections.<QName, Serializable>emptyMap(),
                    missingAspect);
        missingAspects.addAll(furtherMissingAspects);
        allTypesAndAspects.addAll(furtherMissingAspects);
    }
    // Done
    return missingAspects;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:74,代码来源:DbNodeServiceImpl.java

示例13: checkSourceMultiplicity

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * Checks that the source multiplicity has not been violated for the
 * target of the association.
 */
protected void checkSourceMultiplicity(
        List<IntegrityRecord> eventResults,
        AssociationDefinition assocDef,
        QName assocTypeQName,
        NodeRef targetNodeRef)
{
    // get the source multiplicity
    boolean mandatory = assocDef.isSourceMandatory();
    boolean allowMany = assocDef.isSourceMany();
    // do we need to check
    if (!mandatory && allowMany)
    {
        // it is not mandatory and it allows many on both sides of the assoc
        return;
    }
    
    // check the target of the association if this is a delete
    if (isDelete)
    {
        // get the class the association is defined for and see if it is an aspect
        ClassDefinition classDef = assocDef.getTargetClass(); 
        if (classDef.isAspect())
        {
            // see if the target node has the aspect applied, if it does not
            // there's no need to check multiplicity
            if (!this.nodeService.hasAspect(targetNodeRef, classDef.getName()))
            {
                return;
            }
        }
    }
    
    int actualSize = 0;
    if (assocDef.isChild())
    {
        // check the parent assocs present
        List<ChildAssociationRef> parentAssocRefs = nodeService.getParentAssocs(
                targetNodeRef,
                assocTypeQName,
                RegexQNamePattern.MATCH_ALL);
        actualSize = parentAssocRefs.size();
    }
    else
    {
        // check the source assocs present
        List<AssociationRef> sourceAssocRefs = nodeService.getSourceAssocs(targetNodeRef, assocTypeQName);
        actualSize = sourceAssocRefs.size();
    }
    
    if ((mandatory && actualSize == 0) || (!allowMany && actualSize > 1))
    {
        if (actualSize == 0)
        {
            // ALF-9591: Integrity check: Association source multiplicity checking is incorrect
            //           At this point, there is no point worrying.  There are no more associations
            //           pointing *to* this node and therefore the checking of the source
            //           multiplicity (a feature of the source type/aspect) is not relevant
            return;
        }
        
        String parentOrSourceStr = (assocDef.isChild() ? "parent" : "source");
        IntegrityRecord result = new IntegrityRecord(
                "The association " + parentOrSourceStr + " multiplicity has been violated: \n" +
                "   Target Node: " + targetNodeRef + "\n" +
                "   Association: " + assocDef + "\n" +
                "   Required " + parentOrSourceStr + " Multiplicity: " + getMultiplicityString(mandatory, allowMany) + "\n" +
                "   Actual " + parentOrSourceStr + " Multiplicity: " + actualSize);
        eventResults.add(result);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:75,代码来源:AssocSourceMultiplicityIntegrityEvent.java


注:本文中的org.alfresco.service.cmr.dictionary.ClassDefinition.isAspect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。