Class DefaultClassifiedService
- java.lang.Object
-
- org.silverpeas.components.classifieds.service.DefaultClassifiedService
-
- All Implemented Interfaces:
ClassifiedService
,org.silverpeas.core.ApplicationService
@Service @Named("classifiedService") public class DefaultClassifiedService extends Object implements ClassifiedService
Services provided by the Classified Silverpeas component.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CLASSIFIED
static String
CLASSIFIED_TYPE
static String
CLASSIFIEDS_IN_APPLICATION
-
Constructor Summary
Constructors Constructor Description DefaultClassifiedService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkSubscription(Subscribe subscribe)
String
createClassified(ClassifiedDetail classified)
create a classifiedvoid
createSubscribe(Subscribe subscribe)
create a subscriptionvoid
deleteAllClassifieds(String instanceId)
delete all classifieds for the instance corresponding to instanceIdvoid
deleteAllSubscribes(String instanceId)
delete all subscriptions for the instance corresponding to instanceIdvoid
deleteClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)
delete the classified corresponding to classifiedIdvoid
deleteIndex(ClassifiedDetail classified)
void
deleteSubscribe(String subscribeId)
delete a subscription corresponding to subscribeIdvoid
draftInClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)
pass the classified corresponding to classifiedId in draft modevoid
draftOutClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId, String profile, boolean isValidationEnabled)
take out draft mode the classified corresponding to classifiedCollection<ClassifiedDetail>
getAllClassifieds(String instanceId)
get all classifieds for an instance corresponding to instanceIdCollection<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, Map<String,String> mapFields1, Map<String,String> mapFields2, String searchField1, String searchField2, int firstItemIndex, int elementsPerPage)
get all valid classifiedsList<ClassifiedDetail>
getClassifiedsByUser(String instanceId, String userId)
get all classifieds for user and instance corresponding to userId and instanceIdList<ClassifiedDetail>
getClassifiedsToValidate(String instanceId)
get all classifieds to validate for an instance corresponding to instanceIdorg.silverpeas.core.util.LocalizationBundle
getComponentMessages(String language)
org.silverpeas.core.util.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 instanceIdCollection<Subscribe>
getSubscribesByUser(String instanceId, String userId)
get all subscriptions for user and instance corresponding to userId and instanceIdCollection<String>
getUsersBySubscribe(String field1, String field2)
get all subscribing users to a search corresponding to fields field1 and field2void
indexClassifieds(String instanceId)
index all the classifieds for the instance corresponding to instanceIdboolean
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 queryvoid
sendSubscriptionsNotification(String field1, String field2, ClassifiedDetail classified)
send a notification for subscribers to field1 and field2 when classified modifiedvoid
setClassification(ClassifiedDetail classified, String searchField1, String searchField2, String xmlFormName)
void
unpublishClassified(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)
Unpublish a subscription corresponding to classifiedIdvoid
updateClassified(ClassifiedDetail classified, boolean notify)
update the classified and send notification if notify is truevoid
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
-
-
-
Field Detail
-
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
-
-
Method Detail
-
getContributionById
public Optional<ClassifiedDetail> getContributionById(org.silverpeas.core.contribution.model.ContributionIdentifier classifiedId)
- Specified by:
getContributionById
in interfaceorg.silverpeas.core.ApplicationService
- Specified by:
getContributionById
in interfaceClassifiedService
-
getComponentSettings
public org.silverpeas.core.util.SettingBundle getComponentSettings()
- Specified by:
getComponentSettings
in interfaceorg.silverpeas.core.ApplicationService
-
getComponentMessages
public org.silverpeas.core.util.LocalizationBundle getComponentMessages(String language)
- Specified by:
getComponentMessages
in interfaceorg.silverpeas.core.ApplicationService
-
isRelatedTo
public boolean isRelatedTo(String instanceId)
- Specified by:
isRelatedTo
in interfaceorg.silverpeas.core.ApplicationService
-
createClassified
public String createClassified(ClassifiedDetail classified)
Description copied from interface:ClassifiedService
create a classified- Specified by:
createClassified
in interfaceClassifiedService
- 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- Parameters:
classified
- : ClassifiedDetailnotify
- : 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- Parameters:
instanceId
- : StringuserId
- : 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- Parameters:
classifiedId
- unique identifier of a classifieduserId
- unique identifier of the user refusing the classifiedrefusalMotive
- 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 interfaceClassifiedService
- Parameters:
field1
- : stringfield2
- : Stringclassified
- : 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 interfaceClassifiedService
- Parameters:
nbDays
- : intinstanceId
- : 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- Parameters:
classifiedId
- the unique identifier of the classifiedprofile
- 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 interfaceClassifiedService
- 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 interfaceClassifiedService
- Parameters:
subscribe
- : Subscribe
-
deleteSubscribe
public void deleteSubscribe(String subscribeId)
Description copied from interface:ClassifiedService
delete a subscription corresponding to subscribeId- Specified by:
deleteSubscribe
in interfaceClassifiedService
- 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 interfaceClassifiedService
- Parameters:
instanceId
- : StringuserId
- : 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 interfaceClassifiedService
- Parameters:
field1
- : Stringfield2
- : 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 interfaceClassifiedService
- Parameters:
instanceId
- unique identifier of a component instance.
-
getAllValidClassifieds
public List<ClassifiedDetail> getAllValidClassifieds(String instanceId)
- Specified by:
getAllValidClassifieds
in interfaceClassifiedService
-
getAllValidClassifieds
public List<ClassifiedDetail> getAllValidClassifieds(String instanceId, Map<String,String> mapFields1, Map<String,String> mapFields2, String searchField1, String searchField2, int firstItemIndex, int elementsPerPage)
Description copied from interface:ClassifiedService
get all valid classifieds- Specified by:
getAllValidClassifieds
in interfaceClassifiedService
- Parameters:
instanceId
- : StringmapFields1
- : HashMap des champs de recherche 1mapFields2
- : HashMap des champs de recherche 1searchField1
- : champ de recherche 1searchField2
- : champ de recherche 2firstItemIndex
- : index of first item to displayelementsPerPage
- : 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 interfaceClassifiedService
-
-