예제 #1
0
  /**
   * @param setHandle
   * @param setDesign
   * @param propertyName
   */
  void updateDataSetDesign(
      OdaDataSetHandle setHandle, DataSetDesign setDesign, String propertyName) {
    if (setHandle == null || setDesign == null || propertyName == null) return;

    // properties on ReportElement, like name, displayNames, etc.

    if (OdaDataSetHandle.NAME_PROP.equalsIgnoreCase(propertyName))
      setDesign.setName(setHandle.getName());
    else if (OdaDataSetHandle.DISPLAY_NAME_PROP.equalsIgnoreCase(propertyName))
      setDesign.setDisplayName(setHandle.getDisplayName());
    else if (OdaDataSetHandle.DISPLAY_NAME_ID_PROP.equalsIgnoreCase(propertyName))
      setDesign.setDisplayNameKey(setHandle.getDisplayNameKey());

    // properties such as comments, extends, etc are kept in
    // DataSourceHandle, not DataSourceDesign.

    // scripts of DataSource are kept in
    // DataSourceHandle, not DataSourceDesign.

    else if (OdaDataSourceHandle.EXTENSION_ID_PROP.equalsIgnoreCase(propertyName))
      setDesign.setOdaExtensionDataSetId(setHandle.getExtensionID());
    else if (OdaDataSetHandle.PRIVATE_DRIVER_PROPERTIES_PROP.equalsIgnoreCase(propertyName))
      setDesign.setPrivateProperties(
          newOdaPrivateProperties(setHandle.privateDriverPropertiesIterator()));
    else if (OdaDataSetHandle.RESULT_SET_NAME_PROP.equalsIgnoreCase(propertyName))
      setDesign.setPrimaryResultSetName(setHandle.getResultSetName());
    else if (OdaDataSetHandle.QUERY_TEXT_PROP.equalsIgnoreCase(propertyName))
      setDesign.setQueryText(setHandle.getQueryText());

    // create a new data source design for this set design.

    else if (OdaDataSetHandle.DATA_SOURCE_PROP.equalsIgnoreCase(propertyName)) {
      OdaDataSourceHandle sourceHandle = (OdaDataSourceHandle) setHandle.getDataSource();

      if (sourceHandle != null)
        setDesign.setDataSourceDesign(new DataSourceAdapter().createDataSourceDesign(sourceHandle));
    } else if (OdaDataSetHandle.PARAMETERS_PROP.equalsIgnoreCase(propertyName)) {
      org.eclipse.datatools.connectivity.oda.design.DataSetParameters dsParams =
          new DataSetParameterAdapter(setHandle, setDesign)
              .newOdaDataSetParams(
                  SchemaConversionUtil.convertToDesignParameters(getCachedParameters(setHandle)));

      if (dsParams != null) setDesign.setParameters(dsParams);
      else setDesign.setParameters(null);
    } else if (OdaDataSetHandle.RESULT_SET_PROP.equalsIgnoreCase(propertyName))
      new ResultSetsAdapter(setHandle, setDesign).updateOdaResultSetDefinition();
    else if (OdaDataSetHandle.COLUMN_HINTS_PROP.equalsIgnoreCase(propertyName))
      new ResultSetsAdapter(setHandle, setDesign).updateOdaColumnHints();
    else if (OdaDataSetHandle.FILTER_PROP.equalsIgnoreCase(propertyName))
      new ResultSetCriteriaAdapter(setHandle, setDesign).updateODAResultSetCriteria();

    updateODAMessageFile(setDesign.getDataSourceDesign(), setHandle.getModuleHandle());
  }
예제 #2
0
  /**
   * @param setHandle
   * @param setDesign
   */
  void updateDataSetDesign(OdaDataSetHandle setHandle, DataSetDesign setDesign) {
    // properties on ReportElement, like name, displayNames, etc.

    setDesign.setName(setHandle.getName());

    String displayName = setHandle.getDisplayName();
    String displayNameKey = setHandle.getDisplayNameKey();

    if (displayName != null || displayNameKey != null) {
      setDesign.setDisplayName(displayName);
      setDesign.setDisplayNameKey(displayNameKey);
    }

    // properties such as comments, extends, etc are kept in
    // DataSourceHandle, not DataSourceDesign.

    // scripts of DataSource are kept in
    // DataSourceHandle, not DataSourceDesign.

    setDesign.setOdaExtensionDataSetId(setHandle.getExtensionID());

    setDesign.setPublicProperties(
        newOdaPublicProperties(setHandle.getExtensionPropertyDefinitionList(), setHandle));

    setDesign.setPrivateProperties(
        newOdaPrivateProperties(setHandle.privateDriverPropertiesIterator()));

    setDesign.setPrimaryResultSetName(setHandle.getResultSetName());

    setDesign.setQueryText(setHandle.getQueryText());

    // create a new data source design for this set design.

    OdaDataSourceHandle sourceHandle = (OdaDataSourceHandle) setHandle.getDataSource();

    if (sourceHandle != null)
      setDesign.setDataSourceDesign(new DataSourceAdapter().createDataSourceDesign(sourceHandle));

    // when converts the ODA to BIRT, some information for parameter
    // definitions may be lost. So, must get the cached values first. Then
    // try to restore to latest value.

    String strDesignValues = setHandle.getDesignerValues();

    DesignValues designerValues = null;

    try {
      if (strDesignValues != null) designerValues = SerializerImpl.instance().read(strDesignValues);

    } catch (IOException e) {
    }

    // the driver defined parameters are in the designer values

    DataSetParameters cachedParams = null;
    if (designerValues != null) {
      cachedParams = designerValues.getDataSetParameters();
    }

    DataSetParameterAdapter dataParamAdapter = new DataSetParameterAdapter(setHandle, setDesign);

    org.eclipse.datatools.connectivity.oda.design.DataSetParameters designDefinedParams = null;
    if (cachedParams != null) {
      // cached are driver-defined parameters
      designDefinedParams =
          SchemaConversionUtil.convertToDesignParameters(EcoreUtil.copy(cachedParams));

      setDesign.setParameters(designDefinedParams);

      dataParamAdapter.updateDriverDefinedParameter(
          designDefinedParams, SchemaConversionUtil.getCachedDynamicList(cachedParams));
    }

    // if there is no driver defined parameters, update parameters with set
    // handle defined with cached in the last request

    if (designDefinedParams == null) {
      designDefinedParams = dataParamAdapter.newOdaDataSetParams(designDefinedParams);
      setDesign.setParameters(designDefinedParams);
    }

    // handle those parameters defined by user

    dataParamAdapter.updateUserDefinedParameter(designDefinedParams);

    org.eclipse.datatools.connectivity.oda.design.DataSetParameters userDefinedParams =
        dataParamAdapter.newOdaDataSetParams(dataParamAdapter.getUserDefinedParams());

    if (designDefinedParams == null) {
      designDefinedParams = userDefinedParams;
      setDesign.setParameters(designDefinedParams);
    } else if (userDefinedParams != null)
      designDefinedParams
          .getParameterDefinitions()
          .addAll(userDefinedParams.getParameterDefinitions());

    new ResultSetsAdapter(setHandle, setDesign).updateOdaResultSetDefinition();

    updateODAMessageFile(setDesign.getDataSourceDesign(), setHandle.getModuleHandle());
  }