- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {}
/** * Get the root event. If it does not exist it will be crated AS EMPTY event. * * @return */ public static Tapahtuma getAuditRootTapahtuma() { if (s_tapahtumaHolder.get() == null) { s_tapahtumaHolder.set(new Tapahtuma()); } return s_tapahtumaHolder.get(); }
private static Tapahtuma createEmpty() { Tapahtuma t = new Tapahtuma(); t.setSystem(null); t.setTarget(null); t.setTargetType(null); t.setTimestamp(new Date()); t.setType(null); t.setUser(null); t.setUserActsForUser(null); try { t.setHost(InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException ex) { // ignored } return t; }
/** * Logs event when a form phase is successfully saved * as application data in data store. */ @AfterReturning(pointcut = "execution(* fi.vm.sade.haku.oppija.hakemus.service.ApplicationService.submitApplication(..)) && args(applicationSystemId,..)", returning = "application") public void logSubmitApplication(final String applicationSystemId, final Application application) { try { Tapahtuma t = new Tapahtuma(); t.setTarget("Haku: " + applicationSystemId + ", käyttäjä: " + userSession.getUser().getUserName() + ", hakemus oid: " + application.getOid()); t.setTimestamp(new Date()); t.setUserActsForUser("" + userSession.getUser().getUserName()); t.setType("Hakemus lähetetty"); t.setUser("Hakemus Service"); Map<String, String> answers = application.getVastauksetMerged(); for (Map.Entry<String, String> answer : answers.entrySet()) { t.addValueChange(answer.getKey(), null, answer.getValue()); } LOGGER.debug(t.toString()); logger.log(t); } catch (Exception e) { LOGGER.warn("Could not log submit application event"); } }
public void logUpdateApplication(final Application application, final ApplicationPhase applicationPhase) { try { MapDifference<String, String> diffAnswers = ApplicationDiffUtil.diffAnswers(application, applicationPhase); AnswersDifference answersDifference = new AnswersDifference(diffAnswers); List<Difference> differences = answersDifference.getDifferences(); Tapahtuma tapahtuma = new Tapahtuma(); tapahtuma.setTarget("hakemus: " + application.getOid() + ", vaihe: " + applicationPhase.getPhaseId()); tapahtuma.setTimestamp(new Date()); tapahtuma.setUserActsForUser(userSession.getUser().getUserName()); tapahtuma.setType("Hakemuksen muokkaus"); tapahtuma.setUser(userSession.getUser().getUserName()); for (Difference difference : differences) { tapahtuma.addValueChange(difference.getKey(), difference.getOldValue(), difference.getNewValue()); } LOGGER.debug(tapahtuma.toString()); logger.log(tapahtuma); } catch (Exception e) { LOGGER.warn("Could not log update application event"); } }