AnsweredAssumed Answered

Transaction in the example firstFoundationClient

Question asked by bardelman on Aug 10, 2012
Latest reply on Aug 15, 2012 by jonash
I'm new alfresco and I started to learn its APIs ..

In the example with the SDK : the firstFoundationClient, I found this snippet in the the project main:

/ / Use to wrap TransactionWork service calls in a user transaction
TransactionService transactionService serviceRegistry.getTransactionService = ();
RetryingTransactionCallback <Object> exampleWork RetryingTransactionCallback <Object> = new ()
public Object execute () throws Exception
doExample (serviceRegistry);
return null;
transactionService.getRetryingTransactionHelper (). doInTransaction (exampleWork);

I am very curious and I want to understand that way of writting code (the public Object execute () throws Exception
{…} .. ) written in brackets in an instantiation of a collection (or smthg which looks like ..)
I am very surprised to have a method declaration in a place like this and worse .. in themain!!

I also have another question about transaction: In this example, I don't see where the transaction begins and ends.., is it the injected code which is the method declaration (the public Object execute () ??

Thank you for the help!