Exemplo n.º 1
0
 public Task AddTask(HttpRequestMessage requestMessage, Task newTask)
 {
     return new Task
     {
         Subject = "In v1, newTask.Subject = " + newTask.Subject
     };
 }
Exemplo n.º 2
0
 public void AddLinks(Task task)
 {
     AddSelfLink(task);
     AddAllTasksLink(task);
     AddTaskUsersLink(task);
     AddAllStatusesLink(task);
     AddUpdateTaskLink(task);
     AddCreateNewTaskLink(task);
     AddDeleteUserLink(task);
     AddAddUserLink(task);
     AddDeleteUsersLink(task);
     AddReplaceUsersLink(task);
     AddWorkflowLink(task);
     AddLinksToChildObjects(task);
 }
 public virtual PropertyValueMapType GetPropertyValueMap(JObject taskFragment,
     Task taskContainingUpdateData)
 {
     var namesOfModifiedProperties = _updateablePropertyDetector
         .GetNamesOfPropertiesToUpdate<Task>(taskFragment).ToList();
     var propertyInfos = typeof(Task).GetProperties();
     var updatedPropertyValueMap = new PropertyValueMapType();
     foreach (var propertyName in namesOfModifiedProperties)
     {
         var propertyValue = propertyInfos.Single(x => x.Name == propertyName)
             .GetValue(taskContainingUpdateData);
         updatedPropertyValueMap.Add(propertyName, propertyValue);
     }
     return updatedPropertyValueMap;
 }
 public virtual void AddSelfLink(Task task)
 {
     if (task.TaskId != null)
         task.AddLink(GetSelfLink(task.TaskId.Value));
 }
 public void AddLinksToChildObjects(Task task)
 {
     task.Assignees.ForEach(x => _userLinkService.AddSelfLink(x));
 }
Exemplo n.º 6
0
 public virtual void AddReplaceUsersLink(Task task)
 {
     var pathFragment = string.Format("tasks/{0}/users", task.TaskId.Value);
     var link = _commonLinkService.GetLink(pathFragment, "replaceUsers", HttpMethod.Put);
     task.AddLink(link);
 }
Exemplo n.º 7
0
 public virtual void AddDeleteUserLink(Task task)
 {
     var pathFragment = string.Format("tasks/{0}/users/userId", task.TaskId.Value);
     var link = _commonLinkService.GetLink(pathFragment, "deleteUser", HttpMethod.Delete);
     task.AddLink(link);
 }
Exemplo n.º 8
0
 public virtual void AddCreateNewTaskLink(Task task)
 {
     const string pathFragment = "tasks";
     var link = _commonLinkService.GetLink(pathFragment, "createTask", HttpMethod.Post);
     task.AddLink(link);
 }
Exemplo n.º 9
0
 public virtual void AddAllTasksLink(Task task)
 {
     task.AddLink(GetAllTasksLink());
 }
Exemplo n.º 10
0
 public virtual void AddAllStatusesLink(Task task)
 {
     task.AddLink(_statusLinkService.GetAllStatusesLink());
 }
Exemplo n.º 11
0
        public virtual void AddWorkflowLink(Task task)
        {
            const int notStarted = 1;
            const int inProgress = 2;
            const int completed = 3;

            string pathFragment;
            string relValue;

            switch (task.Status.StatusId)
            {
                case notStarted:
                    pathFragment = string.Format("tasks/{0}/activations", task.TaskId.Value);
                    relValue = "activateTask";
                    break;
                case inProgress:
                    pathFragment = string.Format("tasks/{0}/completions", task.TaskId.Value);
                    relValue = "completeTask";
                    break;
                case completed:
                    pathFragment = string.Format("tasks/{0}/reactivations", task.TaskId.Value);
                    relValue = "re-activateTask";
                    break;
                default:
                    throw new InvalidOperationException("Invalid status: " + task.Status.StatusId);
            }

            var link = _commonLinkService.GetLink(pathFragment, relValue, HttpMethod.Put);
            task.AddLink(link);
        }
Exemplo n.º 12
0
 public virtual void AddUpdateTaskLink(Task task)
 {
     var pathFragment = string.Format("tasks/{0}", task.TaskId.Value);
     var link = _commonLinkService.GetLink(pathFragment, "updateTask", HttpMethod.Put);
     task.AddLink(link);
 }