@Override public boolean isDefinitionExists(QName qName) { return (null != dictionaryService.getType(qName)); } });
@Override public boolean isDefinitionExists(QName qName) { return (null != dictionaryService.getType(qName)); } });
private QName getNodeType(Long nodeId) { QName result = nodeDAO.getNodeType(nodeId); TypeDefinition type = dictionaryService.getType(result); return (null == type) ? (null) : (result); }
@Override protected TypeDefinition getBaseType(NodeRef nodeRef) { QName typeName = nodeService.getType(nodeRef); return dictionaryService.getType(typeName); }
private QName getNodeType(Long nodeId) { QName result = nodeDAO.getNodeType(nodeId); TypeDefinition type = dictionaryService.getType(result); return (null == type) ? (null) : (result); }
@Override protected TypeDefinition getBaseType(NodeRef nodeRef) { QName typeName = nodeService.getType(nodeRef); return dictionaryService.getType(typeName); }
/** * @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); }
/** * @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); }
private boolean parentMatches(QName type) { boolean matches = false; QName t = type; while(t != null) { TypeDefinition typeDef = dictionaryService.getType(t); t = typeDef.getParentName(); if(t != null) { if(matchingTypes.contains(t)) { matches = true; matchingTypes.add(type); break; } } } return matches; }
/** * Gets teh type of the nodeRef and checks that the type exists in the data * dcitionary. If the type is not in the data dictionary then the method * logs a warning and returns false. Otherwise it returns true. * * @param nodeRef NodeRef * @return True if the nodeRef type is in the data dictionary, otherwise * false. */ private boolean checkTypeIsInDataDictionary(NodeRef nodeRef) { QName type = protectedNodeService.getType(nodeRef); if (dictionaryService.getType(type) == null) { if (logger.isWarnEnabled()) logger.warn("Found invalid object in database: id = " + nodeRef + ", type = " + type); return false; } return true; }
private boolean parentMatches(QName type) { boolean matches = false; QName t = type; while(t != null) { TypeDefinition typeDef = dictionaryService.getType(t); t = typeDef.getParentName(); if(t != null) { if(matchingTypes.contains(t)) { matches = true; matchingTypes.add(type); break; } } } return matches; }
private Set<QName> getDefaultAspects(QName sourceNodeTypeQName) { TypeDefinition sourceNodeTypeDef = dictionaryService.getType(sourceNodeTypeQName); if (sourceNodeTypeDef == null) { return Collections.emptySet(); } Set<QName> defaultAspectQNames = new HashSet<QName>(7); for (AspectDefinition aspectDef : sourceNodeTypeDef.getDefaultAspects()) { defaultAspectQNames.add(aspectDef.getName()); } // Done return defaultAspectQNames; }
private Set<QName> getDefaultAspects(QName sourceNodeTypeQName) { TypeDefinition sourceNodeTypeDef = dictionaryService.getType(sourceNodeTypeQName); if (sourceNodeTypeDef == null) { return Collections.emptySet(); } Set<QName> defaultAspectQNames = new HashSet<QName>(7); for (AspectDefinition aspectDef : sourceNodeTypeDef.getDefaultAspects()) { defaultAspectQNames.add(aspectDef.getName()); } // Done return defaultAspectQNames; }
/** * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() */ protected Map<String, String> getAllowableValuesImpl() { Collection<QName> types = dictionaryService.getAllTypes(); Map<String, String> result = new LinkedHashMap<String, String>(types.size()); for (QName type : types) { TypeDefinition typeDef = dictionaryService.getType(type); if (typeDef != null && typeDef.getTitle(dictionaryService) != null) { result.put(type.toPrefixString(), typeDef.getTitle(dictionaryService)); } } return result; } }
/** * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() */ protected Map<String, String> getAllowableValuesImpl() { Collection<QName> types = dictionaryService.getAllTypes(); Map<String, String> result = new LinkedHashMap<String, String>(types.size()); for (QName type : types) { TypeDefinition typeDef = dictionaryService.getType(type); if (typeDef != null && typeDef.getTitle(dictionaryService) != null) { result.put(type.toPrefixString(), typeDef.getTitle(dictionaryService)); } } return result; } }
@Override public Void doWork() throws Exception { assertNotNull(service.getType(ContentModel.TYPE_CONTENT)); QName qname = QName.createQName("{http://www.alfresco.org/test/dictionarydaotest1/1.0}type1"); TypeDefinition td = service.getType(qname); assertNull(td); return null; } }, "user2", "tenant2");
/** * @return Returns the type of the parent */ public String getParentTypeShort() { if (this.parentType == null) { this.parentType = this.services.getDictionaryService().getType(getType()).getParentName(); } return parentType.toPrefixString(this.services.getNamespaceService()); }
/** * @return Returns the type of the parent */ public String getParentTypeShort() { if (this.parentType == null) { this.parentType = this.services.getDictionaryService().getType(getType()).getParentName(); } return parentType.toPrefixString(this.services.getNamespaceService()); }
@Override public Void doWork() throws Exception { M2Model customModel = M2Model.createModel( Thread.currentThread().getContextClassLoader(). getResourceAsStream("dictionary/dictionarydaotest_model1.xml")); dictionaryDAO.putModel(customModel); assertNotNull(service.getType(ContentModel.TYPE_CONTENT)); QName qname = QName.createQName("{http://www.alfresco.org/test/dictionarydaotest1/1.0}type1"); TypeDefinition td = service.getType(qname); assertNotNull(td); return null; } }, "user1", "tenant1");
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); }