Beispiel #1
0
        public static HqlCondition IsOfClass(string variable, Type[] classes)
        {
            var or = new HqlOr();

            foreach (var clazz in classes)
            {
                or.Conditions.Add(new HqlCondition(string.Format("{0}.class = {1}", variable, clazz.FullName)));
            }
            return(or);
        }
Beispiel #2
0
		/// <summary>
		/// Adds the specified criteria to the specified query, pre-pending the specified qualifier.
		/// </summary>
		/// <param name="qualifier"></param>
		/// <param name="criteria"></param>
		/// <param name="query"></param>
		/// <param name="remapHqlExprFunction"></param>
		/// <remarks>
		/// All HQL dot expressions are passed through the <paramref name="remapHqlExprFunction"/>, allowing the expression
		/// to be modified prior to be added to the query.
		/// </remarks>
		public static void AddCriteriaToQuery(string qualifier, WorklistItemSearchCriteria[] criteria, HqlProjectionQuery query,
			Converter<string, string> remapHqlExprFunction)
		{
			var or = new HqlOr();
			foreach (var c in criteria)
			{
				if(c.IsEmpty)
					continue;

				var conditions = HqlCondition.FromSearchCriteria(qualifier, c, remapHqlExprFunction);
				var and = new HqlAnd(conditions);
				if (and.Conditions.Count > 0)
					or.Conditions.Add(and);
			}

			if (or.Conditions.Count > 0)
				query.Conditions.Add(or);
		}
Beispiel #3
0
		private static HqlProjectionQuery BuildSentQuery(Notebox notebox, INoteboxQueryContext nqc, bool countQuery)
		{
			var query = GetBaseQuery(nqc, countQuery, "n", typeof(Note), SentItemProjection, SentItemsJoins);

			var or = new HqlOr();
			foreach (var criteria in notebox.GetInvariantCriteria(nqc))
			{
				var and = new HqlAnd();

				// for sent items, IsAcknowledged means fully acknowledged (all readers have acknowledged)
				and.Conditions.Add(new HqlCondition("n.IsFullyAcknowledged = ?", criteria.IsAcknowledged));

				if (criteria.SentByMe)
					and.Conditions.Add(new HqlCondition("n.Author = ?", nqc.Staff));

				or.Conditions.Add(and);
			}
			query.Conditions.Add(or);
			query.Conditions.Add(new HqlCondition("n.HasPostings = ?", true));

			if (!countQuery)
				query.Sorts.AddRange(SentItemOrdering);

			return query;
		}
Beispiel #4
0
		private static HqlProjectionQuery BuildInboxQuery(Notebox notebox, INoteboxQueryContext nqc, bool countQuery)
		{
			var query = GetBaseQuery(nqc, countQuery, "np", typeof(NotePosting), InboxItemProjection, InboxItemsJoins);

			var or = new HqlOr();
			foreach (var criteria in notebox.GetInvariantCriteria(nqc))
			{
				var and = new HqlAnd();
				and.Conditions.Add(new HqlCondition("np.IsAcknowledged = ?", criteria.IsAcknowledged));

				if (criteria.SentToMe)
					and.Conditions.Add(new HqlCondition("np.Recipient = ?", nqc.Staff));
				if (criteria.SentToGroupIncludingMe)
					and.Conditions.Add(new HqlCondition("np.Recipient = ?", nqc.StaffGroup));
				
				or.Conditions.Add(and);
			}
			query.Conditions.Add(or);
			//query.Conditions.Add(ConditionMostRecentNote);

			if (!countQuery)
				query.Sorts.AddRange(InboxItemOrdering);

			return query;
		}
Beispiel #5
0
		public static HqlCondition IsOfClass(string variable, Type[] classes)
		{
			var or = new HqlOr();
			foreach (var clazz in classes)
			{
				or.Conditions.Add(new HqlCondition(string.Format("{0}.class = {1}", variable, clazz.FullName)));
			}
			return or;
		}