Package com.sogou.qadev.service.cynthia.vo

Examples of com.sogou.qadev.service.cynthia.vo.ScriptVO


  @ResponseBody
  public String initScript(@RequestParam("scriptId")String scriptId) throws Exception {
   
    DataAccessSession das = DataAccessFactory.getInstance().getSysDas();
    Script script = das.queryScriptNoImport(DataAccessFactory.getInstance().createUUID(scriptId));
    ScriptVO scriptVO = new ScriptVO();
    scriptVO.setId(script.getId().toString());
    scriptVO.setAfterFail(script.isAfterFail());
    scriptVO.setAfterQuery(script.isAfterQuery());
    scriptVO.setAfterSuccess(script.isAfterSuccess());
    scriptVO.setAsync(script.isAsync());
    scriptVO.setCreateTime(script.getCreateTime());
    scriptVO.setCreateUser(script.getCreateUser());
    scriptVO.setName(script.getName());
    scriptVO.setScript(script.getScript());
    scriptVO.setActionEdit(script.isActionEdit());
    scriptVO.setStatEdit(script.isStatEdit());
    scriptVO.setValid(script.isValid());
   
    UUID[] templateIds = script.getTemplateIds();
    Map<String,String> mountTemplatesMap = new HashMap<String,String>();
    if(templateIds!=null)
    { 
      for(UUID templateId : templateIds)
      {
        Template template = das.queryTemplate(templateId);
        if(template!=null)
          mountTemplatesMap.put(templateId.toString(), template.getName());
      }
    }
    Map<String,String> allTemplateMap = new HashMap<String,String>();
    Template[] allTemplates = das.queryAllTemplates();
    if(allTemplates!=null)
    {
      for(Template template: allTemplates)
      {
        allTemplateMap.put(template.getId().toString(), template.getName());
      }
    }
    scriptVO.setAllTemplates(allTemplateMap);
    scriptVO.setMountTemplates(mountTemplatesMap);
   
    UUID[] statIds = script.getEndStatIds();
    List<String> statIdsList = new ArrayList<String>();
    if(statIds != null)
    {
      for(UUID statId : statIds)
      {
        statIdsList.add(statId.toString());
      }
    }
    UUID[] actionIds = script.getActionIds();
    List<String> actionIdsList = new ArrayList<String>();
    if(actionIds != null)
    {
      for(UUID actionId : actionIds)
      {
        actionIdsList.add(actionId.toString());
      }
    }
   
    UUID[] allowedTemplateIds = script.getAllowedTemplateIds();
    List<String> allowedTemplateIdsList = new ArrayList<String>();
    if(allowedTemplateIds != null)
    {
      for(UUID allowedTemplateId : allowedTemplateIds)
      {
        allowedTemplateIdsList.add(allowedTemplateId.toString());
      }
    }
   
    scriptVO.setAllowedTemplates(allowedTemplateIdsList);
    scriptVO.setActionIds(actionIdsList);
    scriptVO.setStatIds(statIdsList);
   
    JsonConfig config = new JsonConfig()
        config.registerJsonValueProcessor(Timestamp.class, new DateJsonValueProcessor());
        JSONObject json = JSONObject.fromObject(scriptVO,config);
        return json.toString();
View Full Code Here

TOP

Related Classes of com.sogou.qadev.service.cynthia.vo.ScriptVO

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.