Search in sources :

Example 1 with Content

use of com.salesmanager.shop.model.content.Content in project shopizer by shopizer-ecommerce.

the class ContentAdministrationApi method list.

/**
 * Works with ng-file-man client
 *
 * @param path
 * @param merchantStore
 * @param language
 * @return
 * @throws Exception
 */
@GetMapping(value = "/private/content/list", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") })
public List<ImageFile> list(@RequestParam(value = "parentPath", required = false) String path, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language) throws Exception {
    String decodedPath = decodeContentPath(path);
    ContentFolder folder = contentFacade.getContentFolder(decodedPath, merchantStore);
    List<ImageFile> files = folder.getContent().stream().map(x -> convertToImageFile(merchantStore, x)).collect(Collectors.toList());
    return files;
}
Also used : Content(com.salesmanager.shop.model.content.Content) RequestParam(org.springframework.web.bind.annotation.RequestParam) URLDecoder(java.net.URLDecoder) RestApiException(com.salesmanager.shop.store.api.exception.RestApiException) ContentFacade(com.salesmanager.shop.store.controller.content.facade.ContentFacade) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) StringUtils(org.apache.commons.lang3.StringUtils) CrossOrigin(org.springframework.web.bind.annotation.CrossOrigin) Inject(javax.inject.Inject) Language(com.salesmanager.core.model.reference.language.Language) MerchantStore(com.salesmanager.core.model.merchant.MerchantStore) ContentFile(com.salesmanager.shop.model.content.ContentFile) Qualifier(org.springframework.beans.factory.annotation.Qualifier) GetMapping(org.springframework.web.bind.annotation.GetMapping) FileNameUtils(com.salesmanager.shop.utils.FileNameUtils) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) FileContentType(com.salesmanager.core.model.content.FileContentType) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) PostMapping(org.springframework.web.bind.annotation.PostMapping) Logger(org.slf4j.Logger) MediaType(org.springframework.http.MediaType) ApiImplicitParam(io.swagger.annotations.ApiImplicitParam) IOException(java.io.IOException) ImageFilePath(com.salesmanager.shop.utils.ImageFilePath) UUID(java.util.UUID) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) Collectors(java.util.stream.Collectors) RestController(org.springframework.web.bind.annotation.RestController) Serializable(java.io.Serializable) ApiIgnore(springfox.documentation.annotations.ApiIgnore) ContentFolder(com.salesmanager.shop.model.content.ContentFolder) HttpStatus(org.springframework.http.HttpStatus) List(java.util.List) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException) MultipartFile(org.springframework.web.multipart.MultipartFile) ApiImplicitParams(io.swagger.annotations.ApiImplicitParams) UnsupportedEncodingException(java.io.UnsupportedEncodingException) FilenameUtils(org.apache.commons.io.FilenameUtils) ContentFolder(com.salesmanager.shop.model.content.ContentFolder) GetMapping(org.springframework.web.bind.annotation.GetMapping) ApiImplicitParams(io.swagger.annotations.ApiImplicitParams)

Aggregations

FileContentType (com.salesmanager.core.model.content.FileContentType)1 MerchantStore (com.salesmanager.core.model.merchant.MerchantStore)1 Language (com.salesmanager.core.model.reference.language.Language)1 Content (com.salesmanager.shop.model.content.Content)1 ContentFile (com.salesmanager.shop.model.content.ContentFile)1 ContentFolder (com.salesmanager.shop.model.content.ContentFolder)1 RestApiException (com.salesmanager.shop.store.api.exception.RestApiException)1 ServiceRuntimeException (com.salesmanager.shop.store.api.exception.ServiceRuntimeException)1 ContentFacade (com.salesmanager.shop.store.controller.content.facade.ContentFacade)1 FileNameUtils (com.salesmanager.shop.utils.FileNameUtils)1 ImageFilePath (com.salesmanager.shop.utils.ImageFilePath)1 ApiImplicitParam (io.swagger.annotations.ApiImplicitParam)1 ApiImplicitParams (io.swagger.annotations.ApiImplicitParams)1 IOException (java.io.IOException)1 Serializable (java.io.Serializable)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 URLDecoder (java.net.URLDecoder)1 List (java.util.List)1 UUID (java.util.UUID)1 Collectors (java.util.stream.Collectors)1