public abstract class DynamicQueryUADExporter<T extends 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 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 ActionableDynamicQuery |
getActionableDynamicQuery(long userId)
Returns an
ActionableDynamicQuery for type T. |
protected ZipWriter |
getZipWriter(long userId,
java.lang.String modelClassName)
Returns a
ZipWriter to write the data to. |
protected 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,
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, waitgetExportDataCountgetTypeClasspublic long count(long userId)
throws PortalException
UADExporterT entities associated with the user.count in interface UADExporter<T extends BaseModel>userId - the primary key of the user whose data to countPortalExceptionpublic byte[] export(T baseModel) throws PortalException
UADExporterexport in interface UADExporter<T extends BaseModel>baseModel - the type T entity to convert into a byte arrayPortalException - if a portal exception occurredpublic java.io.File exportAll(long userId)
throws PortalException
UADExporterT
entities related to the user.exportAll in interface UADExporter<T extends BaseModel>userId - the primary key of the user whose data to exportPortalException - if a portal exception occurredprotected java.io.File createFolder(long userId)
protected abstract 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 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 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 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, 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