/** * Gets the serializable string for design values. Design values include data set parameter * definitions and result set definitions. * * @param setDesign the data set desgin * @return the serializable string for design values */ private String serializeOdaValues(DataSetDesign setDesign) { DataSetParameters params = SchemaConversionUtil.convertToAdapterParameters(setDesign.getParameters()); ResultSets resultSets = setDesign.getResultSets(); DesignValues values = ModelFactory.eINSTANCE.createDesignValues(); values.setVersion(IConstants.DESINGER_VALUES_VERSION); boolean hasData = false; if (params != null) { values.setDataSetParameters((DataSetParameters) EcoreUtil.copy(params)); hasData = true; } if (resultSets != null) { values.setResultSets((ResultSets) EcoreUtil.copy(resultSets)); hasData = true; } if (!hasData) return IConstants.EMPTY_STRING; try { return SerializerImpl.instance().write(values); } catch (IOException e) { return null; } }
/** * Updates the designer value. Designer values only contain Driver-defined parameters. * * @param setDesign the data set design * @param setHandle the data set handle * @param designerValues the designer values * @param userDefinedList the user defined parameters * @throws SemanticException */ private void updateDesignerValue( DataSetDesign setDesign, OdaDataSetHandle setHandle, DataSetParameters requestParameters, List userDefinedList, ResultSets requestResultSets) throws SemanticException { DesignValues designerValues = null; // update design values. org.eclipse.datatools.connectivity.oda.design.DataSetParameters setDefinedParams = setDesign.getParameters(); if (setDefinedParams == null) { if (requestParameters != null) { designerValues = ModelFactory.eINSTANCE.createDesignValues(); designerValues.setDataSetParameters(null); } } else { org.eclipse.datatools.connectivity.oda.design.DataSetParameters driverParams = DataSetParameterAdapter.getDriverDefinedParameters( setDefinedParams.getParameterDefinitions(), userDefinedList); if (driverParams.getParameterDefinitions().size() > 0) { designerValues = ModelFactory.eINSTANCE.createDesignValues(); DataSetParameters adapterParams = SchemaConversionUtil.convertToAdapterParameters(driverParams); designerValues.setDataSetParameters(adapterParams); clearReportParameterRelatedValues( adapterParams.getParameters(), setHandle.getModuleHandle()); } } if (designerValues == null && requestResultSets == null) { setHandle.setDesignerValues(null); return; } if (requestResultSets != null) { if (designerValues == null) { designerValues = ModelFactory.eINSTANCE.createDesignValues(); designerValues.setDataSetParameters(null); } designerValues.setResultSets(requestResultSets); } else designerValues.setResultSets(null); // Set DesignerValues try { String dValue = SerializerImpl.instance().write(designerValues); setHandle.setDesignerValues(dValue); } catch (IOException e) { } }
/** * @param dataSetHandle * @param completedSession * @throws SemanticException */ public void updateDataSetHandle(OdaDataSetHandle dataSetHandle, OdaDesignSession completedSession) throws SemanticException { if (completedSession == null || dataSetHandle == null) return; DataSetDesign responseDesign = completedSession.getResponseDataSetDesign(); DataSetDesign requestDesign = completedSession.getRequestDataSetDesign(); updateDataSetHandle( responseDesign, dataSetHandle, false, SchemaConversionUtil.convertToAdapterParameters(requestDesign.getParameters()), requestDesign.getResultSets()); DesignerStateAdapter.updateROMDesignerState( completedSession.getResponse().getDesignerState(), dataSetHandle); ; }