diff --git a/assets/config/opensrp.properties b/assets/config/opensrp.properties
index 8b9631c2e7..cfe2ff4d3d 100644
--- a/assets/config/opensrp.properties
+++ b/assets/config/opensrp.properties
@@ -17,7 +17,7 @@ report-fields-definition-path=/report-fields-definition.json
report-definition-path=/report-definition.json
mcts-report-definition-path=/mcts-report-definition.json
mcts-report-delay-in-days=10
-mcts.poll.time.interval.in.minutes=10git
+mcts.poll.time.interval.in.minutes=10
# OpenMRS configuration
openmrs.url=http://localhost:8080/openmrs/
@@ -44,7 +44,7 @@ openmrs.scheduletracker.syncer.interval-min=2
couchdb.server=localhost
couchdb.port=5984
couchdb.username=admin
-couchdb.password=admin
+couchdb.password=D3v!23
couchdb.atomfeed-db.revision-limit=2
@@ -113,12 +113,5 @@ oauth.default.callback.url=https://yourapplication.com/registered/callback
#Team module settings
use.opensrp.team.module=false
-# S3 configuration (should be populated for deployments using S3 multimedia storage)
-aws_access_key_id=
-aws_secret_access_key=
-aws_region=
-aws_bucket=
-aws_key_folder=none
-
# multimedia file manager (is file system by default)
multimedia_file_manager=FileSystemMultimediaFileManager
diff --git a/build/lib/postgresql-9.1-901.jdbc4.jar b/build/lib/postgresql-9.1-901.jdbc4.jar
old mode 100755
new mode 100644
diff --git a/build/maven.properties b/build/maven.properties
old mode 100755
new mode 100644
diff --git a/build/sql/tables_opensrp.sql b/build/sql/tables_opensrp.sql
old mode 100755
new mode 100644
diff --git a/build/sql/tables_quartz_MYSQL.sql b/build/sql/tables_quartz_MYSQL.sql
old mode 100755
new mode 100644
diff --git a/build/sql/tables_quartz_postgres.sql b/build/sql/tables_quartz_postgres.sql
old mode 100755
new mode 100644
diff --git a/modules/core/persistence_postgres.xml b/modules/core/persistence_postgres.xml
index 981c1b0ca7..02a752809f 100644
--- a/modules/core/persistence_postgres.xml
+++ b/modules/core/persistence_postgres.xml
@@ -19,8 +19,6 @@
expression="org.opensrp.service.formSubmission.ziggy.*" />
-
diff --git a/opensrp-api/pom.xml b/opensrp-api/pom.xml
deleted file mode 100755
index 49c9b20b76..0000000000
--- a/opensrp-api/pom.xml
+++ /dev/null
@@ -1,255 +0,0 @@
-
- 4.0.0
- org.smartregister
-
- opensrp-server-api
- jar
-
- 1.0.1
-
- opensrp-server-api
- OpenSRP Server Api module
- http://github.com/OpenSRP/opensrp-server-api
-
-
- ${project.basedir}
- UTF-8
- 1.5.1
-
- 1.0.1
-
-
-
-
-
- nexus-snapshots
- Nexus Snapshots Repository
- https://oss.sonatype.org/content/repositories/snapshots
- false
-
-
- nexus-releases
- https://oss.sonatype.org/service/local/staging/deploy/maven2
-
-
-
-
- scm:git:git@github.com:OpenSRP/opensrp-server-api.git
- scm:git:git@github.com:OpenSRP/opensrp-server-api.git
- https://github.com/OpenSRP/opensrp-server-api
-
-
-
-
- Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0.txt
- repo
- Open Smart Register Platform (OpenSRP) is Licensed under the Apache License, Version 2.0
-
-
-
-
-
- opensrp_developer
- OpenSRP Developer
- info@smartregister.org
- https://groups.google.com/forum/#!forum/opensrp-dev
- OpenSRP
- http://smartregister.org
-
- developer
-
- Africa/Nairobi
-
-
-
-
-
- snapshots-repo
- https://oss.sonatype.org/content/repositories/snapshots
-
- false
-
-
- true
-
-
-
-
-
-
- org.smartregister
- opensrp-server-common
- ${opensrp.common.version}
-
-
- commons-lang
- commons-lang
- 2.5
-
-
- junit
- junit
- 4.8.2
- test
-
-
- org.apache.commons
- commons-lang3
- 3.1
-
-
- com.google.code.gson
- gson
- 2.2.4
-
-
- com.openpojo
- openpojo
- 0.8.3
- test
-
-
- nl.jqno.equalsverifier
- equalsverifier
- 2.3
- test
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.5.1
-
- 1.7
- 1.7
- UTF-8
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
-
-
- attach-sources
-
- jar
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
-
- attach-javadocs
-
- jar
-
-
- none
-
-
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- ${nexus-staging-maven-plugin.version}
-
-
- default-deploy
- deploy
-
- deploy
-
-
-
-
- nexus-snapshots
- https://oss.sonatype.org/
- true
-
-
-
- org.jacoco
- jacoco-maven-plugin
- 0.7.9
-
- ${basedir}/target/coverage-reports/jacoco-unit.exec
- ${basedir}/target/coverage-reports/jacoco-unit.exec
-
-
-
- jacoco-initialize
-
- prepare-agent
-
-
-
- jacoco-site
- test
-
- report
-
-
-
-
-
- org.eluder.coveralls
- coveralls-maven-plugin
- 4.0.0
-
-
-
-
-
-
- release
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.5
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.5.1
-
-
- default-deploy
- deploy
-
- deploy
-
-
-
-
- nexus-releases
- https://oss.sonatype.org/
- false
- true
-
-
-
-
-
-
-
diff --git a/opensrp-api/src/main/java/org/opensrp/api/contract/AuthorizationHandler.java b/opensrp-api/src/main/java/org/opensrp/api/contract/AuthorizationHandler.java
deleted file mode 100644
index 334dc4f1e3..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/contract/AuthorizationHandler.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.opensrp.api.contract;
-
-import org.opensrp.api.domain.User;
-
-public interface AuthorizationHandler {
-
- boolean verifyAuthorization(User user, T service) throws IllegalAccessException;
-}
diff --git a/opensrp-api/src/main/java/org/opensrp/api/contract/LocationManager.java b/opensrp-api/src/main/java/org/opensrp/api/contract/LocationManager.java
deleted file mode 100644
index fbb6c8876d..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/contract/LocationManager.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.opensrp.api.contract;
-
-import org.opensrp.api.domain.Location;
-import org.opensrp.api.domain.User;
-import org.opensrp.api.util.LocationTree;
-import org.opensrp.api.util.TreeNode;
-
-public interface LocationManager {
-
- Location getLocation(String locationId);
-
- TreeNode getLocationWithTree(String startinglocationId);
-
- LocationTree getLocationHierarchy();
-
- void verifyLocationAccess(Location location, User user);
-}
diff --git a/opensrp-api/src/main/java/org/opensrp/api/contract/SecurityManager.java b/opensrp-api/src/main/java/org/opensrp/api/contract/SecurityManager.java
deleted file mode 100644
index 54a57e7cf1..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/contract/SecurityManager.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.opensrp.api.contract;
-
-import org.opensrp.api.domain.User;
-
-public interface SecurityManager {
-
- /*
- * List getRoles(String username); boolean hasRole(String username);
- * List getPermissions(String username); boolean
- * hasPermission(String username, String permission);
- */
- User login(String username, String password, AuthorizationHandler> callbackHandler);
-
- void logout(AuthorizationHandler> callbackHandler);
-
- User getUser(String username);//???????????????????????
-
- User authenticate(String username, String password) throws IllegalAccessException;
-
- boolean verifyAuthorization(String username, AuthorizationHandler> callbackHandler);
-
- boolean verifyAuthorization(User user, AuthorizationHandler> callbackHandler);
-
- boolean hasAdminRights(String username);
-
- String encryptPassword(String username, String salt, String cleartextPassword);
-
- String encryptPassword(User user, String cleartextPassword);
-
- // do we really want to encrypt data across client-server. If so what would happen incase of reset of password
- byte[] encryptData(byte[] data);
-
- byte[] decryptData(byte[] data);
-}
diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Address.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Address.java
deleted file mode 100644
index 08348b1c38..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/domain/Address.java
+++ /dev/null
@@ -1,350 +0,0 @@
-package org.opensrp.api.domain;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.opensrp.common.AddressField;
-
-public class Address {
-
- private String addressType;
-
- private Date startDate;
-
- private Date endDate;
-
- private Map addressFields;
-
- private String latitude;
-
- private String longitute;
-
- private String postalCode;
-
- private String state;
-
- private String country;
-
- public Address() {
- }
-
- public Address(String addressType, Date startDate, Date endDate, Map addressFields, String latitude,
- String longitute, String postalCode, String state, String country) {
- this.addressType = addressType;
- this.startDate = startDate;
- this.endDate = endDate;
- this.addressFields = addressFields;
- this.latitude = latitude;
- this.longitute = longitute;
- this.postalCode = postalCode;
- this.state = state;
- this.country = country;
- }
-
- public String getAddressType() {
- return addressType;
- }
-
- public void setAddressType(String addressType) {
- this.addressType = addressType;
- }
-
- public Date getStartDate() {
- return startDate;
- }
-
- public void setStartDate(Date startDate) {
- this.startDate = startDate;
- }
-
- public Date getEndDate() {
- return endDate;
- }
-
- public void setEndDate(Date endDate) {
- this.endDate = endDate;
- }
-
- public Map getAddressFields() {
- return addressFields;
- }
-
- public String getAddressField(String addressField) {
- for (Entry a : addressFields.entrySet()) {
- if (a.getKey().equalsIgnoreCase(addressField)) {
- return a.getValue();
- }
- }
- return null;
- }
-
- /**
- * Returns field matching the regex. Note that incase of multiple fields matching criteria
- * function would return first match. The must be well formed to find out a single value
- *
- * @param regex
- * @return
- */
- public String getAddressFieldMatchingRegex(String regex) {
- for (Entry a : addressFields.entrySet()) {
- if (a.getKey().matches(regex)) {
- return a.getValue();
- }
- }
- return null;
- }
-
- public String getAddressField(AddressField addressField) {
- for (Entry a : addressFields.entrySet()) {
- if (a.getKey().equalsIgnoreCase(addressField.name())) {
- return a.getValue();
- }
- }
- return null;
- }
-
- /**
- * WARNING: Overrides all existing fields
- *
- * @param addressFields
- * @return
- */
- public void setAddressFields(Map addressFields) {
- this.addressFields = addressFields;
- }
-
- public void addAddressField(String field, String value) {
- if (addressFields == null) {
- addressFields = new HashMap<>();
- }
- addressFields.put(field, value);
- }
-
- /**
- * Add field name from a list of predefined options from enum {@link AddressField}
- *
- * @param field
- * @param value
- */
- public void addAddressField(AddressField field, String value) {
- if (addressFields == null) {
- addressFields = new HashMap<>();
- }
- addressFields.put(field.name(), value);
- }
-
- public void removeAddressField(AddressField field) {
- for (Entry a : addressFields.entrySet()) {
- if (a.getKey().equalsIgnoreCase(field.name())) {
- addressFields.remove(a.getKey());
- }
- }
- }
-
- public void removeAddressField(String field) {
- for (Entry a : addressFields.entrySet()) {
- if (a.getKey().equalsIgnoreCase(field)) {
- addressFields.remove(a.getKey());
- }
- }
- }
-
- public String getLatitude() {
- return latitude;
- }
-
- public void setLatitude(String latitude) {
- this.latitude = latitude;
- }
-
- public String getLongitute() {
- return longitute;
- }
-
- public void setLongitute(String longitute) {
- this.longitute = longitute;
- }
-
- public String getPostalCode() {
- return postalCode;
- }
-
- public void setPostalCode(String postalCode) {
- this.postalCode = postalCode;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- /**
- * True if endDate is null or endDate is in future
- *
- * @return
- */
- public boolean isActive() {
- return endDate == null || endDate.after(new Date());
- }
-
- /**
- * If startDate is not specified returns -1. If endDate is not specified duration is from
- * startDate to current date
- *
- * @return
- */
- private long durationInMillis() {
- if (startDate == null) {
- return -1;
- }
- if (endDate == null) {
- return new Date().getTime() - startDate.getTime();
- }
-
- return endDate.getTime() - startDate.getTime();
- }
-
- /**
- * If startDate is not specified returns -1. If endDate is not specified duration is from
- * startDate to current date
- *
- * @return
- */
- public int durationInDays() {
- return (int) (durationInMillis() == -1 ? durationInMillis() : (durationInMillis() / (1000 * 60 * 60 * 24L)));
- }
-
- /**
- * If startDate is not specified returns -1. If endDate is not specified duration is from
- * startDate to current date
- *
- * @return
- */
- public int durationInWeeks() {
- return durationInDays() == -1 ? durationInDays() : (durationInDays() / 7);
- }
-
- /**
- * If startDate is not specified returns -1. If endDate is not specified duration is from
- * startDate to current date
- *
- * @return
- */
- public int durationInMonths() {
- return durationInDays() == -1 ? durationInDays() : ((int) (durationInDays() / 30));
- }
-
- /**
- * If startDate is not specified returns -1. If endDate is not specified duration is from
- * startDate to current date
- *
- * @return
- */
- public int durationInYears() {
- return durationInDays() == -1 ? durationInDays() : (durationInDays() / 365);
- }
-
- /**
- * The type address represents
- *
- * @param addressType
- * @return
- */
- public Address withAddressType(String addressType) {
- this.addressType = addressType;
- return this;
- }
-
- /**
- * The date when address was started or owned
- *
- * @param endDate
- * @return
- */
- public Address withStartDate(Date startDate) {
- this.startDate = startDate;
- return this;
- }
-
- /**
- * The date when address was outdated or abandoned
- *
- * @param endDate
- * @return
- */
- public Address withEndDate(Date endDate) {
- this.endDate = endDate;
- return this;
- }
-
- /**
- * WARNING: Overrides all existing fields
- *
- * @param addressFields
- * @return
- */
- public Address withAddressFields(Map addressFields) {
- this.addressFields = addressFields;
- return this;
- }
-
- public Address withAddressField(String field, String value) {
- if (addressFields == null) {
- addressFields = new HashMap<>();
- }
- addressFields.put(field, value);
- return this;
- }
-
- public Address withAddressField(AddressField field, String value) {
- if (addressFields == null) {
- addressFields = new HashMap<>();
- }
- addressFields.put(field.name(), value);
- return this;
- }
-
- public Address withLatitude(String latitude) {
- this.latitude = latitude;
- return this;
- }
-
- public Address withLongitute(String longitute) {
- this.longitute = longitute;
- return this;
- }
-
- public Address withPostalCode(String postalCode) {
- this.postalCode = postalCode;
- return this;
- }
-
- public Address withState(String state) {
- this.state = state;
- return this;
- }
-
- public Address withCountry(String country) {
- this.country = country;
- return this;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-}
diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/BaseDataObject.java b/opensrp-api/src/main/java/org/opensrp/api/domain/BaseDataObject.java
deleted file mode 100644
index e68c30e12d..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/domain/BaseDataObject.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.opensrp.api.domain;
-
-import java.util.Date;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-/**
- * The Base Object for keeping audit data for any business entity.
- */
-public abstract class BaseDataObject {
-
- private User creator;
-
- private Date dateCreated;
-
- private User editor;
-
- private Date dateEdited;
-
- private Boolean voided = Boolean.FALSE;
-
- private Date dateVoided;
-
- private User voider;
-
- private String voidReason;
-
- public BaseDataObject() {
- }
-
- public User getCreator() {
- return creator;
- }
-
- public void setCreator(User creator) {
- this.creator = creator;
- }
-
- public Date getDateCreated() {
- return dateCreated;
- }
-
- public void setDateCreated(Date dateCreated) {
- this.dateCreated = dateCreated;
- }
-
- /**
- * The last User who edited the data
- *
- * @return
- */
- public User getEditor() {
- return editor;
- }
-
- /**
- * The last User who edited the data
- */
- public void setEditor(User editor) {
- this.editor = editor;
- }
-
- /**
- * The last edited date of the data
- *
- * @return
- */
- public Date getDateEdited() {
- return dateEdited;
- }
-
- /**
- * The last edited date of the data
- */
- public void setDateEdited(Date dateEdited) {
- this.dateEdited = dateEdited;
- }
-
- public Boolean getVoided() {
- return voided;
- }
-
- public void setVoided(Boolean voided) {
- this.voided = voided;
- }
-
- public Date getDateVoided() {
- return dateVoided;
- }
-
- public void setDateVoided(Date dateVoided) {
- this.dateVoided = dateVoided;
- }
-
- public User getVoider() {
- return voider;
- }
-
- public void setVoider(User voider) {
- this.voider = voider;
- }
-
- public String getVoidReason() {
- return voidReason;
- }
-
- public void setVoidReason(String voidReason) {
- this.voidReason = voidReason;
- }
-
- public BaseDataObject withCreator(User creator) {
- this.creator = creator;
- return this;
- }
-
- public BaseDataObject withDateCreated(Date dateCreated) {
- this.dateCreated = dateCreated;
- return this;
- }
-
- public BaseDataObject withEditor(User editor) {
- this.editor = editor;
- return this;
- }
-
- public BaseDataObject withDateEdited(Date dateEdited) {
- this.dateEdited = dateEdited;
- return this;
- }
-
- public BaseDataObject withVoided(Boolean voided) {
- this.voided = voided;
- return this;
- }
-
- public BaseDataObject withDateVoided(Date dateVoided) {
- this.dateVoided = dateVoided;
- return this;
- }
-
- public BaseDataObject withVoider(User voider) {
- this.voider = voider;
- return this;
- }
-
- public BaseDataObject withVoidReason(String voidReason) {
- this.voidReason = voidReason;
- return this;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-}
diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/BaseEntity.java b/opensrp-api/src/main/java/org/opensrp/api/domain/BaseEntity.java
deleted file mode 100644
index e334e13e23..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/domain/BaseEntity.java
+++ /dev/null
@@ -1,237 +0,0 @@
-package org.opensrp.api.domain;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-/**
- * The BaseEntity is the parent entity that contains basic information for all other business
- * entities. The class generalizes the identifiers, addresses, and attributes for other entities.
- * The class is the generic representation of all other business entities those have different
- * business roles in system. For example: A user in system can also be data provider. The
- * {@link User} would have basic data into {@link BaseEntity} and specific information in
- * {@link User}. The {@link BaseEntity} would also be referred by {@link Provider} to represent and
- * link roles. This helps in getting reports for any dimension for any entity into the system.
- */
-public class BaseEntity extends BaseDataObject {
-
- private String baseEntityId;
-
- private Map identifiers;
-
- private List addresses;
-
- private Map attributes;
-
- protected BaseEntity() {
- }
-
- public BaseEntity(String baseEntityId) {
- this.baseEntityId = baseEntityId;
- }
-
- public BaseEntity(String baseEntityId, Map identifiers) {
- this.baseEntityId = baseEntityId;
- this.identifiers = identifiers;
- }
-
- public BaseEntity(String baseEntityId, Map identifiers, Map attributes) {
- this.baseEntityId = baseEntityId;
- this.identifiers = identifiers;
- this.attributes = attributes;
- }
-
- public BaseEntity(String baseEntityId, Map identifiers, Map attributes,
- List addresses) {
- this.baseEntityId = baseEntityId;
- this.identifiers = identifiers;
- this.attributes = attributes;
- this.addresses = addresses;
- }
-
- public String getBaseEntityId() {
- return baseEntityId;
- }
-
- public void setBaseEntityId(String baseEntityId) {
- this.baseEntityId = baseEntityId;
- }
-
- public List getAddresses() {
- return addresses;
- }
-
- /**
- * WARNING: Overrides all existing addresses
- *
- * @param addresses
- * @return
- */
- public void setAddresses(List addresses) {
- this.addresses = addresses;
- }
-
- public void addAddress(Address address) {
- if (addresses == null) {
- addresses = new ArrayList<>();
- }
- addresses.add(address);
- }
-
- public Map getAttributes() {
- return attributes;
- }
-
- public Object getAttribute(String name) {
- if (attributes == null) {
- return null;
- }
- for (String k : attributes.keySet()) {
- if (k.equalsIgnoreCase(name)) {
- return attributes.get(k);
- }
- }
- return null;
- }
-
- /**
- * WARNING: Overrides all existing attributes
- *
- * @param attributes
- * @return
- */
- public void setAttributes(Map attributes) {
- this.attributes = attributes;
- }
-
- public void addAttribute(String name, Object value) {
- if (attributes == null) {
- attributes = new HashMap<>();
- }
-
- attributes.put(name, value);
- }
-
- public void removeAttribute(String name) {
- attributes.remove(name);
- }
-
- public Map getIdentifiers() {
- return identifiers;
- }
-
- public String getIdentifier(String identifierType) {
- if (identifiers == null) {
- return null;
- }
- for (String k : identifiers.keySet()) {
- if (k.equalsIgnoreCase(identifierType)) {
- return identifiers.get(k);
- }
- }
- return null;
- }
-
- /**
- * Returns field matching the regex. Note that incase of multiple fields matching criteria
- * function would return first match. The must be well formed to find out a single value
- *
- * @param regex
- * @return
- */
- public String getIdentifierMatchingRegex(String regex) {
- for (Entry a : getIdentifiers().entrySet()) {
- if (a.getKey().matches(regex)) {
- return a.getValue();
- }
- }
- return null;
- }
-
- public void setIdentifiers(Map identifiers) {
- this.identifiers = identifiers;
- }
-
- public void addIdentifier(String identifierType, String identifier) {
- if (identifiers == null) {
- identifiers = new HashMap<>();
- }
-
- identifiers.put(identifierType, identifier);
- }
-
- public void removeIdentifier(String identifierType) {
- identifiers.remove(identifierType);
- }
-
- public BaseEntity withBaseEntityId(String baseEntityId) {
- this.baseEntityId = baseEntityId;
- return this;
- }
-
- /**
- * WARNING: Overrides all existing identifiers
- *
- * @param identifiers
- * @return
- */
- public BaseEntity withIdentifiers(Map identifiers) {
- this.identifiers = identifiers;
- return this;
- }
-
- public BaseEntity withIdentifier(String identifierType, String identifier) {
- if (identifiers == null) {
- identifiers = new HashMap<>();
- }
- identifiers.put(identifierType, identifier);
- return this;
- }
-
- /**
- * WARNING: Overrides all existing addresses
- *
- * @param addresses
- * @return
- */
- public BaseEntity withAddresses(List addresses) {
- this.addresses = addresses;
- return this;
- }
-
- public BaseEntity withAddress(Address address) {
- if (addresses == null) {
- addresses = new ArrayList<>();
- }
- addresses.add(address);
- return this;
- }
-
- /**
- * WARNING: Overrides all existing attributes
- *
- * @param attributes
- * @return
- */
- public BaseEntity withAttributes(Map attributes) {
- this.attributes = attributes;
- return this;
- }
-
- public BaseEntity withAttribute(String name, Object value) {
- if (attributes == null) {
- attributes = new HashMap<>();
- }
- attributes.put(name, value);
- return this;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-}
diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Client.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Client.java
deleted file mode 100644
index a6922e73fc..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/domain/Client.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.opensrp.api.domain;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.opensrp.common.Gender;
-
-/**
- * Client is the main beneficiary, the system facilitates to capture data for. The entity inherits
- * all of the generic data from {@link BaseEntity}.
- */
-public class Client extends BaseEntity {
-
- private String firstName;
-
- private String middleName;
-
- private String lastName;
-
- private Date birthdate;
-
- private Date deathdate;
-
- private Boolean birthdateApprox;
-
- private Boolean deathdateApprox;
-
- private String gender;
-
- protected Client() {
-
- }
-
- public Client(String baseEntityId) {
- super(baseEntityId);
- }
-
- public Client(String baseEntityId, String firstName, String middleName, String lastName, Date birthdate, Date deathdate,
- Boolean birthdateApprox, Boolean deathdateApprox, String gender) {
- super(baseEntityId);
- this.firstName = firstName;
- this.middleName = middleName;
- this.lastName = lastName;
- this.birthdate = birthdate;
- this.deathdate = deathdate;
- this.birthdateApprox = birthdateApprox;
- this.deathdateApprox = deathdateApprox;
- this.gender = gender;
- }
-
- public Client(String baseEntityId, String firstName, String middleName, String lastName, Date birthdate, Date deathdate,
- Boolean birthdateApprox, Boolean deathdateApprox, String gender, String identifierType, String identifier) {
- super(baseEntityId);
- this.firstName = firstName;
- this.middleName = middleName;
- this.lastName = lastName;
- this.birthdate = birthdate;
- this.deathdate = deathdate;
- this.birthdateApprox = birthdateApprox;
- this.deathdateApprox = deathdateApprox;
- this.gender = gender;
- addIdentifier(identifierType, identifier);
- }
-
- public Client(String baseEntityId, String firstName, String middleName, String lastName, Date birthdate, Date deathdate,
- Boolean birthdateApprox, Boolean deathdateApprox, String gender, List addresses,
- Map identifiers, Map attributes) {
- super(baseEntityId);
- this.firstName = firstName;
- this.middleName = middleName;
- this.lastName = lastName;
- this.birthdate = birthdate;
- this.deathdate = deathdate;
- this.birthdateApprox = birthdateApprox;
- this.deathdateApprox = deathdateApprox;
- this.gender = gender;
- setIdentifiers(identifiers);
- setAddresses(addresses);
- setAttributes(attributes);
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getMiddleName() {
- return middleName;
- }
-
- public void setMiddleName(String middleName) {
- this.middleName = middleName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public Date getBirthdate() {
- return birthdate;
- }
-
- public void setBirthdate(Date birthdate) {
- this.birthdate = birthdate;
- }
-
- public Date getDeathdate() {
- return deathdate;
- }
-
- public void setDeathdate(Date deathdate) {
- this.deathdate = deathdate;
- }
-
- public Boolean getBirthdateApprox() {
- return birthdateApprox;
- }
-
- public void setBirthdateApprox(Boolean birthdateApprox) {
- this.birthdateApprox = birthdateApprox;
- }
-
- public Boolean getDeathdateApprox() {
- return deathdateApprox;
- }
-
- public void setDeathdateApprox(Boolean deathdateApprox) {
- this.deathdateApprox = deathdateApprox;
- }
-
- public String getGender() {
- return gender;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- public Client withFirstName(String firstName) {
- this.firstName = firstName;
- return this;
- }
-
- public Client withMiddleName(String middleName) {
- this.middleName = middleName;
- return this;
- }
-
- public Client withLastName(String lastName) {
- this.lastName = lastName;
- return this;
- }
-
- public Client withName(String firstName, String middleName, String lastName) {
- this.firstName = firstName;
- this.middleName = middleName;
- this.lastName = lastName;
- return this;
- }
-
- public Client withBirthdate(Date birthdate, Boolean isApproximate) {
- this.birthdate = birthdate;
- this.birthdateApprox = isApproximate;
- return this;
- }
-
- public Client withDeathdate(Date deathdate, Boolean isApproximate) {
- this.deathdate = deathdate;
- this.deathdateApprox = isApproximate;
- return this;
- }
-
- public Client withGender(String gender) {
- this.gender = gender;
- return this;
- }
-
- public Client withGender(Gender gender) {
- this.gender = gender.name();
- return this;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-}
diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Event.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Event.java
deleted file mode 100644
index a1016d6112..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/domain/Event.java
+++ /dev/null
@@ -1,307 +0,0 @@
-package org.opensrp.api.domain;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.joda.time.DateTime;
-
-/**
- * An {@link Event} is a logical happening or experience of {@link BaseEntity} with the system as
- * defined by the program workflow. The difference of an {@link Event} and other activities in
- * system is that the data of {@link Event} is meaningful for business clients of system and also
- * the data links back with international standard dictionaries. An {@link Event} in system is
- * recorded via a form filled by data {@link Provider}. The form data is represented by
- * {@link FormSubmission}
- */
-public class Event extends BaseDataObject {
-
- private Map identifiers;
-
- private String baseEntityId;
-
- private String locationId;
-
- private DateTime eventDate;
-
- private String eventType;
-
- private String formSubmissionId;
-
- private String providerId;
-
- private String status;
-
- private Map statusHistory;
-
- private String priority;
-
- private List episodeOfCare;
-
- private List referrals;
-
- private String category;
-
- private int duration;
-
- private String reason;
-
- private List obs;
-
- private String entityType;
-
- private Map details;
-
- private long version;
-
- private List photos;
-
- public Event() {
- this.version = System.currentTimeMillis();
- }
-
- public Event(String baseEntityId, String eventType, DateTime eventDate, String entityType, String providerId,
- String locationId, String formSubmissionId) {
- this.baseEntityId = baseEntityId;
- this.eventType = eventType;
- this.eventDate = eventDate;
- this.entityType = entityType;
- this.providerId = providerId;
- this.locationId = locationId;
- this.formSubmissionId = formSubmissionId;
- this.version = System.currentTimeMillis();
- }
-
- public List getObs() {
- return obs;
- }
-
- /**
- * WARNING: Overrides all existing obs
- *
- * @param obs
- * @return
- */
- public void setObs(List obs) {
- this.obs = obs;
- }
-
- public void addObs(Obs observation) {
- if (obs == null) {
- obs = new ArrayList<>();
- }
-
- obs.add(observation);
- }
-
- public String getBaseEntityId() {
- return baseEntityId;
- }
-
- public void setBaseEntityId(String baseEntityId) {
- this.baseEntityId = baseEntityId;
- }
-
- public Map getIdentifiers() {
- if (identifiers == null) {
- identifiers = new HashMap<>();
- }
- return identifiers;
- }
-
- public String getIdentifier(String identifierType) {
- if (identifiers == null) {
- return null;
- }
- for (String k : identifiers.keySet()) {
- if (k.equalsIgnoreCase(identifierType)) {
- return identifiers.get(k);
- }
- }
- return null;
- }
-
- /**
- * Returns field matching the regex. Note that incase of multiple fields matching criteria
- * function would return first match. The must be well formed to find out a single value
- *
- * @param regex
- * @return
- */
- public String getIdentifierMatchingRegex(String regex) {
- for (Entry a : getIdentifiers().entrySet()) {
- if (a.getKey().matches(regex)) {
- return a.getValue();
- }
- }
- return null;
- }
-
- public void setIdentifiers(Map identifiers) {
- this.identifiers = identifiers;
- }
-
- public void addIdentifier(String identifierType, String identifier) {
- if (identifiers == null) {
- identifiers = new HashMap<>();
- }
-
- identifiers.put(identifierType, identifier);
- }
-
- public void removeIdentifier(String identifierType) {
- identifiers.remove(identifierType);
- }
-
- public String getLocationId() {
- return locationId;
- }
-
- public void setLocationId(String locationId) {
- this.locationId = locationId;
- }
-
- public DateTime getEventDate() {
- return eventDate;
- }
-
- public void setEventDate(DateTime eventDate) {
- this.eventDate = eventDate;
- }
-
- public String getEventType() {
- return eventType;
- }
-
- public void setEventType(String eventType) {
- this.eventType = eventType;
- }
-
- public String getFormSubmissionId() {
- return formSubmissionId;
- }
-
- public void setFormSubmissionId(String formSubmissionId) {
- this.formSubmissionId = formSubmissionId;
- }
-
- public String getProviderId() {
- return providerId;
- }
-
- public void setProviderId(String providerId) {
- this.providerId = providerId;
- }
-
- public String getEntityType() {
- return entityType;
- }
-
- public void setEntityType(String entityType) {
- this.entityType = entityType;
- }
-
- public Map getDetails() {
- return details;
- }
-
- public void setDetails(Map details) {
- this.details = details;
- }
-
- public void addDetails(String key, String val) {
- if (details == null) {
- details = new HashMap<>();
- }
- details.put(key, val);
- }
-
- public long getVersion() {
- return version;
- }
-
- public void setVersion(long version) {
- this.version = version;
- }
-
- public Event withBaseEntityId(String baseEntityId) {
- this.baseEntityId = baseEntityId;
- return this;
- }
-
- /**
- * WARNING: Overrides all existing identifiers
- *
- * @param identifiers
- * @return
- */
- public Event withIdentifiers(Map identifiers) {
- this.identifiers = identifiers;
- return this;
- }
-
- public Event withIdentifier(String identifierType, String identifier) {
- if (identifiers == null) {
- identifiers = new HashMap<>();
- }
- identifiers.put(identifierType, identifier);
- return this;
- }
-
- public Event withLocationId(String locationId) {
- this.locationId = locationId;
- return this;
- }
-
- public Event withEventDate(DateTime eventDate) {
- this.eventDate = eventDate;
- return this;
- }
-
- public Event withEventType(String eventType) {
- this.eventType = eventType;
- return this;
- }
-
- public Event withFormSubmissionId(String formSubmissionId) {
- this.formSubmissionId = formSubmissionId;
- return this;
- }
-
- public Event withProviderId(String providerId) {
- this.providerId = providerId;
- return this;
- }
-
- public Event withEntityType(String entityType) {
- this.entityType = entityType;
- return this;
- }
-
- /**
- * WARNING: Overrides all existing obs
- *
- * @param obs
- * @return
- */
- public Event withObs(List obs) {
- this.obs = obs;
- return this;
- }
-
- public Event withObs(Obs observation) {
- if (obs == null) {
- obs = new ArrayList<>();
- }
- obs.add(observation);
- return this;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-}
diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Location.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Location.java
deleted file mode 100644
index 8c49d3a750..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/domain/Location.java
+++ /dev/null
@@ -1,259 +0,0 @@
-package org.opensrp.api.domain;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-/**
- * The registered location which needs to be identified uniquely across the system
- */
-public class Location extends BaseDataObject {
-
- private String locationId;
-
- private String name;
-
- private Address address;
-
- private Map identifiers;
-
- private Location parentLocation;
-
- private Set tags;
-
- private Map attributes;
-
- public Location() {
- }
-
- public Location(String locationId, String name, Address address, Location parentLocation) {
- this.locationId = locationId;
- this.name = name;
- this.address = address;
- this.parentLocation = parentLocation;
- }
-
- public Location(String locationId, String name, Address address, Map identifiers,
- Location parentLocation, Set tags, Map attributes) {
- this.locationId = locationId;
- this.name = name;
- this.address = address;
- this.identifiers = identifiers;
- this.parentLocation = parentLocation;
- this.tags = tags;
- this.attributes = attributes;
- }
-
- public String getLocationId() {
- return locationId;
- }
-
- public void setLocationId(String locationId) {
- this.locationId = locationId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Address getAddress() {
- return address;
- }
-
- public void setAddress(Address address) {
- this.address = address;
- }
-
- public Map getIdentifiers() {
- return identifiers;
- }
-
- public String getIdentifier(String identifierType) {
- return identifiers.get(identifierType);
- }
-
- /**
- * WARNING: Overrides all existing identifiers
- *
- * @param identifiers
- * @return
- */
- public void setIdentifiers(Map identifiers) {
- this.identifiers = identifiers;
- }
-
- public void addIdentifier(String identifierType, String identifier) {
- if (identifiers == null) {
- identifiers = new HashMap<>();
- }
-
- identifiers.put(identifierType, identifier);
- }
-
- public void removeIdentifier(String identifierType) {
- identifiers.remove(identifierType);
- }
-
- public Location getParentLocation() {
- return parentLocation;
- }
-
- public void setParentLocation(Location parentLocation) {
- this.parentLocation = parentLocation;
- }
-
- public Set getTags() {
- return tags;
- }
-
- public boolean hasTag(String tag) {
- return tags.contains(tag);
- }
-
- /**
- * WARNING: Overrides all existing tags
- *
- * @param tags
- * @return
- */
- public void setTags(Set tags) {
- this.tags = tags;
- }
-
- public void addTag(String tag) {
- if (tags == null) {
- tags = new HashSet<>();
- }
-
- tags.add(tag);
- }
-
- public boolean removeTag(String tag) {
- return tags.remove(tag);
- }
-
- public Map getAttributes() {
- return attributes;
- }
-
- public Object getAttribute(String name) {
- return attributes.get(name);
- }
-
- /**
- * WARNING: Overrides all existing attributes
- *
- * @param attributes
- * @return
- */
- public void setAttributes(Map attributes) {
- this.attributes = attributes;
- }
-
- public void addAttribute(String name, Object value) {
- if (attributes == null) {
- attributes = new HashMap<>();
- }
-
- attributes.put(name, value);
- }
-
- public void removeAttribute(String name) {
- attributes.remove(name);
- }
-
- public Location withLocationId(String locationId) {
- this.locationId = locationId;
- return this;
- }
-
- public Location withName(String name) {
- this.name = name;
- return this;
- }
-
- public Location withAddress(Address address) {
- this.address = address;
- return this;
- }
-
- /**
- * WARNING: Overrides all existing identifiers
- *
- * @param identifiers
- * @return
- * @return
- */
- public Location withIdentifiers(Map identifiers) {
- this.identifiers = identifiers;
- return this;
- }
-
- public Location withIdentifier(String identifierType, String identifier) {
- if (identifiers == null) {
- identifiers = new HashMap<>();
- }
-
- identifiers.put(identifierType, identifier);
- return this;
- }
-
- public Location withParentLocation(Location parentLocation) {
- this.parentLocation = parentLocation;
- return this;
- }
-
- /**
- * WARNING: Overrides all existing tags
- *
- * @param tags
- * @return
- * @return
- */
- public Location withTags(Set tags) {
- this.tags = tags;
- return this;
- }
-
- public Location withTag(String tag) {
- if (tags == null) {
- tags = new HashSet<>();
- }
-
- tags.add(tag);
- return this;
- }
-
- /**
- * WARNING: Overrides all existing attributes
- *
- * @param attributes
- * @return
- * @return
- */
- public Location withAttributes(Map attributes) {
- this.attributes = attributes;
- return this;
- }
-
- public Location withAttribute(String name, Object value) {
- if (attributes == null) {
- attributes = new HashMap<>();
- }
-
- attributes.put(name, value);
- return this;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-}
diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Obs.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Obs.java
deleted file mode 100644
index d797b4aadd..0000000000
--- a/opensrp-api/src/main/java/org/opensrp/api/domain/Obs.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.opensrp.api.domain;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The observations applicable or noted for any {@link Event} by data entry person. Each obs links
- * back to variable in {@link FormSubmission} represent by name in {@link FormField}. Each
- * {@link Obs} instead of recording value with the text of label of question, maps each question
- * with a code that links with a standard international dictionary. This helps in getting
- * standardized reports and integration with different systems
- */
-public class Obs {
-
- private String fieldType;
-
- private String fieldDataType;
-
- private String fieldCode;
-
- private String parentCode;
-
- private List