Skip to content

Commit

Permalink
Add some getInstance() to create direct BonitaEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-yves-monnet committed Mar 14, 2019
1 parent eb54d18 commit c4c2a34
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
23 changes: 23 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>BonitaEvent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
4 changes: 4 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
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.2.0</version>
<version>1.3.0</version>
<name>BonitaEvent</name>
</project>
28 changes: 25 additions & 3 deletions src/main/java/org/bonitasoft/log/event/BEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,37 @@ public BEvent(final String packageName, final long number, final Level level, fi
}

/**
* this is the common constructor in usage of event.
* create a Event Success with only a title.
*/
public static BEvent getInstanceShortSuccess(final String packageName, final long number, final String title)
{
return new BEvent(packageName, number, Level.SUCCESS, title, null);
}
/**
* create a Event Success with title and the cause, to give more explanation on the success.
*/
public static BEvent getInstanceSuccess(final String packageName, final long number, final String title, String cause)
{
return new BEvent(packageName, number, Level.SUCCESS, title, cause);
}
/**
* this is the common constructor in usage of event. A main event is referenced, which give all explanations, and the event only capture some additionnal parameters
*
* @param referenceEvent
* @param parameters
* @param referenceEvent : the referentiel event, which contains the level, cause, explanation, action (if errors). Example, a event to explain that a file can't be openned.
* @param parameters : to give more explanations to the event, the parameters carry all information to send to users (example, complete fileName)
*/
public BEvent(final BEvent referenceEvent, final String parameters) {
mReferenceEvent = referenceEvent;
mParameters = parameters;
}

/**
* Build an event from an Exception. The referentiel event contains all informations (explanation, cause, actions) and the exception is used to complete the event. Any parameters are welcome
* Default Constructor.
* @param referenceEvent: the referentiel event, which contains the level, cause, explanation, action (if errors). Example, a event to explain that a file can't be openned.
* @param e: the exception, to collect more information
* @param parameters: to give more explanations to the event, the parameters carry all information to send to users (example, complete fileName)
*/
public BEvent(final BEvent referenceEvent, final Exception e, final String parameters) {
mReferenceEvent = referenceEvent;
mParameters = parameters;
Expand All @@ -129,6 +150,7 @@ public BEvent(final BEvent referenceEvent, final Exception e, final String param
mExceptionDetails = sw.toString();
}


/* ******************************************************************************** */
/* */
/* Tools */
Expand Down

0 comments on commit c4c2a34

Please sign in to comment.