public class ExportPool extends Object
The ExportPool
is part of the high level API for bulk exports of real
estate data.
Multiple real estates and contacts (including attachments) can be collected
in the ExportPool
. The corresponding data is stored into a temporary
folder on the local harddisk. After the ExportPool
was created and
initialized with some data, the bulk export can be started via
ExportHandler
.
Constructor and Description |
---|
ExportPool()
Creates an empty
ExportPool . |
ExportPool(File baseDir)
Creates an empty
ExportPool . |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Clear settings and empty the local directory.
|
File |
getBaseDir()
Returns directory, where local files are stored.
|
RealtorContactDetails |
getContact(String pooledContactId)
Returns a pooled contact.
|
String[] |
getContactIds()
Returns ID's of pooled contacts.
|
File |
getContactsDir()
Returns directory, where pooled contacts are stored.
|
long |
getContactSize(String pooledContactId,
boolean completely)
Returns size of a pooled contact.
|
RealEstate |
getObject(String pooledObjectId)
Returns a pooled real estate.
|
Attachment |
getObjectAttachment(String pooledObjectId,
String attachmentId)
Returns a pooled attachment for a real estate.
|
File |
getObjectAttachmentFile(String pooledObjectId,
Attachment attachment)
Returns the file of a pooled attachment for a real estate.
|
File |
getObjectAttachmentFile(String pooledObjectId,
String name)
Returns the file of a pooled attachment for a real estate.
|
File |
getObjectAttachmentFile(String pooledObjectId,
URL href)
Returns the file of a pooled attachment for a real estate.
|
String[] |
getObjectAttachmentIds(String pooledObjectId)
Returns attachment ID's of a pooled real estate.
|
long |
getObjectAttachmentSize(String pooledObjectId,
String attachmentId)
Returns size of a pooled attachment for a real estate.
|
URL |
getObjectAttachmentURL(String pooledObjectId,
String attachmentId)
Returns the URL of a pooled attachment for a real estate.
|
String[] |
getObjectIds()
Returns ID's of pooled real estates.
|
String[] |
getObjectIdsForRemoval()
Returns ID's of real estates, that were pooled for removal.
|
File |
getObjectsDir()
Returns directory, where pooled real estates are stored.
|
long |
getObjectSize(String pooledObjectId,
boolean completely)
Returns size of a pooled real estate.
|
String |
getSetting(String key)
Returns a settings from the export pool.
|
String |
getSetting(String key,
String defaultValue)
Returns a settings from the export pool.
|
long |
getTotalSize()
Returns the total size of the local pool directory.
|
boolean |
hasContactForExport(String pooledContactId)
Checks, if a contact was pooled for export.
|
boolean |
hasObjectForExport(String pooledObjectId)
Checks, if a real estate was pooled for export.
|
boolean |
hasObjectForRemoval(String externalObjectId)
Checks, if a real estate was pooled for removal.
|
void |
putContact(RealtorContactDetails contact)
Adds a contact to export pool.
|
void |
putContact(RealtorContactDetails contact,
String pooledContactId)
Adds a contact to export pool.
|
void |
putObject(RealEstate object)
Adds a real estate to export pool.
|
void |
putObject(RealEstate object,
String pooledObjectId)
Adds a real estate to export pool.
|
void |
putObjectAttachedFile(String pooledObjectId,
Attachment attachment,
File file)
Adds an attachment for a real estate to export pool.
|
void |
putObjectAttachedFile(String pooledObjectId,
Attachment attachment,
URL file)
Adds an attachment for a real estate to export pool.
|
void |
putObjectAttachedLink(String pooledObjectId,
Attachment link)
Adds an web link for a real estate to export pool.
|
void |
putObjectForRemoval(String externalObjectId)
Registers an real estate object for removal.
|
void |
putSetting(String key,
String value)
Puts a settings to the export pool.
|
void |
readSettings()
Read export pool settings from local directory.
|
void |
writeSettings()
Writes export pool settings to local directory.
|
public ExportPool()
ExportPool
.
Files are stored into the default temporary directory of the Java runtime environment.
public ExportPool(File baseDir)
ExportPool
.baseDir
- directory, where pooled files are storedpublic void cleanup()
public final File getBaseDir()
public RealtorContactDetails getContact(String pooledContactId) throws IOException
pooledContactId
- ID of the contact within the poolIOException
- if object is not readable from local directorypublic String[] getContactIds()
public long getContactSize(String pooledContactId, boolean completely)
pooledContactId
- ID of the contact within the poolcompletely
- calculate the complete size (including attachments)public final File getContactsDir()
public RealEstate getObject(String pooledObjectId) throws IOException
pooledObjectId
- ID of the real estate within the poolIOException
- if object is not readable from local directorypublic Attachment getObjectAttachment(String pooledObjectId, String attachmentId) throws IOException
pooledObjectId
- ID of the real estate within the poolattachmentId
- ID of the attachmentIOException
- if object is not readable from local directorypublic File getObjectAttachmentFile(String pooledObjectId, Attachment attachment)
pooledObjectId
- ID of the real estate within the poolattachment
- attachment to lookuppublic File getObjectAttachmentFile(String pooledObjectId, URL href)
pooledObjectId
- ID of the real estate within the poolhref
- attachment hrefpublic File getObjectAttachmentFile(String pooledObjectId, String name)
pooledObjectId
- ID of the real estate within the poolname
- file namepublic long getObjectAttachmentSize(String pooledObjectId, String attachmentId)
pooledObjectId
- ID of the real estate within the poolattachmentId
- ID of the attachmentpublic URL getObjectAttachmentURL(String pooledObjectId, String attachmentId) throws IOException
pooledObjectId
- ID of the real estate within the poolattachmentId
- ID of the attachmentIOException
- if object is not readable from local directorypublic String[] getObjectAttachmentIds(String pooledObjectId)
pooledObjectId
- ID of the real estate within the poolpublic String[] getObjectIds()
public String[] getObjectIdsForRemoval()
public long getObjectSize(String pooledObjectId, boolean completely)
pooledObjectId
- ID of the real estate within the poolcompletely
- calculate the complete size (including attachments)public final File getObjectsDir()
public String getSetting(String key)
key
- setting keypublic String getSetting(String key, String defaultValue)
key
- setting keydefaultValue
- default value, if the setting is not definedpublic long getTotalSize()
public boolean hasContactForExport(String pooledContactId)
pooledContactId
- ID of the contact within the poolpublic boolean hasObjectForExport(String pooledObjectId)
pooledObjectId
- ID of the real estate within the poolpublic boolean hasObjectForRemoval(String externalObjectId)
externalObjectId
- real estate IDpublic void putContact(RealtorContactDetails contact) throws IOException
contact
- contactIOException
- if pooling failedpublic void putContact(RealtorContactDetails contact, String pooledContactId) throws IOException
contact
- contactpooledContactId
- ID of the contact within the poolIOException
- if pooling failedpublic void putObject(RealEstate object) throws IOException
object
- real estateIOException
- if pooling failedpublic void putObject(RealEstate object, String pooledObjectId) throws IOException
object
- real estatepooledObjectId
- ID of the real estate within the poolIOException
- if pooling failedpublic void putObjectAttachedFile(String pooledObjectId, Attachment attachment, File file) throws IOException
pooledObjectId
- ID of the real estate within the poolattachment
- attachment informationsfile
- attached fileIOException
- if pooling failedpublic void putObjectAttachedFile(String pooledObjectId, Attachment attachment, URL file) throws IOException
pooledObjectId
- ID of the real estate within the poolattachment
- attachment informationsfile
- URL, that points to the attached fileIOException
- if pooling failedpublic void putObjectAttachedLink(String pooledObjectId, Attachment link) throws IOException
pooledObjectId
- ID of the real estate within the poollink
- web linkIOException
- if pooling failedpublic void putObjectForRemoval(String externalObjectId)
externalObjectId
- real estate IDpublic void putSetting(String key, String value)
key
- setting keyvalue
- setting valuepublic void readSettings() throws IOException
IOException
- if settings are not loadablepublic void writeSettings() throws IOException
IOException
- if settings are not wriableCopyright © 2014 OpenEstate. All rights reserved.