com.silverpeas.classifieds.control
Class DefaultClassifiedService

java.lang.Object
  extended by com.silverpeas.classifieds.control.DefaultClassifiedService
All Implemented Interfaces:
ClassifiedService, com.silverpeas.SilverpeasComponentService<ClassifiedDetail>

@Named(value="classifiedService")
public class DefaultClassifiedService
extends Object
implements ClassifiedService

Services provided by the Classified Silverpeas component.


Field Summary
static String COMPONENT_NAME
           
 
Constructor Summary
DefaultClassifiedService()
           
 
Method Summary
 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(String instanceId, String classifiedId)
          delete the classified corresponding to classifiedId
 void deleteIndex(ClassifiedDetail classified)
           
 void deleteSubscribe(String subscribeId)
          delete a subscription corresponding to subscribeId
 void draftInClassified(String classifiedId)
          pass the classified corresponding to classifiedId in draft mode
 void draftOutClassified(String 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)
           
 Collection<ClassifiedDetail> getAllValidClassifieds(String instanceId, Map<String,String> mapFields1, Map<String,String> mapFields2, String searchField1, String searchField2, int currentPage, int elementsPerPage)
          get all valid classifieds
 Collection<ClassifiedDetail> getClassifiedsByUser(String instanceId, String userId)
          get all classifieds for user and instance corresponding to userId and instanceId
 Collection<ClassifiedDetail> getClassifiedsToValidate(String instanceId)
          get all classifieds to validate for an instance corresponding to instanceId
 com.stratelia.webactiv.util.ResourceLocator getComponentMessages(String language)
           
 com.stratelia.webactiv.util.ResourceLocator getComponentSettings()
           
 ClassifiedDetail getContentById(String 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<ClassifiedDetail> getUnpublishedClassifieds(String instanceId, String userId)
          get all classifieds unpublished for an instance corresponding to instanceId and for given user
 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 initialize()
          Initializes this service by registering itself among Silverpeas core services as interested by events.
 void refusedClassified(String classifiedId, String userId, String refusalMotive)
          pass to status refused because the user corresponding to userId refused the classified corresponding to classifiedId for the motive ResusalMotive
 void release()
          Releases all the resources required by this service.
 List<ClassifiedDetail> search(org.silverpeas.search.searchEngine.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(String classifiedId)
          unpublish a subscription corresponding to subscribeId
 void updateClassified(ClassifiedDetail classified, boolean notify)
          update the classified and send notification if notify is true
 void validateClassified(String 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 Detail

COMPONENT_NAME

public static final String COMPONENT_NAME
See Also:
Constant Field Values
Constructor Detail

DefaultClassifiedService

public DefaultClassifiedService()
Method Detail

initialize

@PostConstruct
public void initialize()
Initializes this service by registering itself among Silverpeas core services as interested by events.


release

@PreDestroy
public void release()
Releases all the resources required by this service. For instance, it unregisters from the Silverpeas core services.


getContentById

public ClassifiedDetail getContentById(String classifiedId)
Specified by:
getContentById in interface com.silverpeas.SilverpeasComponentService<ClassifiedDetail>

getComponentSettings

public com.stratelia.webactiv.util.ResourceLocator getComponentSettings()
Specified by:
getComponentSettings in interface com.silverpeas.SilverpeasComponentService<ClassifiedDetail>

getComponentMessages

public com.stratelia.webactiv.util.ResourceLocator getComponentMessages(String language)
Specified by:
getComponentMessages in interface com.silverpeas.SilverpeasComponentService<ClassifiedDetail>

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(String instanceId,
                             String classifiedId)
Description copied from interface: ClassifiedService
delete the classified corresponding to classifiedId

Specified by:
deleteClassified in interface ClassifiedService
Parameters:
instanceId - : String
classifiedId - : String

unpublishClassified

public void unpublishClassified(String classifiedId)
Description copied from interface: ClassifiedService
unpublish a subscription corresponding to subscribeId

Specified by:
unpublishClassified in interface ClassifiedService

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 Collection<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 Collection<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

getUnpublishedClassifieds

public Collection<ClassifiedDetail> getUnpublishedClassifieds(String instanceId,
                                                              String userId)
Description copied from interface: ClassifiedService
get all classifieds unpublished for an instance corresponding to instanceId and for given user

Specified by:
getUnpublishedClassifieds in interface ClassifiedService
Parameters:
instanceId - : String
userId - : creator user id
Returns:
a collection of ClassifiedDetail

validateClassified

public void validateClassified(String 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

refusedClassified

public void refusedClassified(String 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 motive ResusalMotive

Specified by:
refusedClassified in interface ClassifiedService
Parameters:
classifiedId - : String
userId - : String
refusalMotive - : String

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 - : string
field2 - : String
classified - : ClassifiedDetail

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.search.searchEngine.model.QueryDescription query)
Description copied from interface: ClassifiedService
search all classifieds corresponding to the query

Specified by:
search in interface ClassifiedService
Parameters:
query - : QueryDescription
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(String 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 - : String
profile - : String
isValidationEnabled - : boolean

draftInClassified

public void draftInClassified(String classifiedId)
Description copied from interface: ClassifiedService
pass the classified corresponding to classifiedId in draft mode

Specified by:
draftInClassified in interface ClassifiedService
Parameters:
classifiedId - : String

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 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

getAllValidClassifieds

public Collection<ClassifiedDetail> getAllValidClassifieds(String instanceId,
                                                           Map<String,String> mapFields1,
                                                           Map<String,String> mapFields2,
                                                           String searchField1,
                                                           String searchField2,
                                                           int currentPage,
                                                           int elementsPerPage)
Description copied from interface: ClassifiedService
get all valid classifieds

Specified by:
getAllValidClassifieds in interface ClassifiedService
Parameters:
instanceId - : String
mapFields1 - : HashMap des champs de recherche 1
mapFields2 - : HashMap des champs de recherche 1
searchField1 - : champ de recherche 1
searchField2 - : champ de recherche 2
currentPage - : numéro de page actuelle
elementsPerPage - : nombre d'éléments à afficher par page
Returns:
a collection of ClassifiedDetail

setClassification

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


Copyright © 2016 Silverpeas. All Rights Reserved.