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

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


  {
    Data data = queryData(dataId,templateId);
    if(data == null)
      return null;
   
    UUID newDataId = DataAccessFactory.getInstance().newUUID("DATA");
    newUUIDTable.put(newDataId, false);
   
    DataImpl newData = new DataImpl(newDataId, data.getTemplateId(), data.getCreateUsername(), data.getCreateTime());
   
    //set title
View Full Code Here


    // check
    boolean checkPrivilege = checkUserPrivilege(data, DataAccessAction.delete);
    if (!checkPrivilege)
      return ErrorCode.privilegeFail;

    UUID id = data.getId();
    DataAccessEntry<Data> entry = new DataAccessEntry<Data>();

    entry.setAction(DataAccessAction.delete);
    entry.setData(data);
View Full Code Here

   * @return
   * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#modifyData(com.sogou.qadev.service.cynthia.bean.Data)
   */
  public Pair<ErrorCode, String> modifyData(Data data)
  {
    UUID id = data.getId();
    DataAccessAction action = null;
   
    Template template = queryTemplate(data.getTemplateId());
    if(template == null)
      return new Pair<ErrorCode, String>(ErrorCode.noSuchTemplateFail, null);
View Full Code Here

    }
  }

  public synchronized Flow createFlow(String userName)
  {
    UUID flowId = DataAccessFactory.getInstance().newUUID("FLOW");
    Flow flow  = new FlowImpl(flowId);
    flow.setCreateUser(userName);
    return flow;
  }
View Full Code Here

  public synchronized Template createTemplate(UUID templateTypeId)
  {
    if(templateTypeId == null)
      return null;
   
    UUID templateId = DataAccessFactory.getInstance().newUUID("TEMP");
    Template template =  new TemplateImpl(templateId, templateTypeId);
    return template;
  }
View Full Code Here

    return errorCode;
  }
 
  public ErrorCode removeDataFromCache(Data data)
  {
    UUID id = data.getId();
    if(dataStatus.containsKey(id))
    {
      dataStatus.remove(id);
    }
    updateCache(DataAccessAction.delete, id.getValue(), data);
    return ErrorCode.success;
  }
View Full Code Here

   * @return
   * @see com.sogou.qadev.service.cynthia.service.ScriptAccessSession#createScript(java.lang.String)
   */
  public Script createScript(String createUser)
  {
    UUID scriptId = DataAccessFactory.getInstance().newUUID("SCRI");
    Timestamp createTime = new Timestamp(System.currentTimeMillis());
    return new ScriptImpl(scriptId,createUser,createTime);
  }
