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

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


    Set<String> nodeStatusSet = new HashSet<String>();

    for(UUID dataId : dataIdArray)
    {
      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++){
View Full Code Here


    Set<String> nodeStatusSet = new HashSet<String>();

    for(UUID dataId : dataIdArray)
    {
      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)
View Full Code Here

    UUID[] taskReferUUIDArray = taskData.getMultiReference(multiReferField.getId());
    if(taskReferUUIDArray == null || taskReferUUIDArray.length == 0)
      return resultMap;
   
    for (UUID uuid : taskReferUUIDArray) {
      Data data = das.queryData(uuid);
      if (data!=null) {
        bugTemplate = das.queryTemplate(data.getTemplateId());
      }
      if (bugTemplate != null) {
        break;
      }
    }
View Full Code Here

   * @param logContent
   * @return
   * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateDataLog(com.sogou.qadev.service.cynthia.bean.UUID, int, java.lang.String)
   */
  public boolean updateDataLog(UUID dataId, int logIndex, String logContent){
    Data data = queryData(dataId);
    if (data == null) {
      return false;
    }
    try {
      ChangeLog changeLog = data.getChangeLogs()[logIndex-1];
      changeLog.setActionComment(logContent);
      updateCache(DataAccessAction.update, dataId.getValue(), data);
      return new LogAccessSessionMySQL().updateLogComment(dataId, data.getTemplateId(), logIndex, logContent);
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
  }
View Full Code Here

    }
  }

  public String getDataFieldValue(UUID dataId, UUID templateId, UUID fieldId, DataAccessSession das)
  {
    Data data = das.queryData(dataId,templateId);
    if(data == null)
      return null;

    Field field = das.queryField(fieldId , data.getTemplateId());
    if(field == null)
      return null;

    if(field.getType().equals(Field.Type.t_selection))
    {
      if(field.getDataType().equals(Field.DataType.dt_single))
      {
        UUID optionId = data.getSingleSelection(fieldId);
        if(optionId == null)
          return null;

        Option option = field.getOption(optionId);
        if(option != null)
          return "[" + option.getName() + "]";
      }
      else if(field.getDataType().equals(Field.DataType.dt_multiple))
      {
        UUID[] optionIdArray = data.getMultiSelection(fieldId);
        if(optionIdArray == null || optionIdArray.length == 0)
          return null;

        StringBuffer valueStrb = new StringBuffer();
        for(UUID optionId : optionIdArray)
        {
          Option option = field.getOption(optionId);
          if(option == null)
            continue;

          if(valueStrb.length() > 0)
            valueStrb.append(",");

          valueStrb.append("[").append(option.getName()).append("]");
        }

        return valueStrb.toString();
      }
    }
    else if(field.getType().equals(Field.Type.t_reference))
    {
      if(field.getDataType().equals(Field.DataType.dt_single))
      {
        UUID referenceId = data.getSingleReference(fieldId);
        if(referenceId == null)
          return null;

        String[] referTitleArray = new DataAccessSessionMySQL().queryFieldByIds(new UUID[]{referenceId}, "title", templateId);
        if(referTitleArray != null && referTitleArray.length > 0)
          return "[" + referTitleArray[0] + "]";
      }
      else if(field.getDataType().equals(Field.DataType.dt_multiple))
      {
        UUID[] referenceIdArray = data.getMultiReference(fieldId);
        if(referenceIdArray == null || referenceIdArray.length == 0)
          return null;

        StringBuffer valueStrb = new StringBuffer();
        String[] referTitleArray = new DataAccessSessionMySQL().queryFieldByIds(referenceIdArray, "title", templateId);

        for(String title : referTitleArray)
        {
          if(title == null)
            continue;
          if(valueStrb.length() > 0)
            valueStrb.append(",");
          valueStrb.append("[").append(title).append("]");
        }

        return valueStrb.toString();
      }
    }
    else if(field.getType().equals(Field.Type.t_attachment))
    {
      UUID[] attachmentIdArray = data.getAttachments(fieldId);
      if(attachmentIdArray == null || attachmentIdArray.length == 0)
        return null;

      StringBuffer valueStrb = new StringBuffer();

      Attachment[] attachmentArray = das.queryAttachments(attachmentIdArray, false);
      for(Attachment attachment : attachmentArray)
      {
        if(valueStrb.length() > 0)
          valueStrb.append(",");

        valueStrb.append("[").append(attachment.getName()).append("]");
      }

      return valueStrb.toString();
    }
    else if(field.getType().equals(Field.Type.t_input))
    {
      Object value = null;

      if(field.getDataType().equals(Field.DataType.dt_integer))
        value = data.getInteger(fieldId);
      else if(field.getDataType().equals(Field.DataType.dt_long))
        value = data.getLong(fieldId);
      else if(field.getDataType().equals(Field.DataType.dt_float))
        value = data.getFloat(fieldId);
      else if(field.getDataType().equals(Field.DataType.dt_double))
        value = data.getDouble(fieldId);
      else if(field.getDataType().equals(Field.DataType.dt_string) || field.getDataType().equals(Field.DataType.dt_text))
        value = data.getString(fieldId);
      else if(field.getDataType().equals(Field.DataType.dt_timestamp))
        value = data.getDate(fieldId);

      if(value != null)
        return value.toString();
    }
View Full Code Here

TOP

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

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.