Skip to content

Commit

Permalink
Setting up iReporter project
Browse files Browse the repository at this point in the history
  • Loading branch information
fredmugerwa committed Sep 7, 2021
1 parent 84e3e8d commit 25aef1d
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions .classpath
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>
17 changes: 17 additions & 0 deletions .project
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>
11 changes: 11 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
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
1 change: 1 addition & 0 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/org/
9 changes: 9 additions & 0 deletions src/org/pahappa/systems/exceptions/SavingFailedException.java
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;

}
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;
}
14 changes: 14 additions & 0 deletions src/org/pahappa/systems/models/Incident.java
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 {

}
85 changes: 85 additions & 0 deletions src/org/pahappa/systems/services/IncidentService.java
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);
}
63 changes: 63 additions & 0 deletions src/org/pahappa/systems/services/IncidentServiceImpl.java
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

}


}
9 changes: 9 additions & 0 deletions src/org/pahappa/systems/views/IReporter.java
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");
}

}

0 comments on commit 25aef1d

Please sign in to comment.