Package org.silverpeas.components.classifieds.dao

## Class ClassifiedsDAO

- java.lang.Object
- - org.silverpeas.components.classifieds.dao.ClassifiedsDAO

-     public class ClassifiedsDAO
      extends Object

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static String` | `createClassified​(Connection con, ClassifiedDetail classified)` | Create a classified
    `static String` | `createSubscribe​(Connection con, Subscribe subscribe)` | create a subscription
    `static void` | `deleteClassified​(Connection con, String classifiedId)` | delete the classified corresponding to classifiedId
    `static void` | `deleteSubscribe​(Connection con, String subscribeId)` | delete a subscription corresponding to subscribeId
    `static Collection<ClassifiedDetail>` | `getAllClassifieds​(Connection con, String instanceId)` | get all classifieds of a instance corresponding to instanceId
    `static List<ClassifiedDetail>` | `getAllClassifiedsToUnpublish​(Connection con, int nbDays, String instanceId)` | get all expiring classifieds (corresponding of a number of day nbDays)
    `static Collection<Subscribe>` | `getAllSubscribes​(Connection con, String instanceId)` | get all subscriptions for an instance corresponding to instanceId
    `static ClassifiedDetail` | `getClassified​(Connection con, String classifiedId)` | get the classified correspond to classifiedId
    `static List<ClassifiedDetail>` | `getClassifiedsByUser​(Connection con, String instanceId, String userId)` | get all classifieds for user and instance, corresponding to userId and instanceId
    `static List<ClassifiedDetail>` | `getClassifiedsWithStatus​(Connection con, String instanceId, String status, int firstItemIndex, int elementsPerPage)` | get all classifieds with given status for an instance corresponding to instanceId
    `static String` | `getNbTotalClassifieds​(Connection con, String instanceId)` | get the number of classifieds to be validated for an instance corresponding to instanceId
    `static Collection<Subscribe>` | `getSubscribesByUser​(Connection con, String instanceId, String userId)` | get all subscriptions for user and instance corresponding to userId and instanceId
    `static Collection<ClassifiedDetail>` | `getUnpublishedClassifieds​(Connection con, String instanceId, String userId)` | get the unpublished classified
    `static Collection<String>` | `getUsersBySubscribe​(Connection con, String field1, String field2)` | get all subscribing users to a search corresponding to fields field1 and field2
    `static void` | `updateClassified​(Connection con, ClassifiedDetail classified)` | update a classified

    - ### Methods inherited from class java.lang.Object

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

- - ### Method Detail

    - #### createClassified

          public static String createClassified​(Connection con,
                                                ClassifiedDetail classified)
                                         throws SQLException

      Create a classified
      Parameters:
        `con` - : Connection
        `classified` - : ClassifiedDetail
      Returns:
        classifiedId : String
      Throws:
        `SQLException`

    - #### updateClassified

          public static void updateClassified​(Connection con,
                                              ClassifiedDetail classified)
                                       throws SQLException

      update a classified
      Parameters:
        `con` - : Connection
        `classified` - : ClassifiedDetail
      Throws:
        `SQLException`

    - #### deleteClassified

          public static void deleteClassified​(Connection con,
                                              String classifiedId)
                                       throws SQLException

      delete the classified corresponding to classifiedId
      Parameters:
        `con` - : Connection
        `classifiedId` - : String
      Throws:
        `SQLException`

    - #### getClassified

          public static ClassifiedDetail getClassified​(Connection con,
                                                       String classifiedId)
                                                throws SQLException

      get the classified correspond to classifiedId
      Parameters:
        `con` - : Connection
        `classifiedId` - : String
      Returns:
        classified : ClassifiedDetail
      Throws:
        `SQLException`

    - #### getAllClassifieds

          public static Collection<ClassifiedDetail> getAllClassifieds​(Connection con,
                                                                       String instanceId)
                                                                throws SQLException

      get all classifieds of a instance corresponding to instanceId
      Parameters:
        `con` - : Connection
        `instanceId` - : String
      Returns:
        a collection of ClassifiedDetail
      Throws:
        `SQLException`

    - #### getNbTotalClassifieds

          public static String getNbTotalClassifieds​(Connection con,
                                                     String instanceId)
                                              throws SQLException

      get the number of classifieds to be validated for an instance corresponding to instanceId
      Parameters:
        `con` - : Connection
        `instanceId` - : String
      Returns:
        the number : String
      Throws:
        `SQLException`

    - #### getClassifiedsByUser

          public static List<ClassifiedDetail> getClassifiedsByUser​(Connection con,
                                                                    String instanceId,
                                                                    String userId)
                                                             throws SQLException

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

    - #### getClassifiedsWithStatus

          public static 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
        `instanceId` - : String
        `status` - : status
      Returns:
        a list of ClassifiedDetail
      Throws:
        `SQLException`

    - #### getAllClassifiedsToUnpublish

          public static List<ClassifiedDetail> getAllClassifiedsToUnpublish​(Connection con,
                                                                            int nbDays,
                                                                            String instanceId)
                                                                     throws SQLException

      get all expiring classifieds (corresponding of a number of day nbDays)
      Parameters:
        `con` - : Connection
        `nbDays` - : int
        `instanceId` - : component instance id
      Returns:
        a list of ClassifiedDetail
      Throws:
        `SQLException`

    - #### createSubscribe

          public static String createSubscribe​(Connection con,
                                               Subscribe subscribe)
                                        throws SQLException

      create a subscription
      Parameters:
        `con` - : Connection
        `subscribe` - : Subscribe
      Returns:
        subscribeId : String
      Throws:
        `SQLException`

    - #### deleteSubscribe

          public static void deleteSubscribe​(Connection con,
                                             String subscribeId)
                                      throws SQLException

      delete a subscription corresponding to subscribeId
      Parameters:
        `con` - : Connection
        `subscribeId` - : String
      Throws:
        `SQLException`

    - #### getAllSubscribes

          public static Collection<Subscribe> getAllSubscribes​(Connection con,
                                                               String instanceId)
                                                        throws SQLException

      get all subscriptions for an instance corresponding to instanceId
      Parameters:
        `con` - : connection
        `instanceId` - : String
      Returns:
        a collection of Subscribe
      Throws:
        `SQLException`

    - #### getSubscribesByUser

          public static 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
        `instanceId` - : String
        `userId` - : String
      Returns:
        a collection of Subscribe
      Throws:
        `SQLException`

    - #### getUsersBySubscribe

          public static Collection<String> getUsersBySubscribe​(Connection con,
                                                               String field1,
                                                               String field2)
                                                        throws SQLException

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

    - #### getUnpublishedClassifieds

          public static Collection<ClassifiedDetail> getUnpublishedClassifieds​(Connection con,
                                                                               String instanceId,
                                                                               String userId)
                                                                        throws SQLException

      get the unpublished classified
      Parameters:
        `con` - : Connection
        `instanceId` - : String
        `userId` - : String
      Returns:
        a collection of ClassifiedDetail
      Throws:
        `SQLException`