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

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


   
    String filterIdStr = request.getParameter("filterId");
    UUID filterId = DataAccessFactory.getInstance().createUUID(filterIdStr);
    DataAccessSession das = DataAccessFactory.getInstance().getSysDas();

    Filter filter = das.queryFilter(filterId);
   
    FilterField groupField = null;
    List<FilterField> showList = new ArrayList<FilterField>();
    List<FilterField> backList = new ArrayList<FilterField>();
    List<String> showFieldId = new ArrayList<String>();
   
    if(filter == null)
      return "";
   
    try {
      Document filterXmlDoc = XMLUtil.string2Document(filter.getXml(), "UTF-8");
     
      if (FilterQueryManager.isSysFilter(filter.getId().getValue())) {
        //系统过滤器
        List<Node> displayFieldNodes = XMLUtil.getNodes(filterXmlDoc, "query/templateType/display/field");
        showList.add(new FilterField("id", "编号"));
        showFieldId.add("id");
        for (Node node : displayFieldNodes) {
View Full Code Here


  @ResponseBody
  public String getFilterXml(HttpServletRequest request, HttpServletResponse response ,HttpSession session) throws Exception {
   
    Key key = (Key)session.getAttribute("key");
    String filterId = request.getParameter("filterId");
    Filter filter = das.queryFilter(DataAccessFactory.getInstance().createUUID(filterId));
    if (filter == null) {
      return "";
    }
    else {
      if(filter.getCreateUser().equals("admin@sohu-rd.com"))
         {
           Document filterDoc = XMLUtil.string2Document(filter.getXml(), "UTF-8");

           Node envNode = XMLUtil.getSingleNode(filterDoc, "query/env");

           XMLUtil.getSingleNode(envNode, "current_user").setTextContent(key.getUsername());

           UserInfo userInfo = das.queryUserInfoByUserName(key.getUsername());
           if (userInfo != null) {
             Node userListNode = filterDoc.createElement("user_list");
             userListNode.setTextContent(userInfo.getUserName());
             envNode.appendChild(userListNode);
        }

           filter.setXml(XMLUtil.document2String(filterDoc, "UTF-8"));
         }
     
      return filter.getXml().replaceAll("\\\r", "").replaceAll("\\\n", "").replaceAll("\\\"", "\\\\\\\"").trim();
    }
  }
View Full Code Here

     
      if (timerAction == null) {
        return;
      }

      Filter filter = null;
     
      if (timer.getFilterId() != null) {
       
        filter = new FilterAccessSessionMySQL().queryFilter(timer.getFilterId());
       
View Full Code Here

   * @param filterIdStr
   * @return
   */
  public static String exportXmlDataFilter(String filterIdStr){
    DataAccessSession das = DataAccessFactory.getInstance().getSysDas();
    Filter filter = das.queryFilter(DataAccessFactory.getInstance().createUUID(filterIdStr));
    boolean isSysFilter = FilterQueryManager.isSysFilter(filter.getId().getValue());
    if (isSysFilter) {
      try {
        FilterQueryManager.initFilterEnv(filter,ConfigUtil.magic, ConfigUtil.sysEmail, null, das);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
   
     Map<UUID, Template> templateMap = new HashMap<UUID, Template>();
     Map<UUID, Flow> flowMap = new HashMap<UUID, Flow>();
     Map<String, String> userAliasMap = new HashMap<String, String>();
    
     Data[] allDatas = das.getDataFilter().queryDatas(filter.getXml(),null)//取过滤器所有数据
    
     String[] displayNames = FilterQueryManager.getDisplayNamesFilter(filter.getXml(), das)//显示字段名
     StringBuffer plainBuffer = new StringBuffer();
     plainBuffer.append("<root>");
     for (int i = 0; i < allDatas.length; i++) {
       Data task = allDatas[i];
      
View Full Code Here

    return xmlBuffer.toString();
  }
 
  private int getFilterCount(UUID filterId , String username) throws TransformerException{
    Set<String> querySpeFieldSet = new HashSet<String>();
    Filter filter = das.queryFilter(filterId);
    if (filter == null || filter.getXml() == null || ("").equals(filter.getXml()) ) {
      return 0 ;
    }
   
    Document filterXMLDoc = null;
    try{
      filterXMLDoc = XMLUtil.string2Document(filter.getXml(), "UTF-8");
    }catch(Exception e){
      System.out.println("filter parse error , filter id :" + filter.getId().getValue());
    }

    if(filterXMLDoc == null){
      return 0;
    }
View Full Code Here

   * @return
   * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeFilter(com.sogou.qadev.service.cynthia.bean.UUID)
   */
  public ErrorCode removeFilter(UUID filterId)
  {
    Filter filter = this.queryFilter(filterId);
    if(filter == null){
      return ErrorCode.success;
    }
   
    return new FilterAccessSessionMySQL().removeFilter(filterId);
View Full Code Here

  {
  }

  public Filter addFilter(Filter filter)
  {
    Filter newFilter = null;
    PreparedStatement pstm = null;
    Connection conn = null;
    try
    {
      conn = DbPoolConnection.getInstance().getConnection();
View Full Code Here

      while(rs.next()){
        UUID id = DataAccessFactory.getInstance().createUUID(rs.getObject("id").toString());
        String createUser = rs.getString("create_user");
        Timestamp createTime = rs.getTimestamp("create_time");

        Filter filter = new FilterImpl(id, createUser, createTime, null);
        filter.setName(rs.getString("name"));
        filter.setXml(rs.getString("xml"));
        filter.setAnd(rs.getBoolean("is_and"));
        filter.setPublic(rs.getBoolean("is_public"));
        filter.setVisible(rs.getBoolean("is_visible"));

        filterList.add(filter);
      }
    }
    catch(Exception e){
      e.printStackTrace();
    }
    finally{
      DbPoolConnection.getInstance().closeResultSet(rs);
      DbPoolConnection.getInstance().closeStatment(pstm);
      DbPoolConnection.getInstance().closeConn(conn);
    }

    Map<UUID, Boolean> templateAllowMap = new HashMap<UUID, Boolean>();
    Map<UUID, List<Template>> allTemplateTypeMap = new HashMap<UUID, List<Template>>();
    Map<UUID, Template> allTemplateMap = new HashMap<UUID, Template>();
    Map<UUID, Flow> allFlowMap = new HashMap<UUID, Flow>();
   
    Iterator<Filter> filterItr = filterList.iterator();
    while(filterItr.hasNext()){
      Filter filter = filterItr.next();

      Document xmlDoc = null;
      try{
        xmlDoc = XMLUtil.string2Document(filter.getXml(), "UTF-8");
      }
      catch(Exception e){
        e.printStackTrace();
        System.err.println("error filter id: " + filter.getId());
      }

      if(xmlDoc == null){
        filterItr.remove();
        continue;
View Full Code Here

      rs = pstm.executeQuery();
      while(rs.next()){
        UUID id = DataAccessFactory.getInstance().createUUID(Long.toString(rs.getLong("id")));
        Timestamp createTime = rs.getTimestamp("create_time");

        Filter filter = new FilterImpl(id, DataAccessFactory.sysUser, createTime, null);
        filter.setName(rs.getString("name"));
        filter.setXml(rs.getString("xml"));
        filter.setAnd(rs.getBoolean("is_and"));
        filter.setPublic(rs.getBoolean("is_public"));
        filter.setVisible(rs.getBoolean("is_visible"));

        filterList.add(filter);
      }
    }
    catch(Exception e){
View Full Code Here

      rs = pstm.executeQuery();
      while(rs.next()){
        UUID id = DataAccessFactory.getInstance().createUUID(Long.toString(rs.getLong("id")));
        Timestamp createTime = rs.getTimestamp("create_time");
        String createUser = rs.getString("create_user");
        Filter filter = new FilterImpl(id, createUser, createTime, null);
        filter.setName(rs.getString("name"));
        filter.setXml(rs.getString("xml"));
        filter.setAnd(rs.getBoolean("is_and"));
        filter.setPublic(rs.getBoolean("is_public"));
        filter.setVisible(rs.getBoolean("is_visible"));
        filterList.add(filter);
      }
    }
    catch(Exception e){
      e.printStackTrace();
View Full Code Here

TOP

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

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.