Package com.sogou.qadev.service.cynthia.bean

Examples of com.sogou.qadev.service.cynthia.bean.Field


    {
      String fieldIdStr = XMLUtil.getAttribute(fieldNode, "id");
      if(CommonUtil.isPosNum(fieldIdStr))
      {
        UUID fieldId = DataAccessFactory.getInstance().createUUID(fieldIdStr);
        Field field = null;
        if (template == null) {
          field = TemplateCache.getInstance().queryField(fieldId);
        }else {
          field = template.getField(fieldId);
        }
        if(field != null)
          set.add(field.getName());
      }else{
        String fieldName = ConfigUtil.baseFieldNameMap.get(fieldIdStr);
        if(fieldName != null)
          set.add(fieldName);
      }
View Full Code Here


      {
        String fieldIdStr = XMLUtil.getAttribute(fieldNode, "id");
        if(CommonUtil.isPosNum(fieldIdStr))
        {
          UUID fieldId = DataAccessFactory.getInstance().createUUID(fieldIdStr);
          Field field = null;
          if (template == null) {
            field = TemplateCache.getInstance().queryField(fieldId);
          }else {
            field = template.getField(fieldId);
          }
          if(field != null)
            displayFieldsSet.add(field.getName());
        }else{
          String fieldName = ConfigUtil.baseFieldNameMap.get(fieldIdStr);
          if(fieldName != null)
            displayFieldsSet.add(fieldName);
        }
View Full Code Here

      }else {
        if(isSysFilter && "修改优先级".equals( fieldName )){
          fieldShowName = "priority";
        }
       
        Field field = template.getField(fieldName);
       
        if (field != null) {
          if (fieldShowName == null || fieldShowName == "") {
            fieldShowName = "FIEL-" + field.getId().getValue();
          }
         
          if(field.getType().equals(Type.t_selection))
          {
            if(field.getDataType().equals(DataType.dt_single))
            {
              UUID optionId = task.getSingleSelection(field.getId());
              if(optionId != null)
              {
                Option option = field.getOption(optionId);
                if(option != null)
                  fieldShowValue =  option.getName();
              }
            }
            else
            {
              UUID[] optionIdArray = task.getMultiSelection(field.getId());
              if(optionIdArray != null && optionIdArray.length > 0)
              {
                StringBuffer valueStrb = new StringBuffer();
                for(UUID optionId : optionIdArray)
                {
                  Option option = field.getOption(optionId);
                  if(option != null)
                  {
                    if(valueStrb.length() > 0)
                      valueStrb.append(",");
                   
                    valueStrb.append("[").append(option.getName()).append("]");
                  }
                }
               
                if(valueStrb.length() > 0)
                  fieldShowValue =  valueStrb.toString();
              }
            }
          }
          else if(field.getType().equals(Type.t_reference))
          {
            if(field.getDataType().equals(DataType.dt_single))
            {
             
              UUID dataId = task.getSingleReference(field.getId());
             
              if(dataId != null)
              {
                String[] titles = new DataAccessSessionMySQL().queryFieldByIds(new UUID[]{dataId} , "title" , null);
                if (titles != null && titles.length > 0) {
                  fieldShowValue =  titles[0];
                }
              }
            }
            else
            {
              UUID[] dataIdArray = task.getMultiReference(field.getId());
              StringBuffer valueStrb = new StringBuffer();
              if(dataIdArray != null && dataIdArray.length > 0){
                String[] titles = new DataAccessSessionMySQL().queryFieldByIds(dataIdArray, "title" , null);
                for(String title : titles){
                  if(valueStrb.length() > 0)
                      valueStrb.append(",");
                  valueStrb.append("[").append(title).append("]");
                }
              }
              if(valueStrb.length() > 0)
                fieldShowValue =  valueStrb.toString();
            }
          }
          else if(field.getType().equals(Type.t_attachment))
          {
            UUID[] attachmentIdArray = task.getAttachments(field.getId());
            if(attachmentIdArray != null && attachmentIdArray.length > 0)
            {
              StringBuffer valueStrb = new StringBuffer();
              Map<String, String> attachMap = new AttachmentAccessSessionMySQL().queryAttachmentIdNames(attachmentIdArray);
             
              for(String id : attachMap.keySet()){
                if(valueStrb.length() > 0)
                  valueStrb.append(",");
                String attachName = attachMap.get(id);
                if (CynthiaUtil.isPicture(attachName)) {  //如果是图片则加上连接
                  valueStrb.append("[").append("<a href = \"").append(ConfigUtil.getCynthiaWebRoot() + "attachment/image.jsp?fileId=" + id).append("\" target=\"_blank\">").append(attachMap.get(id)).append("</a>").append("]");
                }else {
                  valueStrb.append("[").append("<a href = \"").append(ConfigUtil.getCynthiaWebRoot() + "attachment/download.jsp?method=download&id=" + id).append("\" target=\"blank\">").append(attachMap.get(id)).append("</a>").append("]");
                }
              }
             
              if(valueStrb.length() > 0)
                fieldShowValue = valueStrb.toString();
            }
          }
          else if(field.getType().equals(Type.t_input))
          {
            if(field.getDataType().equals(DataType.dt_integer))
            {
              Integer valueTmp = task.getInteger(field.getId());
              if(valueTmp == null){
                valueTmp = Integer.MIN_VALUE;
              }
             
              fieldShowValue =  valueTmp.toString();
            }
            else if(field.getDataType().equals(DataType.dt_long))
            {
              Long valueTmp = task.getLong(field.getId());
              if(valueTmp == null){
                valueTmp = Long.MIN_VALUE;
              }
             
              fieldShowValue =  valueTmp.toString();
            }
            else if(field.getDataType().equals(DataType.dt_float))
            {
              Float valueTmp = task.getFloat(field.getId());
              if(valueTmp == null){
                valueTmp = Float.MIN_VALUE;
              }
             
              fieldShowValue =  valueTmp.toString();
            }
            else if(field.getDataType().equals(DataType.dt_double))
            {
              Double valueTmp = task.getDouble(field.getId());
              if(valueTmp == null){
                valueTmp = Double.MIN_VALUE;
              }
             
              fieldShowValue =  valueTmp.toString();
            }
            else if(field.getDataType().equals(DataType.dt_string) || field.getDataType().equals(DataType.dt_text))
            {
              String valueTmp = task.getString(field.getId());
              if(valueTmp != null)
                fieldShowValue =  valueTmp;
            }
            else if(field.getDataType().equals(DataType.dt_timestamp))
            {
              Date valueTmp = task.getDate(field.getId());
              if(valueTmp != null)
                fieldShowValue = valueTmp.toString();
            }
          }
       
View Full Code Here

        List<UserInfo> allUsers = flow.queryAllUserInfo();
        for (UserInfo userInfo : allUsers) {
          allFieldSet.add(new StatisticField(userInfo.getUserName(), userInfo.getNickName()));
       }
    }else {
      Field field = template.getField(DataAccessFactory.getInstance().createUUID(fieldIdStr));
      if(field != null){
        for (Option option : field.getOptions()) {
          if (option != null && option.getForbidden().equals(Forbidden.f_permit)) {
            allFieldSet.add(new StatisticField(option.getId().getValue(), option.getName()));
          }
        }
      }
View Full Code Here

      name += ":指派人";
    }else if (fieldIdStr.equals("statusId")) {
      name += ":状态";
    }else if (CommonUtil.isPosNum(fieldIdStr)) {
      //表单字段
      Field field = template.getField(DataAccessFactory.getInstance().createUUID(fieldIdStr));
      if (field == null) {
        return "";
      }
      name += ":"+field.getName();
    }
    
     Map<String, String> dataMap = getTemplateFieldStatistic(template, flow, fieldIdStr, startTimestamp, endTimestamp, statisticOption);
    
     Map<String, Object> resultMap = new HashMap<String, Object>();
View Full Code Here

        fieldNameMap.put(stat.getId().getValue(), stat.getName());
      }
    }else if (CommonUtil.isPosNum(fieldId)) {
      //表单字段
      dbColName = FieldNameCache.getInstance().getFieldName(fieldId, template.getId().getValue());
      Field field = template.getField(DataAccessFactory.getInstance().createUUID(fieldId));
      if (field == null) {
        return resultMap;
      }
      for (Option option : field.getOptions()) {
        if (option != null && option.getForbidden().equals(Forbidden.f_permit)) {
          fieldNameMap.put(option.getId().getValue(), option.getName());
        }
      }
    }
