示例#1
0
		public IList FindProcessInstances(DateTime startedAfter, DateTime startedBefore, String initiatorActorId, String actorId, Int64 processDefinitionId, Relations relations, DbSession dbSession)
		{
			IList processInstances = null;
			String query = queryFindAllProcessInstances;
			ArrayList parameters = new ArrayList();
			ArrayList types = new ArrayList();

			if (startedAfter != DateTime.MinValue)
			{
				query += "and pi.StartNullable > ? ";
				parameters.Add(startedAfter);
				types.Add(DbType.DATE);
			}

			if (startedBefore != DateTime.MinValue)
			{
				query += "and pi.StartNullable < ? ";
				parameters.Add(startedBefore);
				types.Add(DbType.DATE);
			}

			if (initiatorActorId != null && initiatorActorId != "")
			{
				query += "and pi.InitiatorActorId = ? ";
				parameters.Add(initiatorActorId);
				types.Add(DbType.STRING);
			}

			if (actorId != null && actorId != "")
			{
				query += "and f.ActorId = ? ";
				parameters.Add(actorId);
				types.Add(DbType.STRING);
			}

			if (processDefinitionId != 0)
			{
				query += "and pi.ProcessDefinition.Id = ? ";
				parameters.Add(processDefinitionId);
				types.Add(DbType.LONG);
			}

			query += "order by pi.StartNullable desc";

			log.Debug("query for searching process instances : '" + query + "'");

			Object[] parameterArray = parameters.ToArray();
			IType[] typeArray = (IType[]) types.ToArray(typeof (IType));

			processInstances = dbSession.Find(query, parameterArray, typeArray);

			if (relations != null)
			{
				relations.Resolve(processInstances);
			}

			log.Debug("process instances : '" + processInstances + "'");

			return processInstances;
		}
        public IList FindAttributeInstanceByName(string attributeName,long scopeId,DbSession dbSession)
        {
            Object[] values = new Object[] { attributeName, scopeId };
            IType[] types = new IType[] { DbType.STRING, DbType.LONG };

            return dbSession.Find(queryFindAttributeInstanceByName, values, types);
        }
示例#3
0
		public IList GetProcessDefinitions(Relations relations, DbSession dbSession)
		{
			IList processDefinitions = null;
			processDefinitions = dbSession.Find(queryFindProcessDefinitions);
			if (relations != null)
			{
				relations.Resolve(processDefinitions);
			}
			return processDefinitions;
		}
示例#4
0
		public IList GetAllProcessDefinitions(Relations relations, DbSession dbSession)
		{
			IList processDefinitions = null;
			log.Debug("getting all process definitions...");
			processDefinitions = dbSession.Find(queryFindAllProcessDefinitions);
			if (relations != null)
			{
				relations.Resolve(processDefinitions);
			}
			return processDefinitions;
		}
示例#5
0
        public void RunActionsForEvent(EventType eventType, long definitionObjectId, ExecutionContextImpl executionContext,DbSession dbSession)
        {
            log.Debug("processing '" + eventType + "' events for executionContext " + executionContext);

            // find all actions for definitionObject on the given eventType
            Object[] values = new Object[] { eventType, definitionObjectId };
            IType[] types = new IType[] { DbType.INTEGER, DbType.LONG };

            IList actions = dbSession.Find(queryFindActionsByEventType, values, types);
            IEnumerator iter = actions.GetEnumerator();
            log.Debug("list" + actions);
            while (iter.MoveNext())
            {
                ActionImpl action = (ActionImpl)iter.Current;
                log.Debug("action: " + action);
                delegationHelper.DelegateAction(action.ActionDelegation, executionContext);
            }
            log.Debug("ende runActionsForEvent!");
        }
		public IList FindMembershipsByUserAndGroup(String userId, String groupId, Relations relations, DbSession dbSession)
		{
			IList memberships = null;
			try
			{
				Object[] args = new Object[] {userId, groupId};
				IType[] types = new IType[] {DbType.STRING, DbType.STRING};
				log.Debug("findMembershipsByUserAndGroup(" + userId + "," + groupId + "): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " + memberships);
				memberships = dbSession.Find(queryFindMembershipsByUserAndGroup, args, types);
				log.Debug("findMembershipsByUserAndGroup(" + userId + "," + groupId + "): " + memberships);
				if (relations != null)
					relations.Resolve(memberships);
			}
			catch (Exception t)
			{
				throw new OrganisationRuntimeException("organisation-exception : coudn't find memberships by user '" + userId + "' and group '" + groupId + "' : " + t.Message);
			}
			return memberships;
		}
		public IList FindUsersByGroupAndRole(String groupId, String role, Relations relations, DbSession dbSession)
		{
			IList users = null;
			try
			{
				Object[] args = new Object[] {groupId, role};
				IType[] types = new IType[] {DbType.STRING, DbType.STRING};
				users = dbSession.Find(queryFindUsersByGroupAndRole, args, types);
				if (relations != null)
					relations.Resolve(users);
			}
			catch (Exception t)
			{
				throw new OrganisationRuntimeException("organisation-exception : coudn't find users by group '" + groupId + "' and role '" + role + "' : " + t.Message);
			}
			return users;
		}
		public IList FindAllUsers(Relations relations, DbSession dbSession)
		{
			IList users = null;
			try
			{
				users = dbSession.Find(queryFindAllUsers);
				if (relations != null)
					relations.Resolve(users);
			}
			catch (Exception t)
			{
				throw new OrganisationRuntimeException("organisation-exception : coudn't find all users : " + t.Message);
			}
			return users;
		}
