本文整理汇总了Java中org.alfresco.service.cmr.dictionary.TypeDefinition类的典型用法代码示例。如果您正苦于以下问题:Java TypeDefinition类的具体用法?Java TypeDefinition怎么用?Java TypeDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeDefinition类属于org.alfresco.service.cmr.dictionary包,在下文中一共展示了TypeDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDefinition
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
@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();
}
示例2: addTypePermissions
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
/**
* Support to add permissions for types
*
* @param type QName
* @param permissions Set<PermissionReference>
* @param exposedOnly boolean
*/
private void addTypePermissions(QName type, Set<PermissionReference> permissions, boolean exposedOnly)
{
TypeDefinition typeDef = dictionaryService.getType(type);
if (typeDef == null)
{
// the type definition is no longer in the dictionary - ignore
return;
}
if (typeDef.getParentName() != null)
{
PermissionSet permissionSet = permissionSets.get(type);
if (!exposedOnly || (permissionSet == null) || permissionSet.exposeAll())
{
addTypePermissions(typeDef.getParentName(), permissions, exposedOnly);
}
}
for (AspectDefinition ad : typeDef.getDefaultAspects())
{
addAspectPermissions(ad.getName(), permissions, exposedOnly);
}
mergePermissions(permissions, type, exposedOnly, true);
}
示例3: for
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
/**
* Construct
*
* @param type the primary type
* @param aspects the aspects to combine with the type
*/
/*package*/ M2AnonymousTypeDefinition(TypeDefinition type, Collection<AspectDefinition> aspects)
{
this.type = type;
// Combine features of type and aspects
properties.putAll(type.getProperties());
associations.putAll(type.getAssociations());
childassociations.putAll(type.getChildAssociations());
for (AspectDefinition aspect : aspects)
{
properties.putAll(aspect.getProperties());
associations.putAll(aspect.getAssociations());
childassociations.putAll(aspect.getChildAssociations());
}
}
示例4: testPropertyOverride
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
@Test
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);
}
示例5: mayHaveChildren
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
/**
* Does the node type or any applied aspect allow this node to have child associations?
*
* @param nodeRef NodeRef
* @return true if the node may have children
*/
private boolean mayHaveChildren(NodeRef nodeRef)
{
// 1) Does the type support children?
QName nodeTypeRef = nodeService.getType(nodeRef);
TypeDefinition nodeTypeDef = getDictionaryService().getType(nodeTypeRef);
if ((nodeTypeDef != null) && (nodeTypeDef.getChildAssociations().size() > 0))
{
return true;
}
// 2) Do any of the applied aspects support children?
Set<QName> aspects = nodeService.getAspects(nodeRef);
for (QName aspect : aspects)
{
AspectDefinition aspectDef = getDictionaryService().getAspect(aspect);
if ((aspectDef != null) && (aspectDef.getChildAssociations().size() > 0))
{
return true;
}
}
return false;
}
示例6: isCategory
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
private boolean isCategory(TypeDefinition typeDef)
{
if (typeDef == null)
{
return false;
}
TypeDefinition current = typeDef;
while (current != null)
{
if (current.getName().equals(ContentModel.TYPE_CATEGORY))
{
return true;
}
else
{
QName parentName = current.getParentName();
if (parentName == null)
{
break;
}
current = getDictionaryService().getType(parentName);
}
}
return false;
}
示例7: getTypeImpl
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
protected TypeDefinition getTypeImpl(QName typeName)
{
TypeDefinition typeDef = null;
if (typeName != null)
{
List<CompiledModel> models = getModelsForUri(typeName.getNamespaceURI());
if(models != null && models.size() > 0)
{
for (CompiledModel model : models)
{
typeDef = model.getType(typeName);
if(typeDef != null)
{
break;
}
}
}
}
return typeDef;
}
示例8: getTaskTypeDefinition
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
/**
* Gets the Task {@link TypeDefinition} for the given name.
*
* @param name the name of the task definition.
* @param isStart is theis a start task?
* @return the task {@link TypeDefinition}.
*/
public TypeDefinition getTaskTypeDefinition(String name, boolean isStart)
{
TypeDefinition typeDef = null;
if(name!=null)
{
QName typeName = qNameConverter.mapNameToQName(name);
typeDef = dictionaryService.getType(typeName);
}
if (typeDef == null)
{
QName defaultTypeName = isStart? defaultStartTaskType : WorkflowModel.TYPE_WORKFLOW_TASK;
typeDef = dictionaryService.getType(defaultTypeName);
if (typeDef == null)
{
String msg = messageService.getMessage("workflow.get.task.definition.metadata.error", name);
throw new WorkflowException( msg);
}
}
return typeDef;
}
示例9: getVariables
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
/**
* @param variables raw variables
* @param typeDefinition the typê definition for the start-task of the process, used to extract types.
* @return list of {@link Variable}, representing the given raw variables
*/
public List<Variable> getVariables(Map<String, Object> variables, TypeDefinition typeDefinition)
{
List<Variable> result = new ArrayList<Variable>();
TypeDefinitionContext context = new TypeDefinitionContext(typeDefinition, getQNameConverter());
Variable variable = null;
for(Entry<String, Object> entry : variables.entrySet())
{
if(!INTERNAL_PROPERTIES.contains(entry.getKey()))
{
variable = new Variable();
variable.setName(entry.getKey());
// Set value and type
setVariableValueAndType(variable, entry.getValue(), context);
result.add(variable);
}
}
return result;
}
示例10: notify
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
@Override
public void notify(DelegateTask task)
{
// Set all default properties, based on the type-definition
propertyConverter.setDefaultTaskProperties(task);
String taskFormKey = getFormKey(task);
// Fetch definition and extract name again. Possible that the default is used if the provided is missing
TypeDefinition typeDefinition = propertyConverter.getWorkflowObjectFactory().getTaskTypeDefinition(taskFormKey, false);
taskFormKey = typeDefinition.getName().toPrefixString();
// The taskDefinition key is set as a variable in order to be available
// in the history
task.setVariableLocal(ActivitiConstants.PROP_TASK_FORM_KEY, taskFormKey);
// Add process initiator as involved person
ActivitiScriptNode initiatorNode = (ActivitiScriptNode) task.getExecution().getVariable(WorkflowConstants.PROP_INITIATOR);
if(initiatorNode != null) {
task.addUserIdentityLink((String) initiatorNode.getProperties().get(ContentModel.PROP_USERNAME.toPrefixString()), IdentityLinkType.STARTER);
}
}
示例11: processStartType
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
/**
* Process start of a node definition
*
* @param xpp XmlPullParser
* @param typeDef TypeDefinition
* @param parserContext ParserContext
* @throws XmlPullParserException
* @throws IOException
*/
private void processStartType(XmlPullParser xpp, TypeDefinition typeDef, ParserContext parserContext)
throws XmlPullParserException, IOException
{
ParentContext parent = (ParentContext)parserContext.elementStack.peek();
NodeContext node = new NodeContext(typeDef.getName(), parent, typeDef);
// Extract child name if explicitly defined
String childName = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_CHILD_NAME_ATTR);
if (childName != null && childName.length() > 0)
{
node.setChildName(childName);
}
// Extract import id if explicitly defined
String importId = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_ID_ATTR);
if (importId != null && importId.length() > 0)
{
node.setImportId(importId);
}
parserContext.elementStack.push(node);
if (logger.isDebugEnabled())
logger.debug(indentLog("Pushed " + node, parserContext.elementStack.size() -1));
}
示例12: testListTypesAspects_Empty
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
@Test
public void testListTypesAspects_Empty() throws Exception
{
final String modelName = makeUniqueName("testCustomModel");
Pair<String, String> namespacePair = getTestNamespacePrefixPair();
final M2Model model = M2Model.createModel(namespacePair.getSecond() + QName.NAMESPACE_PREFIX + modelName);
model.createNamespace(namespacePair.getFirst(), namespacePair.getSecond());
createModel(model, false);
// Retrieve the created model
CustomModelDefinition modelDefinition = getModel(modelName);
assertNotNull(modelDefinition);
assertEquals(modelName, modelDefinition.getName().getLocalName());
// List all of the model's types
Collection<TypeDefinition> types = modelDefinition.getTypeDefinitions();
assertEquals(0, types.size());
// List all of the model's aspects
Collection<AspectDefinition> aspects = modelDefinition.getAspectDefinitions();
assertEquals(0, aspects.size());
}
示例13: testLabels
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
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());
}
示例14: testPropertyOverride
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
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);
}
示例15: testPriorityIsValid
import org.alfresco.service.cmr.dictionary.TypeDefinition; //导入依赖的package包/类
/**
* 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).
*/
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()));
}
}