public abstract class AbstractTransaction extends Object implements StrolchTransaction
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
AbstractTransaction(PrivilegeHandler privilegeHandler,
StrolchRealm realm,
Certificate certificate,
String action) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommand(Command command)
Adds the given
Command to the transaction. |
Audit |
auditFrom(AccessType accessType,
String elementType,
String elementSubType,
String id)
Helper method to create an
Audit with the given arguments. |
Audit |
auditFrom(AccessType accessType,
StrolchRootElement element)
Helper method to create an
Audit with the given arguments. |
void |
autoCloseableCommit()
DO NOT CALL THIS METHOD.
|
void |
autoCloseableDoNothing()
DO NOT CALL THIS METHOD.
|
void |
autoCloseableRollback()
DO NOT CALL THIS METHOD.
|
void |
close()
DO NOT CALL THIS METHOD.
|
protected abstract void |
commit() |
void |
commitOnClose()
|
void |
doNothingOnClose()
|
<U> List<U> |
doQuery(ActivityQuery<U> query)
Performs the given
ActivityQuery and each returned Activity is passed through the
ActivityVisitor attached to the ActivityQuery and the return value of the visitor is added to the
return list |
<U> List<U> |
doQuery(AuditQuery<U> query)
Performs the given
AuditQuery and each returned Audit is passed through the AuditVisitor
attached to the AuditQuery and the return value of the visitor is added to the return list |
<U> List<U> |
doQuery(OrderQuery<U> query)
Performs the given
OrderQuery and each returned Order is passed through the OrderVisitor
attached to the OrderQuery and the return value of the visitor is added to the return list |
<U> List<U> |
doQuery(ResourceQuery<U> query)
Performs the given
ResourceQuery and each returned Resource is passed through the
ResourceVisitor attached to the ResourceQuery and the return value of the visitor is added to the
return list |
StrolchTransactionException |
fail(String string)
Sets the
TransactionCloseStrategy to TransactionCloseStrategy.ROLLBACK and returns a
StrolchTransactionException which can be thrown by the caller to stop the exception |
<T extends StrolchElement> |
findElement(Locator locator)
Used to find a
StrolchElement by a Locator. |
void |
flush()
Performs all registered commands
|
List<Activity> |
getActivitiesBy(StringListParameter refP)
Returns all
Activities which are referenced by the given StringListParameter. |
List<Activity> |
getActivitiesBy(StringListParameter refP,
boolean assertExists)
Returns all
Activities which are referenced by the given StringListParameter. |
Activity |
getActivityBy(StringParameter refP)
Returns the
Activity which is referenced by the given StringParameter. |
Activity |
getActivityBy(StringParameter refP,
boolean assertExists)
Returns the
Activity which is referenced by the given StringParameter. |
Activity |
getActivityBy(String type,
String id)
Returns the
Activity with the given type and id, or null if it does not exist |
Activity |
getActivityBy(String type,
String id,
boolean assertExists)
Returns the
Activity with the given type and id, or null if it does not exist |
ActivityMap |
getActivityMap()
Returns a reference to the
ActivityMap for the StrolchRealm for which this transaction was opened |
Activity |
getActivityTemplate(String type)
Returns a copy of the
Activity of Type StrolchConstants.TEMPLATE with the given type as id, or
null if it does not exist |
Activity |
getActivityTemplate(String type,
boolean assertExists)
Returns a copy of the
Activity of Type StrolchConstants.TEMPLATE with the given type as id. |
AuditTrail |
getAuditTrail()
Returns a reference to the
AuditTrail for the StrolchRealm for which this transaction was opened |
Certificate |
getCertificate()
Returns the
Certificate which allowed this TX to be opened |
TransactionCloseStrategy |
getCloseStrategy()
Returns the currently set
TransactionCloseStrategy |
Order |
getOrderBy(StringParameter refP)
Returns the
Order which is referenced by the given StringParameter. |
Order |
getOrderBy(StringParameter refP,
boolean assertExists)
Returns the
Order which is referenced by the given StringParameter. |
Order |
getOrderBy(String type,
String id)
Returns the
Order with the given type and id, or null if it does not exist |
Order |
getOrderBy(String type,
String id,
boolean assertExists)
Returns the
Order with the given type and id, or null if it does not exist |
OrderMap |
getOrderMap()
Returns a reference to the
OrderMap for the StrolchRealm for which this transaction was opened |
List<Order> |
getOrdersBy(StringListParameter refP)
Returns all
Orders which are referenced by the given StringListParameter. |
List<Order> |
getOrdersBy(StringListParameter refP,
boolean assertExists)
Returns all
Orders which are referenced by the given StringListParameter. |
Order |
getOrderTemplate(String type)
Returns a copy of the
Order of Type StrolchConstants.TEMPLATE with the given type as id, or null
if it does not exist |
Order |
getOrderTemplate(String type,
boolean assertExists)
Returns a copy of the
Order of Type StrolchConstants.TEMPLATE with the given type as id. |
StrolchRealm |
getRealm() |
String |
getRealmName()
Returns the name of the
StrolchRealm for which this transaction was opened |
Resource |
getResourceBy(StringParameter refP)
Returns the
Resource which is referenced by the given StringParameter. |
Resource |
getResourceBy(StringParameter refP,
boolean assertExists)
Returns the
Resource which is referenced by the given StringParameter. |
Resource |
getResourceBy(String type,
String id)
Returns the
Resource with the given type and id, or null if it does not exist |
Resource |
getResourceBy(String type,
String id,
boolean assertExists)
Returns the
Resource with the given type and id, or null if it does not exist |
ResourceMap |
getResourceMap()
Returns a reference to the
ResourceMap for the StrolchRealm for which this transaction was opened |
List<Resource> |
getResourcesBy(StringListParameter refP)
Returns all
Resources which are referenced by the given StringListParameter. |
List<Resource> |
getResourcesBy(StringListParameter refP,
boolean assertExists)
Returns all
Resources which are referenced by the given StringListParameter. |
Resource |
getResourceTemplate(String type)
Returns a copy of the
Resource of Type StrolchConstants.TEMPLATE with the given type as id, or
null if it does not exist |
Resource |
getResourceTemplate(String type,
boolean assertExists)
Returns a copy of the
Resource of Type StrolchConstants.TEMPLATE with the given type as id. |
TransactionState |
getState() |
TransactionResult |
getTxResult() |
protected void |
handleFailure(long closeStartNanos,
Exception e) |
boolean |
isClosing() |
boolean |
isCommitting() |
boolean |
isRollingBack() |
boolean |
isSuppressAudits()
Returns true if writing
Audits is currently suppressed |
boolean |
isSuppressDoNothingLogging()
Returns true if logging of a
TransactionCloseStrategy.DO_NOTHING should be suppressed |
boolean |
isSuppressUpdates()
Returns true if the observer updates are currently suppressed
|
boolean |
isVersioningEnabled()
Returns true if versioning is enabled on the
StrolchRealm for which this transaction has been opened |
<T extends StrolchRootElement> |
lock(T element)
Locks the given element and registers it on the transaction so the lock is released when the transaction is
closed
|
<T extends StrolchRootElement> |
releaseLock(T element)
Releases the lock of the given element so that even though the transaction is still open, another
thread/transaction can lock the element
|
protected abstract void |
rollback() |
void |
rollbackOnClose()
|
void |
setSuppressAudits(boolean suppressAudits)
If the given argument is true, then no
Audits are written |
void |
setSuppressDoNothingLogging(boolean quietDoNothing)
If the given argument is true, then logging of a
TransactionCloseStrategy.DO_NOTHING will be suppressed |
void |
setSuppressUpdates(boolean suppressUpdates)
If the given argument is true, then no observer updates are performed
|
protected abstract void |
writeChanges() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPersistenceHandlerpublic AbstractTransaction(PrivilegeHandler privilegeHandler, StrolchRealm realm, Certificate certificate, String action)
public TransactionResult getTxResult()
public TransactionState getState()
getState in interface StrolchTransactionTransactionStatepublic boolean isRollingBack()
isRollingBack in interface StrolchTransactionStrolchTransaction is TransactionState.ROLLING_BACKpublic boolean isCommitting()
isCommitting in interface StrolchTransactionStrolchTransaction is TransactionState.COMMITTINGpublic boolean isClosing()
isClosing in interface StrolchTransactionStrolchTransaction is TransactionState.CLOSINGpublic String getRealmName()
StrolchTransactionStrolchRealm for which this transaction was openedgetRealmName in interface StrolchTransactionStrolchRealm for which this transaction was openedpublic StrolchRealm getRealm()
public Certificate getCertificate()
StrolchTransactionCertificate which allowed this TX to be openedgetCertificate in interface StrolchTransactionCertificate which allowed this TX to be openedpublic TransactionCloseStrategy getCloseStrategy()
StrolchTransactionTransactionCloseStrategygetCloseStrategy in interface StrolchTransactionTransactionCloseStrategypublic void close()
throws StrolchTransactionException
StrolchTransaction
DO NOT CALL THIS METHOD. This interface implements AutoCloseable and transactions are expected to be used
in a auto closing try block:
StrolchAgent strolchAgent = getStrolchAgent();
StrolchRealm realm = strolchAgent.getContainer().getRealm("defaultRealm");
try(StrolchTransaction tx = realm.openTx(certificate, getClass())){
// do work
tx.commitOnClose();
}
After the block is closed, the transaction is automatically closed and all allocated resources are releasedclose in interface AutoCloseableclose in interface StrolchTransactionStrolchTransactionExceptionpublic void doNothingOnClose()
StrolchTransactiondoNothingOnClose in interface StrolchTransactionpublic void commitOnClose()
StrolchTransactioncommitOnClose in interface StrolchTransactionpublic void rollbackOnClose()
StrolchTransactionrollbackOnClose in interface StrolchTransactionpublic StrolchTransactionException fail(String string)
StrolchTransactionTransactionCloseStrategy to TransactionCloseStrategy.ROLLBACK and returns a
StrolchTransactionException which can be thrown by the caller to stop the exceptionfail in interface StrolchTransactionStrolchTransactionException to be thrown by the callerpublic void setSuppressUpdates(boolean suppressUpdates)
StrolchTransactionsetSuppressUpdates in interface StrolchTransactionsuppressUpdates - true to suppress the updates, false to enable thempublic boolean isSuppressUpdates()
StrolchTransactionisSuppressUpdates in interface StrolchTransactionpublic void setSuppressAudits(boolean suppressAudits)
StrolchTransactionAudits are writtensetSuppressAudits in interface StrolchTransactionsuppressAudits - true to suppress writing Audits, false to enable thempublic boolean isSuppressAudits()
StrolchTransactionAudits is currently suppressedisSuppressAudits in interface StrolchTransactionAudits is currently suppressedpublic boolean isSuppressDoNothingLogging()
StrolchTransactionTransactionCloseStrategy.DO_NOTHING should be suppressedisSuppressDoNothingLogging in interface StrolchTransactionTransactionCloseStrategy.DO_NOTHING should be suppressedpublic void setSuppressDoNothingLogging(boolean quietDoNothing)
StrolchTransactionTransactionCloseStrategy.DO_NOTHING will be suppressedsetSuppressDoNothingLogging in interface StrolchTransactionpublic boolean isVersioningEnabled()
StrolchTransactionStrolchRealm for which this transaction has been openedisVersioningEnabled in interface StrolchTransactionpublic <T extends StrolchRootElement> void lock(T element) throws StrolchLockException
StrolchTransactionlock in interface StrolchTransactionelement - the element to lockStrolchLockExceptionpublic <T extends StrolchRootElement> void releaseLock(T element) throws StrolchLockException
StrolchTransactionreleaseLock in interface StrolchTransactionelement - the element for which the lock is to be releasedStrolchLockExceptionpublic void addCommand(Command command)
StrolchTransactionCommand to the transaction. Using this method guarantees that a Command is
executed properly:
and if an exception occurs:
addCommand in interface StrolchTransactionpublic ResourceMap getResourceMap()
StrolchTransactionResourceMap for the StrolchRealm for which this transaction was openedgetResourceMap in interface StrolchTransactionResourceMappublic OrderMap getOrderMap()
StrolchTransactionOrderMap for the StrolchRealm for which this transaction was openedgetOrderMap in interface StrolchTransactionOrderMappublic ActivityMap getActivityMap()
StrolchTransactionActivityMap for the StrolchRealm for which this transaction was openedgetActivityMap in interface StrolchTransactionActivityMappublic AuditTrail getAuditTrail()
StrolchTransactionAuditTrail for the StrolchRealm for which this transaction was openedgetAuditTrail in interface StrolchTransactionAuditTrailpublic <U> List<U> doQuery(OrderQuery<U> query)
StrolchTransaction
Performs the given OrderQuery and each returned Order is passed through the OrderVisitor
attached to the OrderQuery and the return value of the visitor is added to the return list
doQuery in interface StrolchTransactionquery - the query to performOrderVisitor, never nullpublic <U> List<U> doQuery(ResourceQuery<U> query)
StrolchTransaction
Performs the given ResourceQuery and each returned Resource is passed through the
ResourceVisitor attached to the ResourceQuery and the return value of the visitor is added to the
return list
doQuery in interface StrolchTransactionquery - the query to performResourceVisitor, never nullpublic <U> List<U> doQuery(ActivityQuery<U> query)
StrolchTransaction
Performs the given ActivityQuery and each returned Activity is passed through the
ActivityVisitor attached to the ActivityQuery and the return value of the visitor is added to the
return list
doQuery in interface StrolchTransactionquery - the query to performActivityVisitor, never nullpublic <U> List<U> doQuery(AuditQuery<U> query)
StrolchTransaction
Performs the given AuditQuery and each returned Audit is passed through the AuditVisitor
attached to the AuditQuery and the return value of the visitor is added to the return list
doQuery in interface StrolchTransactionquery - the query to performAuditVisitor, never nullpublic <T extends StrolchElement> T findElement(Locator locator)
StrolchTransaction
Used to find a StrolchElement by a Locator.
A Locator has the form <ObjectClassType>/<Type>/<Id> - this is the least amount of path
elements to find an object. Thus to query a Resource of type "MyType" and the id "@1" use the following
path: Resourcee/MyType/@1
This method can also be used to find a deeper element, e.g. a specific Parameter on an
ParameterBag on an Order. This would be done as follows: Order/MyType/@1/myParam
findElement in interface StrolchTransactionlocator - the locator defining the path to the element which is to be foundLocator references an element which does not exist, i.e.
an inexistant Resource or an inexistand Parameter on a Resource, then a
StrolchException is thrownpublic Resource getResourceTemplate(String type)
StrolchTransaction
Returns a copy of the Resource of Type StrolchConstants.TEMPLATE with the given type as id, or
null if it does not exist
Templates are StrolchRootElements which have the type
StrolchConstants.TEMPLATE and their id is the type of element for which it is a template. For instance
when creating a Resource of type Person then having a template with the id
Person helps creating new Person resources; get the resource and then create a clone:
Resource.getClone()
getResourceTemplate in interface StrolchTransactiontype - the id of the Resource templateResource template with the given id, or null if it does not existpublic Resource getResourceTemplate(String type, boolean assertExists) throws StrolchException
StrolchTransaction
Returns a copy of the Resource of Type StrolchConstants.TEMPLATE with the given type as id. If
assertExists is true, then an exception is thrown if the template does not exist does not exist
Templates are StrolchRootElements which have the type
StrolchConstants.TEMPLATE and their id is the type of element for which it is a template. For instance
when creating a Resource of type Person then having a template with the id
Person helps creating new Person resources; get the resource and then create a clone:
Resource.getClone()
getResourceTemplate in interface StrolchTransactiontype - the id of the Resource templateResource template with the given id, or if assertExists is true,
then an exception is thrown if the resource does not existStrolchExceptionpublic Order getOrderTemplate(String type)
StrolchTransaction
Returns a copy of the Order of Type StrolchConstants.TEMPLATE with the given type as id, or null
if it does not exist
Templates are StrolchRootElements which have the type
StrolchConstants.TEMPLATE and their id is the type of element for which it is a template. For instance
when creating an Order of type PurchaseOrder then having a template with the id
PurchaseOrder helps creating new PurchaseOrder orders; get the order and then create a clone:
Order.getClone()
getOrderTemplate in interface StrolchTransactiontype - the id of the Order templateOrder template with the given id, or null if it does not existpublic Order getOrderTemplate(String type, boolean assertExists) throws StrolchException
StrolchTransaction
Returns a copy of the Order of Type StrolchConstants.TEMPLATE with the given type as id. If
assertExists is true, then an exception is thrown if the template does not exist does not exist
Templates are StrolchRootElements which have the type
StrolchConstants.TEMPLATE and their id is the type of element for which it is a template. For instance
when creating an Order of type PurchaseOrder then having a template with the id
PurchaseOrder helps creating new PurchaseOrder orders; get the order and then create a clone:
Order.getClone()
getOrderTemplate in interface StrolchTransactiontype - the id of the Order templateOrder template with the given id, or if assertExists is true, then
an exception is thrown if the order does not existStrolchExceptionpublic Activity getActivityTemplate(String type)
StrolchTransaction
Returns a copy of the Activity of Type StrolchConstants.TEMPLATE with the given type as id, or
null if it does not exist
Templates are StrolchRootElements which have the type
StrolchConstants.TEMPLATE and their id is the type of element for which it is a template. For instance
when creating a Activity of type ToStock then having a template with the id
ToStock helps creating new ToStock activities; get the activity and then create a clone:
Activity.getClone()
getActivityTemplate in interface StrolchTransactiontype - the id of the Activity templateActivity template with the given id, or null if it does not existpublic Activity getActivityTemplate(String type, boolean assertExists) throws StrolchException
StrolchTransaction
Returns a copy of the Activity of Type StrolchConstants.TEMPLATE with the given type as id. If
assertExists is true, then an exception is thrown if the template does not exist does not exist
Templates are StrolchRootElements which have the type
StrolchConstants.TEMPLATE and their id is the type of element for which it is a template. For instance
when creating a Activity of type ToStock then having a template with the id
ToStock helps creating new ToStock activities; get the activity and then create a clone:
Activity.getClone()
getActivityTemplate in interface StrolchTransactiontype - the id of the Activity templateActivity template with the given id, or if assertExists is true,
then an exception is thrown if the activity does not existStrolchExceptionpublic Order getOrderBy(String type, String id)
StrolchTransactionOrder with the given type and id, or null if it does not existgetOrderBy in interface StrolchTransactiontype - the type of the Orderid - the id of the OrderOrder with the given type and id, or null if it does not existpublic Order getOrderBy(String type, String id, boolean assertExists) throws StrolchException
StrolchTransactionOrder with the given type and id, or null if it does not existgetOrderBy in interface StrolchTransactiontype - the type of the Orderid - the id of the OrderassertExists - if true, and order does not exist, then a StrolchException is thrownOrder with the given type and id, or null if it does not existStrolchException - if the order does not exist, and assertExists is truepublic Order getOrderBy(StringParameter refP) throws StrolchException
StrolchTransactionOrder which is referenced by the given StringParameter. A reference Parameter
must have its interpretation set to StrolchConstants.INTERPRETATION_ORDER_REF and the UOM must be set to
the order's type and the value is the id of the ordergetOrderBy in interface StrolchTransactionrefP - the StringParameter which references an OrderStrolchException - if the StringParameter is not a properly configured as a reference parameterpublic Order getOrderBy(StringParameter refP, boolean assertExists) throws StrolchException
StrolchTransactionOrder which is referenced by the given StringParameter. A reference Parameter
must have its interpretation set to StrolchConstants.INTERPRETATION_ORDER_REF and the UOM must be set to
the order's type and the value is the id of the ordergetOrderBy in interface StrolchTransactionrefP - the StringParameter which references an OrderassertExists - if true, and order does not exist, then a StrolchException is thrownStrolchException - if the StringParameter is not a properly configured as a reference parameter, or if the order
does not exist, and assertExists is truepublic List<Order> getOrdersBy(StringListParameter refP) throws StrolchException
StrolchTransactionOrders which are referenced by the given StringListParameter. A reference
Parameter must have its interpretation set to StrolchConstants.INTERPRETATION_ORDER_REF and the
UOM must be set to the order's type and the value is the id of the ordergetOrdersBy in interface StrolchTransactionrefP - the StringListParameter which references a list of OrdersStrolchException - if the StringListParameter is not a properly configured as a reference parameterpublic List<Order> getOrdersBy(StringListParameter refP, boolean assertExists) throws StrolchException
StrolchTransactionOrders which are referenced by the given StringListParameter. A reference
Parameter must have its interpretation set to StrolchConstants.INTERPRETATION_ORDER_REF and the
UOM must be set to the order's type and the value is the id of the ordergetOrdersBy in interface StrolchTransactionrefP - the StringListParameter which references a list of OrdersassertExists - if true, and order does not exist, then a StrolchException is thrownassertExists is trueStrolchException - if the StringListParameter is not a properly configured as a reference parameterpublic Resource getResourceBy(String type, String id)
StrolchTransactionResource with the given type and id, or null if it does not existgetResourceBy in interface StrolchTransactiontype - the type of the Resourceid - the id of the ResourceResource with the given type and id, or null if it does not existpublic Resource getResourceBy(String type, String id, boolean assertExists) throws StrolchException
StrolchTransactionResource with the given type and id, or null if it does not existgetResourceBy in interface StrolchTransactiontype - the type of the Resourceid - the id of the ResourceassertExists - if true, and resource does not exist, then a StrolchException is thrownResource with the given type and id, or null if it does not existStrolchException - if the resource does not exist, and assertExists is truepublic Resource getResourceBy(StringParameter refP) throws StrolchException
StrolchTransactionResource which is referenced by the given StringParameter. A reference
Parameter must have its interpretation set to StrolchConstants.INTERPRETATION_RESOURCE_REF and
the UOM must be set to the resource's type and the value is the id of the resourcegetResourceBy in interface StrolchTransactionrefP - the StringParameter which references a ResourceStrolchException - if the StringParameter is not a properly configured as a reference parameterpublic Resource getResourceBy(StringParameter refP, boolean assertExists) throws StrolchException
StrolchTransactionResource which is referenced by the given StringParameter. A reference
Parameter must have its interpretation set to StrolchConstants.INTERPRETATION_RESOURCE_REF and
the UOM must be set to the resource's type and the value is the id of the resourcegetResourceBy in interface StrolchTransactionrefP - the StringParameter which references a ResourceassertExists - if true, and resource does not exist, then a StrolchException is thrownStrolchException - if the StringParameter is not a properly configured as a reference parameter, or if the
resource does not exist, and assertExists is truepublic List<Resource> getResourcesBy(StringListParameter refP) throws StrolchException
StrolchTransactionResources which are referenced by the given StringListParameter. A reference
Parameter must have its interpretation set to StrolchConstants.INTERPRETATION_RESOURCE_REF and
the UOM must be set to the resource's type and the value is the id of the resourcegetResourcesBy in interface StrolchTransactionrefP - the StringListParameter which references a list of ResourcesStrolchException - if the StringListParameter is not a properly configured as a reference parameterpublic List<Resource> getResourcesBy(StringListParameter refP, boolean assertExists) throws StrolchException
StrolchTransactionResources which are referenced by the given StringListParameter. A reference
Parameter must have its interpretation set to StrolchConstants.INTERPRETATION_RESOURCE_REF and
the UOM must be set to the resource's type and the value is the id of the resourcegetResourcesBy in interface StrolchTransactionrefP - the StringListParameter which references a list of ResourcesassertExists - if true, and resource does not exist, then a StrolchException is thrownassertExists is trueStrolchException - if the StringListParameter is not a properly configured as a reference parameterpublic Activity getActivityBy(String type, String id)
StrolchTransactionActivity with the given type and id, or null if it does not existgetActivityBy in interface StrolchTransactiontype - the type of the Activityid - the id of the ActivityActivity with the given type and id, or null if it does not existpublic Activity getActivityBy(String type, String id, boolean assertExists) throws StrolchException
StrolchTransactionActivity with the given type and id, or null if it does not existgetActivityBy in interface StrolchTransactiontype - the type of the Activityid - the id of the ActivityassertExists - if true, and activity does not exist, then a StrolchException is thrownActivity with the given type and id, or null if it does not existStrolchException - if the activity does not exist, and assertExists is truepublic Activity getActivityBy(StringParameter refP) throws StrolchException
StrolchTransactionActivity which is referenced by the given StringParameter. A reference
Parameter must have its interpretation set to StrolchConstants.INTERPRETATION_ACTIVITY_REF and
the UOM must be set to the activity's type and the value is the id of the activitygetActivityBy in interface StrolchTransactionrefP - the StringParameter which references an ActivityStrolchException - if the StringParameter is not a properly configured as a reference parameterpublic Activity getActivityBy(StringParameter refP, boolean assertExists) throws StrolchException
StrolchTransactionActivity which is referenced by the given StringParameter. A reference
Parameter must have its interpretation set to StrolchConstants.INTERPRETATION_ACTIVITY_REF and
the UOM must be set to the activity's type and the value is the id of the activitygetActivityBy in interface StrolchTransactionrefP - the StringParameter which references an ActivityassertExists - if true, and activity does not exist, then a StrolchException is thrownStrolchException - if the StringParameter is not a properly configured as a reference parameter, or if the
activity does not exist, and assertExists is truepublic List<Activity> getActivitiesBy(StringListParameter refP) throws StrolchException
StrolchTransactionActivities which are referenced by the given StringListParameter. A
reference Parameter must have its interpretation set to
StrolchConstants.INTERPRETATION_ACTIVITY_REF and the UOM must be set to the activity's type and the value
is the id of the activitygetActivitiesBy in interface StrolchTransactionrefP - the StringListParameter which references a list of ActivitiesStrolchException - if the StringListParameter is not a properly configured as a reference parameterpublic List<Activity> getActivitiesBy(StringListParameter refP, boolean assertExists) throws StrolchException
StrolchTransactionActivities which are referenced by the given StringListParameter. A
reference Parameter must have its interpretation set to
StrolchConstants.INTERPRETATION_ACTIVITY_REF and the UOM must be set to the activity's type and the value
is the id of the activitygetActivitiesBy in interface StrolchTransactionrefP - the StringListParameter which references a list of ActivitiesassertExists - if true, and activity does not exist, then a StrolchException is thrownassertExists is trueStrolchException - if the StringListParameter is not a properly configured as a reference parameterpublic void flush()
StrolchTransactionPerforms all registered commands
This method does not release any locks, nor does it notify any observers
flush in interface StrolchTransactionpublic void autoCloseableCommit()
StrolchTransactionTransactionCloseStrategy.COMMIT, then
when the transaction is closed, this method is called and all registered Command are performed, locks on
objects are released and any other resources are releasedautoCloseableCommit in interface StrolchTransactionpublic void autoCloseableRollback()
StrolchTransactionTransactionCloseStrategy.ROLLBACK, then
when the transaction is closed, no further actions are performed and any Command which were performed
have their Command.undo() method called and any DB connections are also rolled backautoCloseableRollback in interface StrolchTransactionpublic void autoCloseableDoNothing()
throws StrolchTransactionException
StrolchTransactionTransactionCloseStrategy.DO_NOTHING, then
when the transaction is closed, this method is called no changes to the model is performed but locks on objects
are released and any other resources are releasedautoCloseableDoNothing in interface StrolchTransactionStrolchTransactionExceptionprotected void handleFailure(long closeStartNanos,
Exception e)
public Audit auditFrom(AccessType accessType, StrolchRootElement element)
StrolchTransactionAudit with the given arguments. The audit can then be saved by calling
AuditTrail.add(StrolchTransaction, Audit)auditFrom in interface StrolchTransactionaccessType - the type of accesselement - the element from which to to create the auditpublic Audit auditFrom(AccessType accessType, String elementType, String elementSubType, String id)
StrolchTransactionAudit with the given arguments. The audit can then be saved by calling
AuditTrail.add(StrolchTransaction, Audit)auditFrom in interface StrolchTransactionaccessType - the type of accesselementType - the element type, i.e. Tags.RESOURCE, Tags.ORDERid - the id of the element auditedCopyright © 2011–2016 Strolch. All rights reserved.