01: /*
02: * To change this template, choose Tools | Templates
03: * and open the template in the editor.
04: */
05: package it.biobytes.ammentos.test;
06:
07: import it.biobytes.ammentos.*;
08: import static it.biobytes.ammentos.FieldTypeEnum.*;
09: import java.util.*;
10:
11: @PersistentEntity(sourceDomain="people",primaryKey="id")
12: public class HandledPerson {
13: @PersistentField(fieldName="id")
14: private String m_id;
15:
16: @PersistentField(typeClass="it.biobytes.ammentos.fieldtypes.StringType")
17: private String name;
18:
19: @PersistentField(fieldName="surname",description="code",type=STRING)
20: private String m_surname;
21:
22: private String handlerLog = "";
23:
24: @OnSave(When.BEFORE)
25: private void beforeSave() {
26: handlerLog += "BEFORE_SAVE";
27: }
28:
29: @OnSave(When.AFTER)
30: private void afterSave() {
31: handlerLog += "AFTER_SAVE";
32: }
33:
34: @OnDelete(When.BEFORE)
35: private void beforeDelete() {
36: handlerLog += "BEFORE_DELETE";
37: }
38:
39: @OnDelete(When.AFTER)
40: private void afterDelete() {
41: handlerLog += "AFTER_DELETE";
42: }
43:
44: @OnLoad
45: private void onLoad() {
46: handlerLog += "ON_LOAD";
47: }
48:
49: public HandledPerson(String id) {
50: m_id = id;
51: }
52:
53: private HandledPerson() {
54: }
55:
56: public String getId() {
57: return m_id;
58: }
59:
60: public String getName() {
61: return name;
62: }
63:
64: public void setName(String m_name) {
65: this .name = m_name;
66: }
67:
68: public String getSurname() {
69: return m_surname;
70: }
71:
72: public void setSurname(String m_surname) {
73: this .m_surname = m_surname;
74: }
75:
76: public String getHandlerLog() {
77: return handlerLog;
78: }
79: }
|