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

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


      data.setLastModifyTime(colValueMap.get("lastModifyTime") == null ? null : Timestamp.valueOf(colValueMap.get("lastModifyTime")));
      data.setAssignUser(colValueMap.get("assignUser"));
      data.setStatusId(DataAccessFactory.getInstance().createUUID(colValueMap.get("statusId")));

      if (allTemplateMap.get(templateId) == null) {
        Template template = TemplateCache.getInstance().get(templateId);
        if (template != null) {
          allTemplateMap.put(templateId, template);
        }
      }

      Template template = allTemplateMap.get(templateId);

      for (String colName : colValueMap.keySet()) {
        Field validField = null;
        try {
          if (colName.startsWith("field") && colValueMap.get(colName) != null && colValueMap.get(colName).length() > 0) {

            String fieldIdStr = "";

            if (templateFieldNameCache == null ) {
              if (templateFieldNameMap.get(templateId) == null) {
                Map<String, String> fieldNameMap = new FieldNameAccessSessionMySQL().queryTemplateFieldMap(templateId.getValue());
                templateFieldNameMap.put(templateId, fieldNameMap);
              }
              fieldIdStr = templateFieldNameMap.get(templateId).get(colName);
            }else {
              fieldIdStr = templateFieldNameCache.get(colName);
            }

            UUID fieldId = DataAccessFactory.getInstance().createUUID(fieldIdStr);

            validField = template.getField(fieldId);

            if (validField == null) {
//              System.out.println("can not find field in assembleData ,fieldIdStr :" + fieldIdStr );
              continue;
            }
View Full Code Here


   * @param dataSaveDBMap
   * @return
   */
  public Map<String,String> getDataValueMap(Data data ,Map<String, String> dataSaveDBMap){

    Template template = TemplateCache.getInstance().get(data.getTemplateId());

    if(template == null){
      return null;
    }

    dataSaveDBMap.put("id", data.getId().getValue());
    dataSaveDBMap.put("templateId", template.getId().getValue());
    dataSaveDBMap.put("createUser", data.getCreateUsername());
    dataSaveDBMap.put("templateTypeId", template.getTemplateTypeId().getValue());
    dataSaveDBMap.put("title", data.getTitle());
    dataSaveDBMap.put("description", data.getDescription());
    dataSaveDBMap.put("createTime", data.getCreateTime().toString());
    dataSaveDBMap.put("lastModifyTime", data.getLastModifyTime().toString());
    dataSaveDBMap.put("assignUser", data.getAssignUsername());
    dataSaveDBMap.put("statusId", data.getStatusId().getValue());

    Set<Field> allFields = template.getFields();
    for(Field field : allFields){
      if (field == null) {
        continue;
      }
      String fieldValue = "";
      Type type = field.getType();

      DataType dataType = field.getDataType();

      if (type == Type.t_selection) {
        if (dataType == DataType.dt_single) {
          fieldValue = data.getSingleSelection(field.getId()) == null ? "" : data.getSingleSelection(field.getId()).getValue();
        }else {
          if (data.getMultiSelection(field.getId()) != null) {
            for (UUID uuid : data.getMultiSelection(field.getId())) {
              if (uuid == null) {
                continue;
              }
              fieldValue += "".equals(fieldValue) ?  uuid.getValue() : "," +  uuid.getValue();
            }
          }
        }
      }else if (type == Type.t_reference) {
        if (dataType == DataType.dt_single) {
          fieldValue = data.getSingleReference(field.getId()) == null ? "" : data.getSingleReference(field.getId()).getValue();
        }else {
          if (data.getMultiReference(field.getId()) != null) {
            for (UUID uuid : data.getMultiReference(field.getId())) {
              if (uuid == null) {
                continue;
              }
              fieldValue += "".equals(fieldValue) ?  uuid.getValue() : "," +   uuid.getValue();
            }
          }
        }
      }else if (type == Type.t_attachment) {
        if (data.getAttachments(field.getId()) != null) {
          for (UUID uuid : data.getAttachments(field.getId())) {
            if (uuid == null) {
              continue;
            }
            fieldValue += "".equals(fieldValue) ? uuid.getValue() : "," +  uuid.getValue();
          }
        }

      }else if (type == Type.t_input) {

        if (dataType.equals(DataType.dt_integer))
        {
          fieldValue = data.getInteger(field.getId()) == null ? null : data.getInteger(field.getId()).toString();
        }else if (dataType.equals(DataType.dt_double))
        {
          fieldValue = data.getDouble(field.getId()) == null ? null : data.getDouble(field.getId()).toString();
        }else if (dataType.equals(DataType.dt_float))
        {
          fieldValue = data.getFloat(field.getId()) == null ? null : data.getFloat(field.getId()).toString();
        }else if (dataType.equals(DataType.dt_long))
        {
          fieldValue = data.getLong(field.getId()) == null ? null : data.getLong(field.getId()).toString();
        }else if (dataType.equals(DataType.dt_string) || dataType.equals(DataType.dt_text) || dataType.equals(DataType.dt_editor))
        {
          fieldValue = data.getString(field.getId()) == null ? null : data.getString(field.getId()).toString();
        }else if(dataType.equals(DataType.dt_timestamp))
        {
          fieldValue = data.getDate(field.getId()) == null ? null : data.getDate(field.getId()).toTimestamp().toString();
        }
      }

      String fieldColName = FieldNameCache.getInstance().getFieldName(field.getId(),template.getId());
      if (fieldColName != null && fieldColName.length() > 0) {
        dataSaveDBMap.put(fieldColName, fieldValue);
      }
    }

View Full Code Here

    return result.toString();
  }
 
  public synchronized void addExtFields(UUID templateId, Map<String, CommonField> fieldMap, Map<String, Set<CommonOption>> fieldOptionMap, DataAccessSession das)
  {
    Template template = das.queryTemplate(templateId);
    if(template == null)
      return;

    Set<Field> fieldSet = template.getFields();
    if(fieldSet == null)
      return;

    for(Field field : fieldSet)
    {
View Full Code Here

    return null;
  }

  public String getDataStatus(Data data, DataAccessSession das)
  {
    Template template = das.queryTemplate(data.getTemplateId());
    if(template == null)
      return null;

    Flow flow = das.queryFlow(template.getFlowId());
    if(flow == null)
      return null;

    Stat stat = flow.getStat(data.getStatusId());
    if(stat == null)
View Full Code Here

    return stat.getName();
  }

  public UUID getDataTemplateTypeId(Data data, DataAccessSession das)
  {
    Template template = das.queryTemplate(data.getTemplateId());
    if(template == null)
      return null;

    return template.getTemplateTypeId();
  }
View Full Code Here

    {
      Data data = das.queryData(dataId);
      if(data == null)
        continue;

      Template template = das.queryTemplate(data.getTemplateId());
      if(template == null)
        continue;

      if(nodeStatusSet.contains(template.getId() + "|" + data.getStatusId()))
        continue;

      nodeStatusSet.add(template.getId() + "|" + data.getStatusId());

      Flow flow = das.queryFlow(template.getFlowId());
      if(flow == null)
        continue;
      boolean isEditAllow = flow.isEditActionAllow(das.getUsername(), template.getId(), data.getAssignUsername(), data.getActionUser());

      if(isEditAllow){//具有编辑权限的人可以批量修改状态
        Stat[] allStats = flow.getStats();
        allStatSet.addAll(Arrays.asList(allStats));
      }
View Full Code Here

    {
      Data data = das.queryData(dataId);
      if(data == null)
        continue;

      Template template = das.queryTemplate(data.getTemplateId());
      if(template == null)
        continue;

      if(nodeStatusSet.contains(template.getId() + "|" + data.getStatusId()))
        continue;

      nodeStatusSet.add(template.getId() + "|" + data.getStatusId());

      Flow flow = das.queryFlow(template.getFlowId());
      if(flow == null)
        continue;
      boolean isEditAllow = flow.isEditActionAllow(das.getUsername(), template.getId(), data.getAssignUsername(), data.getActionUser());
      Set<Action> actionSet = new LinkedHashSet<Action>();

      if(isEditAllow){//具有编辑权限的人可以批量关闭BUG add by lyl
        Action[] endActions = flow.getEndActions();
        for(int i=0;endActions!=null && i<endActions.length;i++){
          actionSet.add(endActions[i]);
        }
      }
      for(Action action : actionSet)
      {
        String actionName = action.getName();
        if(action.getBeginStatId() == null)
          actionName = "激活--" + actionName;

        actionUserMap.put(actionName, new LinkedHashSet<String>());

        String[] userArray = flow.queryNodeStatAssignUsers(template.getId(), action.getEndStatId());
        if(userArray != null)
          actionUserMap.get(actionName).addAll(Arrays.asList(userArray));
      }
    }
View Full Code Here

    {
      Data data = das.queryData(dataId);
      if(data == null)
        continue;

      Template template = das.queryTemplate(data.getTemplateId());
      if(template == null)
        continue;

      if(nodeStatusSet.contains(template.getId() + "|" + data.getStatusId()))
        continue;

      nodeStatusSet.add(template.getId() + "|" + data.getStatusId());

      Flow flow = das.queryFlow(template.getFlowId());
      if(flow == null)
        continue;

      boolean isEditAllow = flow.isEditActionAllow(das.getUsername(), template.getId(), data.getAssignUsername(), data.getActionUser());
      if(isEditAllow)
      {
        String[] assignUserArray = flow.queryNodeStatAssignUsers(template.getId(), data.getStatusId());
        if(assignUserArray != null)
        {
          if(!actionUserMap.containsKey("编辑"))
            actionUserMap.put("编辑", new LinkedHashSet<String>());

          actionUserMap.get("编辑").addAll(Arrays.asList(assignUserArray));
        }
      }

      Set<Action> actionSet = new LinkedHashSet<Action>();

      Action[] statActionArray = flow.queryStatActions(data.getStatusId());
      if(statActionArray == null || statActionArray.length == 0)
      {
        Action[] userNodeBeginActionArray = flow.queryUserNodeBeginActions(das.getUsername(), template.getId());
        for(int i = 0; userNodeBeginActionArray != null && i < userNodeBeginActionArray.length; i++)
          actionSet.add(userNodeBeginActionArray[i]);
      }
      else
      {
        Action[] userNodeStatActionArray = flow.queryUserNodeStatActions(das.getUsername(), template.getId(), data.getStatusId());
        for(int i = 0; userNodeStatActionArray != null && i < userNodeStatActionArray.length; i++)
          actionSet.add(userNodeStatActionArray[i]);
      }

      for(Action action : actionSet)
      {
        String actionName = action.getName();
        if(action.getBeginStatId() == null)
          actionName = "激活--" + actionName;

        actionUserMap.put(actionName, new LinkedHashSet<String>());

        String[] userArray = flow.queryNodeStatAssignUsers(template.getId(), action.getEndStatId());
        if(userArray != null)
          actionUserMap.get(actionName).addAll(Arrays.asList(userArray));
      }
    }
View Full Code Here

  {
    StringBuffer  returnXml = new StringBuffer();
    returnXml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>");

    UUID templateId = DataAccessFactory.getInstance().createUUID(templateIdStr);
    Template template = das.queryTemplate(templateId);
    Flow flow = das.queryFlow(template.getFlowId());
     
    Stat[] stats = flow.getStats();   //状态
    Set<Field> allFields = template.getFields();
   
    Timestamp startTimestamp = null;
    try {
      startTimestamp = new Timestamp(new SimpleDateFormat("yyyy-MM-dd").parse(java.sql.Date.valueOf(startTime).toLocaleString()).getTime());
    } catch (ParseException e) {
View Full Code Here

  {
    StringBuffer  returnXml = new StringBuffer();
    returnXml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>");

    UUID templateId = DataAccessFactory.getInstance().createUUID(templateIdStr);
    Template template = das.queryTemplate(templateId);
    Flow flow = das.queryFlow(template.getFlowId());
     
    Stat[] stats = flow.getStats();   //状态
    Set<Field> allFields = template.getFields();
   
    Timestamp startTimestamp = null;
    try {
      startTimestamp = new Timestamp(new SimpleDateFormat("yyyy-MM-dd").parse(java.sql.Date.valueOf(startTime).toLocaleString()).getTime());
    } catch (ParseException e) {
View Full Code Here

TOP

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

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.