Search in sources :

Example 1 with ContentDescriptionEntity

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

the class ContentFacadeImpl method convertContentToReadableContentFull.

@Deprecated
private ReadableContentFull convertContentToReadableContentFull(MerchantStore store, Language language, Content content) {
    ReadableContentFull contentFull = new ReadableContentFull();
    try {
        List<ContentDescriptionEntity> descriptions = this.createContentDescriptionEntitys(store, content, language);
        contentFull.setDescriptions(descriptions);
        contentFull.setId(content.getId());
        contentFull.setDisplayedInMenu(content.isLinkToMenu());
        contentFull.setContentType(content.getContentType().name());
        contentFull.setCode(content.getCode());
        contentFull.setId(content.getId());
        contentFull.setVisible(content.isVisible());
        return contentFull;
    } catch (ServiceException e) {
        throw new ServiceRuntimeException("Error while creating ReadableContentFull", e);
    }
}
Also used : ServiceException(com.salesmanager.core.business.exception.ServiceException) ReadableContentFull(com.salesmanager.shop.model.content.ReadableContentFull) ContentDescriptionEntity(com.salesmanager.shop.model.content.ContentDescriptionEntity) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException)

Example 2 with ContentDescriptionEntity

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

the class ContentFacadeImpl method convertContentToReadableContentEntity.

@Deprecated
private ReadableContentEntity convertContentToReadableContentEntity(MerchantStore store, Language language, Content content) {
    ReadableContentEntity contentEntity = new ReadableContentEntity();
    ContentDescriptionEntity description = this.create(content.getDescription());
    contentEntity.setDescription(description);
    contentEntity.setId(content.getId());
    contentEntity.setDisplayedInMenu(content.isLinkToMenu());
    contentEntity.setContentType(content.getContentType().name());
    contentEntity.setCode(content.getCode());
    contentEntity.setId(content.getId());
    contentEntity.setVisible(content.isVisible());
    return contentEntity;
}
Also used : ReadableContentEntity(com.salesmanager.shop.model.content.ReadableContentEntity) ContentDescriptionEntity(com.salesmanager.shop.model.content.ContentDescriptionEntity)

Example 3 with ContentDescriptionEntity

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

the class ContentFacadeImpl method create.

@Deprecated
private ContentDescriptionEntity create(ContentDescription description) {
    ContentDescriptionEntity contentDescription = new ContentDescriptionEntity();
    contentDescription.setLanguage(description.getLanguage().getCode());
    contentDescription.setTitle(description.getTitle());
    contentDescription.setName(description.getName());
    contentDescription.setFriendlyUrl(description.getSeUrl());
    contentDescription.setDescription(description.getDescription());
    if (description.getId() != null && description.getId().longValue() > 0) {
        contentDescription.setId(description.getId());
    }
    return contentDescription;
}
Also used : ContentDescriptionEntity(com.salesmanager.shop.model.content.ContentDescriptionEntity)

Example 4 with ContentDescriptionEntity

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

the class ContentFacadeImpl method createContentDescriptionEntitys.

/*
	 * private Content convertContentPageToContent(MerchantStore store, Language
	 * language, Content content, PersistableContentEntity contentPage) throws
	 * ServiceException {
	 * 
	 * ContentType contentType =
	 * ContentType.valueOf(contentPage.getContentType()); if (contentType ==
	 * null) { throw new
	 * ServiceRuntimeException("Invalid specified contentType [" +
	 * contentPage.getContentType() + "]"); }
	 * 
	 * List<ContentDescription> descriptions = createContentDescription(store,
	 * content, contentPage); descriptions.stream().forEach(c ->
	 * c.setContent(content));
	 * 
	 * content.setDescriptions(descriptions);
	 * 
	 * // ContentDescription contentDescription = //
	 * createContentDescription(store, contentPage, language); //
	 * setContentDescriptionToContentModel(content,contentDescription,language);
	 * 
	 * // contentDescription.setContent(content);
	 * 
	 * if (contentPage.getId() != null && contentPage.getId().longValue() > 0) {
	 * content.setId(contentPage.getId()); }
	 * content.setVisible(contentPage.isVisible());
	 * content.setLinkToMenu(contentPage.isDisplayedInMenu());
	 * content.setContentType(ContentType.valueOf(contentPage.getContentType()))
	 * ; content.setMerchantStore(store);
	 * 
	 * return content; }
	 */
@Deprecated
private List<ContentDescriptionEntity> createContentDescriptionEntitys(MerchantStore store, Content contentModel, Language language) throws ServiceException {
    List<ContentDescriptionEntity> descriptions = new ArrayList<ContentDescriptionEntity>();
    if (!CollectionUtils.isEmpty(contentModel.getDescriptions())) {
        for (ContentDescription description : contentModel.getDescriptions()) {
            if (language != null && !language.getId().equals(description.getLanguage().getId())) {
                continue;
            }
            ContentDescriptionEntity contentDescription = create(description);
            descriptions.add(contentDescription);
        }
    }
    return descriptions;
}
Also used : ArrayList(java.util.ArrayList) ContentDescription(com.salesmanager.core.model.content.ContentDescription) ContentDescriptionEntity(com.salesmanager.shop.model.content.ContentDescriptionEntity)

Aggregations

ContentDescriptionEntity (com.salesmanager.shop.model.content.ContentDescriptionEntity)4 ServiceException (com.salesmanager.core.business.exception.ServiceException)1 ContentDescription (com.salesmanager.core.model.content.ContentDescription)1 ReadableContentEntity (com.salesmanager.shop.model.content.ReadableContentEntity)1 ReadableContentFull (com.salesmanager.shop.model.content.ReadableContentFull)1 ServiceRuntimeException (com.salesmanager.shop.store.api.exception.ServiceRuntimeException)1 ArrayList (java.util.ArrayList)1