Commit da77cf86 authored by yannick legoc's avatar yannick legoc
Browse files

Added the enumerated values/labels functionality for properties

parent 0db707d1
......@@ -21,14 +21,24 @@ package fr.ill.ics.nscclient.servant;
public class ClientPropertyDescriptor {
private int id;
private String name;
private String type;
private int enumeratedValuesId;
private int enumeratedLabelsId;
public ClientPropertyDescriptor(String name, String type) {
public ClientPropertyDescriptor(int id, String name, String type, int enumeratedValuesId, int enumeratedLabelsId) {
this.id = id;
this.name = name;
this.type = type;
this.enumeratedValuesId = enumeratedValuesId;
this.enumeratedLabelsId = enumeratedLabelsId;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
......@@ -36,4 +46,13 @@ public class ClientPropertyDescriptor {
public String getType() {
return type;
}
public int getEnumeratedValuesId() {
return enumeratedValuesId;
}
public int getEnumeratedLabelsId() {
return enumeratedLabelsId;
}
}
\ No newline at end of file
......@@ -278,11 +278,23 @@ public class CorbaServantManager {
ids.add(i.next());
}
int enumeratedValuesId = 0;
int enumeratedLabelsId = 0;
if (pbProperty.hasEnumeratedValuesID()) {
enumeratedValuesId = pbProperty.getEnumeratedValuesID();
}
if (pbProperty.hasEnumeratedLabelsID()) {
enumeratedLabelsId = pbProperty.getEnumeratedLabelsID();
}
if (pbProperty.getDynamic()) {
PropertyDatabase.getInstance().addDynamicPropertyDescriptor(descriptor.getId(), new DynamicPropertyDescriptor(propertyId, ids, pbProperty.getName(), pbProperty.getType()));
PropertyDatabase.getInstance().addDynamicPropertyDescriptor(descriptor.getId(), new DynamicPropertyDescriptor(propertyId, ids, pbProperty.getName(), pbProperty.getType(), enumeratedValuesId, enumeratedLabelsId));
} else {
PropertyDatabase.getInstance().addStandardPropertyDescriptor(descriptor.getId(), new StandardPropertyDescriptor(propertyId, pbProperty.getName(), pbProperty.getType()));
PropertyDatabase.getInstance().addStandardPropertyDescriptor(descriptor.getId(), new StandardPropertyDescriptor(propertyId, pbProperty.getName(), pbProperty.getType(), enumeratedValuesId, enumeratedLabelsId));
}
}
Iterator<ServantDataConfiguration.CommandDescriptor> d = pbServant.getCommandsList().iterator();
......@@ -395,8 +407,19 @@ public class CorbaServantManager {
ids.add(i.next());
}
int enumeratedValuesId = 0;
int enumeratedLabelsId = 0;
if (pbProperty.hasEnumeratedValuesID()) {
enumeratedValuesId = pbProperty.getEnumeratedValuesID();
}
if (pbProperty.hasEnumeratedLabelsID()) {
enumeratedLabelsId = pbProperty.getEnumeratedLabelsID();
}
if (pbProperty.getDynamic()) {
PropertyDatabase.getInstance().addDynamicPropertyDescriptor(servantID, new DynamicPropertyDescriptor(propertyId, ids, pbProperty.getName(), pbProperty.getType()));
PropertyDatabase.getInstance().addDynamicPropertyDescriptor(servantID, new DynamicPropertyDescriptor(propertyId, ids, pbProperty.getName(), pbProperty.getType(), enumeratedValuesId, enumeratedLabelsId));
} else {
System.err.println("properties should be dynamic in updateDynamicProperties");
}
......
......@@ -23,12 +23,10 @@ import java.util.List;
public class DynamicPropertyDescriptor extends ClientPropertyDescriptor {
private int id;
private List<Integer> ids;
public DynamicPropertyDescriptor(int id, List<Integer> ids, String name, String type) {
super(name, type);
this.id = id;
public DynamicPropertyDescriptor(int id, List<Integer> ids, String name, String type, int enumeratedValuesId, int enumeratedLabelsId) {
super(id, name, type, enumeratedValuesId, enumeratedLabelsId);
this.ids = new ArrayList<Integer>(ids);
}
......@@ -36,14 +34,8 @@ public class DynamicPropertyDescriptor extends ClientPropertyDescriptor {
return ids.size();
}
public int getId() {
return id;
}
public List<Integer> getIds() {
return ids;
}
}
\ No newline at end of file
......@@ -20,15 +20,8 @@ package fr.ill.ics.nscclient.servant;
public class StandardPropertyDescriptor extends ClientPropertyDescriptor {
private int id;
public StandardPropertyDescriptor(int id, String name, String type) {
super(name, type);
this.id = id;
}
public int getId() {
return id;
public StandardPropertyDescriptor(int id, String name, String type, int enumeratedValuesId, int enumeratedLabelsId) {
super(id, name, type, enumeratedValuesId, enumeratedLabelsId);
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment