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:
-
What is the set of social activities the factory generates extra data
for. See
getActivitySQLWhereClause()
andsetActivitySQLParameters(PreparedStatement)
. -
How to obtain the model entities related to such activities. See
getSQL()
andsetModelSQLParameters(PreparedStatement, long, long, long, long, long, int, String)
. -
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 Summary
Modifier and TypeMethodDescriptioncom.liferay.portal.kernel.json.JSONObject
createExtraDataJSONObject
(ResultSet resultSet, String extraData) Returns the JSON object containing the extra data.Returns the class name of the entity whose activities the factory generates extra data for.Returns the "where" clause in the social activity query to select theSocialActivity
tuples the factory generates extra data for.getSQL()
Returns the SQL query on any model entity which the selectedSocialActivity
tuples refer to.void
setActivitySQLParameters
(PreparedStatement preparedStatement) Sets parameters required to run the activity query returned bygetActivitySQLWhereClause()
in the factory.void
setModelSQLParameters
(PreparedStatement preparedStatement, long companyId, long groupId, long userId, long classNameId, long classPK, int type, String extraData) Sets parameters required to run the entity query returned bygetSQL()
in the factory, based on fields from theSocialActivity
tuple.
-
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 thegetSQL()
and the original extra data in theSocialActivity
tuple pointing to that entity, this method computes the extra data that will be persisted in theSocialActivity
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 theSocialActivity
tuples the factory generates extra data for. -
getSQL
String getSQL()Returns the SQL query on any model entity which the selectedSocialActivity
tuples refer to. Extra data is generated from the entities returned by this query. -
setActivitySQLParameters
Sets parameters required to run the activity query returned bygetActivitySQLWhereClause()
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 bygetSQL()
in the factory, based on fields from theSocialActivity
tuple.- Throws:
SQLException
-