diff options
| author | abranson <andrew.branson@cern.ch> | 2011-08-04 00:42:34 +0200 |
|---|---|---|
| committer | abranson <andrew.branson@cern.ch> | 2011-08-04 00:42:34 +0200 |
| commit | 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch) | |
| tree | 5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/collection/AggregationMember.java | |
| parent | 036cbdba66f804743c4c838ed598d6972c4b3e17 (diff) | |
More code cleanup:
Refactored Entity Proxy Subscription to handle generics better
Rewrote RemoteMap to use TreeMap instead of the internal array for
order. It now sorts its keys by number if they parse, else as strings.
Removed a no-longer-in-progress outcome form class
Diffstat (limited to 'source/com/c2kernel/collection/AggregationMember.java')
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/collection/AggregationMember.java | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/source/com/c2kernel/collection/AggregationMember.java b/source/com/c2kernel/collection/AggregationMember.java index 753f503..d383f02 100755..100644 --- a/source/com/c2kernel/collection/AggregationMember.java +++ b/source/com/c2kernel/collection/AggregationMember.java @@ -27,8 +27,8 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb {
private int mEntityKey = -1;
- private EntityProxy mEntity = null;
- private Collection mCollection = null;
+ private EntityProxy mEntity = null;
+ private Aggregation mCollection = null;
private String mClassProps = null;
String entityName;
Image image;
@@ -44,50 +44,55 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb mCollection = null;
}
- public void setEntityKey(int entityKey) {
- mEntityKey = entityKey;
+ @Override
+ public void setEntityKey(int entityKey) {
+ mEntityKey = entityKey;
entityName = null;
}
-
- public void setCollection(Collection aggregation)
+
+ public void setCollection(Aggregation aggregation)
{
mCollection = aggregation;
}
- public void setClassProps(String props)
+ @Override
+ public void setClassProps(String props)
{
mClassProps = props;
}
- public int getEntityKey()
+ @Override
+ public int getEntityKey()
{
return mEntityKey;
}
- public Collection getCollection()
+ public Aggregation getCollection()
{
return mCollection;
}
- public String getClassProps()
+ @Override
+ public String getClassProps()
{
return mClassProps;
}
- public void assignEntity(int entityKey) throws MembershipException
+ @Override
+ public void assignEntity(int entityKey) throws MembershipException
{
if (entityKey > -1) {
if (mClassProps == null || getProperties() == null)
throw new MembershipException("ClassProps not yet set. Cannot check membership validity.");
-
+
//for each mandatory prop check if its in the member property and has the matching value
StringTokenizer sub = new StringTokenizer(mClassProps, ",");
while (sub.hasMoreTokens())
{
- String aClassProp = sub.nextToken();
- try {
- String memberValue = (String)getProperties().get(aClassProp);
- Property entityProperty = (Property)Gateway.getStorage().get(entityKey, ClusterStorage.PROPERTY+"/"+aClassProp, null);
+ String aClassProp = sub.nextToken();
+ try {
+ String memberValue = (String)getProperties().get(aClassProp);
+ Property entityProperty = (Property)Gateway.getStorage().get(entityKey, ClusterStorage.PROPERTY+"/"+aClassProp, null);
if (entityProperty == null)
throw new MembershipException("Property "+aClassProp+ " does not exist for entityKey=" + entityKey );
if (entityProperty.getValue() == null || !entityProperty.getValue().equalsIgnoreCase(memberValue))
@@ -96,25 +101,27 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb catch (MembershipException ex) {
throw ex;
}
- catch (Exception ex)
+ catch (Exception ex)
{
Logger.error(ex);
throw new MembershipException("Error checking properties");
}
- }
+ }
}
-
+
mEntityKey = entityKey;
mEntity = null;
entityName = null;
}
-
- public void clearEntity() {
+
+ @Override
+ public void clearEntity() {
mEntityKey = -1;
mEntity = null;
}
-
- public EntityProxy resolveEntity() throws ObjectNotFoundException {
+
+ @Override
+ public EntityProxy resolveEntity() throws ObjectNotFoundException {
if (mEntity == null) {
try {
EntityPath path = new EntityPath(mEntityKey);
@@ -124,9 +131,9 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb }
}
return mEntity;
-
+
}
-
+
public Image getImage() {
if (image == null) {
image = Resource.getImageResource("typeicons/"+getProperties().get("Type")+"_16.png").getImage();
@@ -147,7 +154,7 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb else
entityName = "Empty";
}
-
+
return entityName;
}
|
