From 85471ea6d55ad60060ac15f4f526c73855c4a2a3 Mon Sep 17 00:00:00 2001 From: karthik-tarento Date: Wed, 17 Apr 2024 15:01:53 +0530 Subject: [PATCH] Using sector framework name from config --- .../sunbird/catalog/service/CatalogServiceImpl.java | 12 ++++++------ .../sunbird/common/util/CbExtServerProperties.java | 11 +++++++++++ src/main/resources/application.properties | 3 ++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/sunbird/catalog/service/CatalogServiceImpl.java b/src/main/java/org/sunbird/catalog/service/CatalogServiceImpl.java index 53db99902..747233ce2 100644 --- a/src/main/java/org/sunbird/catalog/service/CatalogServiceImpl.java +++ b/src/main/java/org/sunbird/catalog/service/CatalogServiceImpl.java @@ -97,7 +97,7 @@ public SBApiResponse getSectors() { StringBuilder strUrl = new StringBuilder(extServerProperties.getKmBaseHost()); strUrl.append(extServerProperties.getKmFrameworkTermSearchPath()).append("?framework=") - .append(extServerProperties.getTaxonomyFrameWorkName()).append("&category=") + .append(extServerProperties.getSectorFrameworkName()).append("&category=") .append(extServerProperties.getSectorCategoryName()); Map termResponse = outboundRequestHandlerServiceImpl.fetchResultUsingPost(strUrl.toString(), @@ -163,7 +163,7 @@ public SBApiResponse readSector(String sectorId) { try { StringBuilder strUrl = new StringBuilder(extServerProperties.getKmBaseHost()); strUrl.append(extServerProperties.getKmFrameworkTermReadPath()).append("/").append(sectorId).append("?framework=") - .append(extServerProperties.getTaxonomyFrameWorkName()).append("&category=") + .append(extServerProperties.getSectorFrameworkName()).append("&category=") .append(extServerProperties.getSectorCategoryName()); Map sectorMap = new HashMap(); @@ -214,7 +214,7 @@ public SBApiResponse createSector(Map request) { // Resource is not found... we can create sector. reqBody.put(Constants.CODE, name); Map parentObj = new HashMap<>(); - parentObj.put(Constants.IDENTIFIER, extServerProperties.getTaxonomyFrameWorkName() + "_" + extServerProperties.getSectorCategoryName()); + parentObj.put(Constants.IDENTIFIER, extServerProperties.getSectorFrameworkName() + "_" + extServerProperties.getSectorCategoryName()); reqBody.put(Constants.PARENTS, Arrays.asList(parentObj)); Map termReq = new HashMap(); termReq.put(Constants.TERM, reqBody); @@ -223,7 +223,7 @@ public SBApiResponse createSector(Map request) { StringBuilder strUrl = new StringBuilder(extServerProperties.getKmBaseHost()); strUrl.append(extServerProperties.getKmFrameworkTermCreatePath()).append("?framework=") - .append(extServerProperties.getTaxonomyFrameWorkName()).append("&category=") + .append(extServerProperties.getSectorFrameworkName()).append("&category=") .append(extServerProperties.getSectorCategoryName()); Map termResponse = outboundRequestHandlerServiceImpl.fetchResultUsingPost(strUrl.toString(), createReq, null); @@ -284,7 +284,7 @@ public SBApiResponse createSubSector(Map request) { termReq.put(Constants.NAME, name); Map parentObj = new HashMap<>(); - parentObj.put(Constants.IDENTIFIER, extServerProperties.getTaxonomyFrameWorkName() + "_" + extServerProperties.getSectorCategoryName() + "_" + id); + parentObj.put(Constants.IDENTIFIER, extServerProperties.getSectorFrameworkName() + "_" + extServerProperties.getSectorCategoryName() + "_" + id); termReq.put(Constants.PARENTS, Arrays.asList(parentObj)); requestBody.put(Constants.TERM, termReq); Map createReq = new HashMap(); @@ -292,7 +292,7 @@ public SBApiResponse createSubSector(Map request) { StringBuilder strUrl = new StringBuilder(extServerProperties.getKmBaseHost()); strUrl.append(extServerProperties.getKmFrameworkTermCreatePath()).append("?framework=") - .append(extServerProperties.getTaxonomyFrameWorkName()).append("&category=") + .append(extServerProperties.getSectorFrameworkName()).append("&category=") .append(extServerProperties.getSectorCategoryName()); Map termResponse = outboundRequestHandlerServiceImpl.fetchResultUsingPost(strUrl.toString(), createReq, null); diff --git a/src/main/java/org/sunbird/common/util/CbExtServerProperties.java b/src/main/java/org/sunbird/common/util/CbExtServerProperties.java index d99154233..9ae2bf218 100644 --- a/src/main/java/org/sunbird/common/util/CbExtServerProperties.java +++ b/src/main/java/org/sunbird/common/util/CbExtServerProperties.java @@ -711,6 +711,9 @@ public void setRedisWheeboxKey(String redisWheeboxKey) { @Value("${km.framework.term.create.path}") private String kmFrameworkTermCreatePath; + @Value("${sector.framework.name}") + private String sectorFrameworkName; + public boolean qListFromCacheEnabled() { return qListFromCacheEnabled; } @@ -2512,4 +2515,12 @@ public String getKmFrameworkTermCreatePath() { public void setKmFrameworkTermCreatePath(String kmFrameworkTermCreatePath) { this.kmFrameworkTermCreatePath = kmFrameworkTermCreatePath; } + + public String getSectorFrameworkName() { + return sectorFrameworkName; + } + + public void setSectorFrameworkName(String sectorFrameworkName) { + this.sectorFrameworkName = sectorFrameworkName; + } } \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ff7af9b37..649fc44c8 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -121,7 +121,8 @@ km.framework.term.create.path=v1/framework/term/create #Taxonomy Framework and Category igot.taxonomy.framework.name=igot igot.taxonomy.category.name=Taxonomy -sector.category.name=testsector +sector.framework.name=sector-fw +sector.category.name=sector sector.category.fields=identifier,code,name,description,appIcon,imgUrl sub.sector.category.fields=identifier,code,name,description,appIcon