use of org.jaffa.soa.services.RaiseEventService in project jaffa-framework by jaffa-projects.
the class TestThread method run.
@Override
public void run() {
UOW uow = null;
UserContextWrapper ucw = null;
try {
synchronized (this) {
ucw = UserContextWrapperFactory.instance(userId);
}
uow = new UOW();
HeaderParam headerParam = new HeaderParam(soaEventParamName, soaEventParamValue);
RaiseEventService raiseEventService = new RaiseEventService();
List<HeaderParam> headerParamList = new ArrayList<HeaderParam>();
headerParamList.add(headerParam);
raiseEventService.raiseSoaEvent(uow, eventName, eventDesc, null, headerParamList);
uow.commit();
} catch (ApplicationExceptions applicationExceptions) {
applicationExceptions.printStackTrace();
} catch (FrameworkException fe) {
fe.printStackTrace();
} catch (ApplicationException ae) {
ae.printStackTrace();
} finally {
synchronized (this) {
if (ucw != null)
ucw.unsetContext();
}
if (uow != null) {
try {
uow.rollback();
} catch (Exception e) {
e.printStackTrace();
// the uow cannot be rolled back
}
}
}
}
use of org.jaffa.soa.services.RaiseEventService in project jaffa-framework by jaffa-projects.
the class SOAEventBaseHandler method raiseSOAEvent.
/**
* Raises the SOA event defined in the rule meta data
*
* @param uow UOW for handler life cycle event
* @param targetObject the target object
* @param rule the raise soa event rule meta data
* @throws ApplicationExceptions
* @throws FrameworkException
*/
private void raiseSOAEvent(UOW uow, Object targetObject, RuleMetaData rule, Object[] args) throws ApplicationExceptions, FrameworkException {
UOW localUow = uow;
if (uow == null || !uow.isActive()) {
localUow = getUOW(targetObject);
}
if (log.isDebugEnabled()) {
log.debug("Applying " + rule + " on " + targetObject);
}
// Add Parameters for the SOAEvent
List<HeaderParam> headerParamsList = new ArrayList<>();
headerParamsList.addAll(createSOAEventParameters(rule.getParameter("staticParameters"), null, null, null));
headerParamsList.addAll(createSOAEventParameters(rule.getParameter("dynamicParameters"), targetObject, args, rule));
RaiseEventService raiseEventService = new RaiseEventService();
raiseEventService.raiseSoaEvent(localUow, rule.getParameter("eventName"), rule.getParameter("description"), rule.getParameter("category"), headerParamsList);
}
Aggregations