public void update(Object[] data, String[] keys) throws Exception { if ((data != null) && (data.length > 0)) { try { if (transaction) { start(); } for (Object o : data) { Object example = o.getClass().newInstance(); this.copy(o, example, keys); BaseBean entity = (BaseBean) find(example); if (entity != null) { entity.assign(o); jpa.merge(entity); data = null; } } if (transaction) { commit(); } } catch (Exception e) { rollback(); throw e; } } }
@PostConstruct private void afterCreation(InvocationContext ctx) { System.out.println("In InterceptorA.PostConstruct"); try { BaseBean b = (BaseBean) ctx.getTarget(); System.out.println("PostConstruct on : " + b); if (b.pc) throw new Exception("PostConstruct already called for " + b); ctx.proceed(); b.pc = true; } catch (Exception e) { throw new RuntimeException(e); } }
@AroundConstruct private void create(InvocationContext ctx) { System.out.println("In InterceptorA.AroundConstruct"); try { java.lang.reflect.Constructor<?> c = ctx.getConstructor(); System.out.println("Using Constructor: " + c); ctx.proceed(); BaseBean b = (BaseBean) ctx.getTarget(); System.out.println("Created instance: " + b); b.ac = true; } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void update() { mChangeTv.setText(baseBean.getContent()); }
@Override protected void onPause() { super.onPause(); baseBean.removeUpdatable(this); }
@Override protected void onResume() { super.onResume(); baseBean.addUpdatable(this); }
@Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (baseBean != null) { baseBean.setContent(s.toString()); } }
/** * Called by JSF page (report) * * @return */ public String send() { TilkynningVertakaBean tilkynningVertakaBean = BaseBean.getTilkynningVertakaBean(); return tilkynningVertakaBean.sendApplicationReport(); }