diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index 6a3d4624f..9a9faf578 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -246,6 +246,21 @@ function getBaseURL(docURL)
Update a Fund |
|
+
+ | STAFF | staff |
+ Create a Staff |
+ List Staff |
+ |
+ |
+
+
+ |
+ staff/{staffId} |
+ |
+ Retrieve a Staff Member |
+ Update a Staff Member |
+ |
+
@@ -2579,6 +2594,115 @@ Request Body:
+
+
+
+
+
Staff
+
Allows you to model staff members. At present the key role of signifigance is whether this staff member is a loan officer or not.
+
+
+
+
+
+
+
Create a staff member
+
Creates a staff member.
+
+
+ POST https://Domain Name/api/v1/staff
+ POST staff
+Content-Type: application/json
+Request Body:
+{
+ "officeId": 1,
+ "firstname": "John",
+ "lastname": "Doe",
+ "isLoanOfficer": "true"
+}
+
+ {
+ "officeId": 1,
+ "resourceId": 1
+}
+
+
+
+
+
+
+
+
Retrieve Staff
+
Returns the list of staff members.
+
Example Requests:
+
staff
+
+
+ GET https://Domain Name/api/v1/staff
+ [
+ {
+ "id": 1,
+ "firstname": "John",
+ "lastname": "Doe",
+ "displayName": "Doe, John",
+ "officeId": 1,
+ "officeName": "Head Office",
+ "isLoanOfficer": true
+ }
+]
+
+
+
+
+
+
+
+
Retrieve a Staff Member
+
Returns the details of a Staff Member.
+
Example Requests:
+
staff/1
+
+
+ GET https://Domain Name/api/v1/staff/1
+ {
+ "id": 1,
+ "firstname": "John",
+ "lastname": "Doe",
+ "displayName": "Doe, John",
+ "officeId": 1,
+ "officeName": "Head Office",
+ "isLoanOfficer": true
+}
+
+
+
+
+
+
+
+
Update a Staff Member
+
Updates the details of a staff member.
+
+
+ PUT https://Domain Name/api/v1/staff/1
+ PUT staff/1
+Content-Type: application/json
+Request Body:
+{
+ "isLoanOfficer": "false"
+}
+
+ {
+ "officeId": 1,
+ "resourceId": 1,
+ "changes": {
+ "isLoanOfficer": false
+ }
+}
+
+
+
+
@@ -3700,6 +3824,21 @@ Request body:
Update a Fund |
|
+
+ | STAFF | staff |
+ Create a Staff |
+ List Staff |
+ |
+ |
+
+
+ |
+ staff/{staffId} |
+ |
+ Retrieve a Staff Member |
+ Update a Staff Member |
+ |
+
| DATA TABLE | datatables | | List Data Tables | | |
| datatables/register/{datatable}/{apptable} | Register Data Table | | | |
| datatables/deregister/{datatable} | Deregister Data Table | | | |
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/command/StaffCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/command/StaffCommand.java
deleted file mode 100644
index e968fa0c5..000000000
--- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/command/StaffCommand.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.mifosplatform.organisation.staff.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.mifosplatform.infrastructure.core.data.ApiParameterError;
-import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
-import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
-
-/**
- * Immutable command for creating or updating details of a staff member.
- */
-public class StaffCommand {
-
- private final String firstname;
- private final String lastname;
- private final Long officeId;
- private final Boolean isLoanOfficer;
-
- public StaffCommand(final Long officeId, final String firstName, final String lastName, final Boolean isLoanOfficer) {
- this.firstname = firstName;
- this.lastname = lastName;
- this.officeId = officeId;
- this.isLoanOfficer = isLoanOfficer;
- }
-
- public void validateForCreate() {
- List
dataValidationErrors = new ArrayList();
-
- DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("staff");
-
- baseDataValidator.reset().parameter("firstname").value(this.firstname).notBlank().notExceedingLengthOf(50);
- baseDataValidator.reset().parameter("lastname").value(this.lastname).notBlank().notExceedingLengthOf(50);
- baseDataValidator.reset().parameter("officeId").value(this.officeId).notNull().integerGreaterThanZero();
-
- if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
- "Validation errors exist.", dataValidationErrors); }
- }
-
- public void validateForUpdate() {
- List dataValidationErrors = new ArrayList();
-
- DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("staff");
-
- baseDataValidator.reset().parameter("officeId").value(this.officeId).ignoreIfNull().integerGreaterThanZero();
- baseDataValidator.reset().parameter("firstname").value(this.firstname).ignoreIfNull().notBlank().notExceedingLengthOf(50);
- baseDataValidator.reset().parameter("lastname").value(this.lastname).ignoreIfNull().notBlank().notExceedingLengthOf(50);
-
- baseDataValidator.reset().parameter("loanOfficerFlag").value(this.isLoanOfficer).ignoreIfNull();
-
- baseDataValidator.reset().anyOfNotNull(this.firstname, this.lastname, this.officeId, this.isLoanOfficer);
-
- if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
- "Validation errors exist.", dataValidationErrors); }
- }
-}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java
index e921081d0..611299058 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java
@@ -1,28 +1,27 @@
package org.mifosplatform.organisation.staff.serialization;
import java.lang.reflect.Type;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
+import org.mifosplatform.infrastructure.core.data.ApiParameterError;
+import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
-import org.mifosplatform.infrastructure.core.serialization.AbstractFromApiJsonDeserializer;
-import org.mifosplatform.infrastructure.core.serialization.FromApiJsonDeserializer;
+import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
-import org.mifosplatform.organisation.staff.command.StaffCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
-/**
- * Implementation of {@link FromApiJsonDeserializer} for {@link StaffCommand}'s.
- */
@Component
-public final class StaffCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer {
+public final class StaffCommandFromApiJsonDeserializer {
/**
* The parameters supported for this command.
@@ -36,20 +35,69 @@ public final class StaffCommandFromApiJsonDeserializer extends AbstractFromApiJs
this.fromApiJsonHelper = fromApiJsonHelper;
}
- @Override
- public StaffCommand commandFromApiJson(final String json) {
+ public void validateForCreate(final String json) {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken