Skip to content

Commit

Permalink
Version 1.2 : short event list
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-yves-monnet committed Dec 27, 2018
1 parent e5e1d74 commit eb54d18
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BonitaEvent
Java Librairy to manage errors and informations. Don't throws an exception, create an event where you can give an ErrorCode, a Title, a Cause, a WhatToDo, a Consequence to the final user
Java Library to manage errors and informations. Don't throws an exception, create an event where you can give an ErrorCode, a Title, a Cause, a WhatToDo, a Consequence to the final user

Son in your software, create some events like :
private final BEvent inputDivisionEvent = new BEvent(BEventUsage.class.getName(), 1, Level.INFO, "Calculate Division", "Run a division");
Expand All @@ -20,4 +20,4 @@ What's more ?
- result to the user ? In the BEventFactory, you can transform the event (or the list of event) in a nice HTML view. Ready to send to the browser ! Look the custom page Ping to have an example.



1.2 add the BEventFactory.getSyntheticHtml() method
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bonitasoft.log.event</groupId>
<artifactId>bonita-event</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<name>BonitaEvent</name>
</project>
17 changes: 16 additions & 1 deletion src/main/java/org/bonitasoft/log/event/BEventFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,22 @@ public static String getHtml(final List<BEvent> listEvents) {
table += "</table>";
return table;
}

/**
* create the list in a synthetic way, as a list of events
* @param listEvents
* @return
*/
public static String getSyntheticHtml(final List<BEvent> listEvents) {
String table = "<table>";
for (final BEvent event : listEvents) {
table += "<tr><td> <span title=\""+event.getKey()+"\">" + event.getTitle() + "</td>"
+"<td>" + event.getLevel().toString() + "</td>"
+"<td>" + event.getParameters() + "</td>"
+ "</tr>";
}
table += "</table>";
return table;
}
/**
* add the event in the list only if this event is a new one, in order to remove the duplication.
* An event already exist if this is the same package/number/parameters (see BEvent.same() ).
Expand Down

0 comments on commit eb54d18

Please sign in to comment.