Skip to content

caioleonhardt/atg-transaction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

ATG Transaction

Transactions in ATG 10.0.3 are ugly and use repetitive code. The solution was create a proxy with cglib, it make the method annotable and transparent, see bellow.

Add the factory for your component:

$class=foo.bar.YourComponent
$instanceFactory=/com/leonhardt/transaction/ATGTransactionFactory

Now, if you want use transactions or lock:

@ATGTransaction
public void executeTransaction() {
	System.out.println("executeTransaction");
}

@ATGLock
public void executeLockTransaction(@Lock RepositoryItem item, String id) {
	System.out.println("executeLockTransaction");
}

@ATGLock
public void execute(@Lock String string) {
    System.out.println(string);
}

@ATGLockOrder
public void executeLockOrder(@Lock Order order, String id) {
	synchronized (order) {
	    vlogInfo("the order will be locked ");
	    // TODO all the order updates
	    getOrderManager().updateOrder(order);
    }
}

To test, you can start the server in debug mode and see the lock table in ClientLockManager:

ATTENTION: Tested only in development enviroment!!

About

create transactions in ATG using annotations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages