Skip to content

Commit

Permalink
Merge pull request #1701 from nandhu-kumar/develop
Browse files Browse the repository at this point in the history
MOSIP-35404 | Added new method to configure schema version from properties
  • Loading branch information
mohanachandran-s authored Dec 12, 2024
2 parents 1020202 + 2f25232 commit d23400c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5310,7 +5310,7 @@ public static String modifySchemaGenerateHbs(boolean regenerateHbs) {
JSONObject requestJson = new JSONObject();
kernelAuthLib = new KernelAuthentication();
String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN);
String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL);
String url = getSchemaURL();

Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
GlobalConstants.AUTHORIZATION, token);
Expand Down Expand Up @@ -5542,6 +5542,18 @@ else if (eachRequiredProp.equals("password")) {
identityHbs = requestJson.toString();
return identityHbs;
}


public static String getSchemaURL() {
String schemaURL = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL);
String schemaVersion = ConfigManager.getproperty(GlobalConstants.SCHEMA_VERSION);

if (schemaVersion != null && !schemaVersion.isEmpty()) {
schemaURL = schemaURL + "?schemaVersion=" + schemaVersion;
}

return schemaURL;
}


public static String updateIdentityHbs(boolean regenerateHbs) {
Expand All @@ -5552,7 +5564,7 @@ public static String updateIdentityHbs(boolean regenerateHbs) {
JSONObject requestJson = new JSONObject();
kernelAuthLib = new KernelAuthentication();
String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN);
String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL);
String url = getSchemaURL();

Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
GlobalConstants.AUTHORIZATION, token);
Expand Down Expand Up @@ -5759,7 +5771,7 @@ else if (eachRequiredProp.equals("proofOfIdentity")) {
public static String generateLatestSchemaVersion() {
kernelAuthLib = new KernelAuthentication();
String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN);
String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL);
String url = getSchemaURL();

Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
GlobalConstants.AUTHORIZATION, token);
Expand All @@ -5782,7 +5794,7 @@ public static String generateHbsForUpdateDraft() {
JSONObject requestJson = new JSONObject();
kernelAuthLib = new KernelAuthentication();
String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN);
String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL);
String url = getSchemaURL();

Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
GlobalConstants.AUTHORIZATION, token);
Expand Down Expand Up @@ -6076,7 +6088,7 @@ public static String generateHbsForPrereg(boolean isItUpdate) {
JSONObject requestJson = new JSONObject();
kernelAuthLib = new KernelAuthentication();
String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN);
String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL);
String url = getSchemaURL();

Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
GlobalConstants.AUTHORIZATION, token);
Expand Down Expand Up @@ -8204,7 +8216,7 @@ public static JSONArray getRequiredField() {
JSONObject requestJson = new JSONObject();
kernelAuthLib = new KernelAuthentication();
String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN);
String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL);
String url = getSchemaURL();

Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
GlobalConstants.AUTHORIZATION, token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public class GlobalConstants {
public static final String MOSIP_ESIGNET_ACCESS_TOKEN_EXPIRE_SECONDS = "mosip.esignet.access-token-expire-seconds";
public static final String ERROR_BOOK_APPOINTMENT = "Failed to fetch registration details while booking appointment";
public static final String MASTER_SCHEMA_URL = "masterSchemaURL";
public static final String SCHEMA_VERSION = "schemaVersion";
public static final String ID_VERSION = "idVersion";
public static final String SCHEMA_JSON = "schemaJson";
public static final String REQUIRED = "required";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,4 @@ authCertsPath=/home/mosip/authcerts


mosip_components_base_urls=
#auditmanager=api-internal.released.mosip.net;idrepository=api-internal.released.mosip.net;partnermanager=api-internal.released.mosip.net;idauthentication=api-internal.released.mosip.net;policymanager=api-internal.released.mosip.net;authmanager=api-internal.released.mosip.net;resident=api-internal.released.mosip.net;preregistration=api-internal.released.mosip.net;masterdata=api-internal.released.mosip.net;idgenerator=api-internal.released.mosip.net;
#auditmanager=api-internal.released.mosip.net;idrepository=api-internal.released.mosip.net;authmanager=api-internal.released.mosip.net;resident=api-internal.released.mosip.net;partnermanager=api-internal.released.mosip.net;idauthentication=api-internal.released.mosip.net;masterdata=api-internal.released.mosip.net;idgenerator=api-internal.released.mosip.net;policymanager=api-internal.released.mosip.net;preregistration=api-internal.released.mosip.net;keymanager=api-internal.released.mosip.net

0 comments on commit d23400c

Please sign in to comment.