View Full Code Here

          UUID curOptionId = data.getSingleSelection(field.getId());
         
          Option curOption = field.getOption(curOptionId);
         
          if (curOption == null || !curOption.getControlOptionId().getValue().equals(controlOptionId.getValue())) {
            Field controlField = template.getField(controlFieldId);
            return controlField.getName() + "选项下没有" + field.getName() + "值!";
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

   */
  private Set<Field> GetAllFields(Template template) {
    Set<Field> allFields = template.getFields();
    Iterator<Field> iter = allFields.iterator();
    while(iter.hasNext()){
      Field field = iter.next();
      if (field.getName().indexOf("废弃")!=-1) {
        iter.remove();
      }
    }
    return allFields;
  }
View Full Code Here

      if (fieldDataNodeList.size() == 0){
        continue;
      }

      UUID fieldId = dataAccessFactory.createUUID(XMLUtil.getSingleNodeTextContent(fieldNode, "id"));
      Field field = template.getField(fieldId);
      if(field == null){
        continue;
      }

      if(field.getType().equals(Type.t_selection)){
        if(field.getDataType().equals(DataType.dt_single)){
          this.setSingleSelection(fieldId, dataAccessFactory.createUUID(fieldDataNodeList.get(0).getTextContent()));
        }
        else if(field.getDataType().equals(DataType.dt_multiple)){
          Set<UUID> fieldDataSet = new LinkedHashSet<UUID>();

          for(Node fieldDataNode : fieldDataNodeList){
            fieldDataSet.add(dataAccessFactory.createUUID(fieldDataNode.getTextContent()));
          }

          this.setMultiSelection(fieldId, fieldDataSet.toArray(new UUID[fieldDataSet.size()]));
        }
      }
      else if(field.getType().equals(Type.t_reference)){
        if (field.getDataType().equals(DataType.dt_single)){
          this.setSingleReference(fieldId, dataAccessFactory.createUUID(fieldDataNodeList.get(0).getTextContent()));
        }
        else if(field.getDataType().equals(DataType.dt_multiple)){
          Set<UUID> fieldDataSet = new LinkedHashSet<UUID>();

          for(Node fieldDataNode : fieldDataNodeList){
            fieldDataSet.add(dataAccessFactory.createUUID(fieldDataNode.getTextContent()));
          }

          this.setMultiReference(fieldId, fieldDataSet.toArray(new UUID[fieldDataSet.size()]));
        }
      }
      else if(field.getType().equals(Type.t_attachment)){
        Set<UUID> fieldDataSet = new LinkedHashSet<UUID>();

        for(Node fieldDataNode : fieldDataNodeList){
          fieldDataSet.add(dataAccessFactory.createUUID(fieldDataNode.getTextContent()));
        }

        this.setAttachments(fieldId, fieldDataSet.toArray(new UUID[fieldDataSet.size()]));
      }
      else if(field.getType().equals(Type.t_input)){
        String fieldData = fieldDataNodeList.get(0).getTextContent();
        if(fieldData != null){
          if(field.getDataType().equals(DataType.dt_integer)){
            this.setInteger(fieldId, Integer.valueOf(fieldData));
          }
          else if(field.getDataType().equals(DataType.dt_double)){
            this.setDouble(fieldId, Double.valueOf(fieldData));
          }
          else if(field.getDataType().equals(DataType.dt_float)){
            this.setFloat(fieldId, Float.valueOf(fieldData));
          }
          else if(field.getDataType().equals(DataType.dt_long)){
            this.setLong(fieldId, Long.valueOf(fieldData));
          }
          else if(field.getDataType().equals(DataType.dt_timestamp)){
            this.setDate(fieldId, Date.valueOf(fieldData));
          }
          else if(field.getDataType().equals(DataType.dt_string) || field.getDataType().equals(DataType.dt_text)){
            this.setString(fieldId, fieldData);
          }
        }
      }
    }

    List<Node> logNodeList = XMLUtil.getNodes(taskNode, "logs/log");
    for(Node logNode : logNodeList){
      String logCreateUser = XMLUtil.getSingleNodeTextContent(logNode, "createUser");
      if(logCreateUser.equals("script@sogou-inc.com")){
        continue;
      }

      Timestamp logCreateTime = Timestamp.valueOf(XMLUtil.getSingleNodeTextContent(logNode, "createTime"));

      UUID actionId = null;
      String actionIdStr = XMLUtil.getSingleNodeTextContent(logNode, "actionId");
      if(actionIdStr != null){
        actionId = DataAccessFactory.getInstance().createUUID(actionIdStr);
      }

      String actionComment = XMLUtil.getSingleNodeTextContent(logNode, "actionComment");

      Map<String, Pair<Object, Object>> baseValueMap = new LinkedHashMap<String, Pair<Object, Object>>();

      List<Node> baseValueNodeList = XMLUtil.getNodes(logNode, "baseValues/baseValue");
      for(Node baseValueNode : baseValueNodeList){
        String base = XMLUtil.getSingleNodeTextContent(baseValueNode, "base");
        String previous = XMLUtil.getSingleNodeTextContent(baseValueNode, "previous");
        String current = XMLUtil.getSingleNodeTextContent(baseValueNode, "current");

        Pair<Object, Object> value = new Pair<Object, Object>();

        if(base.equals("id") || base.equals("statusId")){
          if(previous != null){
            value.setFirst(DataAccessFactory.getInstance().createUUID(previous));
          }

          if(current != null){
            value.setSecond(DataAccessFactory.getInstance().createUUID(current));
          }
        }
        else if(base.equals("createTime") || base.equals("lastModifyTime")){
          if(previous != null){
            value.setFirst(Timestamp.valueOf(previous));
          }

          if(current != null){
            value.setSecond(Timestamp.valueOf(current));
          }
        }
        else{
          value.setFirst(previous);
          value.setSecond(current);
        }

        baseValueMap.put(base, value);
      }

      Map<UUID, Pair<Object, Object>> extValueMap = new LinkedHashMap<UUID, Pair<Object, Object>>();

      List<Node> extValueNodeList = XMLUtil.getNodes(logNode, "extValues/extValue");
      for(Node extValueNode : extValueNodeList){
        UUID ext = DataAccessFactory.getInstance().createUUID(XMLUtil.getSingleNodeTextContent(extValueNode, "ext"));
        String previous = XMLUtil.getSingleNodeTextContent(extValueNode, "previous");
        String current = XMLUtil.getSingleNodeTextContent(extValueNode, "current");

        Field field = template.getField(ext);
        if(field == null){
          continue;
        }

        Pair<Object, Object> value = new Pair<Object, Object>();

        if(field.getType().equals(Type.t_selection) || field.getType().equals(Type.t_reference) || field.getType().equals(Type.t_attachment)){
          if(field.getDataType() != null && field.getDataType().equals(DataType.dt_single)){
            if(previous != null){
              value.setFirst(DataAccessFactory.getInstance().createUUID(previous));
            }

            if(current != null){
              value.setSecond(DataAccessFactory.getInstance().createUUID(current));
            }
          }
          else if(field.getDataType() == null || field.getDataType().equals(DataType.dt_multiple)){
            if(previous != null){
              String[] previousElemArray = previous.split("\\,");
              UUID[] previousElemIdArray = new UUID[previousElemArray.length];
              for(int i = 0; i < previousElemArray.length; i++){
                previousElemIdArray[i] = DataAccessFactory.getInstance().createUUID(previousElemArray[i]);
              }

              value.setFirst(previousElemIdArray);
            }

            if(current != null){
              String[] currentElemArray = current.split("\\,");
              UUID[] currentElemIdArray = new UUID[currentElemArray.length];
              for(int i = 0; i < currentElemArray.length; i++){
                currentElemIdArray[i] = DataAccessFactory.getInstance().createUUID(currentElemArray[i]);
              }

              value.setSecond(currentElemIdArray);
            }
          }
        }
        else if(field.getType().equals(Type.t_input)){
          if(field.getDataType().equals(DataType.dt_integer)){
            if(previous != null){
              value.setFirst(Integer.valueOf(previous));
            }

            if(current != null){
              value.setSecond(Integer.valueOf(current));
            }
          }

          if(field.getDataType().equals(DataType.dt_long)){
            if(previous != null){
              value.setFirst(Long.valueOf(previous));
            }

            if(current != null){
              value.setSecond(Long.valueOf(current));
            }
          }

          if(field.getDataType().equals(DataType.dt_float)){
            if(previous != null){
              value.setFirst(Float.valueOf(previous));
            }

            if(current != null){
              value.setSecond(Float.valueOf(current));
            }
          }

          if(field.getDataType().equals(DataType.dt_double)){
            if(previous != null){
              value.setFirst(Double.valueOf(previous));
            }

            if(current != null){
              value.setSecond(Double.valueOf(current));
            }
          }

          if(field.getDataType().equals(DataType.dt_timestamp)){
            if(previous != null){
              value.setFirst(Date.valueOf(previous));
            }

            if(current != null){
              value.setSecond(Date.valueOf(current));
            }
          }

          if(field.getDataType().equals(DataType.dt_string) || field.getDataType().equals(DataType.dt_text)){
            value.setFirst(previous);
            value.setSecond(current);
          }
        }
View Full Code Here

      Template template = TemplateCache.getInstance().get(this.getTemplateId());
      if(template != null)
      {
        for(UUID validFieldId : this.getValidFieldIds())
        {
          Field validField = template.getField(validFieldId);
          if(validField != null)
            validFieldSet.add(validField);
        }
      }
    }

    if(validFieldSet.size() == 0)
      xmlb.append("<fields/>");
    else
    {
      xmlb.append("<fields>");

      for (Field validField : validFieldSet)
      {
        xmlb.append("<field>");
        xmlb.append("<id>").append(validField.getId()).append("</id>");

        if (validField.getType().equals(Type.t_selection))
        {
          if (validField.getDataType().equals(DataType.dt_single))
          {
            UUID fieldData = this.getSingleSelection(validField.getId());
            if (fieldData != null)
              xmlb.append("<data>").append(fieldData).append("</data>");
          }
          else if (validField.getDataType().equals(DataType.dt_multiple))
          {
            UUID[] fieldDataArray = this.getMultiSelection(validField.getId());
            if (fieldDataArray != null)
            {
              for (UUID fieldData : fieldDataArray)
                xmlb.append("<data>").append(fieldData).append("</data>");
            }
          }
        }
        else if (validField.getType().equals(Type.t_reference))
        {
          if (validField.getDataType().equals(DataType.dt_single))
          {
            UUID fieldData = this.getSingleReference(validField.getId());
            if (fieldData != null)
              xmlb.append("<data>").append(fieldData).append("</data>");
          }
          else if (validField.getDataType().equals(DataType.dt_multiple))
          {
            UUID[] fieldDataArray = this.getMultiReference(validField.getId());
            if (fieldDataArray != null)
            {
              for (UUID fieldData : fieldDataArray)
                xmlb.append("<data>").append(fieldData).append("</data>");
            }
          }
        }
        else if (validField.getType().equals(Type.t_input))
        {
          if (validField.getDataType().equals(DataType.dt_integer))
          {
            if(this.getInteger(validField.getId()) != null)
              xmlb.append("<data>").append(this.getInteger(validField.getId())).append("</data>");
          }
          else if (validField.getDataType().equals(DataType.dt_double))
          {
            if(this.getDouble(validField.getId()) != null)
              xmlb.append("<data>").append(this.getDouble(validField.getId())).append("</data>");
          }
          else if (validField.getDataType().equals(DataType.dt_float))
          {
            if(this.getFloat(validField.getId()) != null)
              xmlb.append("<data>").append(this.getFloat(validField.getId())).append("</data>");
          }
          else if (validField.getDataType().equals(DataType.dt_long))
          {
            if(this.getLong(validField.getId()) != null)
              xmlb.append("<data>").append(this.getLong(validField.getId())).append("</data>");
          }
          else if (validField.getDataType().equals(DataType.dt_string) || validField.getDataType().equals(DataType.dt_text) || validField.getDataType().equals(DataType.dt_editor))
          {
            if(this.getString(validField.getId()) != null)
              xmlb.append("<data>").append(XMLUtil.toSafeXMLString(this.getString(validField.getId()))).append("</data>");
          }
          else if(validField.getDataType().equals(DataType.dt_timestamp))
          {
            if(this.getDate(validField.getId()) != null)
              xmlb.append("<data>").append(this.getDate(validField.getId()) == null ?"":this.getDate(validField.getId()).toTimestamp()).append("</data>");
          }
        }
        else if (validField.getType().equals(Type.t_attachment))
        {
          UUID[] fieldDataArray = this.getAttachments(validField.getId());
          if (fieldDataArray != null)
          {
            for (UUID fieldData : fieldDataArray)
              xmlb.append("<data>").append(fieldData).append("</data>");
          }
View Full Code Here

TOP

Related Classes of com.sogou.qadev.service.cynthia.bean.Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.