summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/collection/DependencyMember.java
diff options
context:
space:
mode:
authorabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
committerabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
commit0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch)
tree5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/collection/DependencyMember.java
parent036cbdba66f804743c4c838ed598d6972c4b3e17 (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/DependencyMember.java')
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/collection/DependencyMember.java53
1 files changed, 32 insertions, 21 deletions
diff --git a/source/com/c2kernel/collection/DependencyMember.java b/source/com/c2kernel/collection/DependencyMember.java
index bb28c91..4ca2090 100755..100644
--- a/source/com/c2kernel/collection/DependencyMember.java
+++ b/source/com/c2kernel/collection/DependencyMember.java
@@ -24,7 +24,7 @@ public class DependencyMember implements CollectionMember
{
private int mEntityKey = -1;
- private EntityProxy mEntity = null;
+ private EntityProxy mEntity = null;
private int mId = -1;
private CastorHashMap mProperties = null;
private String mClassProps;
@@ -40,27 +40,31 @@ public class DependencyMember implements CollectionMember
}
- public void setEntityKey(int entityKey)
+ @Override
+ public void setEntityKey(int entityKey)
{
mEntityKey = entityKey;
- mEntity = null;
+ mEntity = null;
}
- public int getEntityKey()
+ @Override
+ public int getEntityKey()
{
return mEntityKey;
}
+ @Override
public void setProperties(CastorHashMap props)
{
mProperties = props;
}
+ @Override
public CastorHashMap getProperties()
{
return mProperties;
}
-
+
public KeyValuePair[] getKeyValuePairs()
{
return mProperties.getKeyValuePairs();
@@ -70,61 +74,68 @@ public class DependencyMember implements CollectionMember
mProperties.setKeyValuePairs(pairs);
}
+ @Override
public int getID() {
return mId;
}
+ @Override
public void setID(int id) {
mId = id;
}
- public void setClassProps(String props)
+ @Override
+ public void setClassProps(String props)
{
mClassProps = props;
}
- 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().equalsIgnoreCase(memberValue))
throw new MembershipException("DependencyMember::checkProperty() Values of mandatory prop "+aClassProp+" do not match " + entityProperty.getValue()+"!="+memberValue);
}
- catch (Exception ex)
+ catch (Exception ex)
{
Logger.error(ex);
throw new MembershipException("Error checking properties");
}
- }
+ }
}
-
+
mEntityKey = entityKey;
mEntity = 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);
@@ -134,7 +145,7 @@ public class DependencyMember implements CollectionMember
}
}
return mEntity;
-
+
}