Package org.silverpeas.components.classifieds.service

# Class DefaultClassifiedService

java.lang.Object
org.silverpeas.components.classifieds.service.DefaultClassifiedService

All Implemented Interfaces:
  `ClassifiedService`, `org.silverpeas.core.ApplicationService`

@Service @Named("classifiedsService") public class DefaultClassifiedService extends Object implements ClassifiedService
Services provided by the Classified Silverpeas component.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CLASSIFIED`
  `static final String`
  `CLASSIFIED_TYPE`
  `static final String`
  `CLASSIFIEDS_IN_APPLICATION`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultClassifiedService()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `checkSubscription(Subscribe subscribe)`
  `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`
  `deleteIndex(ClassifiedDetail classified)`
  `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)
  `Collection<Subscribe>`
  `getAllSubscribes(String instanceId)`
  `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
  `org.silverpeas.kernel.bundle.LocalizationBundle`
  `getComponentMessages(String language)`
  `org.silverpeas.kernel.bundle.SettingBundle`
  `getComponentSettings()`
  `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 instanceId, 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
  `boolean`
  `isRelatedTo(String 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 class java.lang.Object

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

- ## Field Details

  - ### CLASSIFIED

    public static final String CLASSIFIED
    See Also:
      - Constant Field Values

  - ### CLASSIFIEDS_IN_APPLICATION

    public static final String CLASSIFIEDS_IN_APPLICATION
    See Also:
      - Constant Field Values

  - ### CLASSIFIED_TYPE

    public static final String CLASSIFIED_TYPE
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### DefaultClassifiedService

    public DefaultClassifiedService()

- ## Method Details

  - ### getContributionById

    public Optional<ClassifiedDetail> getContributionById(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)
    Specified by:
      `getContributionById` in interface `org.silverpeas.core.ApplicationService`
    Specified by:
      `getContributionById` in interface `ClassifiedService`

  - ### getComponentSettings

    public org.silverpeas.kernel.bundle.SettingBundle getComponentSettings()
    Specified by:
      `getComponentSettings` in interface `org.silverpeas.core.ApplicationService`

  - ### getComponentMessages

    public org.silverpeas.kernel.bundle.LocalizationBundle getComponentMessages(String language)
    Specified by:
      `getComponentMessages` in interface `org.silverpeas.core.ApplicationService`

  - ### isRelatedTo

    public boolean isRelatedTo(String instanceId)
    Specified by:
      `isRelatedTo` in interface `org.silverpeas.core.ApplicationService`

  - ### createClassified

    public String createClassified(ClassifiedDetail classified)
    Description copied from interface: `ClassifiedService`
    create a classified
    Specified by:
      `createClassified` in interface `ClassifiedService`
    Parameters:
      `classified` - : ClassifiedDetail
    Returns:
      classifiedId : String

  - ### deleteClassified

    public void deleteClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)
    Description copied from interface: `ClassifiedService`
    delete the classified corresponding to classifiedId
    Specified by:
      `deleteClassified` in interface `ClassifiedService`
    Parameters:
      `classifiedId` - the unique identifier of the classified.

  - ### unpublishClassified

    public void unpublishClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)
    Description copied from interface: `ClassifiedService`
    Unpublish a subscription corresponding to classifiedId
    Specified by:
      `unpublishClassified` in interface `ClassifiedService`
    Parameters:
      `classifiedId` - the unique identifier of a classified

  - ### deleteAllClassifieds

    public void deleteAllClassifieds(String instanceId)
    Description copied from interface: `ClassifiedService`
    delete all classifieds for the instance corresponding to instanceId
    Specified by:
      `deleteAllClassifieds` in interface `ClassifiedService`
    Parameters:
      `instanceId` - : String

  - ### updateClassified

    public void updateClassified(ClassifiedDetail classified, boolean notify)
    Description copied from interface: `ClassifiedService`
    update the classified and send notification if notify is true
    Specified by:
      `updateClassified` in interface `ClassifiedService`
    Parameters:
      `classified` - : ClassifiedDetail
      `notify` - : boolean

  - ### getAllClassifieds

    public Collection<ClassifiedDetail> getAllClassifieds(String instanceId)
    Description copied from interface: `ClassifiedService`
    get all classifieds for an instance corresponding to instanceId
    Specified by:
      `getAllClassifieds` in interface `ClassifiedService`
    Parameters:
      `instanceId` - : String
    Returns:
      a collection of ClassifiedDetail

  - ### getNbTotalClassifieds

    public String getNbTotalClassifieds(String instanceId)
    Description copied from interface: `ClassifiedService`
    get the number of classifieds for an instance corresponding to instanceId
    Specified by:
      `getNbTotalClassifieds` in interface `ClassifiedService`
    Parameters:
      `instanceId` - : String
    Returns:
      the number of classified : String

  - ### getClassifiedsByUser

    public List<ClassifiedDetail> getClassifiedsByUser(String instanceId, String userId)
    Description copied from interface: `ClassifiedService`
    get all classifieds for user and instance corresponding to userId and instanceId
    Specified by:
      `getClassifiedsByUser` in interface `ClassifiedService`
    Parameters:
      `instanceId` - : String
      `userId` - : String
    Returns:
      a collection of ClassifiedDetail

  - ### getClassifiedsToValidate

    public List<ClassifiedDetail> getClassifiedsToValidate(String instanceId)
    Description copied from interface: `ClassifiedService`
    get all classifieds to validate for an instance corresponding to instanceId
    Specified by:
      `getClassifiedsToValidate` in interface `ClassifiedService`
    Parameters:
      `instanceId` - : String
    Returns:
      a Collection of ClassifiedDetail

  - ### validateClassified

    public void validateClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId, String userId)
    Description copied from interface: `ClassifiedService`
    pass to status validate because the user corresponding to userId validated the classified corresponding to classifiedId
    Specified by:
      `validateClassified` in interface `ClassifiedService`
    Parameters:
      `classifiedId` - the unique identifier of a classified.
      `userId` - the unique identifier of the user validating the classified.

  - ### refusedClassified

    public void refusedClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId, String userId, String refusalMotive)
    Description copied from interface: `ClassifiedService`
    pass to status refused because the user corresponding to userId refused the classified corresponding to classifiedId for the given motive.
    Specified by:
      `refusedClassified` in interface `ClassifiedService`
    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

  - ### sendSubscriptionsNotification

    public void sendSubscriptionsNotification(String field1, String field2, ClassifiedDetail classified)
    Description copied from interface: `ClassifiedService`
    send a notification for subscribers to field1 and field2 when classified modified
    Specified by:
      `sendSubscriptionsNotification` in interface `ClassifiedService`
    Parameters:
      `field1` - the first classified field
      `field2` - the second classified field

  - ### getAllClassifiedsToUnpublish

    public Collection<ClassifiedDetail> getAllClassifiedsToUnpublish(int nbDays, String instanceId)
    Description copied from interface: `ClassifiedService`
    get all expiring classifieds (corresponding of a number of day nbDays)
    Specified by:
      `getAllClassifiedsToUnpublish` in interface `ClassifiedService`
    Parameters:
      `nbDays` - : int
      `instanceId` - : classified component instance id
    Returns:
      a collection of ClassifiedDetail

  - ### search

    public List<ClassifiedDetail> search(org.silverpeas.core.index.search.model.QueryDescription query)
    Description copied from interface: `ClassifiedService`
    search all classifieds corresponding to the query
    Specified by:
      `search` in interface `ClassifiedService`
    Parameters:
      `query` - the query from which the search will be performed.
    Returns:
      a collection of ClassifiedDetail

  - ### indexClassifieds

    public void indexClassifieds(String instanceId)
    Description copied from interface: `ClassifiedService`
    index all the classifieds for the instance corresponding to instanceId
    Specified by:
      `indexClassifieds` in interface `ClassifiedService`
    Parameters:
      `instanceId` - : String

  - ### deleteIndex

    public void deleteIndex(ClassifiedDetail classified)

  - ### draftOutClassified

    public void draftOutClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId, String profile, boolean isValidationEnabled)
    Description copied from interface: `ClassifiedService`
    take out draft mode the classified corresponding to classified
    Specified by:
      `draftOutClassified` in interface `ClassifiedService`
    Parameters:
      `classifiedId` - the unique identifier of the classified
      `profile` - a role profile of the user performing the action.
      `isValidationEnabled` - is the validation enabled?

  - ### draftInClassified

    public void draftInClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)
    Description copied from interface: `ClassifiedService`
    pass the classified corresponding to classifiedId in draft mode
    Specified by:
      `draftInClassified` in interface `ClassifiedService`
    Parameters:
      `classifiedId` - the unique identifier of the classified

  - ### createSubscribe

    public void createSubscribe(Subscribe subscribe)
    Description copied from interface: `ClassifiedService`
    create a subscription
    Specified by:
      `createSubscribe` in interface `ClassifiedService`
    Parameters:
      `subscribe` - : Subscribe

  - ### deleteSubscribe

    public void deleteSubscribe(String subscribeId)
    Description copied from interface: `ClassifiedService`
    delete a subscription corresponding to subscribeId
    Specified by:
      `deleteSubscribe` in interface `ClassifiedService`
    Parameters:
      `subscribeId` - : String

  - ### checkSubscription

    public boolean checkSubscription(Subscribe subscribe)

  - ### getSubscribesByUser

    public Collection<Subscribe> getSubscribesByUser(String instanceId, String userId)
    Description copied from interface: `ClassifiedService`
    get all subscriptions for user and instance corresponding to userId and instanceId
    Specified by:
      `getSubscribesByUser` in interface `ClassifiedService`
    Parameters:
      `instanceId` - : String
      `userId` - : String
    Returns:
      a collection of Subscribe

  - ### getUsersBySubscribe

    public Collection<String> getUsersBySubscribe(String instanceId, String field1, String field2)
    Description copied from interface: `ClassifiedService`
    get all subscribing users to a search corresponding to fields field1 and field2
    Specified by:
      `getUsersBySubscribe` in interface `ClassifiedService`
    Parameters:
      `field1` - : String
      `field2` - : String
    Returns:
      a collection of userId (String)

  - ### getAllSubscribes

    public Collection<Subscribe> getAllSubscribes(String instanceId)

  - ### deleteAllSubscribes

    public void deleteAllSubscribes(String instanceId)
    Description copied from interface: `ClassifiedService`
    delete all subscriptions for the instance corresponding to instanceId
    Specified by:
      `deleteAllSubscribes` in interface `ClassifiedService`
    Parameters:
      `instanceId` - unique identifier of a component instance.

  - ### getAllValidClassifieds

    public List<ClassifiedDetail> getAllValidClassifieds(String instanceId)
    Specified by:
      `getAllValidClassifieds` in interface `ClassifiedService`

  - ### getAllValidClassifieds

    public List<ClassifiedDetail> getAllValidClassifieds(String instanceId, String searchField1, String searchField2, int firstItemIndex, int elementsPerPage)
    Description copied from interface: `ClassifiedService`
    get all valid classifieds
    Specified by:
      `getAllValidClassifieds` in interface `ClassifiedService`
    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

  - ### setClassification

    public void setClassification(ClassifiedDetail classified, String searchField1, String searchField2, String xmlFormName)
    Specified by:
      `setClassification` in interface `ClassifiedService`