View Full Code Here

  {
    Field field = null;
    try
    {
      String fieldIdStr = XMLUtil.getSingleNode(fieldNode, "id").getTextContent();
      UUID fieldId = DataAccessFactory.getInstance().createUUID(fieldIdStr);

      String typeStr = XMLUtil.getSingleNode(fieldNode, "type").getTextContent();
      Type type = Type.valueOf(typeStr);

      DataType dataType = null;
      String dataTypeStr = XMLUtil.getSingleNode(fieldNode, "dataType").getTextContent();
      if (dataTypeStr.length() > 0)
        dataType = DataType.valueOf(dataTypeStr);

      field = new FieldImpl(fieldId, id, type, dataType);

      String fieldName = XMLUtil.getSingleNode(fieldNode, "name").getTextContent();
      field.setName(fieldName);

      String fieldDescription = XMLUtil.getSingleNode(fieldNode, "description").getTextContent();
      if (fieldDescription.length() > 0)
        field.setDescription(fieldDescription);

      String fieldTip = XMLUtil.getSingleNodeTextContent(fieldNode, "fieldTip");
      if(fieldTip!=null)
        field.setFieldTip(fieldTip);

      String fieldSize = XMLUtil.getSingleNodeTextContent(fieldNode, "fieldSize");
      if(fieldSize!=null)
        field.setFieldSize(fieldSize);

      String defaultValue = XMLUtil.getSingleNode(fieldNode, "defaultValue").getTextContent();
      if (defaultValue.length() > 0)
        field.setDefaultValue(defaultValue);

      String controlFieldIdStr = XMLUtil.getSingleNode(fieldNode, "controlFieldId").getTextContent();
      if (controlFieldIdStr.length() > 0)
        field.setControlFieldId(DataAccessFactory.getInstance().createUUID(controlFieldIdStr));


      //////////////////////////////////////////////////////////////////////////////////////////////////////////////
      try {
        Node controlHiddenFieldIdNode = XMLUtil.getSingleNode(fieldNode, "controlHiddenFieldId");
        String controlHiddenFieldIdStr = "";
        if (controlHiddenFieldIdNode != null) {
          controlHiddenFieldIdStr = controlHiddenFieldIdNode.getTextContent();
        }
        if (controlHiddenFieldIdStr.length() > 0) {
          field.setControlHiddenFieldId(DataAccessFactory.getInstance().createUUID(controlHiddenFieldIdStr));
        }

        Set<UUID> controlHiddenFieldsSet = new LinkedHashSet<UUID>();
        List<Node> controlHiddenFieldsList = XMLUtil.getNodes(fieldNode, "controlHiddenFields/controlHiddenField");
        if (controlHiddenFieldsList != null && controlHiddenFieldsList.size() > 0) {
          for (Node controlHiddenFieldNode : controlHiddenFieldsList) {
            UUID controlHiddenFieldId = DataAccessFactory.getInstance().createUUID(controlHiddenFieldNode.getTextContent());
            controlHiddenFieldsSet.add(controlHiddenFieldId);
          }
          field.setControlHiddenFieldsIds(controlHiddenFieldsSet);
        }


        Set<UUID> controlHiddenStatesSet = new LinkedHashSet<UUID>();
        List<Node> controlHiddenStatesList = XMLUtil.getNodes(fieldNode, "controlHiddenStates/controlHiddenState");
        if(controlHiddenStatesList != null && controlHiddenStatesList.size() > 0 ){
          for (Node controlHiddenStateNode : controlHiddenStatesList) {
            UUID controlHiddenStateId = DataAccessFactory.getInstance().createUUID(controlHiddenStateNode.getTextContent());
            controlHiddenStatesSet.add(controlHiddenStateId);
          }
          field.setControlHiddenStatesIds(controlHiddenStatesSet);
        }
      } catch (Exception e) {
        e.printStackTrace();
        System.err.println("init 表单出错");
      }
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////


      Set<Option> optionSet = new LinkedHashSet<Option>();

      List<Node> optionNodeList = XMLUtil.getNodes(fieldNode, "options/option");
      for (Node optionNode : optionNodeList)
      {
        String optionIdStr = XMLUtil.getSingleNode(optionNode, "id").getTextContent();
        UUID optionId = DataAccessFactory.getInstance().createUUID(optionIdStr);

        OptionImpl optionImpl = new OptionImpl(optionId, fieldId);

        String optionName = XMLUtil.getSingleNode(optionNode, "name").getTextContent();
        optionImpl.setName(optionName);

        String optionDescription = XMLUtil.getSingleNode(optionNode, "description").getTextContent();
        if (optionDescription.length() > 0)
          optionImpl.setDescription(optionDescription);

        String controlOptionIdStr = XMLUtil.getSingleNode(optionNode, "controlOptionId").getTextContent();
        if (controlOptionIdStr.length() > 0)
          optionImpl.setControlOptionId(DataAccessFactory.getInstance().createUUID(controlOptionIdStr));

        String forbiddenStr = XMLUtil.getSingleNode(optionNode, "forbidden").getTextContent();
        Forbidden forbidden = Forbidden.valueOf(forbiddenStr);
        optionImpl.setForbidden(forbidden);

        String indexOrderStr = XMLUtil.getSingleNode(optionNode, "indexOrder").getTextContent();
        int indexOrder = Integer.parseInt(indexOrderStr);
        optionImpl.setIndexOrder(indexOrder);

        optionSet.add(optionImpl);
      }

      field.setOptions(optionSet);

      Set<UUID> controlOptionIdSet = new LinkedHashSet<UUID>();

      List<Node> controlOptionIdNodeList = XMLUtil.getNodes(fieldNode, "controlOptionIds/controlOptionId");
      for (Node controlOptionIdNode : controlOptionIdNodeList)
      {
        UUID controlOptionId = DataAccessFactory.getInstance().createUUID(controlOptionIdNode.getTextContent());
        controlOptionIdSet.add(controlOptionId);
      }

      field.setControlOptionIds(controlOptionIdSet);
View Full Code Here

  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;
View Full Code Here

   * @return
   * @see com.sogou.qadev.service.cynthia.bean.Template#addField(com.sogou.qadev.service.cynthia.bean.Field.Type, com.sogou.qadev.service.cynthia.bean.Field.DataType)
   */
  public Field addField(Type type, DataType dataType)
  {
    UUID fieldId = DataAccessFactory.getInstance().newUUID("FIEL");
    Field field = new FieldImpl(fieldId, this.id, type, dataType);
    this.fieldSet.add(field);
    return field;
  }
View Full Code Here

TOP

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

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.