[
https://issues.apache.org/jira/browse/TUSCANY-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518948
]
Adriano Crestani commented on TUSCANY-1465:
-------------------------------------------
Hi Amita,
1)
Lets exemplify:
{ //user code
List userResultDescriptors = new ArrayList();
userResultDescriptors.add(resultDescriptor1);
userResultDescriptors.add(resultDescriptor2);
readCommand.setResultDescriptor(userResultDescriptors);
userResultDescriptors.add(resultDescriptor3); // [3]
} //user code
On ReadCommandImpl:
public void setResultDescriptor(List resultDescriptor){
//for null/0 list or -1 columnIndex, throw RuntimeException
if(resultDescriptor == null || resultDescriptor.size()==0){
throw new RuntimeException("Can not accept null or empty
ResultDescriptor");
}
for(int i=0; i<resultDescriptor.size(); i++){
if(
((ResultDescriptor)resultDescriptor.get(i)).getColumnIndex() <= -1 ){
throw new RuntimeException("Need >=0 columnIndex
sequencing in ResultDescriptor");
}
}
this.resultDescriptor = resultDescriptor; // [1]
this.resultSetShape = new ResultSetShape(resultDescriptor,
configWrapper.getConfig()); // [2]
}
[1] here the user ResultDescriptor List object is being set as Command
ResultDescriptor List, so when the user add the resultDescriptor3 on [3] the
Command ResultDescriptor List will also be modified.
[2] here the user ResultDescriptor List is being copied on ResultSetShape
constructor when ResultDescriptorSorter.sortList() method is invoked, as
defined on item 2). So, as it is a new copy, when user add the
resultDescriptor3 on the list it will not be updated on ResultSetShape, that
will continue storing info only about the resultDescriptor1 and 2. So, the
readCommandImpl.resultDescriptors and readCommandImpl.resultSetShape will have
different information.
I suggest to copy the user ResultDescriptor List and also its
ResultDescriptors, once the user can externaly alter the ResultDescriptor
object using its setters and it will not be updated on ResultSetShape.
It's just all about the ResultSetShape not being updated when ResultDescriptors
info are modified externaly. If you want to, you may find a way to keep the
ResultSetShape updated, but it all depends on the logic you want to define: if
the user can modify the ResultDescriptor externaly after have set the
ResultDescriptor on a Command or not.
4) Sorry for bothering you with names and patterns issues, but as these methods
will be used by the user, I think we should be cautiously when defining them.
Agreed?
> Allow passing ResultDescriptor for dynamic Commands
> ---------------------------------------------------
>
> Key: TUSCANY-1465
> URL: https://issues.apache.org/jira/browse/TUSCANY-1465
> Project: Tuscany
> Issue Type: Bug
> Components: Java DAS RDB
> Affects Versions: Java-DAS-Next
> Reporter: Amita Vadhavkar
> Assignee: Amita Vadhavkar
> Fix For: Java-DAS-Next
>
> Attachments: 1465.patch
>
>
> http://www.mail-archive.com/[email protected]/msg19886.html
> Action for the issue discussed in above mail.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]