List of usage examples for org.aspectj.lang ProceedingJoinPoint getArgs
Object[] getArgs();
From source file:de.iteratec.iteraplan.businesslogic.common.SubscriptionsAdvice.java
License:Open Source License
/** * Intercepts the {@link de.iteratec.iteraplan.presentation.dialog.BuildingBlockFrontendService#saveComponentModel(MemBean, Integer, org.springframework.webflow.execution.RequestContext, org.springframework.webflow.execution.FlowExecutionContext)} * method and sends the notification email. * //from w ww.java 2 s . c o m * @param pjp the ProceedingJoinPoint, which exposes the proceed(..) method in order to support around advice in aspects * @return the result of the intercepted method * @throws Throwable if any exceptions occurs executing method */ public Object saveNewComponentModelAdvice(ProceedingJoinPoint pjp) throws Throwable { if (!activated) { return pjp.proceed(); } Object[] args = pjp.getArgs(); final Object retVal = pjp.proceed(); if (retVal != null) { BuildingBlock buildingBlock = getEntity(args[0]); if (buildingBlock != null && BBT_TO_MESSAGE_KEY.containsKey(buildingBlock.getTypeOfBuildingBlock())) { buildingBlock = load(buildingBlock); List<String> changedTimeseries = determineChangedTimeseries( Maps.<String, List<TimeseriesEntry>>newHashMap(), buildingBlock); String messageKey = GENERIC + CREATED; sendEmail(null, buildingBlock, changedTimeseries, messageKey, buildingBlock.getBuildingBlockType().getSubscribedUsers()); } } return retVal; }
From source file:de.iteratec.iteraplan.businesslogic.common.SubscriptionsAdvice.java
License:Open Source License
/** * Intercepts the {@link de.iteratec.iteraplan.presentation.dialog.BuildingBlockFrontendService#saveComponentModel(MemBean, Integer, org.springframework.webflow.execution.RequestContext, org.springframework.webflow.execution.FlowExecutionContext)} * method and sends the notification email. * //from w ww . j a va 2 s . c om * @param pjp the ProceedingJoinPoint, which exposes the proceed(..) method in order to support around advice in aspects * @return the result of the intercepted method * @throws Throwable if any exceptions occurs executing method */ public Object saveNewReleaseComponentModelAdvice(ProceedingJoinPoint pjp) throws Throwable { if (!activated) { return pjp.proceed(); } Object[] args = pjp.getArgs(); final Object retVal = pjp.proceed(); if (retVal != null) { BuildingBlock buildingBlock = getEntity(args[0]); if (buildingBlock != null && BBT_TO_MESSAGE_KEY.containsKey(buildingBlock.getTypeOfBuildingBlock())) { buildingBlock = load(buildingBlock); List<String> changedTimeseries = determineChangedTimeseries( Maps.<String, List<TimeseriesEntry>>newHashMap(), buildingBlock); String messageKey = GENERIC + RELEASE_NEW; sendEmail(null, buildingBlock, changedTimeseries, messageKey, buildingBlock.getBuildingBlockType().getSubscribedUsers()); } } return retVal; }
From source file:de.iteratec.iteraplan.businesslogic.common.SubscriptionsAdvice.java
License:Open Source License
/** * Intercepts the {@link de.iteratec.iteraplan.presentation.dialog.BuildingBlockFrontendService#saveComponentModel(MemBean, Integer, org.springframework.webflow.execution.RequestContext, org.springframework.webflow.execution.FlowExecutionContext)} * method and sends the notification email. * // w ww . ja v a 2 s . com * @param pjp the ProceedingJoinPoint, which exposes the proceed(..) method in order to support around advice in aspects * @return the result of the intercepted method * @throws Throwable if any exceptions occurs executing method */ public Object saveCopyReleaseComponentModelAdvice(ProceedingJoinPoint pjp) throws Throwable { if (!activated) { return pjp.proceed(); } Object[] args = pjp.getArgs(); final Object retVal = pjp.proceed(); if (retVal != null) { BuildingBlock buildingBlock = getEntity(args[0]); if (buildingBlock != null && BBT_TO_MESSAGE_KEY.containsKey(buildingBlock.getTypeOfBuildingBlock())) { buildingBlock = load(buildingBlock); List<String> changedTimeseries = determineChangedTimeseries( Maps.<String, List<TimeseriesEntry>>newHashMap(), buildingBlock); String messageKey = GENERIC + RELEASE_COPY; sendEmail(null, buildingBlock, changedTimeseries, messageKey, buildingBlock.getBuildingBlockType().getSubscribedUsers()); } } return retVal; }
From source file:de.iteratec.iteraplan.businesslogic.common.SubscriptionsAdvice.java
License:Open Source License
/** * Intercepts the {@link de.iteratec.iteraplan.businesslogic.service.BuildingBlockService#deleteEntity(de.iteratec.iteraplan.model.interfaces.Entity)} * method and sends the notification email. * /* w ww .ja v a 2 s.c o m*/ * @param pjp the ProceedingJoinPoint, which exposes the proceed(..) method in order to support around advice in aspects * @throws Throwable if any exceptions occurs executing method */ public void deleteEntityAdvice(ProceedingJoinPoint pjp) throws Throwable { if (!activated) { pjp.proceed(); return; } Object[] args = pjp.getArgs(); BuildingBlock buildingBlock = load((BuildingBlock) args[0], SUBSCRIBED_USERS); pjp.proceed(); if (BBT_TO_MESSAGE_KEY.containsKey(buildingBlock.getTypeOfBuildingBlock())) { Collection<User> users = new HashSet<User>(buildingBlock.getSubscribedUsers()); users.addAll(buildingBlock.getBuildingBlockType().getSubscribedUsers()); String messageKey = GENERIC + DELETED; sendEmail(null, buildingBlock, null, messageKey, users); } }
From source file:de.iteratec.iteraplan.businesslogic.common.SubscriptionsAdvice.java
License:Open Source License
/** * Intercepts the {@link MassUpdateServiceImpl#updateLine(MassUpdateLine)} method and sends the notification email. * /* ww w. jav a 2s. c o m*/ * @param pjp the ProceedingJoinPoint, which exposes the proceed(..) method in order to support around advice in aspects * @return the result of the intercepted method * @throws Throwable if any exceptions occurs executing method */ @SuppressWarnings("unchecked") public Object massUpdateLineAdvice(ProceedingJoinPoint pjp) throws Throwable { if (!activated) { return pjp.proceed(); } Object[] args = pjp.getArgs(); MassUpdateLine<BuildingBlock> line = (MassUpdateLine<BuildingBlock>) args[0]; BuildingBlock bb = line.getBuildingBlockToUpdate(); if (bb == null) { return pjp.proceed(); } bb = load(bb, SUBSCRIBED_USERS); if (bb.getSubscribedUsers().isEmpty()) { return pjp.proceed(); } BuildingBlock buildingBlockClone = cloneBb(bb); Object retVal = pjp.proceed(); if (buildingBlockClone != null && bb.getId() != null) { BuildingBlock buildingBlock = load(buildingBlockClone, SUBSCRIBED_USERS); String messageKey = GENERIC + UPDATED; sendEmail(buildingBlockClone, buildingBlock, null, messageKey, buildingBlock.getSubscribedUsers()); } return retVal; }
From source file:de.iteratec.iteraplan.businesslogic.common.SubscriptionsAdvice.java
License:Open Source License
/** * Intercepts the {@link de.iteratec.iteraplan.presentation.dialog.BuildingBlockFrontendService#saveComponentModel(MemBean, Integer, org.springframework.webflow.execution.RequestContext, org.springframework.webflow.execution.FlowExecutionContext)} * method and sends the notification email. * //from w w w .j a v a 2s. co m * @param pjp the ProceedingJoinPoint, which exposes the proceed(..) method in order to support around advice in aspects * @throws Throwable if any exceptions occurs executing method */ public void excelImportAdvice(ProceedingJoinPoint pjp) throws Throwable { if (!activated) { pjp.proceed(); return; } Object[] args = pjp.getArgs(); List<BuildingBlockHolder> elements = ((LandscapeData) args[0]).getBuildingBlocks(); List<BuildingBlock> added = new ArrayList<BuildingBlock>(); List<BuildingBlock> updated = new ArrayList<BuildingBlock>(); for (BuildingBlockHolder holder : elements) { BuildingBlock buildingBlock = holder.getBuildingBlock(); if (buildingBlock != null && BBT_TO_MESSAGE_KEY.containsKey(buildingBlock.getTypeOfBuildingBlock())) { BuildingBlock reloaded = bbServiceLocator.getService(buildingBlock.getTypeOfBuildingBlock()) .loadObjectByIdIfExists(buildingBlock.getId()); if (reloaded != null) { updated.add(holder.getClone()); } else { added.add(buildingBlock); } } } pjp.proceed(); for (BuildingBlock bb : added) { if (bb.getId() != null) { BuildingBlock buildingBlock = load(bb, SUBSCRIBED_USERS); String messageKey = GENERIC + CREATED; String messageKeySub = GENERIC + SUBSCRIBED; Collection<User> subscribedUsers = new HashSet<User>(buildingBlock.getSubscribedUsers()); subscribedUsers.addAll(buildingBlock.getBuildingBlockType().getSubscribedUsers()); sendEmail(null, buildingBlock, null, messageKeySub, buildingBlock.getSubscribedUsers()); sendEmail(null, buildingBlock, null, messageKey, subscribedUsers); } } for (BuildingBlock bb : updated) { if (bb.getId() != null) { BuildingBlock buildingBlock = load(bb, SUBSCRIBED_USERS); String messageKey = GENERIC + UPDATED; String messageKeySub = GENERIC + SUBSCRIBED; String messageKeyUnsub = GENERIC + UNSUBSCRIBED; Collection<User> subscribedUsers = new HashSet<User>(buildingBlock.getSubscribedUsers()); subscribedUsers.removeAll(bb.getSubscribedUsers()); Collection<User> unsubscribedUsers = new HashSet<User>(bb.getSubscribedUsers()); unsubscribedUsers.removeAll(buildingBlock.getSubscribedUsers()); sendEmail(null, buildingBlock, null, messageKeySub, subscribedUsers); sendEmail(null, buildingBlock, null, messageKeyUnsub, unsubscribedUsers); sendEmail(bb, buildingBlock, null, messageKey, buildingBlock.getSubscribedUsers()); } } }
From source file:de.kaiserpfalzEdv.commons.jee.spring.ServiceLogging.java
License:Apache License
/** * Retrieves the first UUID from argument list. * * @param joinPoint The join point information * @return a string containing the UUID. * @throws NullPointerException if no argument contained an UUID. *//*from www.j a va 2 s . c o m*/ private String retrieveUUIDFromArguments(ProceedingJoinPoint joinPoint) throws NullPointerException { for (Object arg : joinPoint.getArgs()) { if (arg != null && arg.getClass().equals(UUID.class)) { UUID result = (UUID) arg; return result.toString(); } } throw new NullPointerException("There is no UUID in the argument list of this joinPoint!"); }
From source file:de.kaiserpfalzEdv.vaadin.i18n.I18nInterceptor.java
License:Apache License
@Around("defaultSetCaption() || labelSetValue()") public Object doTranslation(final ProceedingJoinPoint invocation) { LOG.trace("Checking translations for {} ...", invocation.getSignature().getName()); Object result = null;/* w w w .j a v a 2 s.c o m*/ Object[] args = invocation.getArgs(); args[0] = translate((String) args[0], UI.getCurrent().getLocale()); try { result = invocation.proceed(args); } catch (Throwable throwable) { LOG.error(throwable.getClass().getSimpleName() + " caught: " + throwable.getMessage(), throwable); } return result; }
From source file:de.randi2.aspects.LogAspects.java
License:Open Source License
/** * Log create new object.//from w w w. j av a 2 s. c om * * @param pjp * the pjp * * @throws Throwable * the throwable */ @Around("execution(public void de.randi2.services.*.create*(..))") public void logCreateNewObject(ProceedingJoinPoint pjp) throws Throwable { pjp.proceed(); logService.logChange(ActionType.CREATE, SecurityContextHolder.getContext().getAuthentication().getName(), ((AbstractDomainObject) pjp.getArgs()[0])); }
From source file:de.randi2.aspects.LogAspects.java
License:Open Source License
/** * Log update object.//from ww w .j ava 2s. c om * * @param pjp * the pjp * * @return the object * * @throws Throwable * the throwable */ @Around("execution(public * de.randi2.services.*.update*(..))") public Object logUpdateObject(ProceedingJoinPoint pjp) throws Throwable { Object o = pjp.proceed(); logService.logChange(ActionType.UPDATE, SecurityContextHolder.getContext().getAuthentication().getName(), ((AbstractDomainObject) pjp.getArgs()[0])); return o; }