diff --git a/configs b/configs
index 6bc7e2ff9..940b8339b 160000
--- a/configs
+++ b/configs
@@ -1 +1 @@
-Subproject commit 6bc7e2ff9a31f9c157f13e564e58ccf7da8725ed
+Subproject commit 940b8339b74c296bb48992643e83be28f084d952
diff --git a/pom.xml b/pom.xml
index 810c62cb3..d39dd6034 100755
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
opensrp-server-core
jar
- 2.11.4-SNAPSHOT
+ 2.11.5-SNAPSHOT
opensrp-server-core
OpenSRP Server Core module
https://github.com/OpenSRP/opensrp-server-core
diff --git a/src/main/java/org/opensrp/domain/postgres/SettingsMetadata.java b/src/main/java/org/opensrp/domain/postgres/SettingsMetadata.java
index dec8bcfc1..3f4e7b6a9 100644
--- a/src/main/java/org/opensrp/domain/postgres/SettingsMetadata.java
+++ b/src/main/java/org/opensrp/domain/postgres/SettingsMetadata.java
@@ -135,7 +135,7 @@ public class SettingsMetadata {
* @mbg.generated Fri Apr 24 10:25:50 EAT 2020
*/
private String settingDescription;
-
+
/**
*
* This field was generated by MyBatis Generator.
@@ -154,6 +154,12 @@ public class SettingsMetadata {
*/
private String inheritedFrom;
+ /**
+ * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.metadata_version
+ * @mbg.generated Fri May 21 17:49:57 PKT 2021
+ */
+ private Long metadataVersion;
+
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column core.settings_metadata.id
@@ -501,7 +507,7 @@ public void setSettingKey(String settingKey) {
public String getSettingDescription() {
return settingDescription;
}
-
+
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column core.settings_metadata.setting_description
@@ -513,7 +519,7 @@ public String getSettingDescription() {
public void setSettingDescription(String settingDescription) {
this.settingDescription = settingDescription;
}
-
+
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column core.settings_metadata.setting_label
@@ -525,7 +531,7 @@ public void setSettingDescription(String settingDescription) {
public void setSettingLabel(String settingLabel) {
this.settingLabel = settingLabel;
}
-
+
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column core.settings_metadata.setting_label
@@ -537,7 +543,7 @@ public void setSettingLabel(String settingLabel) {
public String getSettingLabel() {
return settingLabel;
}
-
+
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column core.settings_metadata.inherited_from
@@ -561,4 +567,22 @@ public String getInheritedFrom() {
public void setInheritedFrom(String inheritedFrom) {
this.inheritedFrom = inheritedFrom;
}
+
+ /**
+ * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.metadata_version
+ * @return the value of core.settings_metadata.metadata_version
+ * @mbg.generated Fri May 21 17:49:57 PKT 2021
+ */
+ public Long getMetadataVersion() {
+ return metadataVersion;
+ }
+
+ /**
+ * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.metadata_version
+ * @param metadataVersion the value for core.settings_metadata.metadata_version
+ * @mbg.generated Fri May 21 17:49:57 PKT 2021
+ */
+ public void setMetadataVersion(Long metadataVersion) {
+ this.metadataVersion = metadataVersion;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/opensrp/domain/postgres/SettingsMetadataExampleGeneratedCriteria.java b/src/main/java/org/opensrp/domain/postgres/SettingsMetadataExampleGeneratedCriteria.java
index 596f0d961..ed29efc0e 100644
--- a/src/main/java/org/opensrp/domain/postgres/SettingsMetadataExampleGeneratedCriteria.java
+++ b/src/main/java/org/opensrp/domain/postgres/SettingsMetadataExampleGeneratedCriteria.java
@@ -1218,6 +1218,67 @@ public SettingsMetadataExampleGeneratedCriteria.Criteria andInheritedFromNotBetw
addCriterion("inherited_from not between", value1, value2, "inheritedFrom");
return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
}
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionIsNull() {
+ addCriterion("metadata_version is null");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionIsNotNull() {
+ addCriterion("metadata_version is not null");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionEqualTo(Long value) {
+ addCriterion("metadata_version =", value, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionNotEqualTo(Long value) {
+ addCriterion("metadata_version <>", value, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionGreaterThan(Long value) {
+ addCriterion("metadata_version >", value, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionGreaterThanOrEqualTo(Long value) {
+ addCriterion("metadata_version >=", value, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionLessThan(Long value) {
+ addCriterion("metadata_version <", value, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionLessThanOrEqualTo(Long value) {
+ addCriterion("metadata_version <=", value, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionIn(List values) {
+ addCriterion("metadata_version in", values, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionNotIn(List values) {
+ addCriterion("metadata_version not in", values, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionBetween(Long value1, Long value2) {
+ addCriterion("metadata_version between", value1, value2, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
+ public SettingsMetadataExampleGeneratedCriteria.Criteria andMetadataVersionNotBetween(Long value1, Long value2) {
+ addCriterion("metadata_version not between", value1, value2, "metadataVersion");
+ return (SettingsMetadataExampleGeneratedCriteria.Criteria) this;
+ }
+
}
/**
diff --git a/src/main/java/org/opensrp/repository/postgres/SettingRepositoryImpl.java b/src/main/java/org/opensrp/repository/postgres/SettingRepositoryImpl.java
index 503ebd700..26d3deb6e 100755
--- a/src/main/java/org/opensrp/repository/postgres/SettingRepositoryImpl.java
+++ b/src/main/java/org/opensrp/repository/postgres/SettingRepositoryImpl.java
@@ -168,7 +168,9 @@ public List findAllSettings() {
@Override
public List findSettings(SettingSearchBean settingQueryBean,
Map> treeNodeHashMap) {
- return findSettings(settingQueryBean, DEFAULT_FETCH_SIZE, treeNodeHashMap);
+ Integer limit;
+ limit = settingQueryBean.getLimit() == null || settingQueryBean.getLimit() == 0? DEFAULT_FETCH_SIZE : settingQueryBean.getLimit();
+ return findSettings(settingQueryBean, limit, treeNodeHashMap);
}
@Override
@@ -212,6 +214,10 @@ public List findSettingsAndSettingsMetadata(S
criteria.andServerVersionGreaterThanOrEqualTo(settingQueryBean.getServerVersion());
}
+ if (settingQueryBean.getMetadataVersion() != null) {
+ criteria.andMetadataVersionGreaterThan(settingQueryBean.getMetadataVersion());
+ }
+
if (settingQueryBean.isResolveSettings()) {
return fetchSettingsPerLocation(settingQueryBean, metadataExample, treeNodeHashMap, limit, criteria);
} else {
@@ -452,6 +458,9 @@ private Setting convertToSetting(SettingsMetadata settingsMetadata, boolean isV1
setting.setDescription(settingsMetadata.getSettingDescription());
setting.setLabel(settingsMetadata.getSettingLabel());
setting.setSettingIdentifier(settingsMetadata.getIdentifier());
+ if (settingsMetadata.getMetadataVersion() != null) {
+ setting.setMetadataVersion(settingsMetadata.getMetadataVersion());
+ }
if (!isV1Settings) {
setting.setProviderId(settingsMetadata.getProviderId());
setting.setSettingsId(String.valueOf(settingsMetadata.getSettingsId()));
@@ -701,6 +710,7 @@ private List createMetadata(SettingConfiguration settingConfig
metadata.setIdentifier(settingConfiguration.getIdentifier());
checkIdentityAttributtes(settingConfiguration, metadata);
metadata.setServerVersion(settingConfiguration.getServerVersion());
+ metadata.setMetadataVersion(settingConfiguration.getMetadataVersion());
metadata.setJson(convertToSetting(metadata, false)); //always want to create the json on the settings
// creation
diff --git a/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMetadataMapper.xml b/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMetadataMapper.xml
index c0a3f474e..9e370f062 100644
--- a/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMetadataMapper.xml
+++ b/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMetadataMapper.xml
@@ -23,6 +23,7 @@
+
@@ -92,7 +93,8 @@
setting_key,
setting_description,
setting_label,
- inherited_from
+ inherited_from,
+ metadata_version
) VALUES
(
@@ -111,7 +113,8 @@
#{setting.settingKey,jdbcType=VARCHAR},
#{setting.settingDescription,jdbcType=VARCHAR},
#{setting.settingLabel,jdbcType=VARCHAR},
- #{setting.inheritedFrom,jdbcType=VARCHAR}
+ #{setting.inheritedFrom,jdbcType=VARCHAR},
+ nextVal('core.setting_metadata_version_seq')
)
@@ -134,7 +137,8 @@
setting_key = #{setting.settingKey},
setting_description = #{setting.settingDescription},
setting_label = #{setting.settingLabel},
- inherited_from = #{setting.inheritedFrom}
+ inherited_from = #{setting.inheritedFrom},
+ metadata_version = nextVal('core.setting_metadata_version_seq')
WHERE uuid = #{setting.uuid}
AND setting_key = #{setting.settingKey}
diff --git a/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMetadataMapper.xml b/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMetadataMapper.xml
index ea285d09d..934b8a819 100644
--- a/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMetadataMapper.xml
+++ b/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMetadataMapper.xml
@@ -24,6 +24,7 @@
+
id, settings_id, document_id, identifier, server_version, team, team_id, provider_id,
location_id, uuid, json, setting_type, setting_value, setting_key, setting_description,
- inherited_from
+ inherited_from, metadata_version