示例#9
0
 public IList GetOtherActiveConcurrentFlows(long flowId,DbSession dbSession)
 {
     return dbSession.Find(queryFindConcurrentFlows, flowId, DbType.LONG);
 }
示例#10
0
 public IList FindFieldsByState(long stateId,DbSession dbSession)
 {
     return dbSession.Find(queryFieldsByState, stateId, DbType.LONG);
 }
示例#11
0
 public IList FindTasks(string actorId,DbSession dbSession)
 {
     return dbSession.Find(queryFindTasks, actorId, DbType.STRING);
 }
示例#12
0
		private IList GetActorTaskList(String actorId, DbSession dbSession)
		{
			IList tasks = (IList) dbSession.Find(queryFindTasks, actorId, DbType.STRING);
			return tasks;
		}
示例#13
0
		public IActivityForm GetActivityForm(String authenticatedActorId, Int64 flowId, DbSession dbSession, IOrganisationSessionLocal organisationComponent)
		{
			IActivityForm activityForm = null;

			// First check if the actor is allowed to get this form
			authorizationHelper.CheckGetActivityForm(authenticatedActorId, flowId, dbSession);

			FlowImpl flow = (FlowImpl) dbSession.Load(typeof (FlowImpl), flowId);
			StateImpl state = (StateImpl) flow.Node;

			// create an executionContext for easy attributeValue retrieval    
			ExecutionContextImpl executionContext = new ExecutionContextImpl(null, flow, dbSession, organisationComponent);

			// create a convenient map from the attribute-names to the fields
			IList fields = dbSession.Find(queryFieldsByState, state.Id, DbType.LONG);
			IDictionary attributeValues = new Hashtable();
			IEnumerator iter = fields.GetEnumerator();
			while (iter.MoveNext())
			{
				FieldImpl field = (FieldImpl) iter.Current;
				if (FieldAccessHelper.IsReadable(field.Access) || FieldAccessHelper.IsWritable(field.Access))
				{
					// activity form contains only readable or writeable fields
					String attributeName = field.Attribute.Name;
					if (executionContext.GetAttribute(attributeName) != null)
					{
						// attribute might not exist (this will cause a warning already being logged previusly)
						attributeValues[attributeName] = executionContext.GetAttribute(attributeName);
					}
				}
			}

			activityForm = new ActivityFormImpl(flow, fields, attributeValues);

			return activityForm;
		}
示例#14
0
		public IActivityForm GetStartForm(String authenticatedActorId, Int64 processDefinitionId, DbSession dbSession, IOrganisationSessionLocal organisationComponent)
		{
			IActivityForm activityForm = null;

			// First check if the actor is allowed to get this form
			authorizationHelper.CheckGetStartForm(authenticatedActorId, processDefinitionId, dbSession);

			ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) dbSession.Load(typeof (ProcessDefinitionImpl), processDefinitionId);
			StartStateImpl startState = (StartStateImpl) processDefinition.StartState;

			// create a convenient map from the attribute-names to the fields
			IList fields = dbSession.Find(queryFieldsByState, startState.Id, DbType.LONG);
			IDictionary attributeValues = new Hashtable();
			IEnumerator iter = fields.GetEnumerator();
			while (iter.MoveNext())
			{
				FieldImpl field = (FieldImpl) iter.Current;

				// if the attribute has an initial value
				AttributeImpl attribute = (AttributeImpl) field.Attribute;
				String attributeName = attribute.Name;
				String initialValue = attribute.InitialValue;
				if ((Object) initialValue != null && (FieldAccessHelper.IsReadable(field.Access) || FieldAccessHelper.IsWritable(field.Access)))
				{
					// start form contains only fields that are readable or writable        

					// get it and store it in the attributeValues
					AttributeInstanceImpl attributeInstance = new AttributeInstanceImpl();
					attributeInstance.Attribute = attribute;
					attributeInstance.ValueText = initialValue;
					attributeValues[attributeName] = attributeInstance.GetValue();
				}
			}

			activityForm = new ActivityFormImpl(processDefinition, fields, attributeValues);

			return activityForm;
		}