Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Commit

Permalink
Merge pull request #465 from OpenSRP/issue455-path-ec-app-db-version
Browse files Browse the repository at this point in the history
Add client application and database version identifiers to the EC model PATH
  • Loading branch information
ndegwamartin committed Jun 21, 2018
2 parents 25e8cf2 + 9a2b8b7 commit c380609
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.opensrp.domain;

import java.util.Date;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.codehaus.jackson.annotate.JsonProperty;
Expand All @@ -27,6 +26,12 @@ public abstract class BaseDataObject extends MotechBaseDataObject {
private String voidReason;
@JsonProperty
private Long serverVersion=System.currentTimeMillis();

@JsonProperty
private Integer clientApplicationVersion;

@JsonProperty
private Integer clientDatabaseVersion;


public BaseDataObject() {}
Expand Down Expand Up @@ -142,6 +147,31 @@ public BaseDataObject withVoidReason(String voidReason) {
this.voidReason = voidReason;
return this;
}

public BaseDataObject withClientApplicationVersion(Integer clientApplicationVersion) {
this.clientApplicationVersion = clientApplicationVersion;
return this;
}

public BaseDataObject withClientDatabaseVersion(Integer clientDatabaseVersion) {
this.clientDatabaseVersion = clientDatabaseVersion;
return this;
}
public Integer getClientApplicationVersion() {
return clientApplicationVersion;
}

public void setClientApplicationVersion(Integer clientApplicationVersion) {
this.clientApplicationVersion = clientApplicationVersion;
}

public Integer getClientDatabaseVersion() {
return clientDatabaseVersion;
}

public void setClientDatabaseVersion(Integer clientDatabaseVersion) {
this.clientDatabaseVersion = clientDatabaseVersion;
}

@Override
public String toString() {
Expand Down
34 changes: 33 additions & 1 deletion opensrp-core/src/main/java/org/opensrp/domain/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class Client extends BaseEntity {
@JsonProperty
private String gender;
@JsonProperty
private String clientType;
@JsonProperty
private Map<String, List<String>> relationships;

protected Client() {
Expand Down Expand Up @@ -89,6 +91,28 @@ public Client(String baseEntityId, String firstName, String middleName, String l
setAddresses(addresses);
setAttributes(attributes);
}

public Client(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate,
DateTime deathdate, Boolean birthdateApprox, Boolean deathdateApprox, String gender, String clientType) {
this(baseEntityId, firstName, middleName, lastName, birthdate, deathdate, birthdateApprox, deathdateApprox, gender);
setClientType(clientType);
}

public Client(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate,
DateTime deathdate, Boolean birthdateApprox, Boolean deathdateApprox, String gender, String identifierType,
String identifier, String clientType) {
this(baseEntityId, firstName, middleName, lastName, birthdate, deathdate, birthdateApprox, deathdateApprox, gender,
identifierType, identifier);
setClientType(clientType);
}

public Client(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate,
DateTime deathdate, Boolean birthdateApprox, Boolean deathdateApprox, String gender, List<Address> addresses,
Map<String, String> identifiers, Map<String, Object> attributes, String clientType) {
this(baseEntityId, firstName, middleName, lastName, birthdate, deathdate, birthdateApprox, deathdateApprox, gender,
addresses, identifiers, attributes);
setClientType(clientType);
}

public String getFirstName() {
return firstName;
Expand Down Expand Up @@ -167,8 +191,16 @@ public String getGender() {
public void setGender(String gender) {
this.gender = gender;
}

public String getClientType() {
return clientType;
}

public void setClientType(String clientType) {
this.clientType = clientType;
}

public Map<String, List<String>> getRelationships() {
public Map<String, List<String>> getRelationships() {
return relationships;
}

Expand Down

0 comments on commit c380609

Please sign in to comment.