Package org.silverpeas.components.classifieds.service

## Interface ClassifiedService

- All Superinterfaces:
    `org.silverpeas.core.ApplicationService`
  All Known Implementing Classes:
    `DefaultClassifiedService`

      public interface ClassifiedService
      extends org.silverpeas.core.ApplicationService

  Services provided by the Classified Silverpeas component. It has to be managed by the IoC container under the name classifiedService.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `createClassified​(ClassifiedDetail classified)` | create a classified
    `void` | `createSubscribe​(Subscribe subscribe)` | create a subscription
    `void` | `deleteAllClassifieds​(String instanceId)` | delete all classifieds for the instance corresponding to instanceId
    `void` | `deleteAllSubscribes​(String instanceId)` | delete all subscriptions for the instance corresponding to instanceId
    `void` | `deleteClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)` | delete the classified corresponding to classifiedId
    `void` | `deleteSubscribe​(String subscribeId)` | delete a subscription corresponding to subscribeId
    `void` | `draftInClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)` | pass the classified corresponding to classifiedId in draft mode
    `void` | `draftOutClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId, String profile, boolean isValidationEnabled)` | take out draft mode the classified corresponding to classified
    `Collection<ClassifiedDetail>` | `getAllClassifieds​(String instanceId)` | get all classifieds for an instance corresponding to instanceId
    `Collection<ClassifiedDetail>` | `getAllClassifiedsToUnpublish​(int nbDays, String instanceId)` | get all expiring classifieds (corresponding of a number of day nbDays)
    `List<ClassifiedDetail>` | `getAllValidClassifieds​(String instanceId)` |
    `List<ClassifiedDetail>` | `getAllValidClassifieds​(String instanceId, String searchField1, String searchField2, int firstItemIndex, int elementsPerPage)` | get all valid classifieds
    `List<ClassifiedDetail>` | `getClassifiedsByUser​(String instanceId, String userId)` | get all classifieds for user and instance corresponding to userId and instanceId
    `List<ClassifiedDetail>` | `getClassifiedsToValidate​(String instanceId)` | get all classifieds to validate for an instance corresponding to instanceId
    `Optional<ClassifiedDetail>` | `getContributionById​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)` |
    `String` | `getNbTotalClassifieds​(String instanceId)` | get the number of classifieds for an instance corresponding to instanceId
    `Collection<Subscribe>` | `getSubscribesByUser​(String instanceId, String userId)` | get all subscriptions for user and instance corresponding to userId and instanceId
    `Collection<String>` | `getUsersBySubscribe​(String field1, String field2)` | get all subscribing users to a search corresponding to fields field1 and field2
    `void` | `indexClassifieds​(String instanceId)` | index all the classifieds for the instance corresponding to instanceId
    `void` | `refusedClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId, String userId, String refusalMotive)` | pass to status refused because the user corresponding to userId refused the classified corresponding to classifiedId for the given motive.
    `List<ClassifiedDetail>` | `search​(org.silverpeas.core.index.search.model.QueryDescription query)` | search all classifieds corresponding to the query
    `void` | `sendSubscriptionsNotification​(String field1, String field2, ClassifiedDetail classified)` | send a notification for subscribers to field1 and field2 when classified modified
    `void` | `setClassification​(ClassifiedDetail classified, String searchField1, String searchField2, String xmlFormName)` |
    `void` | `unpublishClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)` | Unpublish a subscription corresponding to classifiedId
    `void` | `updateClassified​(ClassifiedDetail classified, boolean notify)` | update the classified and send notification if notify is true
    `void` | `validateClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId, String userId)` | pass to status validate because the user corresponding to userId validated the classified corresponding to classifiedId

    - ### Methods inherited from interface org.silverpeas.core.ApplicationService

      `getComponentMessages, getComponentSettings, isRelatedTo`

