Class ClassifiedsDAO
java.lang.Object
org.silverpeas.components.classifieds.dao.ClassifiedsDAO
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateClassified(Connection con, ClassifiedDetail classified) Create a classifiedcreateSubscribe(Connection con, Subscribe subscribe) Create a subscription for user.voiddeleteClassified(Connection con, String classifiedId) Delete the classified with the specified identifier.voiddeleteSubscribe(Connection con, String subscribeId) Delete a subscription corresponding to the subscriber identifiergetAllClassifieds(Connection con, String instanceId) Get all classifieds of an instance corresponding to instanceIdgetAllClassifiedsToUnpublish(Connection con, int nbDays, String instanceId) Get all expiring classifieds (corresponding of a number of days)getAllSubscribes(Connection con, String instanceId) Get all subscriptions for an instance corresponding to instanceIdgetClassified(Connection con, String classifiedId) Get the classified with the specified identifier.getClassifiedsByUser(Connection con, String instanceId, String userId) Get all the classifieds for user and instance, corresponding to userId and instanceIdgetClassifiedsWithStatus(Connection con, String instanceId, String status, int firstItemIndex, int elementsPerPage) Get all classifieds with given status for an instance corresponding to instanceIdgetNbTotalClassifieds(Connection con, String instanceId) Get the number of classifieds to be validated for an instance corresponding to instanceIdgetSubscribesByUser(Connection con, String instanceId, String userId) Get all subscriptions for user and instance corresponding to userId and instanceIdgetUsersBySubscribe(Connection con, String instanceId, String field1, String field2) Get all subscribing users to a search corresponding to fields field1 and field2voidupdateClassified(Connection con, ClassifiedDetail classified) Update a classified
-
Constructor Details
-
ClassifiedsDAO
public ClassifiedsDAO()
-
-
Method Details
-
createClassified
Create a classified- Parameters:
con- connection to the databaseclassified- the new classified- Returns:
- classifiedId the unique identifier of the created classified
- Throws:
SQLException- if the classified cannot be created.
-
updateClassified
Update a classified- Parameters:
con- connection to the database.classified- the ClassifiedDetail with the data to update.- Throws:
SQLException- if the classified cannot be updated
-
deleteClassified
Delete the classified with the specified identifier.- Parameters:
con- connection to the databaseclassifiedId- the unique identifier of a classified- Throws:
SQLException- if the classified fail to be deleted.
-
getClassified
Get the classified with the specified identifier.- Parameters:
con- connection to the databaseclassifiedId- the unique identifier of the classified- Returns:
- classified the
ClassifiedDetailinstance - Throws:
SQLException- if the classified cannot be fetched
-
getAllClassifieds
public Collection<ClassifiedDetail> getAllClassifieds(Connection con, String instanceId) throws SQLException Get all classifieds of an instance corresponding to instanceId- Parameters:
con- connection to the databaseinstanceId- the unique identifier of a classified component instance- Returns:
- a collection of
ClassifiedDetailinstances. - Throws:
SQLException- if the fetching of the classifieds fails
-
getNbTotalClassifieds
Get the number of classifieds to be validated for an instance corresponding to instanceId- Parameters:
con- the connection to the databaseinstanceId- the unique identifier of a classified component instance.- Returns:
- the count of classifieds in the component instance.
- Throws:
SQLException- if an error occurs while getting the classifieds count.
-
getClassifiedsByUser
public List<ClassifiedDetail> getClassifiedsByUser(Connection con, String instanceId, String userId) throws SQLException Get all the classifieds for user and instance, corresponding to userId and instanceId- Parameters:
con- connection to the databaseinstanceId- the unique identifier of a classifieds component instance.userId- the unique identifier of the user- Returns:
- a collection of
ClassifiedDetails of the user. - Throws:
SQLException- if the classifieds getting fails.
-
getClassifiedsWithStatus
public List<ClassifiedDetail> getClassifiedsWithStatus(Connection con, String instanceId, String status, int firstItemIndex, int elementsPerPage) throws SQLException Get all classifieds with given status for an instance corresponding to instanceId- Parameters:
con- connection to the databaseinstanceId- the classifieds component instancestatus- status of the classifieds- Returns:
- a list of
ClassifiedDetail - Throws:
SQLException- if the classifieds cannot be fetched.
-
getAllClassifiedsToUnpublish
public List<ClassifiedDetail> getAllClassifiedsToUnpublish(Connection con, int nbDays, String instanceId) throws SQLException Get all expiring classifieds (corresponding of a number of days)- Parameters:
con- connection to the databasenbDays- the number of daysinstanceId- component instance identifier- Returns:
- a list of
ClassifiedDetail - Throws:
SQLException- if the classifieds cannot be fetched
-
createSubscribe
Create a subscription for user.- Parameters:
con- connection to the databasesubscribe- the subscription to create.- Returns:
- subscribeId the unique identifier of a subscription.
- Throws:
SQLException- if the creation fails.
-
deleteSubscribe
Delete a subscription corresponding to the subscriber identifier- Parameters:
con- connection to the databasesubscribeId- the unique identifier of a subscription- Throws:
SQLException- if the deletion fails.
-
getAllSubscribes
public Collection<Subscribe> getAllSubscribes(Connection con, String instanceId) throws SQLException Get all subscriptions for an instance corresponding to instanceId- Parameters:
con- connection to the databaseinstanceId- the unique identifier of a component instance.- Returns:
- a collection of
Subscribe - Throws:
SQLException- if the fetching fails
-
getSubscribesByUser
public Collection<Subscribe> getSubscribesByUser(Connection con, String instanceId, String userId) throws SQLException Get all subscriptions for user and instance corresponding to userId and instanceId- Parameters:
con- connection to the databaseinstanceId- the unique identifier of a component instanceuserId- the unique identifier of a user- Returns:
- a collection of
Subscribe - Throws:
SQLException- if the fetching fails.
-
getUsersBySubscribe
public Collection<String> getUsersBySubscribe(Connection con, String instanceId, String field1, String field2) throws SQLException Get all subscribing users to a search corresponding to fields field1 and field2- Parameters:
con- connection to the databaseinstanceId- the unique identifier of the component instance on which the subscriptions have to be found.field1- value of the first field of a classified on which subscription can be donefield2- value of the second field of a classified on which subscription can be done- Returns:
- a collection of user identifiers.
- Throws:
SQLException- if the getting of the subscribers fail.
-