-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84e3e8d
commit 25aef1d
Showing
11 changed files
with
223 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>testproject</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
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.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/org/ |
9 changes: 9 additions & 0 deletions
9
src/org/pahappa/systems/exceptions/SavingFailedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.pahappa.systems.exceptions; | ||
public class SavingFailedException extends Exception { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/org/pahappa/systems/exceptions/ValidationFailedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.pahappa.systems.exceptions; | ||
public class ValidationFailedException extends Exception { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.pahappa.systems.models; | ||
|
||
/** | ||
* The class {@code Incident} represents an occurrence, condition, | ||
* or situation arising in the course of work that resulted in or could | ||
* have resulted in injuries, illnesses, damage, or fatalities. | ||
* | ||
* {@code Incident} should have an id, title, type[Redflag, Intervention], | ||
* status[Draft, Under investigation, Resolved, Rejected], createdOn and comment | ||
* | ||
*/ | ||
public class Incident { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package org.pahappa.systems.services; | ||
import java.util.List; | ||
|
||
import org.pahappa.systems.exceptions.SavingFailedException; | ||
import org.pahappa.systems.exceptions.ValidationFailedException; | ||
import org.pahappa.systems.models.Incident; | ||
|
||
public interface IncidentService { | ||
|
||
/** | ||
* Saves an {@link Incident}. An incident must have an id, title, type, status and comment. | ||
* In case any of (id, title, type, createdOn, comment and status) contains a null value, a {@link ValidationFailedException} must be thrown | ||
* The title, and comment must not be empty. | ||
* | ||
* In case a Incident fails to save after all validation criteria is met. Throw {@link SavingFailedException} | ||
* | ||
* @param activity | ||
* @throws Exception | ||
* @return saved {@link Incident} | ||
*/ | ||
Incident saveIncident(Incident incident) throws Exception; | ||
|
||
/** | ||
* Updates an {@link Incident}. An incident must have an id, title, type, status and comment. | ||
* In case any of (id, title, type, createdOn, comment and status) contains a null value, a {@link ValidationFailedException} must be thrown | ||
* The title, and comment must not be empty. | ||
* | ||
* In case a Incident fails to save after all validation criteria is met. Throw {@link SavingFailedException} | ||
* | ||
* @param activity | ||
* @throws Exception | ||
* @return updated {@link Incident} | ||
*/ | ||
Incident updateIncident(Incident incident) throws Exception; | ||
|
||
/** | ||
* Gets all available {@link Incident} | ||
* | ||
* @return a list of {@link Incident} | ||
*/ | ||
List<Incident> getAllIncidents(); | ||
|
||
/** | ||
* Gets all available {@link Incident} of type RedFlag | ||
* | ||
* @return a list of RedFlag {@link Incident} | ||
*/ | ||
List<Incident> getRedflagIncidents(); | ||
|
||
/** | ||
* Gets all available {@link Incident} of type Intervention | ||
* | ||
* @return a list of Intervention {@link Incident} | ||
*/ | ||
List<Incident> getInterventionIncidents(); | ||
|
||
/** | ||
* Counts all available {@link Incident} | ||
* | ||
* @return a count {@link Incident} | ||
*/ | ||
int countIncidents(); | ||
|
||
/** | ||
* Check if an {@link Incident} exist | ||
* | ||
* @return | ||
*/ | ||
boolean incidentExists(Incident incident); | ||
|
||
/** | ||
* Gets an {@link Incident} of a given id | ||
* | ||
* @param id | ||
* @return updated {@link Incident} | ||
*/ | ||
Incident getIncidentOfId(int id); | ||
|
||
/** | ||
* Deletes an {@link Incident} | ||
* | ||
* @param incident | ||
*/ | ||
void deleteIncident(Incident incident); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.pahappa.systems.services; | ||
import java.util.List; | ||
|
||
import org.pahappa.systems.models.Incident; | ||
|
||
public class IncidentServiceImpl implements IncidentService { | ||
|
||
@Override | ||
public Incident saveIncident(Incident incident) throws Exception { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public Incident updateIncident(Incident incident) throws Exception { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Incident> getAllIncidents() { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Incident> getRedflagIncidents() { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Incident> getInterventionIncidents() { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public int countIncidents() { | ||
// TODO Auto-generated method stub | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean incidentExists(Incident incident) { | ||
// TODO Auto-generated method stub | ||
return false; | ||
} | ||
|
||
@Override | ||
public Incident getIncidentOfId(int id) { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public void deleteIncident(Incident incident) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.pahappa.systems.views; | ||
|
||
public class IReporter { | ||
|
||
public static void main(String[] args) { | ||
System.out.println("iReporter"); | ||
} | ||
|
||
} |