/// <summary>
 /// Logs an event for processing.
 /// </summary>
 /// <param name="targetType">The workflow type to log.</param>
 /// <param name="itemProperties">The workflow type identifying information of the workflow to log.</param>
 /// <param name="oldStateName">The current workflow state to log.</param>
 /// <param name="newStateName">The new workflow state to log.</param>
 protected override void DoLogEvent(WorkflowTargetType targetType, Dictionary<string, string> itemProperties, string oldStateName, string newStateName)
 {
     MongoCollection<BsonDocument> collection = this.Database.GetCollection(iApplyDb.Event._COLLECTION_NAME);
     BsonDocument doc = new BsonDocument
                        {
                            { iApplyDb.Event.TARGET_TYPE, new BsonString(targetType.ToString()) },
                            { iApplyDb.Event.TARGET_PROPERTIES, new BsonDocument(itemProperties) },
                            { iApplyDb.Event.PREVIOUS_STATE, string.IsNullOrEmpty(oldStateName) ? BsonValue.Create(BsonNull.Value) : new BsonString(oldStateName) },
                            { iApplyDb.Event.NEW_STATE, new BsonString(newStateName) },
                            { iApplyDb.Event.RAISED, new BsonDateTime(DateTime.Now) },
                            { iApplyDb.Event.PROCESSED, new BsonBoolean(false) }
                        };
     collection.Save(doc);
 }
        /// <summary>
        /// Finds the workflow configurations that match the criteria.
        /// </summary>
        /// <param name="workflowType">The type of workflows to find.</param>
        /// <param name="externalCriteria">Filter the list to those with a matching external id.</param>
        /// <returns>The workflow configurations that match the criteria.</returns>
        protected override WorkflowConfigurationContainerList DoFindWorkflowConfigurations(WorkflowTargetType workflowType, Dictionary<string, int> externalCriteria)
        {
            BsonString bsonWorkflowType = new BsonString(workflowType.ToString());
            IEnumerable<IMongoQuery> formCriteria = externalCriteria.Select(kvp =>
                Query.And(
                    Query.EQ(iApplyDb.WorkflowConfiguration.EXTERNAL_ID, new BsonString(kvp.Key)),
                    Query.EQ(iApplyDb.WorkflowConfiguration.EXTERNAL_VERSION, new BsonInt32(kvp.Value))));

            var eqQuery = Query.EQ(iApplyDb.WorkflowConfiguration.TYPE, bsonWorkflowType);

            IMongoQuery query = formCriteria.Any() ?
                Query.And(Query.Or(formCriteria), eqQuery) :
                eqQuery;

            MongoCollection<BsonDocument> collection = this.Database.GetCollection(iApplyDb.WorkflowConfiguration._COLLECTION_NAME);
            MongoCursor<BsonDocument> documents = collection.Find(query);
            WorkflowConfigurationContainerList list = BsonConverter.ConvertToObjectViaJson<WorkflowConfigurationContainerList>(documents);
            return list;
        }
