|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.AbstractBatcher net.sf.basedb.core.BasicBatcher<ReporterData> net.sf.basedb.core.ReporterBatcher
public class ReporterBatcher
Batcher class for reporters.
Field Summary | |
---|---|
private Set<String> |
batchedExternalIds
A set containing all batched but not yet flushed external reporter id:s. |
private Date |
entryDate
Date to to give new reporters. |
private List<ExtendedProperty> |
extendedProperties
The extended properties for reporters |
private org.hibernate.Query |
findReporter
A query to find reporters by the external id. |
private String |
updateSource
A string to hold the name of the source, used to update the reporters. |
Fields inherited from class net.sf.basedb.core.BasicBatcher |
---|
debugEnabled, logParam |
Fields inherited from class net.sf.basedb.core.AbstractBatcher |
---|
debugSqlEnabled, logSql |
Constructor Summary | |
---|---|
ReporterBatcher(DbControl dc)
|
Method Summary | |
---|---|
boolean |
exists(String externalId,
boolean checkInsertQueue,
boolean checkDb)
Check if a reporter with a given external id exists in the database or has been added to the batch queue of insertion. |
void |
flushInsert()
Flush and clear the internal cache of external reporter id:s. |
ReporterData |
getByExternalId(String externalId)
Get a reporter when you know the external id. |
ReporterData |
getByExternalId(String externalId,
boolean errorIfNotFound)
Get a reporter when you know the external id. |
static ReporterBatcher |
getNew(DbControl dc)
Create a new batcher for reporters. |
Item |
getType()
Get the type of item supported by the batcher. |
void |
insert(ReporterData data)
Insert and add the external reporter id to the internal cache. |
boolean |
isInInsertQueue(String externalId)
|
(package private) void |
onBeforeCommit(ReporterData data,
Transactional.Action action)
Set the last update date to today's date and change the last source of update. |
void |
setUpdateSource(String source)
Set the source that was used when updating the reporters. |
void |
validate(ReporterData data)
Validate all properties for the reporter object: The data object is not null The name or external id is not null or too long The description or symbol is not too long All of the extendable properties using the ExtendedProperty.validateValue(Object)
method
|
Methods inherited from class net.sf.basedb.core.BasicBatcher |
---|
checkPermission, delete, delete, flush, flushDelete, flushUpdate, getPermissions, getPluginPermissions, getPropertyValue, getTotalInsertCount, hasPermission, initPermissions, onBeforeClose, setPropertyValue, update |
Methods inherited from class net.sf.basedb.core.AbstractBatcher |
---|
analyzeTable, close, getBatchSize, getDbControl, getSessionControl, isClosed, setBatchSize, setDbControl, updateLastAccess |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private String updateSource
private final Date entryDate
private final List<ExtendedProperty> extendedProperties
ExtendedProperties
private final Set<String> batchedExternalIds
private org.hibernate.Query findReporter
Constructor Detail |
---|
ReporterBatcher(DbControl dc) throws BaseException
BaseException
Method Detail |
---|
public static ReporterBatcher getNew(DbControl dc) throws BaseException
dc
- The DbControl to use for database access and
permission checking
BaseException
- If there is an errorpublic Item getType()
BasicBatcher
Item
enumeration.
getType
in class BasicBatcher<ReporterData>
Item
public void insert(ReporterData data) throws BaseException
insert
in class BasicBatcher<ReporterData>
data
- Data object to be inserted
InvalidDataException
- If the data is null or it doesn't validate
against the BasicBatcher.validate(BatchableData)
method
PermissionDeniedException
- If the logged in user doesn't
have create permission
BaseException
- If there is another errorpublic void flushInsert() throws DatabaseException
flushInsert
in class BasicBatcher<ReporterData>
DatabaseException
public void validate(ReporterData data) throws InvalidDataException, InvalidUseOfNullException
ExtendedProperty.validateValue(Object)
method
validate
in class BasicBatcher<ReporterData>
data
- Data object to validate
InvalidDataException
- If the data object is invalid
InvalidUseOfNullException
void onBeforeCommit(ReporterData data, Transactional.Action action) throws BaseException
onBeforeCommit
in class BasicBatcher<ReporterData>
data
- Object to updateaction
- The action
BaseException
public boolean exists(String externalId, boolean checkInsertQueue, boolean checkDb) throws BaseException
externalId
- The external id of the reportercheckInsertQueue
- If the insert queue should be checked or notcheckDb
- If the database should be checked or not
BaseException
- If there is an errorpublic boolean isInInsertQueue(String externalId)
public ReporterData getByExternalId(String externalId) throws ItemNotFoundException, BaseException
exists(String, boolean, boolean)
method returns true, but this method throws an ItemNotFoundException
.
externalId
- The external id of the reporter
ReporterData
object
ItemNotFoundException
- If a reporter with the given id
isn't found
BaseException
- If there is another errorpublic ReporterData getByExternalId(String externalId, boolean errorIfNotFound)
exists(String, boolean, boolean)
method returns true, but this method throws an ItemNotFoundException
.
externalId
- The external id of the reportererrorIfNotFound
- If an ItemNotFoundException should be thrown if the
reporter isn't found
ReporterData
object, or null if not found
ItemNotFoundException
- If a reporter with the given id
isn't found and the errorIfNotFound parameter is true
BaseException
- If there is another errorpublic void setUpdateSource(String source)
source
- The source to be set. The format of the source string
should be like: "[item_type]:[item_name]"
StringTooLongException
- If the source is longer that
ReporterData.MAX_LAST_SOURCE_LENGTH
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |