Skip to content

Commit

Permalink
MARP-1104 Market website portal versions and artifacts aren t shown m…
Browse files Browse the repository at this point in the history
…arketplace website (#162)
  • Loading branch information
ndkhanh-axonivy authored Sep 19, 2024
1 parent 8e5bb1b commit a55cbb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ public enum NonStandardProduct {
}

public static NonStandardProduct findById(String id) {
return NON_STANDARD_PRODUCT_MAP.getOrDefault(id,DEFAULT);
return NON_STANDARD_PRODUCT_MAP.getOrDefault(id, DEFAULT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import static com.axonivy.market.constants.ProductJsonConstants.NAME;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

@Log4j2
@Service
@Getter
Expand Down Expand Up @@ -96,7 +97,8 @@ public List<MavenArtifactVersionModel> getArtifactsAndVersionToDisplay(String pr

this.productId = productId;
artifactsFromMeta = getProductMetaArtifacts(productId);
List<String> versionsToDisplay = VersionUtils.getVersionsToDisplay(getVersionsFromMavenArtifacts(), isShowDevVersion, designerVersion);
List<String> versionsToDisplay = VersionUtils.getVersionsToDisplay(getVersionsFromMavenArtifacts(),
isShowDevVersion, designerVersion);
proceedDataCache = mavenArtifactVersionRepository.findById(productId).orElse(new MavenArtifactVersion(productId));
metaProductArtifact = artifactsFromMeta.stream()
.filter(artifact -> artifact.getArtifactId().endsWith(MavenConstants.PRODUCT_ARTIFACT_POSTFIX)).findAny()
Expand All @@ -112,17 +114,18 @@ public List<MavenArtifactVersionModel> getArtifactsAndVersionToDisplay(String pr
}

@Override
public Map<String, Object> getProductJsonContentByIdAndVersion(String productId, String version){
public Map<String, Object> getProductJsonContentByIdAndVersion(String productId, String version) {
Map<String, Object> result = new HashMap<>();
try {
ProductJsonContent productJsonContent = productJsonContentRepository.findByProductIdAndVersion(productId, version);
ProductJsonContent productJsonContent = productJsonContentRepository.findByProductIdAndVersion(productId,
version);
if (ObjectUtils.isEmpty(productJsonContent)) {
return new HashMap<>();
}
result = mapper.readValue(productJsonContent.getContent(), Map.class);
result.computeIfAbsent(NAME, k -> productJsonContent.getName());

} catch (JsonProcessingException jsonProcessingException){
} catch (JsonProcessingException jsonProcessingException) {
log.error(jsonProcessingException.getMessage());
}
return result;
Expand Down Expand Up @@ -249,7 +252,9 @@ public String getVersionTag(String version) {

public String buildProductJsonFilePath() {
String pathToProductFolderFromTagContent = metaProductArtifact.getArtifactId();
GitHubUtils.getNonStandardProductFilePath(productId);
if (NonStandardProduct.DEFAULT != NonStandardProduct.findById(productId)) {
pathToProductFolderFromTagContent = GitHubUtils.getNonStandardProductFilePath(productId);
}
productJsonFilePath = String.format(GitHubConstants.PRODUCT_JSON_FILE_PATH_FORMAT,
pathToProductFolderFromTagContent);
return productJsonFilePath;
Expand Down

0 comments on commit a55cbb8

Please sign in to comment.