Ejemplo n.º 3
0
 public void Raise(WorkflowTargetType targetType, Dictionary<string, string> itemProperties, string oldStateName, string newStateName)
 {
 }
        /// <summary>
        /// Gets the <see cref="WorkflowConfiguration"/> matching the
        /// <paramref name="workflowType"/> and <paramref name="externalId"/>.
        /// </summary>
        /// <param name="workflowType">The workflow type to retrieve.</param>
        /// <param name="externalId">The workflow type reference id of the workflow to retrieve.</param>
        /// <param name="externalVersion">The version number of the workflow configuration to retrieve.</param>
        /// <returns>The <see cref="WorkflowConfiguration"/> matching the
        /// <paramref name="workflowType"/> and <paramref name="externalId"/>.</returns>
        protected override WorkflowConfigurationContainer DoGetWorkflowConfiguration(WorkflowTargetType workflowType, string externalId, int externalVersion)
        {
            BsonString bsonWorkflowType = new BsonString(workflowType.ToString());
            BsonString bsonExternalId = new BsonString(externalId);
            BsonInt32 bsonExternalVersion = new BsonInt32(externalVersion);

            MongoCollection<BsonDocument> collection = this.Database.GetCollection(iApplyDb.WorkflowConfiguration._COLLECTION_NAME);
            IMongoQuery query =
                Query.And(
                    Query.EQ(iApplyDb.WorkflowConfiguration.TYPE, bsonWorkflowType),
                    Query.EQ(iApplyDb.WorkflowConfiguration.EXTERNAL_ID, bsonExternalId),
                    Query.EQ(iApplyDb.WorkflowConfiguration.EXTERNAL_VERSION, bsonExternalVersion));

            BsonDocument document = collection.FindOne(query);
            if (document == null)
            {
                return null;
            }

            return BsonConverter.ConvertToObjectViaJson<WorkflowConfigurationContainer>(document);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Gets the <see cref="WorkflowConfiguration"/> matching the
 /// <paramref name="workflowType"/> and <paramref name="externalId"/>.
 /// </summary>
 /// <param name="workflowType">The workflow type to retrieve.</param>
 /// <param name="externalId">The workflow type reference id of the workflow to retrieve.</param>
 /// <param name="externalVersion">The version number of the workflow configuration to retrieve.</param>
 /// <returns>The <see cref="WorkflowConfiguration"/> matching the
 /// <paramref name="workflowType"/> and <paramref name="externalId"/>.</returns>
 protected abstract WorkflowConfigurationContainer DoGetWorkflowConfiguration(WorkflowTargetType workflowType, string externalId, int externalVersion);
 /// <summary>
 /// Raises a workflow event.
 /// </summary>
 /// <param name="targetType">The type of the workflow object.</param>
 /// <param name="itemProperties">The item properties to be raised as event arguments.</param>
 /// <param name="oldStateName">The previous state of the item.</param>
 /// <param name="newStateName">The new state of the item.</param>
 public void Raise(WorkflowTargetType targetType, Dictionary<string, string> itemProperties, string oldStateName, string newStateName)
 {
     this.dataAccess.LogEvent(targetType, itemProperties, oldStateName, newStateName);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Finds the workflow configurations that match the criteria.
 /// </summary>
 /// <param name="workflowType">The type of workflows to find.</param>
 /// <param name="externalCriteria">Filter the list to those with a matching external id.</param>
 /// <returns>The workflow configurations that match the criteria.</returns>
 protected abstract WorkflowConfigurationContainerList DoFindWorkflowConfigurations(WorkflowTargetType workflowType, Dictionary<string, int> externalCriteria);
Ejemplo n.º 8
0
 /// <summary>
 /// Logs an event for processing.
 /// </summary>
 /// <param name="targetType">The workflow type to log.</param>
 /// <param name="itemProperties">The workflow type identifying information of the workflow to log.</param>
 /// <param name="currentState">The current workflow state to log.</param>
 /// <param name="newState">The new workflow state to log.</param>
 public void LogEvent(WorkflowTargetType targetType, Dictionary<string, string> itemProperties, string currentState, string newState)
 {
     this.DoLogEvent(targetType, itemProperties, currentState, newState);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Gets the <see cref="WorkflowConfiguration"/> matching the
 /// <paramref name="workflowType"/> and <paramref name="externalId"/>.
 /// </summary>
 /// <param name="workflowType">The workflow type to retrieve.</param>
 /// <param name="externalId">The workflow type reference id of the workflow to retrieve.</param>
 /// <param name="externalVersion">The version number of the workflow configuration to retrieve.</param>
 /// <returns>The <see cref="WorkflowConfiguration"/> matching the
 /// <paramref name="workflowType"/> and <paramref name="externalId"/>.</returns>
 public WorkflowConfigurationContainer GetWorkflowConfiguration(WorkflowTargetType workflowType, string externalId, int externalVersion)
 {
     return this.DoGetWorkflowConfiguration(workflowType, externalId, externalVersion);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Finds the workflow configurations that match the criteria.
 /// </summary>
 /// <param name="workflowType">The type of workflows to find.</param>
 /// <param name="externalCriteria">Filter the list to those with a matching external id.</param>
 /// <returns>The workflow configurations that match the criteria.</returns>
 public WorkflowConfigurationContainerList FindWorkflowConfigurations(WorkflowTargetType workflowType, Dictionary<string, int> externalCriteria)
 {
     return this.DoFindWorkflowConfigurations(workflowType, externalCriteria);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Logs an event for processing.
 /// </summary>
 /// <param name="targetType">The workflow type to log.</param>
 /// <param name="itemProperties">The workflow type identifying information of the workflow to log.</param>
 /// <param name="oldStateName">The current workflow state to log.</param>
 /// <param name="newStateName">The new workflow state to log.</param>
 protected abstract void DoLogEvent(WorkflowTargetType targetType, Dictionary<string, string> itemProperties, string oldStateName, string newStateName);