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


Java ModelElementInstance.setAttributeValue方法代码示例

本文整理汇总了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);
}
 
开发者ID:camunda,项目名称:camunda-xml-model,代码行数:19,代码来源:UnknownAnimalTest.java

示例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;
}
 
开发者ID:sdorokhova,项目名称:simple-workflow,代码行数:31,代码来源:ZeebeTaskFactory.java

示例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);
  }
}
 
开发者ID:camunda,项目名称:camunda-xml-model,代码行数:12,代码来源:AttributeImpl.java

示例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);
}
 
开发者ID:camunda,项目名称:camunda-xml-model,代码行数:16,代码来源:UnknownAnimalTest.java

示例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);
}
 
开发者ID:camunda,项目名称:camunda-xml-model,代码行数:6,代码来源:UriElementReferenceImpl.java


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