Package com.narirelays.ems.applogic

Examples of com.narirelays.ems.applogic.OperResult


    return productionProcessManagement.modifyProcessTemplateCategory(stringValue(id), properties);
  }

  public OperResult queryAllProcessTemplateCategory(){
    ArrayList<PTemplateCategory> output = new ArrayList<PTemplateCategory>();
    OperResult result = productionProcessManagement.queryAllProcessTemplateCategory(output);
    if(result.isSUCCEED()){
      JSONArray jsonObject = JSONArray.fromObject(output, jsonConfig);
//      System.out.println(jsonObject);
//      result.setInfoMSG(jsonObject.toString());
      result.setData(jsonObject.toString());
    }
    return result;
  }
View Full Code Here


  public OperResult queryProcessTemplateInAndOut(String pt_id){
//    HashSet<ProcessTemplateIn> ins = new HashSet<ProcessTemplateIn>();
//    HashSet<ProcessTemplateOut> outs = new HashSet<ProcessTemplateOut>();
//    ArrayList<EnergyMedia> inMeasures= new ArrayList<EnergyMedia>();
//    ArrayList<EnergyMedia> outMeasures= new ArrayList<EnergyMedia>();
    OperResult result = productionProcessManagement.queryProcessTemplateInAndOut(pt_id);
//    if(result.isSUCCEED()){
//      for(ProcessTemplateIn in:ins){
//        inMeasures.add(in.getEnergyMedia());
//       
//      }
View Full Code Here

//    }
    return result;
  }
 
  public OperResult queryProcessInAndOut(String pt_id){
    OperResult result = productionProcessManagement.queryProcessInAndOut(pt_id);
    return result;
  }
View Full Code Here

  /**!
   * 采用搜索引擎技术来对所有计量点进行查询,并进行分页
   * @return
   */
  public OperResult searchAllMeasurePoints() {
    OperResult result = new OperResult();
//    List<Measure> findResult = measureDAO.findAll();
////    List<LazyDynaBean> dataBeans = ObjectListConvert2DynaBeanList.convert(findResult);
//    List<LazyDynaBean> dataBeans = new ArrayList<LazyDynaBean>();
//    for(Measure measure:findResult){
//      LazyDynaBean bean = new LazyDynaBean();
View Full Code Here

//    result.setSucceed(MEASURE_QUERY_ALL);
    return result;
  }
 
  public OperResult queryAllMeasurePoints(Map params){
    OperResult result = productionProcessManagement.queryAllMeasurePoints(params);
//    if(result.isSUCCEED()){
//      JSONArray jsonObject = JSONArray.fromObject(result.getBeans(), jsonConfig);
//      result.setInfoMSG(jsonObject.toString());
//    }
    return result;
View Full Code Here

//      result.setInfoMSG(jsonObject.toString());
//    }
    return result;
  }
  public OperResult queryDepartmentProcesses(String dep_id){
    OperResult result = productionProcessManagement.queryDepartmentProcesses(dep_id);
    return result;
  }
