Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » ODA Designer Plug-In Dev: Parameter Data Type not set / used
ODA Designer Plug-In Dev: Parameter Data Type not set / used [message #1400623] Mon, 14 July 2014 13:20 Go to next message
Stefan Uebe is currently offline Stefan UebeFriend
Messages: 3
Registered: July 2014
Junior Member
Hi,

I implement a Designer Plug-In for BIRT and have the problem, that my parameter data types from my ParameterMetaData are not used in UI sometimes. Concretely I have this problem with the data type "Boolean", while "Date" works.

The implementation of method "getParameterType" returns 16 (java.sql.Types.BOOLEAN), as it is given by "getManifest().getDataSetType(null).getDataTypeMapping(nativeDataTypeName)".
The method "getParameterTypeName" returns "Boolean".

When populating an edited / created data set the native data types are also set at the parameter elements of the data set.


Is this a known bug? Unfortunately I didn't found anything useful about this problem.

Here are the snippets of my code.

1. Method for updating parameter settings at data set populating
private static void updateParameterDesign(IParameterMetaData metaData, DataSetDesign dataSetDesign) throws OdaException {
   DataSetParameters paramDesign = 
        DesignSessionUtil.toDataSetParametersDesign(metaData, 
        DesignSessionUtil.toParameterModeDesign(IParameterMetaData.parameterModeIn));
   // no exception in conversion; go ahead and assign to specified dataSetDesign
   dataSetDesign.setParameters(paramDesign);
   if (paramDesign == null) {
      return; // no parameter definitions; done with update
     }

   paramDesign.setDerivedMetaData(true);

   if (paramDesign.getParameterDefinitions().size() > 0) {
      EList<ParameterDefinition> definitions = paramDesign.getParameterDefinitions();
      for (int i = 0; i < definitions.size(); i++) {
         int type = metaData.getParameterType(i + 1);
         ParameterDefinition def = definitions.get(i);
         DataElementAttributes attributes = def.getAttributes();
			
         Object defaultValue = QueryUtil.getDefaultValue(type);
         attributes.setNativeDataTypeCode(type);
         if(defaultValue != null) {
            if(defaultValue instanceof String) {
               def.setDefaultScalarValue(defaultValue.toString());
            }
            def.addDefaultValue(defaultValue);
         }
      }
   }
}


2a. ParameterMetaData-Implementation (getting data types)
public int getParameterType(int param) throws OdaException {
   try {
      int code = Driver.getNativeDataTypeCode(getParameterTypeName(param));
      return code;
   } catch (Exception e) {
      throw new OdaException("Could not get data type for parameter " + param);
   }
}

public String getParameterTypeName(int param) throws OdaException {
   String type = getDefinition(param).getType();
   return type == null ? "String" : type;
}

public IParam getDefinition(int index) {
   return params.get(index - 1);
}


2b. Method for getting data type code (class Driver used in 2a)
public static int getNativeDataTypeCode(String nativeDataTypeName) throws OdaException {
   DataTypeMapping typeMapping = getManifest().getDataSetType(null).getDataTypeMapping(nativeDataTypeName);
   
   if (typeMapping != null) {
      return typeMapping.getNativeTypeCode();
   }
   return UNDEFINED_DATA_TYPE_CODE;
}

Re: ODA Designer Plug-In Dev: Parameter Data Type not set / used [message #1403992 is a reply to message #1400623] Tue, 29 July 2014 01:56 Go to previous message
Linda ChanFriend
Messages: 845
Registered: July 2009
Senior Member
RE: Your ParameterMetaData for boolean data type is not used in UI,
do you mean that the corresponding parameter does not show Boolean data type in the Data Set design page?

It could be due to the <dataTypeMapping> element defined for your native boolean data type is invalid/missing in your ODA runtime plugin manifest (plugin.xml).
The Java implementation for parameter meta data interface method is expected to return an ODA driver-specific native data type code. The native code will then get mapped to an ODA scalar data type based on the <dataTypeMapping> defined. For example,
<dataTypeMapping
nativeDataType="Boolean"
nativeDataTypeCode="16"
odaScalarDataType="Boolean"/>

Hope that helps.

Linda
Previous Topic:Trapping Dataset Exception errors
Next Topic:Project Lead Open Source Eclipse BIRT (San Mateo, CA)
Goto Forum:
  


Current Time: Wed Apr 24 13:35:44 GMT 2024

Powered by FUDForum. Page generated in 0.02588 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top