-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feature/MARP-558-M…
…ultilingualism-for-Detail-Page-Description # Conflicts: # marketplace-service/src/main/java/com/axonivy/market/assembler/ProductDetailModelAssembler.java # marketplace-service/src/main/java/com/axonivy/market/assembler/ProductModelAssembler.java # marketplace-service/src/main/java/com/axonivy/market/constants/CommonConstants.java # marketplace-service/src/main/java/com/axonivy/market/constants/GitHubConstants.java # marketplace-service/src/main/java/com/axonivy/market/constants/MavenConstants.java # marketplace-service/src/main/java/com/axonivy/market/constants/MetaConstants.java # marketplace-service/src/main/java/com/axonivy/market/constants/ProductJsonConstants.java # marketplace-service/src/main/java/com/axonivy/market/constants/ReadmeConstants.java # marketplace-service/src/main/java/com/axonivy/market/controller/ProductController.java # marketplace-service/src/main/java/com/axonivy/market/controller/ProductDetailsController.java # marketplace-service/src/main/java/com/axonivy/market/entity/Product.java # marketplace-service/src/main/java/com/axonivy/market/entity/ProductModuleContent.java # marketplace-service/src/main/java/com/axonivy/market/factory/ProductFactory.java # marketplace-service/src/main/java/com/axonivy/market/github/model/Meta.java # marketplace-service/src/main/java/com/axonivy/market/github/service/GHAxonIvyProductRepoService.java # marketplace-service/src/main/java/com/axonivy/market/github/service/impl/GHAxonIvyProductRepoServiceImpl.java # marketplace-service/src/main/java/com/axonivy/market/github/util/GitHubUtils.java # marketplace-service/src/main/java/com/axonivy/market/model/MultilingualismValue.java # marketplace-service/src/main/java/com/axonivy/market/model/ProductDetailModel.java # marketplace-service/src/main/java/com/axonivy/market/model/ProductModel.java # marketplace-service/src/main/java/com/axonivy/market/repository/ProductRepository.java # marketplace-service/src/main/java/com/axonivy/market/service/ProductService.java # marketplace-service/src/main/java/com/axonivy/market/service/impl/ProductServiceImpl.java # marketplace-service/src/main/java/com/axonivy/market/service/impl/VersionServiceImpl.java # marketplace-service/src/main/java/com/axonivy/market/util/XmlReaderUtils.java # marketplace-service/src/test/java/com/axonivy/market/controller/ProductControllerTest.java # marketplace-service/src/test/java/com/axonivy/market/controller/ProductDetailsControllerTest.java # marketplace-service/src/test/java/com/axonivy/market/factory/ProductFactoryTest.java # marketplace-service/src/test/java/com/axonivy/market/service/GHAxonIvyProductRepoServiceImplTest.java # marketplace-service/src/test/java/com/axonivy/market/service/ProductServiceImplTest.java # marketplace-service/src/test/java/com/axonivy/market/service/VersionServiceImplTest.java # marketplace-service/src/test/java/com/axonivy/market/util/GitHubUtilsTest.java
- Loading branch information
Showing
92 changed files
with
4,111 additions
and
2,839 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
marketplace-service/src/main/java/com/axonivy/market/assembler/FeedbackModelAssembler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.axonivy.market.assembler; | ||
|
||
import com.axonivy.market.controller.FeedbackController; | ||
import com.axonivy.market.entity.Feedback; | ||
import com.axonivy.market.entity.User; | ||
import com.axonivy.market.exceptions.model.NotFoundException; | ||
import com.axonivy.market.model.FeedbackModel; | ||
import com.axonivy.market.service.UserService; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport; | ||
import org.springframework.stereotype.Component; | ||
|
||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; | ||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; | ||
|
||
@Log4j2 | ||
@Component | ||
public class FeedbackModelAssembler extends RepresentationModelAssemblerSupport<Feedback, FeedbackModel> { | ||
|
||
private final UserService userService; | ||
|
||
public FeedbackModelAssembler(UserService userService) { | ||
super(Feedback.class, FeedbackModel.class); | ||
this.userService = userService; | ||
} | ||
|
||
@Override | ||
public FeedbackModel toModel(Feedback feedback) { | ||
FeedbackModel resource = new FeedbackModel(); | ||
resource.add(linkTo(methodOn(FeedbackController.class).findFeedback(feedback.getId())) | ||
.withSelfRel()); | ||
return createResource(resource, feedback); | ||
} | ||
|
||
private FeedbackModel createResource(FeedbackModel model, Feedback feedback) { | ||
User user; | ||
try { | ||
user = userService.findUser(feedback.getUserId()); | ||
} | ||
catch (NotFoundException e) { | ||
log.warn(e.getMessage()); | ||
user = new User(); | ||
} | ||
model.setId(feedback.getId()); | ||
model.setUsername(StringUtils.isBlank(user.getName()) ? user.getUsername() : user.getName()); | ||
model.setUserAvatarUrl(user.getAvatarUrl()); | ||
model.setUserProvider(user.getProvider()); | ||
model.setProductId(feedback.getProductId()); | ||
model.setContent(feedback.getContent()); | ||
model.setRating(feedback.getRating()); | ||
model.setCreatedAt(feedback.getCreatedAt()); | ||
model.setUpdatedAt(feedback.getUpdatedAt()); | ||
return model; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 27 additions & 29 deletions
56
marketplace-service/src/main/java/com/axonivy/market/assembler/ProductModelAssembler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
package com.axonivy.market.assembler; | ||
|
||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; | ||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; | ||
|
||
import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.axonivy.market.controller.ProductDetailsController; | ||
import com.axonivy.market.entity.Product; | ||
import com.axonivy.market.model.ProductModel; | ||
import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport; | ||
import org.springframework.stereotype.Component; | ||
|
||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; | ||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; | ||
|
||
@Component | ||
public class ProductModelAssembler extends RepresentationModelAssemblerSupport<Product, ProductModel> { | ||
|
||
public ProductModelAssembler() { | ||
super(ProductDetailsController.class, ProductModel.class); | ||
} | ||
|
||
@Override | ||
public ProductModel toModel(Product product) { | ||
ProductModel resource = new ProductModel(); | ||
resource.add(linkTo(methodOn(ProductDetailsController.class).findProductDetails(product.getId(), product.getType())) | ||
.withSelfRel()); | ||
return createResource(resource, product); | ||
} | ||
|
||
public ProductModel createResource(ProductModel model, Product product) { | ||
model.setId(product.getId()); | ||
model.setNames(product.getNames()); | ||
model.setShortDescriptions(product.getShortDescriptions()); | ||
model.setType(product.getType()); | ||
model.setTags(product.getTags()); | ||
model.setLogoUrl(product.getLogoUrl()); | ||
return model; | ||
} | ||
|
||
} | ||
public ProductModelAssembler() { | ||
super(ProductDetailsController.class, ProductModel.class); | ||
} | ||
|
||
@Override | ||
public ProductModel toModel(Product product) { | ||
ProductModel resource = new ProductModel(); | ||
resource.add(linkTo(methodOn(ProductDetailsController.class).findProductDetails(product.getId())).withSelfRel()); | ||
return createResource(resource, product); | ||
} | ||
|
||
public ProductModel createResource(ProductModel model, Product product) { | ||
model.setId(product.getId()); | ||
model.setNames(product.getNames()); | ||
model.setShortDescriptions(product.getShortDescriptions()); | ||
model.setType(product.getType()); | ||
model.setTags(product.getTags()); | ||
model.setLogoUrl(product.getLogoUrl()); | ||
return model; | ||
} | ||
|
||
} |
10 changes: 5 additions & 5 deletions
10
marketplace-service/src/main/java/com/axonivy/market/config/MarketApiDocumentConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
marketplace-service/src/main/java/com/axonivy/market/config/MarketHeaderInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
marketplace-service/src/main/java/com/axonivy/market/config/MongoConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.