Package com.narirelays.ems.persistence.orm

Examples of com.narirelays.ems.persistence.orm.ReportTemplate


    if(templateID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
    String expression = template.getOperEdit();
    if(!evaluateUserWithExp(expression))//判断用户有无编辑的权限
    {
      result.setFailed(HAS_NO_EDIT_AUTHENTICATION);
      return result;
    }
    String oldType = template.getReportType();
    if(!oldType.equalsIgnoreCase(reportType))
    {
      //报表类型发生了改变,则删除离线库中已存储的报表
      String sql = null;
      if(oldType.equalsIgnoreCase("other"))
      {
        sql = "delete from other_report where template_id=?";
      }
      else if(oldType.equalsIgnoreCase("day"))
      {
        sql = "delete from day_report where template_id=?";
      }
      else if(oldType.equalsIgnoreCase("month"))
      {
        sql = "delete from month_report where template_id=?";
      }
      else if(oldType.equalsIgnoreCase("year"))
      {
        sql = "delete from year_report where template_id=?";
      }
      jdbcTemplate.update(sql, templateID);
    }
    template.setReportType(reportType);
    reportTemplateDAO.merge(template);
    result.setSucceed();
    return result;
  }
View Full Code Here


    if(templateID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
    Object rowNumObject = properties.get("row_num");
    Object colNumObject = properties.get("col_num");
    Object sheetNumObject = properties.get("sheet_num");
    Object timeObject = properties.get("time");
    if(rowNumObject==null)
    {
      result.setFailed(ROW_NUMBER_IS_NULL);
      return result;
    }
    if(colNumObject==null)
    {
      result.setFailed(COLUMN_NUMBER_IS_NULL);
      return result;
    }
    if(sheetNumObject==null)
    {
      result.setFailed(SHEET_NUMBER_IS_NULL);
      return result;
    }
    if(timeObject==null)
    {
      result.setFailed(REPORT_QUERY_TIME_IS_NULL);
      return result;
    }
    String timeString = stringValue(timeObject);
    long rowNum, colNum, sheetNum;
    try{
      rowNum = Long.valueOf(stringValue(rowNumObject));
      colNum = Long.valueOf(stringValue(colNumObject));
      sheetNum = Long.valueOf(stringValue(sheetNumObject));
    }
    catch(NumberFormatException e)
    {
      result.setFailed("Number Format Error!");
      return result;
    }
   
    CellId cellID = new CellId(rowNum, colNum, templateID, sheetNum);
    Cell cell = cellDAO.findById(cellID);
    if(cell==null)
    {
      result.setFailed(REPORT_CELL_NOT_EXIST);
      return result;
    }
    String queryType = cell.getQueryType();
    if(queryType==null||!queryType.equalsIgnoreCase("manual"))
    {
      result.setFailed(QUERY_TYPE_NOT_CORRECT);
      return result;
    }
   
    if(cell.getMeasureId()==null)
    {
      cell.setMeasureId(MyUUIDGen.getUUID());
      cellDAO.merge(cell);
    }
   
    String reportType = template.getReportType();
    if(reportType==null)//如果报表类型为空,按照默认other处理
      reportType = "other";
    Date time = null;
    SimpleDateFormat sdf = null;
    if(reportType.equalsIgnoreCase("other"))//其它类型报表
View Full Code Here

    if(templateID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
    String expression = template.getOperModify();
    if(!evaluateUserWithExp(expression))
    {
      result.setFailed(HAS_NO_REPORT_MODIFY_AUTHENTICATION);
      return result;
    }
View Full Code Here

    if(IDObject==null)
    {
      return true;//如果id为空,则权限判断通过,交给后面的action去报错
    }
    String templateID = stringValue(IDObject);
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      return true;//如果report为空,则权限判断通过,交给后面的action去报错
    }
    String expression = template.getOperEdit();
    if(!evaluateUserWithExp(expression))
      return false;
    else return true;
  }
