public Object getValue() {
DefaultTableModel tableModel= (DefaultTableModel)table.getModel();
Vector rows = tableModel.getDataVector();
HashMap map = new HashMap();
Or ors = new Or();
for(int i=0; i<rows.size(); i++){
Vector cols = (Vector)rows.get(i);
String key = (String)cols.get(1);
boolean isOtherwise = false;
if(key==null)continue;
if(!map.containsKey(key)){
Or or = new Or();
And and = new And();
for(int j=START_INDEX;j<cols.size();j++){
if(cols.get(j) instanceof Otherwise){
isOtherwise = true;
break;
}else if(cols.get(j) instanceof RoleExist){
RoleExist role = (RoleExist)cols.get(j);
if(role!=null){
and.addCondition(role);
}
}else{
Evaluate eval = (Evaluate)cols.get(j);
if(eval!=null){
and.addCondition(eval);
}
}
}
if(!isOtherwise && and.getConditionsVt().size()>0){
or.addCondition(and);
}
if(isOtherwise){
Otherwise otherwise = new Otherwise();
map.put(key, otherwise);
otherwise.getDescription().setText(key);
ors.addCondition(otherwise);
}else{
map.put(key, or);
or.getDescription().setText(key);
ors.addCondition(or);
}
}else{
And and = new And();