diff options
Diffstat (limited to 'source/com/c2kernel/collection/DependencyMember.java')
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/collection/DependencyMember.java | 53 |
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;
-
+
}
|
