Exemplo n.º 1
0
  private void showHTMLReportViewer(
      RptMain report, String reportFileName, RptProperties properties, boolean showParams) {
    setupReportContext(context, properties);

    // документация по BIRT Viewer
    // http://www.eclipse.org/birt/phoenix/deploy/viewerUsage2.2.php
    StringBuilder sb =
        new StringBuilder(htmlReportViewerApp)
            .append("/frameset?__report=")
            .append(StringUtils.encodeBase64(reportFileName))
            .append("&__encodedPaths=true")
            .append("&__format=html")
            .append("&__parameterpage=false")
            .append("&__title=")
            .append(
                encodeURL(
                    !StringUtils.stringNullOrEmpty(report.getComment())
                        ? report.getComment()
                        : report.getRptName()))
            .append("&__locale=")
            .append(ServerUtils.getUserLocale())
            .append("&")
            .append(VIEWER_CONTEXT_PARAM_NAME)
            .append("=")
            .append(context.get(CONTEXT_ID));

    // формирование параметров отчета
    for (String key : reportParams.keySet()) {
      ReportParameter param = reportParams.get(key);
      Object paramValue = null;
      if (param.getDataType() == ReportParameter.DataType.ENTITY) {
        Object obj = param.getValue();
        if (obj != null) paramValue = ReportUtils.createEntityParam(obj);
        else sb.append("&__isnull=").append(key);
      } else paramValue = param.getValue();
      if (paramValue != null) {
        String strParamValue = null;
        // this is a total hack, see org.eclipse.birt.report.utility.DataUtil#getDisplayValue
        if (paramValue instanceof Float || paramValue instanceof Double)
          strParamValue = paramValue.toString();
        else if (paramValue instanceof BigDecimal
            || paramValue instanceof com.ibm.icu.math.BigDecimal)
          strParamValue =
              paramValue.toString().replaceFirst("E\\+", "E"); // $NON-NLS-1$//$NON-NLS-2$
        else strParamValue = ParameterValidationUtil.getDisplayValue(paramValue);

        sb.append(PARAMETER_SEPARATOR)
            .append(key)
            .append(EQUALS_OPERATOR)
            .append(encodeURL(strParamValue));
      }
    }

    UIUtils.showLocalDocument(sb.toString());
  }
Exemplo n.º 2
0
 /**
  * загрузить список параметров группы
  *
  * @param groupName имя группы
  * @return список параметров
  */
 public List<ReportParameter> findGroupReportParameters(String groupName) {
   List<ReportParameter> result = new ArrayList<ReportParameter>();
   if (!StringUtils.stringNullOrEmpty(groupName))
     for (ReportParameter param : reportParams.values())
       if (groupName.equals(param.groupName())) result.add(param);
   return result;
 }
Exemplo n.º 3
0
 @Override
 protected Set<String> getDefaultFieldsSet() {
   Set<String> result = super.getDefaultFieldsSet();
   result.addAll(
       StringUtils.split(
           "Id,CCode,CName,InsuredPercent,EmployerPercent", ",")); // $NON-NLS-1$ //$NON-NLS-2$
   return DatabaseUtils.embedAddinFieldsDefaultFieldsSet(result, service);
 }
 /**
  * установить исполнителей задачи
  *
  * @param pooledActors список исполнителей, для разделения кодов используется символ ','
  */
 protected void setAssignablePooledActors(String pooledActors) {
   if (pooledActors != null)
     assignable.setPooledActors(StringUtils.split(pooledActors, ",").toArray(new String[0]));
 }
 private String getConnectionPoolName(String connectionPoolName) {
   // если не указан, то работаем с главным соединением системы
   return StringUtils.stringNullOrEmpty(connectionPoolName)
       ? "MERPBackboneDS"
       : connectionPoolName;
 }