- - ### Method Detail

    - #### getContributionById

          Optional<ClassifiedDetail> getContributionById​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)

      Specified by:
        `getContributionById` in interface `org.silverpeas.core.ApplicationService`

    - #### createClassified

          String createClassified​(ClassifiedDetail classified)

      create a classified
      Parameters:
        `classified` - : ClassifiedDetail
      Returns:
        classifiedId : String

    - #### updateClassified

          void updateClassified​(ClassifiedDetail classified,
                                boolean notify)

      update the classified and send notification if notify is true
      Parameters:
        `classified` - : ClassifiedDetail
        `notify` - : boolean

    - #### deleteClassified

          void deleteClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)

      delete the classified corresponding to classifiedId
      Parameters:
        `classifiedId` - the unique identifier of the classified.

    - #### deleteAllClassifieds

          void deleteAllClassifieds​(String instanceId)

      delete all classifieds for the instance corresponding to instanceId
      Parameters:
        `instanceId` - : String

    - #### draftInClassified

          void draftInClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)

      pass the classified corresponding to classifiedId in draft mode
      Parameters:
        `classifiedId` - the unique identifier of the classified

    - #### draftOutClassified

          void draftOutClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId,
                                  String profile,
                                  boolean isValidationEnabled)

      take out draft mode the classified corresponding to classified
      Parameters:
        `classifiedId` - the unique identifier of the classified
        `profile` - a role profile of the user performing the action.
        `isValidationEnabled` - is the validation enabled?

    - #### getAllClassifieds

          Collection<ClassifiedDetail> getAllClassifieds​(String instanceId)

      get all classifieds for an instance corresponding to instanceId
      Parameters:
        `instanceId` - : String
      Returns:
        a collection of ClassifiedDetail

    - #### getClassifiedsByUser

          List<ClassifiedDetail> getClassifiedsByUser​(String instanceId,
                                                      String userId)

      get all classifieds for user and instance corresponding to userId and instanceId
      Parameters:
        `instanceId` - : String
        `userId` - : String
      Returns:
        a collection of ClassifiedDetail

    - #### getNbTotalClassifieds

          String getNbTotalClassifieds​(String instanceId)

      get the number of classifieds for an instance corresponding to instanceId
      Parameters:
        `instanceId` - : String
      Returns:
        the number of classified : String

    - #### getClassifiedsToValidate

          List<ClassifiedDetail> getClassifiedsToValidate​(String instanceId)

      get all classifieds to validate for an instance corresponding to instanceId
      Parameters:
        `instanceId` - : String
      Returns:
        a Collection of ClassifiedDetail

    - #### refusedClassified

          void refusedClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId,
                                 String userId,
                                 String refusalMotive)

      pass to status refused because the user corresponding to userId refused the classified corresponding to classifiedId for the given motive.
      Parameters:
        `classifiedId` - unique identifier of a classified
        `userId` - unique identifier of the user refusing the classified
        `refusalMotive` - the text about the motive of the refusal

    - #### validateClassified

          void validateClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId,
                                  String userId)

      pass to status validate because the user corresponding to userId validated the classified corresponding to classifiedId
      Parameters:
        `classifiedId` - the unique identifier of a classified.
        `userId` - the unique identifier of the user validating the classified.

    - #### search

          List<ClassifiedDetail> search​(org.silverpeas.core.index.search.model.QueryDescription query)

      search all classifieds corresponding to the query
      Parameters:
        `query` - the query from which the search will be performed.
      Returns:
        a collection of ClassifiedDetail

    - #### indexClassifieds

          void indexClassifieds​(String instanceId)

      index all the classifieds for the instance corresponding to instanceId
      Parameters:
        `instanceId` - : String

    - #### getAllClassifiedsToUnpublish

          Collection<ClassifiedDetail> getAllClassifiedsToUnpublish​(int nbDays,
                                                                    String instanceId)

      get all expiring classifieds (corresponding of a number of day nbDays)
      Parameters:
        `nbDays` - : int
        `instanceId` - : classified component instance id
      Returns:
        a collection of ClassifiedDetail

    - #### createSubscribe

          void createSubscribe​(Subscribe subscribe)

      create a subscription
      Parameters:
        `subscribe` - : Subscribe

    - #### deleteSubscribe

          void deleteSubscribe​(String subscribeId)

      delete a subscription corresponding to subscribeId
      Parameters:
        `subscribeId` - : String

    - #### unpublishClassified

          void unpublishClassified​(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)

      Unpublish a subscription corresponding to classifiedId
      Parameters:
        `classifiedId` - the unique identifier of a classified

    - #### getSubscribesByUser

          Collection<Subscribe> getSubscribesByUser​(String instanceId,
                                                    String userId)

      get all subscriptions for user and instance corresponding to userId and instanceId
      Parameters:
        `instanceId` - : String
        `userId` - : String
      Returns:
        a collection of Subscribe

    - #### getUsersBySubscribe

          Collection<String> getUsersBySubscribe​(String field1,
                                                 String field2)

      get all subscribing users to a search corresponding to fields field1 and field2
      Parameters:
        `field1` - : String
        `field2` - : String
      Returns:
        a collection of userId (String)

    - #### deleteAllSubscribes

          void deleteAllSubscribes​(String instanceId)

      delete all subscriptions for the instance corresponding to instanceId
      Parameters:
        `instanceId` - unique identifier of a component instance.

    - #### sendSubscriptionsNotification

          void sendSubscriptionsNotification​(String field1,
                                             String field2,
                                             ClassifiedDetail classified)

      send a notification for subscribers to field1 and field2 when classified modified
      Parameters:
        `field1` - : string
        `field2` - : String
        `classified` - : ClassifiedDetail

    - #### getAllValidClassifieds

          List<ClassifiedDetail> getAllValidClassifieds​(String instanceId,
                                                        String searchField1,
                                                        String searchField2,
                                                        int firstItemIndex,
                                                        int elementsPerPage)

      get all valid classifieds
      Parameters:
        `instanceId` - : String
        `searchField1` - : name of the search field 1
        `searchField2` - : name of the search field 2
        `firstItemIndex` - : index of first item to display
        `elementsPerPage` - : the number of items to render per page
      Returns:
        a collection of ClassifiedDetail

    - #### getAllValidClassifieds

          List<ClassifiedDetail> getAllValidClassifieds​(String instanceId)

    - #### setClassification

          void setClassification​(ClassifiedDetail classified,
                                 String searchField1,
                                 String searchField2,
                                 String xmlFormName)