/src/main/java/com/google/ie/business/service/ProjectService.java

http://thoughtsite.googlecode.com/ · Java · 123 lines · 20 code · 15 blank · 88 comment · 0 complexity · 4a0b2891cd703786333c74be685381ac MD5 · raw file

  1. /* Copyright 2010 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS.
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License
  14. */
  15. package com.google.ie.business.service;
  16. import com.google.appengine.api.datastore.Blob;
  17. import com.google.ie.business.domain.Idea;
  18. import com.google.ie.business.domain.Project;
  19. import com.google.ie.business.domain.User;
  20. import com.google.ie.dto.RetrievalInfo;
  21. import java.util.List;
  22. import java.util.Set;
  23. /**
  24. * A service specification for the Project entity
  25. *
  26. * @author Charanjeet singh
  27. */
  28. public interface ProjectService {
  29. /**
  30. * Creates and saves {@link Project} into data store.<br>
  31. * It creates a project from a published idea, when user submits details of
  32. * project.
  33. *
  34. * @param project The {@link Project} entity.
  35. * @param user The creator of project.
  36. * @return The created {@link Project}.
  37. */
  38. Project createOrUpdateProject(Project project, User user);
  39. /**
  40. * Returns {@link Project} on the basis for project key.
  41. *
  42. * @param key key id of project entity.
  43. * @return {@link Project} with full details.
  44. */
  45. Project getProjectById(String key);
  46. /**
  47. * Retrieves the list of projects by set of project keys.
  48. *
  49. * @param projectKeys Set of project keys.
  50. * @param retrievalInfo request parameters encapsulated in
  51. * {@link RetrievalInfo}.
  52. * @return List of {@link Project} entities.
  53. */
  54. List<Project> getProjects(Set<String> projectKeys, RetrievalInfo retrievalInfo);
  55. /**
  56. * This method return Image on the basis for key.
  57. *
  58. * @param key key id project entity.
  59. * @return object holding the bytes of image.
  60. */
  61. Blob getImageById(String key);
  62. /**
  63. * Returns the paginated list of projects, sorted by their updation date.
  64. *
  65. * @param retrievalInfo RetrievalInfo object representing the auxiliary
  66. * request information to be passed.
  67. * @return list of projects.
  68. */
  69. List<Project> listProjects(RetrievalInfo retrievalInfo);
  70. /**
  71. * Return the paginated list of projects created or joined by user,
  72. * sorted on their creation date.
  73. *
  74. * @param user The {@link User} object.
  75. * @param retrievalInfo {@link RetrievalInfo} object representing the
  76. * auxiliary information to be passed.
  77. * @return list of {@link Projects} created or joined by user.
  78. */
  79. List<Project> listProjects(User user, RetrievalInfo retrievalInfo);
  80. /**
  81. * Returns the details of project.
  82. *
  83. * @param project Project for which details are being fetched.
  84. * @return project details populated in {@link Project} object.
  85. */
  86. Project getDetails(Project project);
  87. /**
  88. * Retrieves the {@link Project} associated with an {@link Idea}.
  89. *
  90. * @param key {@link Idea} key.
  91. * @return List of {@link Projects}.
  92. */
  93. List<Project> getProjectsByIdeaKey(String ideaKey);
  94. /**
  95. * Retrieves the most recent projects.
  96. *
  97. * @return list containing most recent {@link Project} objects
  98. */
  99. List<Project> getRecentProjects();
  100. /**
  101. * Update project in data store.
  102. *
  103. * @param project {@link Project} to be updated in to data store.
  104. *
  105. * @return the updated project.
  106. */
  107. Project updateProject(Project project);
  108. }