/** * Returns an anonymous {@link TypeDefinition} for the given name with all * the mandatory aspects applied. * * @param name * the name of the task definition. * @param isStart * is theis a start task? * @return the task {@link TypeDefinition}. */ public TypeDefinition getTaskFullTypeDefinition(String name, boolean isStart) { TypeDefinition typeDef = getTaskTypeDefinition(name, isStart); return dictionaryService.getAnonymousType(typeDef.getName()); }
/** * Returns an anonymous {@link TypeDefinition} for the given name with all * the mandatory aspects applied. * * @param name * the name of the task definition. * @param isStart * is theis a start task? * @return the task {@link TypeDefinition}. */ public TypeDefinition getTaskFullTypeDefinition(String name, boolean isStart) { TypeDefinition typeDef = getTaskTypeDefinition(name, isStart); return dictionaryService.getAnonymousType(typeDef.getName()); }
List<QName> aspectNames = new ArrayList<QName>(aspects.size()); getMandatoryAspects(typeDef, aspectNames); ClassDefinition startTaskDef = dictionaryService.getAnonymousType(typeDef.getName(), aspectNames);
List<QName> aspectNames = new ArrayList<QName>(aspects.size()); getMandatoryAspects(typeDef, aspectNames); ClassDefinition startTaskDef = dictionaryService.getAnonymousType(typeDef.getName(), aspectNames);
@SuppressWarnings("unchecked") private DictionaryService makeDictionaryService() { DictionaryService mock = mock(DictionaryService.class); TypeDefinition taskTypeDef = definition.getStartTaskDefinition().getMetadata(); when(mock.getAnonymousType((QName) any(), (Collection<QName>) any())).thenReturn(taskTypeDef); return mock; }
@SuppressWarnings("unchecked") private DictionaryService makeDictionaryService() { DictionaryService mock = mock(DictionaryService.class); when(mock.getAnonymousType((QName) any(), (Collection<QName>) any())).thenReturn(task.getDefinition().getMetadata()); return mock; }
when(dictionaryService.getAnonymousType((QName)any())).thenAnswer(new Answer<TypeDefinition>()
TypeDefinition typeDef = this.dictionaryService.getAnonymousType(type, this.nodeService.getAspects(nodeRef)); Map<QName, AssociationDefinition> assocDefs = typeDef.getAssociations(); Map<QName, ChildAssociationDefinition> childAssocDefs = typeDef.getChildAssociations();
TypeDefinition typeDef = this.dictionaryService.getAnonymousType(type, this.nodeService.getAspects(nodeRef)); Map<QName, AssociationDefinition> assocDefs = typeDef.getAssociations(); Map<QName, ChildAssociationDefinition> childAssocDefs = typeDef.getChildAssociations();
TypeDefinition anonymousType = getDictionaryService().getAnonymousType(parent.getTypeDefinition().getName(), allAspects);
@Override protected ContentModelItemData<ItemType> makeItemData(ItemType item) { TypeDefinition baseType = getBaseType(item); Set<QName> aspects = getAspectNames(item); TypeDefinition anonType = dictionaryService.getAnonymousType(baseType.getName(), aspects); Map<QName, PropertyDefinition> propDefs = anonType.getProperties(); Map<QName, AssociationDefinition> assocDefs = anonType.getAssociations(); Map<QName, Serializable> propValues = getPropertyValues(item); Map<QName, Serializable> assocValues = getAssociationValues(item); Map<String, Object> transientValues = getTransientValues(item); return new ContentModelItemData<ItemType>(item, propDefs, assocDefs, propValues, assocValues, transientValues); }
@Override protected ContentModelItemData<ItemType> makeItemData(ItemType item) { TypeDefinition baseType = getBaseType(item); Set<QName> aspects = getAspectNames(item); TypeDefinition anonType = dictionaryService.getAnonymousType(baseType.getName(), aspects); Map<QName, PropertyDefinition> propDefs = anonType.getProperties(); Map<QName, AssociationDefinition> assocDefs = anonType.getAssociations(); Map<QName, Serializable> propValues = getPropertyValues(item); Map<QName, Serializable> assocValues = getAssociationValues(item); Map<String, Object> transientValues = getTransientValues(item); return new ContentModelItemData<ItemType>(item, propDefs, assocDefs, propValues, assocValues, transientValues); }
TypeDefinition anonymousType = getDictionaryService().getAnonymousType(parent.getTypeDefinition().getName(), allAspects);
@Override protected void persistNode(NodeRef nodeRef, FormData data) { super.persistNode(nodeRef, data); QName type = this.nodeService.getType(nodeRef); Set<QName> aspectNames = getAspectNames(getTypedItem(typeItem)); TypeDefinition typeDef = this.dictionaryService.getAnonymousType(type, aspectNames); Map<QName, PropertyDefinition> propDefs = typeDef.getProperties(); Map<QName, Serializable> propsToPersist = new HashMap<QName, Serializable>(); for (FieldData fieldData : data) { String fieldName = fieldData.getName(); if (fieldName.startsWith(PROP_DATA_PREFIX)) { processPropertyPersist(nodeRef, propDefs, fieldData, propsToPersist, data); } } this.nodeService.addProperties(nodeRef, propsToPersist); }