/// <summary> /// Create a new Request with a name. /// </summary> /// <param name="name">The initial name of the entity.</param> /// <param name="project">The Project this Request will be in.</param> /// <param name="attributes">Required attributes.</param> /// <returns>A newly minted Request that exists in the VersionOne system.</returns> public Request Request(string name, Project project, IDictionary<string, object> attributes) { var request = new Request(instance); AddAttributes(request, attributes); request.Name = name; request.Project = project; AddAttributes(request, attributes); request.Save(); return request; }
/// <summary> /// Index a request /// </summary> /// <param name="request">request to index</param> private void Index(Request request) { Document doc = CreateDocument(request); if(null != request.Owner) { doc.Add(UnStored("Owner", request.Owner.Name)); doc.Add(UnStored("OwnerId", request.Owner.Username)); } doc.Add(UnStored("Reference", request.Reference)); if (null != request.Status) doc.Add(UnStored("Status", request.Status.CurrentValue)); if (null != request.Priority) doc.Add(UnStored("Priority", request.Priority.CurrentValue)); if (null != request.Source) doc.Add(UnStored("Source", request.Source.CurrentValue)); doc.Add(UnStored("RequestedBy", request.RequestedBy)); doc.Add(UnStored("ResolutionDetails", request.ResolutionDetails)); doc.Add(UnStored("ResolutionReason", request.ResolutionReason.CurrentValue)); if(null != request.Type) doc.Add(UnStored("Type", request.Type.CurrentValue)); _luceneIndexWriter.AddDocument(doc); }