Skip to content

Commit b637ec2

Browse files
committed
Fixed auditevent dependency rename issue
1 parent 2237bf8 commit b637ec2

File tree

2 files changed

+167
-167
lines changed

2 files changed

+167
-167
lines changed

src/main/java/org/audit4j/handler/db/AuditLogDaoImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import java.sql.SQLException;
2424

2525
import org.audit4j.core.dto.AuditEvent;
26-
import org.audit4j.core.dto.Element;
26+
import org.audit4j.core.dto.Field;
2727

2828
/**
2929
* The Class HSQLAuditLogDao.
@@ -44,7 +44,7 @@ public boolean writeEvent(AuditEvent event) throws SQLException {
4444

4545
StringBuffer elements = new StringBuffer();
4646

47-
for (Element element : event.getEventElements()) {
47+
for (Field element : event.getFields()) {
4848
elements.append(element.getName() + " " + element.getType() + ":" + element.getValue() + ", ");
4949
}
5050
StringBuffer query = new StringBuffer();

src/main/java/org/audit4j/handler/db/DatabaseAuditHandler.java

Lines changed: 165 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -28,173 +28,173 @@
2828
/**
2929
* The Class GeneralDatabaseAuditHandler.
3030
*
31-
* @author Janith Bandara
3231
*/
3332
public class DatabaseAuditHandler extends Handler {
3433

35-
/** The Constant serialVersionUID. */
36-
private static final long serialVersionUID = -4994028889410866952L;
37-
38-
/** The embeded. */
39-
private String embedded;
40-
41-
/** The db_driver. */
42-
private String db_driver;
43-
44-
/** The db_url. */
45-
private String db_url;
46-
47-
/** The db_user. */
48-
private String db_user;
49-
50-
/** The db_password. */
51-
private String db_password;
52-
53-
/*
54-
* (non-Javadoc)
55-
*
56-
* @see org.audit4j.core.handler.Handler#init()
57-
*/
58-
@Override
59-
public void init() throws InitializationException {
60-
if (null == embedded || "true".equals(embedded )) {
61-
EmbededDBServer server = HSQLEmbededDBServer.getInstance();
62-
db_driver = server.getDriver();
63-
db_url = server.getNetworkProtocol() + "://localhost/audit4j";
64-
if (db_user == null) {
65-
db_user = "audit4jdbuser";
66-
}
67-
if (db_password == null) {
68-
db_password = "audit4jdbpassword";
69-
}
70-
server.setUname(db_user);
71-
server.setPassword(db_password);
72-
server.start();
73-
}
74-
75-
ConnectionFactory factory = ConnectionFactory.getInstance();
76-
factory.setDriver(getDb_driver());
77-
factory.setUrl(getDb_url());
78-
factory.setUser(getDb_user());
79-
factory.setPassword(getDb_password());
80-
factory.setConnectionType(ConnectionFactory.POOLED_CONNECTION);
81-
factory.init();
82-
83-
AuditLogDao dao = new AuditLogDaoImpl();
84-
try {
85-
dao.createAuditTableIFNotExist();
86-
} catch (SQLException e) {
87-
throw new InitializationException("Could not create the audit table structure.", e);
88-
}
89-
}
90-
91-
/*
92-
* (non-Javadoc)
93-
*
94-
* @see com.bi3.commons.audit.handler.Handler#handle()
95-
*/
96-
@Override
97-
public void handle() throws HandlerException {
98-
AuditLogDao dao = new AuditLogDaoImpl();
99-
try {
100-
dao.writeEvent(getAuditEvent());
101-
} catch (SQLException e) {
102-
throw new HandlerException("SQL exception occured while writing the event", DatabaseAuditHandler.class, e);
103-
}
104-
}
105-
106-
/**
107-
* Gets the embedded.
108-
*
109-
* @return the embedded
110-
*/
111-
String getEmbedded() {
112-
return embedded;
113-
}
114-
115-
/**
116-
* Sets the embedded.
117-
*
118-
* @param embedded the new embedded
119-
*/
120-
void setEmbedded(String embedded) {
121-
this.embedded = embedded;
122-
}
123-
124-
/**
125-
* Gets the db_driver.
126-
*
127-
* @return the db_driver
128-
*/
129-
public String getDb_driver() {
130-
return db_driver;
131-
}
132-
133-
/**
134-
* Sets the db_driver.
135-
*
136-
* @param db_driver
137-
* the new db_driver
138-
*/
139-
public void setDb_driver(String db_driver) {
140-
this.db_driver = db_driver;
141-
}
142-
143-
/**
144-
* Gets the db_url.
145-
*
146-
* @return the db_url
147-
*/
148-
public String getDb_url() {
149-
return db_url;
150-
}
151-
152-
/**
153-
* Sets the db_url.
154-
*
155-
* @param db_url
156-
* the new db_url
157-
*/
158-
public void setDb_url(String db_url) {
159-
this.db_url = db_url;
160-
}
161-
162-
/**
163-
* Gets the db_user.
164-
*
165-
* @return the db_user
166-
*/
167-
public String getDb_user() {
168-
return db_user;
169-
}
170-
171-
/**
172-
* Sets the db_user.
173-
*
174-
* @param db_user
175-
* the new db_user
176-
*/
177-
public void setDb_user(String db_user) {
178-
this.db_user = db_user;
179-
}
180-
181-
/**
182-
* Gets the db_password.
183-
*
184-
* @return the db_password
185-
*/
186-
public String getDb_password() {
187-
return db_password;
188-
}
189-
190-
/**
191-
* Sets the db_password.
192-
*
193-
* @param db_password
194-
* the new db_password
195-
*/
196-
public void setDb_password(String db_password) {
197-
this.db_password = db_password;
198-
}
34+
/** The Constant serialVersionUID. */
35+
private static final long serialVersionUID = -4994028889410866952L;
36+
37+
/** The embeded. */
38+
private String embedded;
39+
40+
/** The db_driver. */
41+
private String db_driver;
42+
43+
/** The db_url. */
44+
private String db_url;
45+
46+
/** The db_user. */
47+
private String db_user;
48+
49+
/** The db_password. */
50+
private String db_password;
51+
52+
/*
53+
* (non-Javadoc)
54+
*
55+
* @see org.audit4j.core.handler.Handler#init()
56+
*/
57+
@Override
58+
public void init() throws InitializationException {
59+
if (null == embedded || "true".equals(embedded)) {
60+
EmbededDBServer server = HSQLEmbededDBServer.getInstance();
61+
db_driver = server.getDriver();
62+
db_url = server.getNetworkProtocol() + "://localhost/audit4j";
63+
if (db_user == null) {
64+
db_user = "audit4jdbuser";
65+
}
66+
if (db_password == null) {
67+
db_password = "audit4jdbpassword";
68+
}
69+
server.setUname(db_user);
70+
server.setPassword(db_password);
71+
server.start();
72+
}
73+
74+
ConnectionFactory factory = ConnectionFactory.getInstance();
75+
factory.setDriver(getDb_driver());
76+
factory.setUrl(getDb_url());
77+
factory.setUser(getDb_user());
78+
factory.setPassword(getDb_password());
79+
factory.setConnectionType(ConnectionFactory.POOLED_CONNECTION);
80+
factory.init();
81+
82+
AuditLogDao dao = new AuditLogDaoImpl();
83+
try {
84+
dao.createAuditTableIFNotExist();
85+
} catch (SQLException e) {
86+
throw new InitializationException("Could not create the audit table structure.", e);
87+
}
88+
}
89+
90+
/*
91+
* (non-Javadoc)
92+
*
93+
* @see com.bi3.commons.audit.handler.Handler#handle()
94+
*/
95+
@Override
96+
public void handle() throws HandlerException {
97+
AuditLogDao dao = new AuditLogDaoImpl();
98+
try {
99+
dao.writeEvent(getAuditEvent());
100+
} catch (SQLException e) {
101+
throw new HandlerException("SQL exception occured while writing the event", DatabaseAuditHandler.class, e);
102+
}
103+
}
104+
105+
/**
106+
* Gets the embedded.
107+
*
108+
* @return the embedded
109+
*/
110+
String getEmbedded() {
111+
return embedded;
112+
}
113+
114+
/**
115+
* Sets the embedded.
116+
*
117+
* @param embedded
118+
* the new embedded
119+
*/
120+
void setEmbedded(String embedded) {
121+
this.embedded = embedded;
122+
}
123+
124+
/**
125+
* Gets the db_driver.
126+
*
127+
* @return the db_driver
128+
*/
129+
public String getDb_driver() {
130+
return db_driver;
131+
}
132+
133+
/**
134+
* Sets the db_driver.
135+
*
136+
* @param db_driver
137+
* the new db_driver
138+
*/
139+
public void setDb_driver(String db_driver) {
140+
this.db_driver = db_driver;
141+
}
142+
143+
/**
144+
* Gets the db_url.
145+
*
146+
* @return the db_url
147+
*/
148+
public String getDb_url() {
149+
return db_url;
150+
}
151+
152+
/**
153+
* Sets the db_url.
154+
*
155+
* @param db_url
156+
* the new db_url
157+
*/
158+
public void setDb_url(String db_url) {
159+
this.db_url = db_url;
160+
}
161+
162+
/**
163+
* Gets the db_user.
164+
*
165+
* @return the db_user
166+
*/
167+
public String getDb_user() {
168+
return db_user;
169+
}
170+
171+
/**
172+
* Sets the db_user.
173+
*
174+
* @param db_user
175+
* the new db_user
176+
*/
177+
public void setDb_user(String db_user) {
178+
this.db_user = db_user;
179+
}
180+
181+
/**
182+
* Gets the db_password.
183+
*
184+
* @return the db_password
185+
*/
186+
public String getDb_password() {
187+
return db_password;
188+
}
189+
190+
/**
191+
* Sets the db_password.
192+
*
193+
* @param db_password
194+
* the new db_password
195+
*/
196+
public void setDb_password(String db_password) {
197+
this.db_password = db_password;
198+
}
199199

200200
}

0 commit comments

Comments
 (0)