public abstract class DynamicQueryUADExporter<T extends com.liferay.portal.kernel.model.BaseModel> extends java.lang.Object implements UADExporter<T>
UADExporter for entities
generated with Service Builder. The count and batch actions are based on the
ActionableDynamicQuery, which is available in the local service
generated by Service Builder.| Constructor and Description |
|---|
DynamicQueryUADExporter() |
| Modifier and Type | Method and Description |
|---|---|
long |
count(long userId)
Returns the number of type
T entities associated with the user. |
protected java.io.File |
createFolder(long userId) |
protected abstract com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery |
doGetActionableDynamicQuery()
Returns an
ActionableDynamicQuery for type T. |
protected abstract java.lang.String[] |
doGetUserIdFieldNames()
Returns names identifying fields on the type
T entity that
contain the primary key of a user. |
byte[] |
export(T baseModel)
Returns a byte array representing the entity, ready to be written to a
file.
|
java.io.File |
exportAll(long userId)
Returns a file object containing the data from all type
T
entities related to the user. |
protected java.lang.String |
formatXML(java.lang.String xml) |
protected com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery |
getActionableDynamicQuery(long userId)
Returns an
ActionableDynamicQuery for type T. |
protected com.liferay.portal.kernel.zip.ZipWriter |
getZipWriter(long userId,
java.lang.String modelClassName)
Returns a
ZipWriter to write the data to. |
protected abstract java.lang.String |
toXmlString(T baseModel)
Converts the type
T base model to an XML string to be written to
a file. |
protected void |
writeToZip(T baseModel,
com.liferay.portal.kernel.zip.ZipWriter zipWriter)
Converts the type
T base model to a byte array and writes it to
the ZipWriter. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetExportDataCountgetTypeClass, getTypeKeypublic long count(long userId)
throws com.liferay.portal.kernel.exception.PortalException
UADExporterT entities associated with the user.count in interface UADExporter<T extends com.liferay.portal.kernel.model.BaseModel>userId - the primary key of the user whose data to countcom.liferay.portal.kernel.exception.PortalExceptionpublic byte[] export(T baseModel) throws com.liferay.portal.kernel.exception.PortalException
UADExporterexport in interface UADExporter<T extends com.liferay.portal.kernel.model.BaseModel>baseModel - the type T entity to convert into a byte arraycom.liferay.portal.kernel.exception.PortalException - if a portal exception occurredpublic java.io.File exportAll(long userId)
throws com.liferay.portal.kernel.exception.PortalException
UADExporterT
entities related to the user.exportAll in interface UADExporter<T extends com.liferay.portal.kernel.model.BaseModel>userId - the primary key of the user whose data to exportcom.liferay.portal.kernel.exception.PortalException - if a portal exception occurredprotected java.io.File createFolder(long userId)
protected abstract com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery doGetActionableDynamicQuery()
ActionableDynamicQuery for type T. This can be
retrieved from the service.ActionableDynamicQuery for type Tprotected abstract java.lang.String[] doGetUserIdFieldNames()
T entity that
contain the primary key of a user.protected java.lang.String formatXML(java.lang.String xml)
protected com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery(long userId)
ActionableDynamicQuery for type T. It should
be populated with criteria and ready for use by the service.userId - the primary key of the user used to pre-filter the ActionableDynamicQueryActionableDynamicQueryprotected com.liferay.portal.kernel.zip.ZipWriter getZipWriter(long userId,
java.lang.String modelClassName)
ZipWriter to write the data to. Each individual type
T entity is written as a file in the resulting ZIP file.userId - the the primary key of the user whose data to exportmodelClassName - the string representation of the model class nameZipWriter where each piece of data is writtenprotected abstract java.lang.String toXmlString(T baseModel)
T base model to an XML string to be written to
a file.baseModel - the base model to be converted into an XML stringprotected void writeToZip(T baseModel, com.liferay.portal.kernel.zip.ZipWriter zipWriter) throws java.lang.Exception
T base model to a byte array and writes it to
the ZipWriter.baseModel - the baseModel to write to the ZIPzipWriter - the ZipWriter to write tojava.lang.Exception - if an exception occurred