View Full Code Here

    cubes = new ArrayList<String>();
    cubes.add(WebVariable.AW_CUBE_EMS_ID);
  }
 
  public OperResult queryAllMeasures(){
    OperResult result = new OperResult();
    try {
      List resultList = OlapService.getRootMeasureInfo();
      if(resultList!=null){
        result.setSucceed(JSONArray.fromObject(resultList).toString());
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      result.setFailed(e.getMessage());
    }
    return result;
  }
View Full Code Here

  /**!
   * 从时间维度中取得各个时间维度的值,并以树的形式返回。
   * @return
   */
  public OperResult queryAllTime(){
    OperResult result = new OperResult();
    try {
      List resultList = OlapService.getTimeDimensionTree();
      if(resultList!=null){
        result.setSucceed(JSONArray.fromObject(resultList).toString());
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      result.setFailed(e.getMessage());
    }
    return result;
  }
View Full Code Here

  }
 
  public OperResult queryAllEquipment()
  {
    ArrayList<Equipment> output = new ArrayList<Equipment>();
    OperResult result = equipmentManagement.queryAllEquipment(output);
    if(result.isSUCCEED())
    {
      JSONArray jsonObject = JSONArray.fromObject(output, jsonConfig);
      result.setInfoMSG(jsonObject.toString());
    }
    return result;
  }
View Full Code Here

  /**
   * 通用查询,返回所有符合查询条件的列
   * */
  public OperResult queryHistory(String table_name,int table_unit,String id_col_name,String time_col_name,List<String> keys,Date startTime,Date endTime,int interval)
  {
    OperResult result = new OperResult();
   
    if(tableName2Type.get(table_name)==null)//检查输入的表名是否合法
    {
      result.setFailed("table "+table_name+" is not exist!");
      return result;
    }
   
    if(tableName2Type.get(table_name)==TABLE_TIMING&&interval<=0)//判断表插入类型与选择的间隔时间是否一致
    {
      result.setFailed("table "+table_name+" is inserted periodically, plz input correct interval time!");
      return result;
    }
   
    if(tableName2Type.get(table_name)==TABLE_EMITTING&&interval>0)//判断表插入类型与选择的间隔时间是否一致
    {
      result.setFailed("table "+table_name+" is inserted emitted, plz input correct interval time!");
      return result;
    }
   
    List<LazyDynaBean> resultData = new ArrayList<LazyDynaBean>();
    for(String id:keys){
     
      long id_key = 0;
      try
      {
        id_key = Long.parseLong(id);
      }
      catch (NumberFormatException e)
      {
        System.out.println("ID:"+id+"'s format is error!");
        continue;//如果输入的id类型转化出错时不处理,相当于没有查询到该id的数据;逻辑上是正确的
      }

//      按时间间隔获取数据与否只是此处组织查询语句有区别,只要在sql_ping_with_str()函数中区分即可     
      String with_sql_str = sql_ping_with_str(interval,startTime,endTime,table_name,time_col_name,id_col_name,id_key,table_unit);

      if(with_sql_str!=null)//有可能没有找到待查询的表
      {
        String query_sql_str = sql_ping_query_str(table_name);
        String execute_sql_str =  with_sql_str + query_sql_str;
        System.out.println(execute_sql_str);
        /**!
         * 通过每行都进行Meta信息的处理来转成结果。
         */
//        List<LazyDynaBean> records = jdbcTemplate.query(execute_sql_str, new RowMapper<LazyDynaBean>() {
//          public LazyDynaBean mapRow(ResultSet rs, int rowNum)
//              throws SQLException {
//            return DataBaseUtility.convertResultSet2LazyDynaBean(rs);
//          }
//        }); 
        /**!
         * 通过先得到Meta信息,然后遍历结果
         */
        List<LazyDynaBean> records = null;
        try{//有可能用户调接口的时候会出错列名,需要异常处理
          records = jdbcTemplate.query(execute_sql_str, new ResultSetExtractor<List<LazyDynaBean>>(){
//            public LazyDynaBean mapRow(ResultSet rs, int rowNum)
//                throws SQLException {
//              return DataBaseUtility.convertResultSet2LazyDynaBean(rs);
//            }
            @Override
            public List<LazyDynaBean> extractData(ResultSet rs)
                throws SQLException, DataAccessException {
             
              return DataBaseUtility.convertResultSet2LazyDynaBeanList(rs);
            }
          });
        }
        catch(BadSqlGrammarException e)
        {
          e.printStackTrace();
          result.setFailed("Bad column name!");
          return result;
        }       
        resultData.addAll(records);
      }
    }
   
    result.setSucceed();
    result.setData(resultData);   
    return result;
  }
View Full Code Here

TOP

Related Classes of com.narirelays.ems.applogic.OperResult

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.