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


Java FormValue类代码示例

本文整理汇总了Java中org.activiti.bpmn.model.FormValue的典型用法代码示例。如果您正苦于以下问题:Java FormValue类的具体用法?Java FormValue怎么用?Java FormValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FormValue类属于org.activiti.bpmn.model包,在下文中一共展示了FormValue类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseFormPropertyType

import org.activiti.bpmn.model.FormValue; //导入依赖的package包/类
public AbstractFormType parseFormPropertyType(FormProperty formProperty) {
  AbstractFormType formType = null;

  if ("date".equals(formProperty.getType()) && StringUtils.isNotEmpty(formProperty.getDatePattern())) {
    formType = new DateFormType(formProperty.getDatePattern());
    
  } else if ("enum".equals(formProperty.getType())) {
    // ACT-1023: Using linked hashmap to preserve the order in which the entries are defined
    Map<String, String> values = new LinkedHashMap<String, String>();
    for (FormValue formValue: formProperty.getFormValues()) {
      values.put(formValue.getId(), formValue.getName());
    }
    formType = new EnumFormType(values);
    
  } else if (StringUtils.isNotEmpty(formProperty.getType())) {
    formType = formTypes.get(formProperty.getType());
    if (formType == null) {
      throw new ActivitiIllegalArgumentException("unknown type '" + formProperty.getType() + "' " + formProperty.getId());
    }
  }
  return formType;
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:23,代码来源:FormTypes.java

示例2: parseSelectWithRangeFormPropertyType

import org.activiti.bpmn.model.FormValue; //导入依赖的package包/类
private AbstractFormType parseSelectWithRangeFormPropertyType(FormProperty formProperty) {
  Map<String, String> map = new HashMap<String, String>();
  for (FormValue fv : formProperty.getFormValues()) {
    map.put(fv.getId(), fv.getName());
  }
  int from = Integer.parseInt(map.get("from"));
  int to = Integer.parseInt(map.get("to"));
  return new SelectFromRangeFormType(from, to);
}
 
开发者ID:mateuszwenus,项目名称:activiti-custom-form-types,代码行数:10,代码来源:CustomFormTypes.java

示例3: writeFormProperties

import org.activiti.bpmn.model.FormValue; //导入依赖的package包/类
protected void writeFormProperties(FlowElement flowElement, XMLStreamWriter xtw) throws Exception {
  
  List<FormProperty> propertyList = null;
  if (flowElement instanceof UserTask) {
    propertyList = ((UserTask) flowElement).getFormProperties();
  } else if (flowElement instanceof StartEvent) {
    propertyList = ((StartEvent) flowElement).getFormProperties();
  }
  
  if (propertyList != null) {
  
    for (FormProperty property : propertyList) {
      
      if (StringUtils.isNotEmpty(property.getId())) {
        
        if (didWriteExtensionStartElement == false) { 
          xtw.writeStartElement(ELEMENT_EXTENSIONS);
          didWriteExtensionStartElement = true;
        }
        
        xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_FORMPROPERTY, ACTIVITI_EXTENSIONS_NAMESPACE);
        writeDefaultAttribute(ATTRIBUTE_FORM_ID, property.getId(), xtw);
        
        writeDefaultAttribute(ATTRIBUTE_FORM_NAME, property.getName(), xtw);
        writeDefaultAttribute(ATTRIBUTE_FORM_TYPE, property.getType(), xtw);
        writeDefaultAttribute(ATTRIBUTE_FORM_EXPRESSION, property.getExpression(), xtw);
        writeDefaultAttribute(ATTRIBUTE_FORM_VARIABLE, property.getVariable(), xtw);
        writeDefaultAttribute(ATTRIBUTE_FORM_DEFAULT, property.getDefaultExpression(), xtw);
        writeDefaultAttribute(ATTRIBUTE_FORM_DATEPATTERN, property.getDatePattern(), xtw);
        if (property.isReadable() == false) {
          writeDefaultAttribute(ATTRIBUTE_FORM_READABLE, ATTRIBUTE_VALUE_FALSE, xtw);
        }
        if (property.isWriteable() == false) {
          writeDefaultAttribute(ATTRIBUTE_FORM_WRITABLE, ATTRIBUTE_VALUE_FALSE, xtw);
        }
        if (property.isRequired()) {
          writeDefaultAttribute(ATTRIBUTE_FORM_REQUIRED, ATTRIBUTE_VALUE_TRUE, xtw);
        }
        
        for (FormValue formValue : property.getFormValues()) {
          if (StringUtils.isNotEmpty(formValue.getId())) {
            xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_VALUE, ACTIVITI_EXTENSIONS_NAMESPACE);
            xtw.writeAttribute(ATTRIBUTE_ID, formValue.getId());
            xtw.writeAttribute(ATTRIBUTE_NAME, formValue.getName());
            xtw.writeEndElement();
          }
        }
        
        xtw.writeEndElement();
      }
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:54,代码来源:BaseBpmnXMLConverter.java

示例4: parseChildElement

import org.activiti.bpmn.model.FormValue; //导入依赖的package包/类
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
  
  if (parentElement instanceof UserTask == false && parentElement instanceof StartEvent == false) return;
  
  FormProperty property = new FormProperty();
  BpmnXMLUtil.addXMLLocation(property, xtr);
  property.setId(xtr.getAttributeValue(null, ATTRIBUTE_FORM_ID));
  property.setName(xtr.getAttributeValue(null, ATTRIBUTE_FORM_NAME));
  property.setType(xtr.getAttributeValue(null, ATTRIBUTE_FORM_TYPE));
  property.setVariable(xtr.getAttributeValue(null, ATTRIBUTE_FORM_VARIABLE));
  property.setExpression(xtr.getAttributeValue(null, ATTRIBUTE_FORM_EXPRESSION));
  property.setDefaultExpression(xtr.getAttributeValue(null, ATTRIBUTE_FORM_DEFAULT));
  property.setDatePattern(xtr.getAttributeValue(null, ATTRIBUTE_FORM_DATEPATTERN));
  if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_FORM_REQUIRED))) {
    property.setRequired(Boolean.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_FORM_REQUIRED)));
  }
  if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_FORM_READABLE))) {
    property.setReadable(Boolean.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_FORM_READABLE)));
  }
  if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_FORM_WRITABLE))) {
    property.setWriteable(Boolean.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_FORM_WRITABLE)));
  }
  
  boolean readyWithFormProperty = false;
  try {
    while (readyWithFormProperty == false && xtr.hasNext()) {
      xtr.next();
      if (xtr.isStartElement() && ELEMENT_VALUE.equalsIgnoreCase(xtr.getLocalName())) {
        FormValue value = new FormValue();
        BpmnXMLUtil.addXMLLocation(value, xtr);
        value.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID));
        value.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME));
        property.getFormValues().add(value);

      } else if (xtr.isEndElement() && getElementName().equalsIgnoreCase(xtr.getLocalName())) {
        readyWithFormProperty = true;
      }
    }
  } catch (Exception e) {
    LOGGER.warn("Error parsing form properties child elements", e);
  }
  
  if (parentElement instanceof UserTask) {
    ((UserTask) parentElement).getFormProperties().add(property);
  } else {
    ((StartEvent) parentElement).getFormProperties().add(property);
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:49,代码来源:FormPropertyParser.java


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