Package org.silverpeas.components.resourcesmanager.service

## Class SimpleResourcesManager

- java.lang.Object
- - org.silverpeas.components.resourcesmanager.service.SimpleResourcesManager

- All Implemented Interfaces:
    `Serializable`, `ResourcesManager`

      @Service
      public class SimpleResourcesManager
      extends Object
      implements ResourcesManager, Serializable

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SimpleResourcesManager()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `createCategory​(Category category)` | Creating a new resource category.
    `void` | `createResource​(Resource resource)` |
    `void` | `deleteCategory​(Long id, String componentId)` |
    `void` | `deleteReservation​(Long id, String componentId)` |
    `void` | `deleteResource​(Long id, String componentId)` |
    `List<Category>` | `getCategories​(String instanceId)` |
    `Category` | `getCategory​(Long id)` |
    `List<ResourceValidator>` | `getManagers​(long resourceId)` |
    `Reservation` | `getReservation​(String instanceId, Long reservationId)` |
    `List<Reservation>` | `getReservationForValidation​(String instanceId, String userId, org.silverpeas.core.date.period.Period period)` |
    `List<Reservation>` | `getReservationOfUser​(String instanceId, Integer userId, org.silverpeas.core.date.period.Period period)` |
    `List<Reservation>` | `getReservations​(String instanceId)` |
    `List<Reservation>` | `getReservationWithResource​(String instanceId, Integer userId, org.silverpeas.core.date.period.Period period, Long resourceId)` |
    `List<Reservation>` | `getReservationWithResourcesOfCategory​(String instanceId, Integer userId, org.silverpeas.core.date.period.Period period, Long categoryId)` |
    `List<Resource>` | `getReservedResources​(String instanceId, List<Long> resources, Date startDate, Date endDate)` | Get from the given aimed resources those that are unavailable on the given period.
    `List<Resource>` | `getReservedResources​(String instanceId, List<Long> aimedResourceIds, Date startDate, Date endDate, Long reservationIdToSkip)` | Get from the given aimed resources those that are unavailable on the given period.
    `Resource` | `getResource​(Long id)` |
    `String` | `getResourceOfReservationStatus​(Long resourceId, Long reservationId)` |
    `List<Resource>` | `getResourcesByCategory​(Long categoryId)` |
    `List<Resource>` | `getResourcesOfReservation​(String instanceId, Long reservationId)` |
    `List<Resource>` | `getResourcesReservable​(String instanceId, Date startDate, Date endDate)` |
    `List<Reservation>` | `getUserReservations​(String instanceId, String userId)` |
    `void` | `indexResourceManager​(String instanceId)` |
    `boolean` | `isManager​(long userId, long resourceId)` |
    `void` | `saveReservation​(Reservation reservation, List<Long> resourceIds)` |
    `void` | `updateCategory​(Category category)` |
    `void` | `updateReservation​(Reservation reservation, List<Long> resourceIds, boolean updateDate)` |
    `void` | `updateReservedResourceStatus​(long reservationId, long resourceId, String status)` |
    `void` | `updateResource​(Resource updatedResource, List<Long> managerIds)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleResourcesManager

          public SimpleResourcesManager()

  - ### Method Detail

    - #### createCategory

          public void createCategory​(Category category)

      Creating a new resource category.
      Specified by:
        `createCategory` in interface `ResourcesManager`
      Parameters:
        `category` - the category to create

    - #### getCategories

          public List<Category> getCategories​(String instanceId)

      Specified by:
        `getCategories` in interface `ResourcesManager`

    - #### getCategory

          public Category getCategory​(Long id)

      Specified by:
        `getCategory` in interface `ResourcesManager`

    - #### updateCategory

          public void updateCategory​(Category category)

      Specified by:
        `updateCategory` in interface `ResourcesManager`

    - #### deleteCategory

          public void deleteCategory​(Long id,
                                     String componentId)

      Specified by:
        `deleteCategory` in interface `ResourcesManager`

    - #### createResource

          public void createResource​(Resource resource)

      Specified by:
        `createResource` in interface `ResourcesManager`

    - #### getResource

          public Resource getResource​(Long id)

      Specified by:
        `getResource` in interface `ResourcesManager`

    - #### getResourcesByCategory

          public List<Resource> getResourcesByCategory​(Long categoryId)

      Specified by:
        `getResourcesByCategory` in interface `ResourcesManager`

    - #### deleteResource

          public void deleteResource​(Long id,
                                     String componentId)

      Specified by:
        `deleteResource` in interface `ResourcesManager`

    - #### getResourcesReservable

          public List<Resource> getResourcesReservable​(String instanceId,
                                                       Date startDate,
                                                       Date endDate)

      Specified by:
        `getResourcesReservable` in interface `ResourcesManager`

    - #### getResourcesOfReservation

          public List<Resource> getResourcesOfReservation​(String instanceId,
                                                          Long reservationId)

      Specified by:
        `getResourcesOfReservation` in interface `ResourcesManager`

    - #### updateReservation

          public void updateReservation​(Reservation reservation,
                                        List<Long> resourceIds,
                                        boolean updateDate)

      Specified by:
        `updateReservation` in interface `ResourcesManager`

    - #### getReservedResources

          public List<Resource> getReservedResources​(String instanceId,
                                                     List<Long> resources,
                                                     Date startDate,
                                                     Date endDate)

      Get from the given aimed resources those that are unavailable on the given period.
      Specified by:
        `getReservedResources` in interface `ResourcesManager`
      Parameters:
        `instanceId` - the current component instance identifier
        `resources` - the list of resource identifiers
        `startDate` - the start date
        `endDate` - the end date
      Returns:
        a list of reserved resources

    - #### getReservedResources

          public List<Resource> getReservedResources​(String instanceId,
                                                     List<Long> aimedResourceIds,
                                                     Date startDate,
                                                     Date endDate,
                                                     Long reservationIdToSkip)

      Get from the given aimed resources those that are unavailable on the given period. Resources attached to reservationIdToSkip are excluded (but can still be returned if they are attached to another reservation on the given period).
      Specified by:
        `getReservedResources` in interface `ResourcesManager`
      Parameters:
        `instanceId` - the current component instance identifier
        `aimedResourceIds` - the identifiers of the resources to get.
        `startDate` - the start date
        `endDate` - the end date
        `reservationIdToSkip` - the unique identifier of the reservation to skip.
      Returns:
        a list of reserved resources.

    - #### getReservations

          public List<Reservation> getReservations​(String instanceId)

      Specified by:
        `getReservations` in interface `ResourcesManager`

    - #### getUserReservations

          public List<Reservation> getUserReservations​(String instanceId,
                                                       String userId)

      Specified by:
        `getUserReservations` in interface `ResourcesManager`

    - #### getReservation

          public Reservation getReservation​(String instanceId,
                                            Long reservationId)

      Specified by:
        `getReservation` in interface `ResourcesManager`

    - #### deleteReservation

          public void deleteReservation​(Long id,
                                        String componentId)

      Specified by:
        `deleteReservation` in interface `ResourcesManager`

    - #### getReservationForValidation

          public List<Reservation> getReservationForValidation​(String instanceId,
                                                               String userId,
                                                               org.silverpeas.core.date.period.Period period)

      Specified by:
        `getReservationForValidation` in interface `ResourcesManager`

    - #### getReservationOfUser

          public List<Reservation> getReservationOfUser​(String instanceId,
                                                        Integer userId,
                                                        org.silverpeas.core.date.period.Period period)

      Specified by:
        `getReservationOfUser` in interface `ResourcesManager`

    - #### getReservationWithResourcesOfCategory

          public List<Reservation> getReservationWithResourcesOfCategory​(String instanceId,
                                                                         Integer userId,
                                                                         org.silverpeas.core.date.period.Period period,
                                                                         Long categoryId)

      Specified by:
        `getReservationWithResourcesOfCategory` in interface `ResourcesManager`

    - #### getReservationWithResource

          public List<Reservation> getReservationWithResource​(String instanceId,
                                                              Integer userId,
                                                              org.silverpeas.core.date.period.Period period,
                                                              Long resourceId)

      Specified by:
        `getReservationWithResource` in interface `ResourcesManager`

    - #### getResourceOfReservationStatus

          public String getResourceOfReservationStatus​(Long resourceId,
                                                       Long reservationId)

      Specified by:
        `getResourceOfReservationStatus` in interface `ResourcesManager`

    - #### indexResourceManager

          public void indexResourceManager​(String instanceId)

      Specified by:
        `indexResourceManager` in interface `ResourcesManager`

    - #### getManagers

          public List<ResourceValidator> getManagers​(long resourceId)

      Specified by:
        `getManagers` in interface `ResourcesManager`

    - #### saveReservation

          public void saveReservation​(Reservation reservation,
                                      List<Long> resourceIds)

      Specified by:
        `saveReservation` in interface `ResourcesManager`

    - #### updateReservedResourceStatus

          public void updateReservedResourceStatus​(long reservationId,
                                                   long resourceId,
                                                   String status)

      Specified by:
        `updateReservedResourceStatus` in interface `ResourcesManager`

    - #### isManager

          public boolean isManager​(long userId,
                                   long resourceId)

      Specified by:
        `isManager` in interface `ResourcesManager`

    - #### updateResource

          public void updateResource​(Resource updatedResource,
                                     List<Long> managerIds)

      Specified by:
        `updateResource` in interface `ResourcesManager`