summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntje Fuhrmann2013-01-21 07:36:37 (EST)
committerStephan Born2013-01-25 09:21:12 (EST)
commite9f36b59818f404c54324d95bcf07f76f183cea0 (patch)
tree768adbdc80257913587bc85c713148bb7a575ab4
parent429ca62eafe900123f3c4510bb6016821217ea65 (diff)
downloadorg.eclipse.stardust.engine-e9f36b59818f404c54324d95bcf07f76f183cea0.zip
org.eclipse.stardust.engine-e9f36b59818f404c54324d95bcf07f76f183cea0.tar.gz
org.eclipse.stardust.engine-e9f36b59818f404c54324d95bcf07f76f183cea0.tar.bz2
Jira-ID: CRNT-27308
Reverted changes of revision 62159. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/engine@62206 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/extensions/data/DefaultDataFilterExtension.java1
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java90
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java20
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java8
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/struct/spi/StructuredDataFilterExtension.java8
5 files changed, 48 insertions, 79 deletions
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/extensions/data/DefaultDataFilterExtension.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/extensions/data/DefaultDataFilterExtension.java
index 7fa3205..9585553 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/extensions/data/DefaultDataFilterExtension.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/extensions/data/DefaultDataFilterExtension.java
@@ -142,7 +142,6 @@ public class DefaultDataFilterExtension implements DataFilterExtension
cols.add(descriptor.fieldRef(DataValueBean.FIELD__TYPE_KEY));
cols.add(descriptor.fieldRef(DataValueBean.FIELD__STRING_VALUE));
- cols.add(descriptor.fieldRef(DataValueBean.FIELD__NUMBER_VALUE));
return cols;
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java
index 104b19e..a242d86 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java
@@ -34,7 +34,6 @@ import org.eclipse.stardust.engine.core.persistence.Operator.Binary;
import org.eclipse.stardust.engine.core.persistence.Operator.Ternary;
import org.eclipse.stardust.engine.core.persistence.Operator.Unary;
import org.eclipse.stardust.engine.core.persistence.jdbc.ITableDescriptor;
-import org.eclipse.stardust.engine.core.runtime.beans.ActivityInstanceBean;
import org.eclipse.stardust.engine.core.runtime.beans.BigData;
import org.eclipse.stardust.engine.core.runtime.beans.IDataValue;
import org.eclipse.stardust.engine.core.runtime.beans.IProcessInstance;
@@ -538,7 +537,7 @@ public abstract class AbstractAuthorization2Predicate implements Authorization2P
return false;
}
- public boolean isExcludedUser(long activityRtOid, long processInstanceOID, long modelOid, long dataValueOid)
+ public boolean isExcludedUser(long activityRtOid, long processInstanceOID, long modelOid)
{
if(processInstanceOID == 0)
{
@@ -562,79 +561,62 @@ public abstract class AbstractAuthorization2Predicate implements Authorization2P
{
IEventAction action = (IEventAction) l.next();
PluggableType type = action.getType();
- String instanceName = type
- .getStringAttribute(PredefinedConstants.ACTION_CLASS_ATT);
+ String instanceName = type.getStringAttribute(PredefinedConstants.ACTION_CLASS_ATT);
String excludeUserAction = PredefinedConstants.EXCLUDE_USER_ACTION_CLASS;
- Class classFromClassName = Reflect.getClassFromClassName(
- excludeUserAction, false);
- if (classFromClassName != null)
+ Class classFromClassName = Reflect.getClassFromClassName(excludeUserAction, false);
+ if(classFromClassName != null)
{
excludeUserAction = classFromClassName.getName();
}
-
+
if (instanceName.equals(excludeUserAction))
{
+ IProcessDefinition processDefinition = activity.getProcessDefinition();
+ IProcessInstance processInstance = ProcessInstanceBean.findByOID(processInstanceOID);
+
Map<String, Object> attributes = action.getAllAttributes();
- String dataId = (String) attributes
- .get(PredefinedConstants.EXCLUDED_PERFORMER_DATA);
+ String dataId = (String) attributes.get(PredefinedConstants.EXCLUDED_PERFORMER_DATA);
String dataPath = (String) attributes
.get(PredefinedConstants.EXCLUDED_PERFORMER_DATAPATH);
- IData data = ModelUtils.getData(activity.getProcessDefinition(),
- dataId);
- if (PredefinedConstants.LAST_ACTIVITY_PERFORMER.equals(data.getId()))
- {
- IUser lastActivityPerformer = ActivityInstanceBean
- .getLastActivityPerformer(processInstanceOID);
- Object value = lastActivityPerformer != null
- ? lastActivityPerformer.getPrimaryKey()
- : null;
- if (value instanceof UserPK)
- {
- try
- {
- dataValueOid = Long.parseLong(value.toString());
- }
- catch (NumberFormatException e)
- {
- }
- }
- }
- if (!StringUtils.isEmpty(dataPath))
+ IData data = ModelUtils.getData(processDefinition, dataId);
+ IDataValue dataValue = processInstance.getDataValue(data);
+
+ Object value = dataValue.getValue();
+ if(!StringUtils.isEmpty(dataPath))
{
- IProcessInstance processInstance = ProcessInstanceBean
- .findByOID(processInstanceOID);
- IDataValue dataValue = processInstance.getDataValue(data);
ExtendedAccessPathEvaluator evaluator = SpiUtils
- .createExtendedAccessPathEvaluator(data, dataPath);
+ .createExtendedAccessPathEvaluator(data, dataPath);
AccessPathEvaluationContext evaluationContext = new AccessPathEvaluationContext(
- processInstance, null, null, null);
- Object value = evaluator.evaluate(data, dataValue.getValue(),
- dataPath, evaluationContext);
- if (value instanceof Long)
+ processInstance, null, null, null);
+ value = evaluator.evaluate(data, dataValue.getValue(), dataPath, evaluationContext);
+ }
+
+ Long longValue = null;
+ if(value instanceof Long)
+ {
+ longValue = (Long) value;
+ }
+ else if(value instanceof UserPK)
+ {
+ try
{
- dataValueOid = (Long) value;
+ longValue = Long.parseLong(value.toString());
}
- else if (value instanceof UserPK)
+ catch (NumberFormatException e)
{
- try
- {
- dataValueOid = Long.parseLong(value.toString());
- }
- catch (NumberFormatException e)
- {
- }
- }
+ }
}
-
- if (currentPerformer == dataValueOid)
+
+ if(longValue != null && currentPerformer == longValue)
{
return true;
- }
+ }
}
}
}
}
}
- return false;
- }
+
+ return false;
+ }
} \ No newline at end of file
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java
index 760fe8a..2cea138 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java
@@ -19,7 +19,6 @@ import org.eclipse.stardust.engine.api.query.ExcludeUserPolicy;
import org.eclipse.stardust.engine.api.query.Query;
import org.eclipse.stardust.engine.core.persistence.FieldRef;
import org.eclipse.stardust.engine.core.runtime.beans.ActivityInstanceBean;
-import org.eclipse.stardust.engine.core.runtime.beans.DataValueBean;
import org.eclipse.stardust.engine.core.runtime.beans.IActivityInstance;
/**
@@ -83,23 +82,10 @@ public class ActivityInstanceAuthorization2Predicate extends AbstractAuthorizati
long processInstanceOid = rs.getLong(ActivityInstanceBean.FIELD__PROCESS_INSTANCE);
long departmentOid = rs.getLong(ActivityInstanceBean.FIELD__CURRENT_DEPARTMENT);
- if (excludeUserPolicy)
+ if(excludeUserPolicy && isExcludedUser(activityRtOid, processInstanceOid, modelOid))
{
- long dataValueOid = 0;
- try
- {
- dataValueOid = rs.getLong(DataValueBean.FIELD__NUMBER_VALUE);
- }
- catch (SQLException x)
- {
- // leave it to 0 if column cannot be found
- }
- if (isExcludedUser(activityRtOid, processInstanceOid, modelOid,
- dataValueOid))
- {
- return false;
- }
- }
+ return false;
+ }
context.setActivityData(processInstanceOid, activityRtOid, modelOid, currentPerformer,
currentUserPerformer, departmentOid);
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java
index 04ff1cc..1849825 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.stardust.engine.core.runtime.utils;
+import java.lang.reflect.UndeclaredThrowableException;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -34,7 +35,7 @@ import org.eclipse.stardust.engine.core.runtime.beans.WorkItemBean;
public class WorkItemAuthorization2Predicate extends AbstractAuthorization2Predicate
{
private static final Logger trace = LogManager.getLogger(WorkItemAuthorization2Predicate.class);
-
+
public boolean addPrefetchDataHints(Query query)
{
boolean returnValue = super.addPrefetchDataHints(query);
@@ -83,11 +84,9 @@ public class WorkItemAuthorization2Predicate extends AbstractAuthorization2Predi
long performer = rs.getLong(WorkItemBean.FIELD__PERFORMER);
long scopeProcessInstanceOid = 0;
- long dataValueOid = 0;
try
{
scopeProcessInstanceOid = rs.getLong(WorkItemBean.FIELD__SCOPE_PROCESS_INSTANCE);
- dataValueOid = rs.getLong(DataValueBean.FIELD__NUMBER_VALUE);
}
catch (SQLException x)
{
@@ -121,8 +120,7 @@ public class WorkItemAuthorization2Predicate extends AbstractAuthorization2Predi
return false;
}
- if (isExcludedUser(activityRtOid, scopeProcessInstanceOid, modelOid,
- dataValueOid))
+ if(isExcludedUser(activityRtOid, scopeProcessInstanceOid, modelOid))
{
return false;
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/struct/spi/StructuredDataFilterExtension.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/struct/spi/StructuredDataFilterExtension.java
index 5090893..16db49c 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/struct/spi/StructuredDataFilterExtension.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/struct/spi/StructuredDataFilterExtension.java
@@ -46,7 +46,12 @@ import org.eclipse.stardust.engine.core.persistence.PredicateTerm;
import org.eclipse.stardust.engine.core.persistence.Predicates;
import org.eclipse.stardust.engine.core.persistence.QueryDescriptor;
import org.eclipse.stardust.engine.core.persistence.jdbc.ITableDescriptor;
-import org.eclipse.stardust.engine.core.runtime.beans.*;
+import org.eclipse.stardust.engine.core.runtime.beans.BigData;
+import org.eclipse.stardust.engine.core.runtime.beans.LargeStringHolderBigDataHandler;
+import org.eclipse.stardust.engine.core.runtime.beans.ModelManager;
+import org.eclipse.stardust.engine.core.runtime.beans.ModelManagerFactory;
+import org.eclipse.stardust.engine.core.runtime.beans.ProcessInstanceBean;
+import org.eclipse.stardust.engine.core.runtime.beans.ProcessInstanceScopeBean;
import org.eclipse.stardust.engine.core.spi.extensions.runtime.DataFilterExtension;
import org.eclipse.stardust.engine.core.spi.extensions.runtime.DataFilterExtensionContext;
import org.eclipse.stardust.engine.core.struct.DataXPathMap;
@@ -661,7 +666,6 @@ public class StructuredDataFilterExtension implements DataFilterExtension, State
cols.add(descriptor.fieldRef(StructuredDataValueBean.FIELD__TYPE_KEY));
cols.add(descriptor.fieldRef(StructuredDataValueBean.FIELD__STRING_VALUE));
- cols.add(descriptor.fieldRef(StructuredDataValueBean.FIELD__NUMBER_VALUE));
return cols;
}