View Full Code Here

      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      resultBean.set("roles", null);
      result.setData(resultBean);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(id);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      resultBean.set("roles", null);
      result.setData(resultBean);
      return result;
    }
    List<Srole>tmpRoles = sroleDAO.findAll();
    List<LazyDynaBean>roles = new ArrayList<LazyDynaBean>();
    String addExp = template.getOperAdd();
    String deleteExp = template.getOperDelete();
    String editExp = template.getOperEdit();
    String modifyExp = template.getOperModify();
    String queryExp = template.getOperQuery();
    String setExp = template.getOperSet();
    for(Srole role:tmpRoles)
    {
      LazyDynaBean bean = ObjectListConvert2DynaBeanList.convert(role);     
      if(AuthorityExpUtility.isRoleInResExpression(role.getAuthority(), addExp))
        bean.set("add", true);
View Full Code Here

    if(id==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(id);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
    String expression = template.getOperSet();//报表权限配置的权限与报表编辑的权限等同,需要修改!!!
    if(!evaluateUserWithExp(expression))//检测用户是否具有'权限配置'权限
    {
      result.setFailed(HAS_NO_SET_AUTHENTICATION);
      return result;
    }
    Object operObj = properties.get("oper_id");
    Object authorityObj = properties.get("authority");
    if(operObj==null)
    {
      result.setFailed(OPER_ID_IS_NULL);
      return result;
    }
    if(authorityObj==null)
    {
      result.setFailed(AUTHORITY_IS_NULL);
      return result;
    }
    String operation = stringValue(operObj);
    String authority = stringValue(authorityObj);
    if(operation.equalsIgnoreCase("add"))
    {
      expression = template.getOperAdd();
      String exp = AuthorityExpUtility.addRole4Expression(expression, authority);
      template.setOperAdd(exp);
    }
    else if(operation.equalsIgnoreCase("delete"))
    {
      expression = template.getOperDelete();
      String exp = AuthorityExpUtility.addRole4Expression(expression, authority);
      template.setOperDelete(exp);
    }
    else if(operation.equalsIgnoreCase("edit"))
    {
      expression = template.getOperEdit();
      String exp = AuthorityExpUtility.addRole4Expression(expression, authority);
      template.setOperEdit(exp);
    }
    else if(operation.equalsIgnoreCase("modify"))
    {
      expression = template.getOperModify();
      String exp = AuthorityExpUtility.addRole4Expression(expression, authority);
      template.setOperModify(exp);
    }
    else if(operation.equalsIgnoreCase("query"))
    {
      expression = template.getOperQuery();
      String exp = AuthorityExpUtility.addRole4Expression(expression, authority);
      template.setOperQuery(exp);
    }
    else if(operation.equalsIgnoreCase("set"))
    {
      expression = template.getOperSet();
      String exp = AuthorityExpUtility.addRole4Expression(expression, authority);
      template.setOperSet(exp);
    }
    reportTemplateDAO.merge(template);
    result.setSucceed();
    return result;
  }
View Full Code Here

    if(id==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(id);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
    String expression = template.getOperSet();//报表权限配置的权限与报表编辑的权限等同,需要修改!!!
    if(!evaluateUserWithExp(expression))//检测用户是否具有'权限配置'权限
    {
      result.setFailed(HAS_NO_SET_AUTHENTICATION);
      return result;
    }
    Object operObj = properties.get("oper_id");
    Object authorityObj = properties.get("authority");
    if(operObj==null)
    {
      result.setFailed(OPER_ID_IS_NULL);
      return result;
    }
    if(authorityObj==null)
    {
      result.setFailed(AUTHORITY_IS_NULL);
      return result;
    }
    String operation = stringValue(operObj);
    String authority = stringValue(authorityObj);
    if(operation.equalsIgnoreCase("add"))
    {
      expression = template.getOperAdd();
      String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
      template.setOperAdd(exp);
    }
    else if(operation.equalsIgnoreCase("delete"))
    {
      expression = template.getOperDelete();
      String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
      template.setOperDelete(exp);
    }
    else if(operation.equalsIgnoreCase("edit"))
    {
      expression = template.getOperEdit();
      String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
      template.setOperEdit(exp);
    }
    else if(operation.equalsIgnoreCase("modify"))
    {
      expression = template.getOperModify();
      String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
      template.setOperModify(exp);
    }
    else if(operation.equalsIgnoreCase("query"))
    {
      expression = template.getOperQuery();
      String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
      template.setOperQuery(exp);
    }
    else if(operation.equalsIgnoreCase("set"))
    {
      expression = template.getOperSet();
      String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
      template.setOperSet(exp);
    }
    reportTemplateDAO.merge(template);
    result.setSucceed();
    return result;
  }
View Full Code Here

    if(templateID==null)
    {
      result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
      return result;
    }
    ReportTemplate template = reportTemplateDAO.findById(templateID);
    if(template==null)
    {
      result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
      return result;
    }
View Full Code Here

      if(resultBook!=null){
        result.setSucceed();
        result.setData(resultBook);
        result.setInfoMSG("报表");
        if(id!=null){
          ReportTemplate reportTemplate = reportTemplateDAO.findById(id);
          if(reportTemplate!=null){
            result.setInfoMSG(reportTemplate.getName());
          }
        }
      }else{
        result.setFailed(HTML_CONVERT_TO_XLS_FAILED);
      }
View Full Code Here

 
  public OperResult modifyReportTemplate(String action,String id,Map properties){
    OperResult result = new OperResult();
    if(action!=null){
      if("file.new".equals(action)){
        ReportTemplate reportTemplate = new ReportTemplate();
        try {
          BeanUtils.populate(reportTemplate, properties);
          reportTemplate.setId(MyUUIDGen.getUUID());
          reportTemplateDAO.merge(reportTemplate);
          LazyDynaBean bean = new LazyDynaBean();
          bean.set("id", reportTemplate.getId());
          bean.set("name", reportTemplate.getName());
          result.setData(bean);
          result.setSucceed();
        } catch (IllegalAccessException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          result.setFailed(e.getMessage());
        } catch (InvocationTargetException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          result.setFailed(e.getMessage());
        }
      }else if("file.save".equals(action)){
        if(id!=null){
          ReportTemplate reportTemplate = reportTemplateDAO.findById(id);
          if(reportTemplate!=null){
            try {
              BeanUtils.populate(reportTemplate, properties);
              reportTemplateDAO.merge(reportTemplate);
              LazyDynaBean bean = new LazyDynaBean();
              bean.set("id", reportTemplate.getId());
              bean.set("name", reportTemplate.getName());
              result.setData(bean);
              result.setSucceed();
            } catch (IllegalAccessException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
View Full Code Here

TOP

Related Classes of com.narirelays.ems.persistence.orm.ReportTemplate

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.