Package com.narirelays.ems.applogic

Examples of com.narirelays.ems.applogic.OperResult


    }
    return result;
  }
 
  public static OperResult deleteTrigger(String triggerKey){
    OperResult result = new OperResult();
    if(SchedulerProvider.scheduler==null){
      result.setFailed(SCHEDULER_IS_NULL);
    }else{
      try {
        TriggerKey tk = GetObjectString.string2TriggerKey(triggerKey);
        System.out.println("stoping trigger:"+tk);
        SchedulerProvider.scheduler.unscheduleJob(tk);
        result.setSucceed();
      } catch (SchedulerException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        result.setFailed(e.getMessage());
      }
    }
    return result;
  }
View Full Code Here


    }
    return result;
  }
 
  public static OperResult queryTrigger(TaskInfo taskinfo){
    OperResult result = new OperResult();
    if(taskinfo==null){
      result.setFailed(TASK_INFO_NOTEXIST);
    }else{
      if(SchedulerProvider.scheduler==null){
        result.setFailed(SCHEDULER_IS_NULL);
      }else{
        try {
          List<LazyDynaBean> beans = new ArrayList<LazyDynaBean>();
          for(Trigger trigger:SchedulerProvider.scheduler.getTriggersOfJob(GetObjectString.string2JobKey(taskinfo.getId()))){
            TriggerKey triggerKey = trigger.getKey();
            LazyDynaBean bean = ObjectListConvert2DynaBeanList.convert(trigger);
            bean.set("triggerKey", triggerKey.toString());
            if(trigger instanceof CronTrigger){
              CronTrigger cronTrigger = (CronTrigger)trigger;
              bean.set("cronExpression", StringUtils.trim(cronTrigger.getCronExpression()));
            }
//            if(bean.get("cronExpression")!=null){
//              bean.set("cronExpression", StringUtils.trim(bean.get("cronExpression").toString()));
//            }
           
            if(trigger.getPreviousFireTime()!=null){
              bean.set("previousFireTime", WebVariable.sdf.format(trigger.getPreviousFireTime()));
            }
            if(trigger.getNextFireTime()!=null){
              bean.set("nextFireTime", WebVariable.sdf.format(trigger.getNextFireTime()));
            }
//            bean.set("groupname", triggerKey.getGroup());
            TriggerState trigState = SchedulerProvider.scheduler.getTriggerState(triggerKey);
            bean.set("trigState", trigState);

//            bean.remove("expressionSummary", "");
            bean.set("expressionSummary", "");
            beans.add(bean);
          }
          result.setSucceed();
          result.setData(beans);
        } catch (SchedulerException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          result.setFailed(e.getMessage());
        }
       
      }
    }
    return result;
View Full Code Here

    cubes.add(cube);
    return maintain(isFull,null,cubes);
  }
  public static synchronized OperResult maintain(boolean isFull,List<String> dims,List<String> cubes){
    AWConnection awConnection = null;//分析工作空间连接
    OperResult result = new OperResult();
    Connection connection = null;
    try {
      Object bdd = StorageService.ctx.getBean("olapdatasource");
      if(bdd instanceof org.apache.tomcat.dbcp.dbcp.BasicDataSource){
        org.apache.tomcat.dbcp.dbcp.BasicDataSource bds = (BasicDataSource)bdd;
        Connection conn1 = bds.getConnection();
        if(conn1 instanceof org.apache.tomcat.dbcp.dbcp.DelegatingConnection){
          org.apache.tomcat.dbcp.dbcp.DelegatingConnection dc = (org.apache.tomcat.dbcp.dbcp.DelegatingConnection)conn1;
          connection = dc.getInnermostDelegate();
        }
      }else if(bdd instanceof org.jsoftware.fods.impl.FoDataSourceImpl){
        org.jsoftware.fods.impl.FoDataSourceImpl bds = (org.jsoftware.fods.impl.FoDataSourceImpl)bdd;
        connection = bds.getConnection().getMetaData().getConnection();
      }

      if(connection==null ){
        result.setFailed(OLAP_CONNECTION_NOT_AVAILABLE);
        return result;
      }
     
      OracleConnection conn = (OracleConnection) connection;
      try{
        awConnection = new AWConnection(conn);
      }catch(Exception e){
        result.setFailed(e.getMessage());
        e.printStackTrace();
        return result;
      }
      Interaction curInteraction = new Interaction();

        // Set the AWConnection to use when building the analytic workspace.
        curInteraction.setConnection(awConnection);

        // Create an BuildDatabase object.
        BuildDatabase myBuild =
                 (BuildDatabase)curInteraction.createAction("BUILDDATABASE");

        // Set the name of the analytic workspace.
        myBuild.setAWName(WebVariable.AW_GLOBAL_ID);//挂载分析空间global.global

        // Specify not running solves when building the database.
       
        myBuild.setBuildType("EXECUTE");
//        myBuild.setRunSolve(true);
        myBuild.setCleanMeasures(false);
        myBuild.setCleanAttrs(false);
        myBuild.setCleanDim(true);
        myBuild.setTrackStatus(true);
       
//        myBuild.setId("simple");
        /**!
         * TrackStatus
         * true只导入增量数据
         * false全数据导入
         */
//        myBuild.setTrackStatus(isFull);
        myBuild.setMaxJobQueues(0);
        if(dims!=null){
          for(String dimid:dims){
            Dimension dim = new Dimension();
            dim.setId(dimid);
            myBuild.addBuildList(dim);
          }
        }
        if(cubes!=null){
          for(String cubeid:cubes){
            Cube cube = new Cube();
            cube.setId(cubeid);
            myBuild.addBuildList(cube);
          }
        }
       
        myBuild.Execute();
        awConnection.executeCommand("aw detach "+WebVariable.AW_GLOBAL_ID);
        result.setSucceed(getOLAPLog(conn));
        awConnection.close();
        conn.close();
       
    } catch (Exception e) {
      e.printStackTrace();
      result.setFailed(OLAP_MAINTAIN_FAILED,e.getMessage());
    } finally{
      if(awConnection!=null){
        awConnection.close();
        awConnection = null;
      }
View Full Code Here

  }
 
  public static synchronized OperResult executeCalPlan(List<String>solveGroups)//执行计算计划
  {
    AWConnection awConnection = null;//分析工作空间连接
    OperResult result = new OperResult();
    Connection connection = null;
    try {
      Object bdd = StorageService.ctx.getBean("olapdatasource");
      if(bdd instanceof org.apache.tomcat.dbcp.dbcp.BasicDataSource){
        org.apache.tomcat.dbcp.dbcp.BasicDataSource bds = (BasicDataSource)bdd;
        Connection conn1 = bds.getConnection();
        if(conn1 instanceof org.apache.tomcat.dbcp.dbcp.DelegatingConnection){
          org.apache.tomcat.dbcp.dbcp.DelegatingConnection dc = (org.apache.tomcat.dbcp.dbcp.DelegatingConnection)conn1;
          connection = dc.getInnermostDelegate();
        }
      }

      if(connection==null || !(connection instanceof OracleConnection)){
        result.setFailed(OLAP_CONNECTION_NOT_AVAILABLE);
        return result;
      }
      OracleConnection conn = (OracleConnection) connection;
      try{
        awConnection = new AWConnection(conn);
      }catch(Exception e){
        result.setFailed(e.getMessage());
        e.printStackTrace();
        return result;
      }
      Interaction curInteraction = new Interaction();

        // Set the AWConnection to use when building the analytic workspace.
        curInteraction.setConnection(awConnection);

        // Create an BuildDatabase object.
        BuildDatabase myBuild =
                 (BuildDatabase)curInteraction.createAction("BUILDDATABASE");

        // Set the name of the analytic workspace.
        myBuild.setAWName(WebVariable.AW_GLOBAL_ID);//挂载分析空间global.global

        // Specify not running solves when building the database.
       
        myBuild.setBuildType("EXECUTE");
        myBuild.setRunSolve(true);
       
        if(solveGroups!=null)
        {
          for(String solveGroupid:solveGroups)
          {
            SolveGroup solveGroup = new SolveGroup();//计算计划属于SolveGroup型
            solveGroup.setId(solveGroupid);
            myBuild.addBuildList(solveGroup);
          }
        }
        myBuild.Execute();
        awConnection.executeCommand("aw detach "+WebVariable.AW_GLOBAL_ID);
        result.setSucceed(getOLAPLog(conn));
        awConnection.close();
        conn.close();
    }
    catch (Exception e)
    {
      e.printStackTrace();
      result.setFailed(CALCULATE_PLAN_EXECUTE_FAILED,e.getMessage());
    }
    finally
    {
      awConnection.close();
    }
View Full Code Here

    }
  }
 
  public void testDepartment(){
    DepartmentManagementService departmentManagementService = (DepartmentManagementService)StorageService.ctx.getBean("DepartmentManagementService");
    OperResult result = departmentManagementService.queryAllDepartments();
    System.out.println(result);
    HashMap properties = new HashMap();
    properties.put("name", "另外一个公司");
    properties.put("description", "另外一个公司的描述");
    result = departmentManagementService.addDepartment("0", properties);
View Full Code Here

    result = departmentManagementService.queryAllDepartments();
    System.out.println(result);
  }
  public void deleteDepartment(){
    DepartmentManagementService departmentManagementService = (DepartmentManagementService)StorageService.ctx.getBean("DepartmentManagementService");
    OperResult result = departmentManagementService.deleteDepartment("5ab2ae8c60f2412b925012c0a6bbcdf8");
    System.out.println(result);
    result = departmentManagementService.queryAllDepartments();
    System.out.println(result);
  }
