/** * @param setHandle * @return */ private DataSetParameters getCachedParameters(OdaDataSetHandle setHandle) { 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(); return cachedParams; }
public void updateDataSetHandle( DataSetDesign setDesign, OdaDataSetHandle setHandle, boolean isSourceChanged) throws SemanticException { if (setDesign == null || setHandle == null) return; // serialize and get the designer values DesignValues designerValues = null; try { designerValues = SerializerImpl.instance().read(setHandle.getDesignerValues()); } catch (IOException e) { e.printStackTrace(); } DataSetParameters requestParameters = null; ResultSets requestResultSets = null; if (designerValues != null) { requestParameters = designerValues.getDataSetParameters(); requestResultSets = designerValues.getResultSets(); } updateDataSetHandle( setDesign, setHandle, isSourceChanged, requestParameters, requestResultSets); }
/** * @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()); }