Esempio n. 1
0
 /**
  * (non-Javadoc)
  *
  * <p>Title:addFieldRow
  *
  * @param rowIndex
  * @param columnCount
  * @see com.sogou.qadev.service.cynthia.bean.Template#addFieldRow(int, int)
  */
 public void addFieldRow(int rowIndex, int columnCount) {
   FieldRow fieldRow = new FieldRow();
   for (int i = 0; i < columnCount; i++) {
     FieldColumn fieldColumn = new FieldColumn();
     fieldRow.addColumn(fieldColumn);
   }
   this.fieldRowList.add(rowIndex, fieldRow);
 }
Esempio n. 2
0
  /**
   * @description:init new template xml from node
   * @date:2014-5-6 下午4:36:46
   * @version:v1.0
   * @param node
   */
  protected void initTemplateXml(Node node) {
    try {
      org.w3c.dom.Node templateNode = XMLUtil.getSingleNode(node, "template");
      String idStr = XMLUtil.getSingleNode(templateNode, "id").getTextContent();
      UUID id = DataAccessFactory.getInstance().createUUID(idStr);
      String templateTypeIdStr =
          XMLUtil.getSingleNode(templateNode, "templateTypeId").getTextContent();
      UUID templateTypeId = DataAccessFactory.getInstance().createUUID(templateTypeIdStr);

      String name = XMLUtil.getSingleNode(templateNode, "name").getTextContent();

      this.id = id;
      this.templateTypeId = templateTypeId;
      this.name = name;
      this.description = XMLUtil.getSingleNodeTextContent(templateNode, "description");

      String flowIdStr = XMLUtil.getSingleNode(templateNode, "flowId").getTextContent();
      this.flowId = DataAccessFactory.getInstance().createUUID(flowIdStr);

      List<Node> rowNodes = XMLUtil.getNodes(templateNode, "layout/rows/row");
      for (Node rowNode : rowNodes) {
        List<Node> columnNodes = XMLUtil.getNodes(rowNode, "column");
        FieldRow fieldRow = new FieldRow();
        for (Node columnNode : columnNodes) {
          List<Node> fieldNodes = XMLUtil.getNodes(columnNode, "field");
          FieldColumn fieldColumn = new FieldColumn();
          for (Node fieldNode : fieldNodes) {
            Field tempField = initFieldNode(fieldNode);
            fieldColumn.addField(tempField);
            this.fieldSet.add(tempField);
          }
          fieldRow.addColumn(fieldColumn);
        }

        fieldRowList.add(fieldRow);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 3
0
  /**
   * (non-Javadoc)
   *
   * <p>Title:clone
   *
   * @return
   * @see java.lang.Object#clone()
   */
  public Template clone() {
    TemplateImpl templateImpl = new TemplateImpl(this.id, this.templateTypeId);

    templateImpl.flowId = this.flowId;
    templateImpl.name = this.name;
    templateImpl.description = this.description;

    templateImpl.fieldRowList = new ArrayList<FieldRow>();
    for (FieldRow fieldRow : fieldRowList) {
      FieldRow newFieldRow = new FieldRow();
      for (FieldColumn fieldColumn : fieldRow.getFieldColumns()) {
        FieldColumn newFieldColumn = new FieldColumn();
        for (Field field : fieldColumn.getFields()) {
          Field newField = field.clone();
          newFieldColumn.addField(newField);
          templateImpl.fieldSet.add(newField);
        }
        newFieldRow.addColumn(newFieldColumn);
      }
      templateImpl.fieldRowList.add(newFieldRow);
    }

    return templateImpl;
  }