View Full Code Here

    result = departmentManagementService.queryAllDepartments();
    System.out.println(result);
  }
  public void testEnergyMedia(){
    EnergyMediaManagementService energyMediaManagementService = (EnergyMediaManagementService)StorageService.ctx.getBean("EnergyMediaManagementService");
    OperResult result = energyMediaManagementService.queryAllEnergyMedia();
    System.out.println(result);
    HashMap properties = new HashMap();
    properties.put("name", "另外一种介质类型");
    properties.put("description", "另外一种介质类型的描述");
    result = energyMediaManagementService.addEnergyMedia_Base(properties);
View Full Code Here

//    }
//    return result;
//  }

  public static OperResult convert2HTMLTableStringWithPOI(File file1) {
    OperResult result = new OperResult();
    InputStream in = null;
    try {
      in = new FileInputStream(file1);
      Workbook book = WorkbookFactory.create(in);
      Document doc = Jsoup.parse("");
      Element body = doc.body();
      for(int i=0;i<book.getNumberOfSheets();i++){
        Sheet sheet = book.getSheetAt(i);
        if(!ExcelUtility.isEmptySheet(sheet)){
          Element table = body.appendElement("table");
          table.attr("title",sheet.getSheetName());
          ExcelUtility.convertSheet2HTMLTable(sheet, table);
        }
      }
      result.setSucceed();
      result.setData(doc.select("table").toString());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      result.setFailed(e.getMessage());
    } finally{
      if(in!=null){
        try {
          in.close();
        } catch (IOException e) {
View Full Code Here

  public static void cacheOLAP_DEPARTMENT_TREE() {
    if (CacheProvider.cacheValid) {
      DepartmentManagementService departmentManagementService = (DepartmentManagementService) StorageService.ctx
          .getBean("departmentManagementService");
      if (departmentManagementService != null) {
        OperResult resultInfo = departmentManagementService
            .queryAllDepartments();
        if (resultInfo.isSUCCEED()) {

          CacheProvider.setObject(OLAP_DEPARTMENT_TREE, resultInfo);
        }
      }
    }
View Full Code Here

  public static void cacheOLAP_MEDIA_TREE() {
    if (CacheProvider.cacheValid) {
      EnergyMediaManagementService energyMediaManagementService = (EnergyMediaManagementService) StorageService.ctx
          .getBean("energyMediaManagementService");
      if (energyMediaManagementService != null) {
        OperResult resultInfo = energyMediaManagementService
            .queryAllEnergyMedia();
        if (resultInfo.isSUCCEED()) {

          CacheProvider.setObject(OLAP_MEDIA_TREE, resultInfo);
        }
      }
    }
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.