Interface UpgradeSocial.ExtraDataFactory

Enclosing class:
UpgradeSocial

protected static interface UpgradeSocial.ExtraDataFactory
Defines the necessary methods to generate extra data from a set of social activities (com.liferay.social.kernel.model.SocialActivity instances) of any kind.

Implementations have to focus on:

  1. What is the set of social activities the factory generates extra data for. See getActivitySQLWhereClause() and setActivitySQLParameters(PreparedStatement).
  2. How to obtain the model entities related to such activities. See getSQL() and setModelSQLParameters(PreparedStatement, long, long, long, long, long, int, String).
  3. How to generate extra data from that model entity. See createExtraDataJSONObject(ResultSet, String).

The ExtraData Framework works with a list of ExtraData factories. for each one, a query to SocialActivity table is built and run. The extra data for each SocialActivity tuple returned by the query is generated by querying the appropriate entity as dictated by the Factory and building the extra data from that entity tuple. Then the framework updates the extra data in the original SocialActivity tuple, so that the Social Activity Interpreters can find what they need after the upgrade.

  • Method Details

    • createExtraDataJSONObject

      com.liferay.portal.kernel.json.JSONObject createExtraDataJSONObject(ResultSet resultSet, String extraData) throws SQLException
      Returns the JSON object containing the extra data. Given a result from the getSQL() and the original extra data in the SocialActivity tuple pointing to that entity, this method computes the extra data that will be persisted in the SocialActivity tuple as a result of the upgrade process.
      Throws:
      SQLException
    • getActivityClassName

      String getActivityClassName()
      Returns the class name of the entity whose activities the factory generates extra data for. The class name is useful if the factory needs to filter activities by class name ID or refer to other factories' class names.
    • getActivitySQLWhereClause

      String getActivitySQLWhereClause()
      Returns the "where" clause in the social activity query to select the SocialActivity tuples the factory generates extra data for.
    • getSQL

      String getSQL()
      Returns the SQL query on any model entity which the selected SocialActivity tuples refer to. Extra data is generated from the entities returned by this query.
    • setActivitySQLParameters

      void setActivitySQLParameters(PreparedStatement preparedStatement) throws SQLException
      Sets parameters required to run the activity query returned by getActivitySQLWhereClause() in the factory.
      Throws:
      SQLException
    • setModelSQLParameters

      void setModelSQLParameters(PreparedStatement preparedStatement, long companyId, long groupId, long userId, long classNameId, long classPK, int type, String extraData) throws SQLException
      Sets parameters required to run the entity query returned by getSQL() in the factory, based on fields from the SocialActivity tuple.
      Throws:
      SQLException