Spaces:
Sleeping
Sleeping
Commit ·
bfa0569
1
Parent(s): 06576f1
add new services and update HomepageServiceImpl
Browse files- src/main/java/com/artandscience/webbff/webbff/common/constants/ButtonTypeConstants.java +23 -0
- src/main/java/com/artandscience/webbff/webbff/common/constants/HtmlTypeConstants.java +16 -0
- src/main/java/com/artandscience/webbff/webbff/common/service/ExternalAttributeService.java +3 -1
- src/main/java/com/artandscience/webbff/webbff/common/service/MainButtonService.java +11 -0
- src/main/java/com/artandscience/webbff/webbff/common/service/ModelConfigService.java +5 -0
- src/main/java/com/artandscience/webbff/webbff/common/service/impl/ExternalAttributeServiceImpl.java +32 -3
- src/main/java/com/artandscience/webbff/webbff/common/service/impl/MainButtonServiceImpl.java +50 -0
- src/main/java/com/artandscience/webbff/webbff/common/service/impl/ModelConfigServiceImpl.java +47 -0
- src/main/java/com/artandscience/webbff/webbff/dao/entity/Button.java +43 -2
- src/main/java/com/artandscience/webbff/webbff/domain/assembler/SpotlightAssembler.java +44 -0
- src/main/java/com/artandscience/webbff/webbff/domain/constants/HomepageConstants.java +3 -0
- src/main/java/com/artandscience/webbff/webbff/domain/model/SpotlightDto.java +15 -0
- src/main/java/com/artandscience/webbff/webbff/domain/model/buttonModel/ButtonModel.java +3 -1
- src/main/java/com/artandscience/webbff/webbff/domain/model/buttonModel/ButtonModelList.java +17 -0
- src/main/java/com/artandscience/webbff/webbff/domain/model/buttonModel/ButtonType.java +2 -1
- src/main/java/com/artandscience/webbff/webbff/domain/model/buttonModel/HtmlType.java +2 -1
- src/main/java/com/artandscience/webbff/webbff/domain/service/impl/HomepageServiceImpl.java +15 -73
- src/main/resources/application.yml +2 -0
src/main/java/com/artandscience/webbff/webbff/common/constants/ButtonTypeConstants.java
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.common.constants;
|
| 2 |
+
|
| 3 |
+
import lombok.extern.slf4j.Slf4j;
|
| 4 |
+
|
| 5 |
+
@Slf4j
|
| 6 |
+
public class ButtonTypeConstants {
|
| 7 |
+
|
| 8 |
+
public static final String PRIMARY_VIOLET = "PV";
|
| 9 |
+
public static final String SECONDARY = "SE";
|
| 10 |
+
public static final String OUTLINE_VIOLET = "OV";
|
| 11 |
+
public static final String GHOST = "G";
|
| 12 |
+
public static final String DANGER = "D";
|
| 13 |
+
public static final String SUCCESS = "S";
|
| 14 |
+
public static final String LINK = "L";
|
| 15 |
+
public static final String OUTLINE_SLATE = "OS";
|
| 16 |
+
public static final String TEXT_VIOLET = "TV";
|
| 17 |
+
public static final String PRIMARY_TEAL = "PT";
|
| 18 |
+
|
| 19 |
+
private ButtonTypeConstants() {
|
| 20 |
+
log.error("ButtonTypeConstants case create instance");
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
}
|
src/main/java/com/artandscience/webbff/webbff/common/constants/HtmlTypeConstants.java
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.common.constants;
|
| 2 |
+
|
| 3 |
+
import lombok.extern.slf4j.Slf4j;
|
| 4 |
+
|
| 5 |
+
@Slf4j
|
| 6 |
+
public class HtmlTypeConstants {
|
| 7 |
+
|
| 8 |
+
public static final String BUTTON = "B";
|
| 9 |
+
public static final String RESET = "R";
|
| 10 |
+
public static final String SUBMIT = "S";
|
| 11 |
+
|
| 12 |
+
private HtmlTypeConstants() {
|
| 13 |
+
log.error("HtmlTypeConstants case create instance");
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
}
|
src/main/java/com/artandscience/webbff/webbff/common/service/ExternalAttributeService.java
CHANGED
|
@@ -2,10 +2,12 @@ package com.artandscience.webbff.webbff.common.service;
|
|
| 2 |
|
| 3 |
import com.artandscience.webbff.webbff.common.base.model.MessageModel;
|
| 4 |
import com.artandscience.webbff.webbff.common.base.response.MessageBox;
|
|
|
|
| 5 |
|
| 6 |
public interface ExternalAttributeService {
|
| 7 |
|
| 8 |
String getResource(String resourceKey, String... parameters);
|
| 9 |
MessageBox getMessageBox(MessageModel messageModel, String... parameters);
|
| 10 |
-
|
|
|
|
| 11 |
}
|
|
|
|
| 2 |
|
| 3 |
import com.artandscience.webbff.webbff.common.base.model.MessageModel;
|
| 4 |
import com.artandscience.webbff.webbff.common.base.response.MessageBox;
|
| 5 |
+
import com.artandscience.webbff.webbff.domain.model.buttonModel.ButtonModelList;
|
| 6 |
|
| 7 |
public interface ExternalAttributeService {
|
| 8 |
|
| 9 |
String getResource(String resourceKey, String... parameters);
|
| 10 |
MessageBox getMessageBox(MessageModel messageModel, String... parameters);
|
| 11 |
+
ButtonModelList getButtonModelList(String buttonCode);
|
| 12 |
+
String getConfigModel(String modelCode, String... parameters);
|
| 13 |
}
|
src/main/java/com/artandscience/webbff/webbff/common/service/MainButtonService.java
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.common.service;
|
| 2 |
+
|
| 3 |
+
import com.artandscience.webbff.webbff.domain.model.buttonModel.ButtonModelList;
|
| 4 |
+
|
| 5 |
+
import java.util.List;
|
| 6 |
+
|
| 7 |
+
public interface MainButtonService {
|
| 8 |
+
|
| 9 |
+
ButtonModelList getButtonModelList(String buttonCode);
|
| 10 |
+
|
| 11 |
+
}
|
src/main/java/com/artandscience/webbff/webbff/common/service/ModelConfigService.java
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.common.service;
|
| 2 |
+
|
| 3 |
+
public interface ModelConfigService {
|
| 4 |
+
String getModelConfig(String modelCode);
|
| 5 |
+
}
|
src/main/java/com/artandscience/webbff/webbff/common/service/impl/ExternalAttributeServiceImpl.java
CHANGED
|
@@ -4,9 +4,8 @@ import com.artandscience.webbff.webbff.common.base.model.MessageModel;
|
|
| 4 |
import com.artandscience.webbff.webbff.common.base.model.RequestHeader;
|
| 5 |
import com.artandscience.webbff.webbff.common.base.response.MessageBox;
|
| 6 |
import com.artandscience.webbff.webbff.common.scope.RequestHeaderScope;
|
| 7 |
-
import com.artandscience.webbff.webbff.common.service.
|
| 8 |
-
import com.artandscience.webbff.webbff.
|
| 9 |
-
import com.artandscience.webbff.webbff.common.service.ResourceService;
|
| 10 |
import lombok.RequiredArgsConstructor;
|
| 11 |
import lombok.extern.slf4j.Slf4j;
|
| 12 |
import org.springframework.stereotype.Service;
|
|
@@ -19,6 +18,8 @@ public class ExternalAttributeServiceImpl implements ExternalAttributeService {
|
|
| 19 |
private final RequestHeaderScope requestHeaderScope;
|
| 20 |
private final MessageBoxService messageBoxService;
|
| 21 |
private final ResourceService resourceService;
|
|
|
|
|
|
|
| 22 |
|
| 23 |
@Override
|
| 24 |
public String getResource(String resourceKey, String... parameters) {
|
|
@@ -61,6 +62,34 @@ public class ExternalAttributeServiceImpl implements ExternalAttributeService {
|
|
| 61 |
}
|
| 62 |
}
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
private MessageBox getDefaultMessageBox() {
|
| 65 |
return null; //TODO: yazılacak
|
| 66 |
}
|
|
|
|
| 4 |
import com.artandscience.webbff.webbff.common.base.model.RequestHeader;
|
| 5 |
import com.artandscience.webbff.webbff.common.base.response.MessageBox;
|
| 6 |
import com.artandscience.webbff.webbff.common.scope.RequestHeaderScope;
|
| 7 |
+
import com.artandscience.webbff.webbff.common.service.*;
|
| 8 |
+
import com.artandscience.webbff.webbff.domain.model.buttonModel.ButtonModelList;
|
|
|
|
| 9 |
import lombok.RequiredArgsConstructor;
|
| 10 |
import lombok.extern.slf4j.Slf4j;
|
| 11 |
import org.springframework.stereotype.Service;
|
|
|
|
| 18 |
private final RequestHeaderScope requestHeaderScope;
|
| 19 |
private final MessageBoxService messageBoxService;
|
| 20 |
private final ResourceService resourceService;
|
| 21 |
+
private final MainButtonService mainButtonService;
|
| 22 |
+
private final ModelConfigService modelConfigService;
|
| 23 |
|
| 24 |
@Override
|
| 25 |
public String getResource(String resourceKey, String... parameters) {
|
|
|
|
| 62 |
}
|
| 63 |
}
|
| 64 |
|
| 65 |
+
@Override
|
| 66 |
+
public ButtonModelList getButtonModelList(String buttonCode) {
|
| 67 |
+
try {
|
| 68 |
+
RequestHeader requestHeader = requestHeaderScope.getRequestHeader();
|
| 69 |
+
var buttonModelList = mainButtonService.getButtonModelList(buttonCode + "." + requestHeader.getLanguage().toLowerCase());
|
| 70 |
+
if (buttonModelList != null) {
|
| 71 |
+
return buttonModelList;
|
| 72 |
+
}
|
| 73 |
+
}catch (Exception e) {
|
| 74 |
+
log.error("ExternalAttributeServiceImpl getButtonModelList() exception occurred for : " + buttonCode, e);
|
| 75 |
+
}
|
| 76 |
+
return ButtonModelList.builder().build();
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
@Override
|
| 80 |
+
public String getConfigModel(String modelCode, String... parameters) {
|
| 81 |
+
try {
|
| 82 |
+
var jsonModel = modelConfigService.getModelConfig(modelCode);
|
| 83 |
+
if (jsonModel != null && parameters != null && parameters.length != 0) {
|
| 84 |
+
return String.format(jsonModel,parameters);
|
| 85 |
+
}
|
| 86 |
+
return jsonModel;
|
| 87 |
+
} catch (Exception e) {
|
| 88 |
+
log.error("ExternalAttributeServiceImpl getConfigModel() exception occurred for : " + modelCode, e);
|
| 89 |
+
return "";
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
private MessageBox getDefaultMessageBox() {
|
| 94 |
return null; //TODO: yazılacak
|
| 95 |
}
|
src/main/java/com/artandscience/webbff/webbff/common/service/impl/MainButtonServiceImpl.java
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.common.service.impl;
|
| 2 |
+
|
| 3 |
+
import com.artandscience.webbff.webbff.common.service.MainButtonService;
|
| 4 |
+
import com.artandscience.webbff.webbff.dao.entity.Button;
|
| 5 |
+
import com.artandscience.webbff.webbff.dao.entity.MainButton;
|
| 6 |
+
import com.artandscience.webbff.webbff.dao.repository.MainButtonRepository;
|
| 7 |
+
import com.artandscience.webbff.webbff.domain.model.buttonModel.ButtonModel;
|
| 8 |
+
import com.artandscience.webbff.webbff.domain.model.buttonModel.ButtonModelList;
|
| 9 |
+
import lombok.RequiredArgsConstructor;
|
| 10 |
+
import lombok.extern.slf4j.Slf4j;
|
| 11 |
+
import org.springframework.cache.annotation.CacheEvict;
|
| 12 |
+
import org.springframework.cache.annotation.Cacheable;
|
| 13 |
+
import org.springframework.scheduling.annotation.Scheduled;
|
| 14 |
+
import org.springframework.stereotype.Service;
|
| 15 |
+
|
| 16 |
+
import java.util.Comparator;
|
| 17 |
+
import java.util.List;
|
| 18 |
+
import java.util.Optional;
|
| 19 |
+
|
| 20 |
+
@Slf4j
|
| 21 |
+
@Service
|
| 22 |
+
@RequiredArgsConstructor
|
| 23 |
+
public class MainButtonServiceImpl implements MainButtonService {
|
| 24 |
+
|
| 25 |
+
private static final String CACHE_NAME_BUTTON_MODEL = "artandsciencewebbff-buttonModel";
|
| 26 |
+
private final MainButtonRepository mainButtonRepository;
|
| 27 |
+
|
| 28 |
+
@Override
|
| 29 |
+
@Cacheable(cacheNames = CACHE_NAME_BUTTON_MODEL, key = "#buttonCode", unless = "#result == null")
|
| 30 |
+
public ButtonModelList getButtonModelList(String buttonCode) {
|
| 31 |
+
Optional<MainButton> optMainButton = mainButtonRepository.findById(String.format("%s",buttonCode));
|
| 32 |
+
if (optMainButton.isPresent()) {
|
| 33 |
+
List<Button> buttons = optMainButton.get().getButtonModels();
|
| 34 |
+
var buttonModels = buttons.stream()
|
| 35 |
+
.map(Button::getButtonModel)
|
| 36 |
+
.sorted(Comparator.comparing(ButtonModel::getOrderNo)).toList();
|
| 37 |
+
return ButtonModelList.builder()
|
| 38 |
+
.buttonModels(buttonModels)
|
| 39 |
+
.build();
|
| 40 |
+
}
|
| 41 |
+
return null;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
@Scheduled(cron = "${artandscience-web.buttonmodel-cache-expire-time}")
|
| 45 |
+
@CacheEvict(value = CACHE_NAME_BUTTON_MODEL, allEntries = true)
|
| 46 |
+
public void clearCache() {
|
| 47 |
+
log.debug("Cache '{}' cleared.", CACHE_NAME_BUTTON_MODEL);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
}
|
src/main/java/com/artandscience/webbff/webbff/common/service/impl/ModelConfigServiceImpl.java
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.common.service.impl;
|
| 2 |
+
|
| 3 |
+
import com.artandscience.webbff.webbff.common.service.ModelConfigService;
|
| 4 |
+
import com.artandscience.webbff.webbff.dao.entity.ModelConfig;
|
| 5 |
+
import com.artandscience.webbff.webbff.dao.repository.ModelConfigRepository;
|
| 6 |
+
import lombok.RequiredArgsConstructor;
|
| 7 |
+
import lombok.extern.slf4j.Slf4j;
|
| 8 |
+
import org.springframework.cache.annotation.CacheEvict;
|
| 9 |
+
import org.springframework.cache.annotation.Cacheable;
|
| 10 |
+
import org.springframework.scheduling.annotation.Scheduled;
|
| 11 |
+
import org.springframework.stereotype.Service;
|
| 12 |
+
|
| 13 |
+
import java.util.Optional;
|
| 14 |
+
|
| 15 |
+
@Slf4j
|
| 16 |
+
@Service
|
| 17 |
+
@RequiredArgsConstructor
|
| 18 |
+
public class ModelConfigServiceImpl implements ModelConfigService {
|
| 19 |
+
|
| 20 |
+
private static final String CACHE_NAME_CONFIG_MODEL = "artandsciencewebbff-configModel";
|
| 21 |
+
private final ModelConfigRepository modelConfigRepository;
|
| 22 |
+
|
| 23 |
+
@Override
|
| 24 |
+
@Cacheable(cacheNames = CACHE_NAME_CONFIG_MODEL, key = "#modelCode", unless = "#result == null")
|
| 25 |
+
public String getModelConfig(String modelCode) {
|
| 26 |
+
try {
|
| 27 |
+
Optional<ModelConfig> optModelConfig = modelConfigRepository.findById(String.format("%s", modelCode));
|
| 28 |
+
if (optModelConfig.isPresent()) {
|
| 29 |
+
ModelConfig modelConfig = optModelConfig.get();
|
| 30 |
+
return modelConfig.getJsonDetail();
|
| 31 |
+
}
|
| 32 |
+
log.info("ModelConfigService modelCode not found " + modelCode);
|
| 33 |
+
return null;
|
| 34 |
+
} catch (Exception e) {
|
| 35 |
+
log.error("ModelConfigService - getModelConfig - exception" + e.getMessage() + " Model Code: " + modelCode, e);
|
| 36 |
+
return null;
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
@Scheduled(cron = "${artandscience-web.configmodel-cache-expire-time}")
|
| 41 |
+
@CacheEvict(value = CACHE_NAME_CONFIG_MODEL, allEntries = true)
|
| 42 |
+
public void clearCache() {
|
| 43 |
+
log.debug("Cache '{}' cleared.", CACHE_NAME_CONFIG_MODEL);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
}
|
src/main/java/com/artandscience/webbff/webbff/dao/entity/Button.java
CHANGED
|
@@ -1,5 +1,9 @@
|
|
| 1 |
package com.artandscience.webbff.webbff.dao.entity;
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import jakarta.persistence.Column;
|
| 4 |
import jakarta.persistence.Entity;
|
| 5 |
import jakarta.persistence.Id;
|
|
@@ -8,6 +12,8 @@ import lombok.AllArgsConstructor;
|
|
| 8 |
import lombok.Data;
|
| 9 |
import lombok.NoArgsConstructor;
|
| 10 |
|
|
|
|
|
|
|
| 11 |
@AllArgsConstructor
|
| 12 |
@NoArgsConstructor
|
| 13 |
@Data
|
|
@@ -19,10 +25,45 @@ public class Button {
|
|
| 19 |
@Column(name = "key")
|
| 20 |
private String key;
|
| 21 |
|
| 22 |
-
private String
|
| 23 |
private Boolean isDisabled;
|
| 24 |
private String buttonType;
|
| 25 |
private String htmlType;
|
| 26 |
-
private
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
}
|
|
|
|
| 1 |
package com.artandscience.webbff.webbff.dao.entity;
|
| 2 |
|
| 3 |
+
import com.artandscience.webbff.webbff.common.constants.HtmlTypeConstants;
|
| 4 |
+
import com.artandscience.webbff.webbff.domain.model.buttonModel.ButtonModel;
|
| 5 |
+
import com.artandscience.webbff.webbff.domain.model.buttonModel.ButtonType;
|
| 6 |
+
import com.artandscience.webbff.webbff.domain.model.buttonModel.HtmlType;
|
| 7 |
import jakarta.persistence.Column;
|
| 8 |
import jakarta.persistence.Entity;
|
| 9 |
import jakarta.persistence.Id;
|
|
|
|
| 12 |
import lombok.Data;
|
| 13 |
import lombok.NoArgsConstructor;
|
| 14 |
|
| 15 |
+
import com.artandscience.webbff.webbff.common.constants.ButtonTypeConstants;
|
| 16 |
+
|
| 17 |
@AllArgsConstructor
|
| 18 |
@NoArgsConstructor
|
| 19 |
@Data
|
|
|
|
| 25 |
@Column(name = "key")
|
| 26 |
private String key;
|
| 27 |
|
| 28 |
+
private String text;
|
| 29 |
private Boolean isDisabled;
|
| 30 |
private String buttonType;
|
| 31 |
private String htmlType;
|
| 32 |
+
private int orderNo;
|
| 33 |
+
|
| 34 |
+
public static ButtonModel getButtonModel(Button button) {
|
| 35 |
+
return ButtonModel.builder()
|
| 36 |
+
.buttonType(getButtonType(button.getButtonType()))
|
| 37 |
+
.htmlType(getHtmlType(button.getHtmlType()))
|
| 38 |
+
.text(button.getText())
|
| 39 |
+
.isDisabled(button.getIsDisabled())
|
| 40 |
+
.orderNo(button.getOrderNo())
|
| 41 |
+
.build();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
private static ButtonType getButtonType(String buttonType) {
|
| 45 |
+
return switch (buttonType) {
|
| 46 |
+
case ButtonTypeConstants.PRIMARY_VIOLET -> ButtonType.PRIMARY_VIOLET;
|
| 47 |
+
case ButtonTypeConstants.SECONDARY -> ButtonType.SECONDARY;
|
| 48 |
+
case ButtonTypeConstants.OUTLINE_VIOLET -> ButtonType.OUTLINE_VIOLET;
|
| 49 |
+
case ButtonTypeConstants.GHOST -> ButtonType.GHOST;
|
| 50 |
+
case ButtonTypeConstants.DANGER -> ButtonType.DANGER;
|
| 51 |
+
case ButtonTypeConstants.SUCCESS -> ButtonType.SUCCESS;
|
| 52 |
+
case ButtonTypeConstants.LINK -> ButtonType.LINK;
|
| 53 |
+
case ButtonTypeConstants.OUTLINE_SLATE -> ButtonType.OUTLINE_SLATE;
|
| 54 |
+
case ButtonTypeConstants.TEXT_VIOLET -> ButtonType.TEXT_VIOLET;
|
| 55 |
+
case ButtonTypeConstants.PRIMARY_TEAL -> ButtonType.PRIMARY_TEAL;
|
| 56 |
+
default -> ButtonType.NONE;
|
| 57 |
+
};
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
private static String getHtmlType(String htmlType) {
|
| 61 |
+
return switch (htmlType) {
|
| 62 |
+
case HtmlTypeConstants.BUTTON -> HtmlType.BUTTON.getValue();
|
| 63 |
+
case HtmlTypeConstants.RESET -> HtmlType.RESET.getValue();
|
| 64 |
+
case HtmlTypeConstants.SUBMIT -> HtmlType.SUBMIT.getValue();
|
| 65 |
+
default -> HtmlType.NONE.getValue();
|
| 66 |
+
};
|
| 67 |
+
}
|
| 68 |
|
| 69 |
}
|
src/main/java/com/artandscience/webbff/webbff/domain/assembler/SpotlightAssembler.java
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.domain.assembler;
|
| 2 |
+
|
| 3 |
+
import com.artandscience.webbff.webbff.common.service.ExternalAttributeService;
|
| 4 |
+
import com.artandscience.webbff.webbff.domain.model.SpotlightDto;
|
| 5 |
+
import com.artandscience.webbff.webbff.domain.model.contentModel.SpotlightModel;
|
| 6 |
+
import com.fasterxml.jackson.core.JsonProcessingException;
|
| 7 |
+
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 8 |
+
import lombok.RequiredArgsConstructor;
|
| 9 |
+
import lombok.extern.slf4j.Slf4j;
|
| 10 |
+
import org.springframework.stereotype.Component;
|
| 11 |
+
|
| 12 |
+
import java.util.ArrayList;
|
| 13 |
+
import java.util.List;
|
| 14 |
+
import java.util.UUID;
|
| 15 |
+
|
| 16 |
+
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.SpotlightsKey;
|
| 17 |
+
|
| 18 |
+
@Component
|
| 19 |
+
@RequiredArgsConstructor
|
| 20 |
+
@Slf4j
|
| 21 |
+
public class SpotlightAssembler {
|
| 22 |
+
|
| 23 |
+
private final ExternalAttributeService externalAttributeService;
|
| 24 |
+
private final ObjectMapper objectMapper;
|
| 25 |
+
|
| 26 |
+
public List<SpotlightModel> assemble() {
|
| 27 |
+
try {
|
| 28 |
+
return objectMapper.readValue(externalAttributeService.getConfigModel(SpotlightsKey),
|
| 29 |
+
SpotlightDto.class).getSpotlight().stream()
|
| 30 |
+
.peek(spotlightModel -> {
|
| 31 |
+
spotlightModel.setModelUid(UUID.randomUUID().toString());
|
| 32 |
+
spotlightModel.setTitle(externalAttributeService.getResource(spotlightModel.getTitle()));
|
| 33 |
+
spotlightModel.setDesc(externalAttributeService.getResource(spotlightModel.getDesc()));
|
| 34 |
+
spotlightModel.setButtonModel(externalAttributeService
|
| 35 |
+
.getButtonModelList(spotlightModel.getButtonModel().getText()).getButtonModels().get(0));
|
| 36 |
+
}).toList();
|
| 37 |
+
|
| 38 |
+
} catch (JsonProcessingException e) {
|
| 39 |
+
log.error("An error is occurrence: Error: {}",e.getMessage());
|
| 40 |
+
}
|
| 41 |
+
return new ArrayList<>();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
}
|
src/main/java/com/artandscience/webbff/webbff/domain/constants/HomepageConstants.java
CHANGED
|
@@ -25,6 +25,9 @@ public abstract class HomepageConstants {
|
|
| 25 |
public static final String ActivityImageUrl = "/lab.jpg";
|
| 26 |
public static final String ActivityImageTitleKey = "ActivityImageTitle";
|
| 27 |
public static final String ActivityButtonTitleKey = "ActivityButtonTitle";
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
}
|
|
|
|
| 25 |
public static final String ActivityImageUrl = "/lab.jpg";
|
| 26 |
public static final String ActivityImageTitleKey = "ActivityImageTitle";
|
| 27 |
public static final String ActivityButtonTitleKey = "ActivityButtonTitle";
|
| 28 |
+
public static final String LeftHeroButtonsKey = "LeftHeroButtons";
|
| 29 |
+
public static final String ActivityButtonKey = "ActivityButton";
|
| 30 |
+
public static final String SpotlightsKey = "Spotlights";
|
| 31 |
|
| 32 |
|
| 33 |
}
|
src/main/java/com/artandscience/webbff/webbff/domain/model/SpotlightDto.java
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.domain.model;
|
| 2 |
+
|
| 3 |
+
import com.artandscience.webbff.webbff.domain.model.contentModel.SpotlightModel;
|
| 4 |
+
import lombok.AllArgsConstructor;
|
| 5 |
+
import lombok.Data;
|
| 6 |
+
import lombok.NoArgsConstructor;
|
| 7 |
+
|
| 8 |
+
import java.util.List;
|
| 9 |
+
|
| 10 |
+
@Data
|
| 11 |
+
@AllArgsConstructor
|
| 12 |
+
@NoArgsConstructor
|
| 13 |
+
public class SpotlightDto {
|
| 14 |
+
private List<SpotlightModel> spotlight;
|
| 15 |
+
}
|
src/main/java/com/artandscience/webbff/webbff/domain/model/buttonModel/ButtonModel.java
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
package com.artandscience.webbff.webbff.domain.model.buttonModel;
|
| 2 |
|
|
|
|
| 3 |
import lombok.AllArgsConstructor;
|
| 4 |
import lombok.Builder;
|
| 5 |
import lombok.Data;
|
|
@@ -9,11 +10,12 @@ import lombok.NoArgsConstructor;
|
|
| 9 |
@AllArgsConstructor
|
| 10 |
@NoArgsConstructor
|
| 11 |
@Builder
|
| 12 |
-
public class ButtonModel {
|
| 13 |
|
| 14 |
private String text;
|
| 15 |
private ButtonType buttonType;
|
| 16 |
private Boolean isDisabled;
|
| 17 |
private String htmlType;
|
|
|
|
| 18 |
|
| 19 |
}
|
|
|
|
| 1 |
package com.artandscience.webbff.webbff.domain.model.buttonModel;
|
| 2 |
|
| 3 |
+
import com.artandscience.webbff.webbff.common.base.model.BaseModel;
|
| 4 |
import lombok.AllArgsConstructor;
|
| 5 |
import lombok.Builder;
|
| 6 |
import lombok.Data;
|
|
|
|
| 10 |
@AllArgsConstructor
|
| 11 |
@NoArgsConstructor
|
| 12 |
@Builder
|
| 13 |
+
public class ButtonModel extends BaseModel {
|
| 14 |
|
| 15 |
private String text;
|
| 16 |
private ButtonType buttonType;
|
| 17 |
private Boolean isDisabled;
|
| 18 |
private String htmlType;
|
| 19 |
+
private int orderNo;
|
| 20 |
|
| 21 |
}
|
src/main/java/com/artandscience/webbff/webbff/domain/model/buttonModel/ButtonModelList.java
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.domain.model.buttonModel;
|
| 2 |
+
|
| 3 |
+
import com.artandscience.webbff.webbff.common.base.model.BaseModel;
|
| 4 |
+
import lombok.AllArgsConstructor;
|
| 5 |
+
import lombok.Builder;
|
| 6 |
+
import lombok.Data;
|
| 7 |
+
import lombok.NoArgsConstructor;
|
| 8 |
+
|
| 9 |
+
import java.util.List;
|
| 10 |
+
|
| 11 |
+
@Data
|
| 12 |
+
@AllArgsConstructor
|
| 13 |
+
@NoArgsConstructor
|
| 14 |
+
@Builder
|
| 15 |
+
public class ButtonModelList extends BaseModel {
|
| 16 |
+
private List<ButtonModel> buttonModels;
|
| 17 |
+
}
|
src/main/java/com/artandscience/webbff/webbff/domain/model/buttonModel/ButtonType.java
CHANGED
|
@@ -10,5 +10,6 @@ public enum ButtonType {
|
|
| 10 |
LINK,
|
| 11 |
OUTLINE_SLATE,
|
| 12 |
TEXT_VIOLET,
|
| 13 |
-
PRIMARY_TEAL
|
|
|
|
| 14 |
}
|
|
|
|
| 10 |
LINK,
|
| 11 |
OUTLINE_SLATE,
|
| 12 |
TEXT_VIOLET,
|
| 13 |
+
PRIMARY_TEAL,
|
| 14 |
+
NONE
|
| 15 |
}
|
src/main/java/com/artandscience/webbff/webbff/domain/model/buttonModel/HtmlType.java
CHANGED
|
@@ -7,7 +7,8 @@ public enum HtmlType {
|
|
| 7 |
|
| 8 |
BUTTON("button"),
|
| 9 |
RESET("reset"),
|
| 10 |
-
SUBMIT("submit")
|
|
|
|
| 11 |
|
| 12 |
private String value;
|
| 13 |
HtmlType(String value) {
|
|
|
|
| 7 |
|
| 8 |
BUTTON("button"),
|
| 9 |
RESET("reset"),
|
| 10 |
+
SUBMIT("submit"),
|
| 11 |
+
NONE("NONE");
|
| 12 |
|
| 13 |
private String value;
|
| 14 |
HtmlType(String value) {
|
src/main/java/com/artandscience/webbff/webbff/domain/service/impl/HomepageServiceImpl.java
CHANGED
|
@@ -1,132 +1,74 @@
|
|
| 1 |
package com.artandscience.webbff.webbff.domain.service.impl;
|
| 2 |
|
| 3 |
import com.artandscience.webbff.webbff.common.service.ExternalAttributeService;
|
|
|
|
| 4 |
import com.artandscience.webbff.webbff.domain.mapper.SlideModelMapper;
|
| 5 |
-
import com.artandscience.webbff.webbff.domain.model.buttonModel.ButtonModel;
|
| 6 |
-
import com.artandscience.webbff.webbff.domain.model.buttonModel.ButtonType;
|
| 7 |
-
import com.artandscience.webbff.webbff.domain.model.buttonModel.HtmlType;
|
| 8 |
import com.artandscience.webbff.webbff.domain.model.contentModel.ContentModel;
|
| 9 |
import com.artandscience.webbff.webbff.domain.model.contentModel.PromoCardModel;
|
| 10 |
-
import com.artandscience.webbff.webbff.domain.model.contentModel.SpotlightModel;
|
| 11 |
import com.artandscience.webbff.webbff.domain.model.heroModel.*;
|
| 12 |
import com.artandscience.webbff.webbff.domain.model.output.GetHomepageOutput;
|
| 13 |
import com.artandscience.webbff.webbff.domain.service.HomepageService;
|
| 14 |
import com.artandscience.webbff.webbff.domain.utils.SessionStartUtil;
|
| 15 |
import lombok.RequiredArgsConstructor;
|
|
|
|
| 16 |
import org.springframework.stereotype.Service;
|
| 17 |
|
| 18 |
-
import java.util.List;
|
| 19 |
import java.util.UUID;
|
| 20 |
|
| 21 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.LeftTitleKey;
|
| 22 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.RightTitleKey;
|
| 23 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.DescriptionKey;
|
| 24 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.CampaignExamineKey;
|
| 25 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.StartExploringKey;
|
| 26 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ContentHeaderKey;
|
| 27 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ContentSubHeaderKey;
|
| 28 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.SelfArtDesignTitleKey;
|
| 29 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.SelfArtDesignDescriptionKey;
|
| 30 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.BioDesignTitleKey;
|
| 31 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.BioDesignDescriptionKey;
|
| 32 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ImmersiveSpacesTitleKey;
|
| 33 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ImmersiveSpacesDescriptionKey;
|
| 34 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.SpotlightDetailKey;
|
| 35 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.SpotlightIconsKey;
|
| 36 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ActivityTitleKey;
|
| 37 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ActivityDescriptionKey;
|
| 38 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ActivityImageUrl;
|
| 39 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ActivityImageTitleKey;
|
| 40 |
-
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.
|
| 41 |
-
|
| 42 |
-
|
| 43 |
|
| 44 |
@Service
|
| 45 |
@RequiredArgsConstructor
|
|
|
|
| 46 |
public class HomepageServiceImpl implements HomepageService {
|
| 47 |
|
| 48 |
private final ExternalAttributeService externalAttributeService;
|
| 49 |
private final SessionStartUtil sessionStartUtil;
|
|
|
|
| 50 |
|
| 51 |
@Override
|
| 52 |
public GetHomepageOutput getHomepage() {
|
| 53 |
|
| 54 |
-
String[] spotlightIcons = externalAttributeService.
|
| 55 |
-
getResource(SpotlightIconsKey).split(";");
|
| 56 |
-
|
| 57 |
-
var spotlightDetail = ButtonModel.builder()
|
| 58 |
-
.buttonType(ButtonType.TEXT_VIOLET)
|
| 59 |
-
.isDisabled(Boolean.FALSE)
|
| 60 |
-
.htmlType(HtmlType.BUTTON.getValue())
|
| 61 |
-
.text(externalAttributeService.getResource(SpotlightDetailKey))
|
| 62 |
-
.build();
|
| 63 |
-
|
| 64 |
return GetHomepageOutput.builder()
|
| 65 |
.heroBanner(HeroModel.builder()
|
| 66 |
.leftHero(
|
| 67 |
LeftHeroModel.builder()
|
| 68 |
.title(TitleModel.builder()
|
| 69 |
.leftTitle(externalAttributeService.getResource(LeftTitleKey))
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
.
|
| 74 |
-
.text(externalAttributeService.getResource(StartExploringKey))
|
| 75 |
-
.htmlType(HtmlType.BUTTON.getValue())
|
| 76 |
-
.buttonType(ButtonType.OUTLINE_SLATE)
|
| 77 |
-
.isDisabled(Boolean.FALSE)
|
| 78 |
-
.build(),
|
| 79 |
-
ButtonModel.builder()
|
| 80 |
-
.text(externalAttributeService.getResource(CampaignExamineKey))
|
| 81 |
-
.htmlType(HtmlType.BUTTON.getValue())
|
| 82 |
-
.buttonType(ButtonType.PRIMARY_VIOLET)
|
| 83 |
-
.isDisabled(Boolean.FALSE)
|
| 84 |
-
.build()
|
| 85 |
-
))
|
| 86 |
-
.build())
|
| 87 |
.rightHero(RightHeroModel.builder()
|
| 88 |
.heroSlides(SlideModelMapper.campaignModelListToSlideModelList(sessionStartUtil
|
| 89 |
-
|
| 90 |
.build())
|
| 91 |
.build())
|
| 92 |
.contentModel(ContentModel.builder()
|
| 93 |
.header(externalAttributeService.getResource(ContentHeaderKey))
|
| 94 |
.subHeader(externalAttributeService.getResource(ContentSubHeaderKey))
|
| 95 |
-
.spotlight(
|
| 96 |
-
.modelUid(UUID.randomUUID().toString())
|
| 97 |
-
.title(externalAttributeService.getResource(SelfArtDesignTitleKey))
|
| 98 |
-
.desc(externalAttributeService.getResource(SelfArtDesignDescriptionKey))
|
| 99 |
-
.icon(spotlightIcons[0])
|
| 100 |
-
.buttonModel(spotlightDetail)
|
| 101 |
-
.build(),
|
| 102 |
-
SpotlightModel.builder()
|
| 103 |
-
.modelUid(UUID.randomUUID().toString())
|
| 104 |
-
.title(externalAttributeService.getResource(BioDesignTitleKey))
|
| 105 |
-
.desc(externalAttributeService.getResource(BioDesignDescriptionKey))
|
| 106 |
-
.icon(spotlightIcons[1])
|
| 107 |
-
.buttonModel(spotlightDetail)
|
| 108 |
-
.build(),
|
| 109 |
-
SpotlightModel.builder()
|
| 110 |
-
.modelUid(UUID.randomUUID().toString())
|
| 111 |
-
.title(externalAttributeService.getResource(ImmersiveSpacesTitleKey))
|
| 112 |
-
.desc(externalAttributeService.getResource(ImmersiveSpacesDescriptionKey))
|
| 113 |
-
.icon(spotlightIcons[2])
|
| 114 |
-
.buttonModel(spotlightDetail)
|
| 115 |
-
.build()))
|
| 116 |
.promoCardModel(PromoCardModel.builder()
|
| 117 |
.modelUid(UUID.randomUUID().toString())
|
| 118 |
.title(externalAttributeService.getResource(ActivityTitleKey))
|
| 119 |
.desc(externalAttributeService.getResource(ActivityDescriptionKey))
|
| 120 |
.imageTitle(externalAttributeService.getResource(ActivityImageTitleKey))
|
| 121 |
.imageUrl(ActivityImageUrl)
|
| 122 |
-
.buttonModel(
|
| 123 |
-
.
|
| 124 |
-
.buttonType(ButtonType.PRIMARY_TEAL)
|
| 125 |
-
.htmlType(HtmlType.BUTTON.getValue())
|
| 126 |
-
.isDisabled(Boolean.FALSE)
|
| 127 |
-
.build())
|
| 128 |
.build())
|
| 129 |
.build())
|
| 130 |
.build();
|
| 131 |
}
|
|
|
|
| 132 |
}
|
|
|
|
| 1 |
package com.artandscience.webbff.webbff.domain.service.impl;
|
| 2 |
|
| 3 |
import com.artandscience.webbff.webbff.common.service.ExternalAttributeService;
|
| 4 |
+
import com.artandscience.webbff.webbff.domain.assembler.SpotlightAssembler;
|
| 5 |
import com.artandscience.webbff.webbff.domain.mapper.SlideModelMapper;
|
|
|
|
|
|
|
|
|
|
| 6 |
import com.artandscience.webbff.webbff.domain.model.contentModel.ContentModel;
|
| 7 |
import com.artandscience.webbff.webbff.domain.model.contentModel.PromoCardModel;
|
|
|
|
| 8 |
import com.artandscience.webbff.webbff.domain.model.heroModel.*;
|
| 9 |
import com.artandscience.webbff.webbff.domain.model.output.GetHomepageOutput;
|
| 10 |
import com.artandscience.webbff.webbff.domain.service.HomepageService;
|
| 11 |
import com.artandscience.webbff.webbff.domain.utils.SessionStartUtil;
|
| 12 |
import lombok.RequiredArgsConstructor;
|
| 13 |
+
import lombok.extern.slf4j.Slf4j;
|
| 14 |
import org.springframework.stereotype.Service;
|
| 15 |
|
|
|
|
| 16 |
import java.util.UUID;
|
| 17 |
|
| 18 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.LeftTitleKey;
|
| 19 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.RightTitleKey;
|
| 20 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.DescriptionKey;
|
|
|
|
|
|
|
| 21 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ContentHeaderKey;
|
| 22 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ContentSubHeaderKey;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ActivityTitleKey;
|
| 24 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ActivityDescriptionKey;
|
| 25 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ActivityImageUrl;
|
| 26 |
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ActivityImageTitleKey;
|
| 27 |
+
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.LeftHeroButtonsKey;
|
| 28 |
+
import static com.artandscience.webbff.webbff.domain.constants.HomepageConstants.ActivityButtonKey;
|
|
|
|
| 29 |
|
| 30 |
@Service
|
| 31 |
@RequiredArgsConstructor
|
| 32 |
+
@Slf4j
|
| 33 |
public class HomepageServiceImpl implements HomepageService {
|
| 34 |
|
| 35 |
private final ExternalAttributeService externalAttributeService;
|
| 36 |
private final SessionStartUtil sessionStartUtil;
|
| 37 |
+
private final SpotlightAssembler spotlightAssembler;
|
| 38 |
|
| 39 |
@Override
|
| 40 |
public GetHomepageOutput getHomepage() {
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
return GetHomepageOutput.builder()
|
| 43 |
.heroBanner(HeroModel.builder()
|
| 44 |
.leftHero(
|
| 45 |
LeftHeroModel.builder()
|
| 46 |
.title(TitleModel.builder()
|
| 47 |
.leftTitle(externalAttributeService.getResource(LeftTitleKey))
|
| 48 |
+
.rightTitle(externalAttributeService.getResource(RightTitleKey)).build())
|
| 49 |
+
.description(externalAttributeService.getResource(DescriptionKey))
|
| 50 |
+
.buttons(externalAttributeService.getButtonModelList(LeftHeroButtonsKey)
|
| 51 |
+
.getButtonModels()).build())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
.rightHero(RightHeroModel.builder()
|
| 53 |
.heroSlides(SlideModelMapper.campaignModelListToSlideModelList(sessionStartUtil
|
| 54 |
+
.sessionStart(Boolean.TRUE).getCampaignModels()))
|
| 55 |
.build())
|
| 56 |
.build())
|
| 57 |
.contentModel(ContentModel.builder()
|
| 58 |
.header(externalAttributeService.getResource(ContentHeaderKey))
|
| 59 |
.subHeader(externalAttributeService.getResource(ContentSubHeaderKey))
|
| 60 |
+
.spotlight(spotlightAssembler.assemble())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
.promoCardModel(PromoCardModel.builder()
|
| 62 |
.modelUid(UUID.randomUUID().toString())
|
| 63 |
.title(externalAttributeService.getResource(ActivityTitleKey))
|
| 64 |
.desc(externalAttributeService.getResource(ActivityDescriptionKey))
|
| 65 |
.imageTitle(externalAttributeService.getResource(ActivityImageTitleKey))
|
| 66 |
.imageUrl(ActivityImageUrl)
|
| 67 |
+
.buttonModel(externalAttributeService
|
| 68 |
+
.getButtonModelList(ActivityButtonKey).getButtonModels().get(0))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
.build())
|
| 70 |
.build())
|
| 71 |
.build();
|
| 72 |
}
|
| 73 |
+
|
| 74 |
}
|
src/main/resources/application.yml
CHANGED
|
@@ -33,6 +33,8 @@ spring:
|
|
| 33 |
artandscience-web:
|
| 34 |
messagebox-cache-expire-time: 0 0 3 * * *
|
| 35 |
resource-cache-expire-time: 0 0 3 * * *
|
|
|
|
|
|
|
| 36 |
|
| 37 |
server:
|
| 38 |
port: 9090
|
|
|
|
| 33 |
artandscience-web:
|
| 34 |
messagebox-cache-expire-time: 0 0 3 * * *
|
| 35 |
resource-cache-expire-time: 0 0 3 * * *
|
| 36 |
+
buttonmodel-cache-expire-time: 0 0 3 * * *
|
| 37 |
+
configmodel-cache-expire-time: 0 0 3 * * *
|
| 38 |
|
| 39 |
server:
|
| 40 |
port: 9090
|