本文整理汇总了Java中org.camunda.bpm.model.xml.instance.ModelElementInstance.setAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:Java ModelElementInstance.setAttributeValue方法的具体用法?Java ModelElementInstance.setAttributeValue怎么用?Java ModelElementInstance.setAttributeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.model.xml.instance.ModelElementInstance
的用法示例。
在下文中一共展示了ModelElementInstance.setAttributeValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAddUnknownAnimal
import org.camunda.bpm.model.xml.instance.ModelElementInstance; //导入方法依赖的package包/类
@Test
public void testAddUnknownAnimal() {
ModelInstanceImpl modelInstanceImpl = (ModelInstanceImpl) modelInstance;
ModelElementType unknownAnimalType = modelInstanceImpl.registerGenericType(MODEL_NAMESPACE, "unknownAnimal");
ModelElementType animalsType = modelInstance.getModel().getType(Animals.class);
ModelElementType animalType = modelInstance.getModel().getType(Animal.class);
ModelElementInstance unknownAnimal = modelInstance.newInstance(unknownAnimalType);
assertThat(unknownAnimal).isNotNull();
unknownAnimal.setAttributeValue("id", "new-animal", true);
unknownAnimal.setAttributeValue("gender", "Unknown");
unknownAnimal.setAttributeValue("species", "unknown");
ModelElementInstance animals = modelInstance.getModelElementsByType(animalsType).iterator().next();
List<ModelElementInstance> childElementsByType = new ArrayList<ModelElementInstance>(animals.getChildElementsByType(animalType));
animals.insertElementAfter(unknownAnimal, childElementsByType.get(2));
assertThat(animals.getChildElementsByType(unknownAnimalType)).hasSize(3);
}
示例2: buildTask
import org.camunda.bpm.model.xml.instance.ModelElementInstance; //导入方法依赖的package包/类
@Override
public AbstractTaskBuilder buildTask(AbstractFlowNodeBuilder builder, Map<String, Object> taskData)
{
final AbstractTaskBuilder taskBuilder = super.buildTask(builder, taskData);
if (! (taskBuilder instanceof ServiceTaskBuilder)) {
throw new RuntimeException("only service tasks are supported");
}
ServiceTaskBuilder serviceTaskBuilder = (ServiceTaskBuilder) taskBuilder;
final String taskType = (String) taskData.get("type");
final Integer retries = (Integer) taskData.get("retries");
final ServiceTask serviceTask = serviceTaskBuilder.getElement();
final ExtensionElements extensionElements = serviceTask.getModelInstance().newInstance(ExtensionElements.class);
final ModelElementInstance taskDefinition = extensionElements.addExtensionElement(TNGP_NAMESPACE, TASK_DEFINITION_ELEMENT);
taskDefinition.setAttributeValue(TASK_TYPE_ATTRIBUTE, taskType);
if (retries != null)
{
taskDefinition.setAttributeValue(TASK_RETRIES_ATTRIBUTE, String.valueOf(retries));
}
serviceTask.setExtensionElements(extensionElements);
return serviceTaskBuilder;
}
示例3: setValue
import org.camunda.bpm.model.xml.instance.ModelElementInstance; //导入方法依赖的package包/类
@Override
public void setValue(ModelElementInstance modelElement, T value, boolean withReferenceUpdate) {
String xmlValue = convertModelValueToXmlValue(value);
if(namespaceUri == null) {
modelElement.setAttributeValue(attributeName, xmlValue,
isIdAttribute, withReferenceUpdate);
} else {
modelElement.setAttributeValueNs(namespaceUri, attributeName,
xmlValue, isIdAttribute, withReferenceUpdate);
}
}
示例4: testReplaceChildOfUnknownAnimal
import org.camunda.bpm.model.xml.instance.ModelElementInstance; //导入方法依赖的package包/类
@Test
public void testReplaceChildOfUnknownAnimal() {
ModelElementInstance yogi = modelInstance.newInstance(flipper.getElementType());
yogi.setAttributeValue("id", "yogi-bear", true);
yogi.setAttributeValue("gender", "Male");
yogi.setAttributeValue("species", "bear");
assertThat(wanda.getChildElementsByType(flipper.getElementType())).isEmpty();
wanda.insertElementAfter(flipper, null);
assertThat(wanda.getChildElementsByType(flipper.getElementType())).hasSize(1);
wanda.replaceChildElement(flipper, yogi);
assertThat(wanda.getChildElementsByType(flipper.getElementType())).hasSize(1);
assertThat(wanda.getChildElementsByType(flipper.getElementType()).iterator().next())
.isEqualTo(yogi);
}
示例5: setReferenceIdentifier
import org.camunda.bpm.model.xml.instance.ModelElementInstance; //导入方法依赖的package包/类
@Override
protected void setReferenceIdentifier(ModelElementInstance referenceSourceElement, String referenceIdentifier) {
// TODO: implement something more robust (CAM-4028)
referenceSourceElement.setAttributeValue("href", "#" + referenceIdentifier);
}