Skip to content

Commit

Permalink
Adapted logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Nov 13, 2023
1 parent 9221032 commit 2150380
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Dependent;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
Expand All @@ -32,6 +33,7 @@
import de.cuioss.portal.configuration.PortalConfigurationKeys;
import de.cuioss.tools.logging.CuiLogger;
import de.cuioss.uimodel.application.CuiProjectStage;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
Expand Down Expand Up @@ -78,8 +80,8 @@ public class PortalProjectStageImpl implements Serializable {
public static final String BEAN_NAME = "cuiProjectStage";

@Produces
@ApplicationScoped
@Getter
@Dependent
@Getter(value = AccessLevel.PACKAGE)
private CuiProjectStage projectStage = ProjectStage.PRODUCTION;

@Inject
Expand All @@ -91,14 +93,11 @@ public class PortalProjectStageImpl implements Serializable {
*/
@PostConstruct
void initialize() {
initBean();
}

private void initBean() {
final var portalProjectStage = ProjectStage.fromString(portalStageConfigurationProvider.get());
projectStage = portalProjectStage;
final var configuredProjectStage = ProjectStage.fromString(portalStageConfigurationProvider.get());
LOGGER.debug("Read from configuration-system '%s'", configuredProjectStage);
projectStage = configuredProjectStage;

switch (portalProjectStage) {
switch (configuredProjectStage) {
case DEVELOPMENT:
LOGGER.warn(PROJECT_STAGE_XY_DETECTED, "development");
break;
Expand All @@ -125,7 +124,7 @@ void portalConfigurationChangeEventListener(
@Observes @PortalConfigurationChangeEvent final Map<String, String> deltaMap) {
if (deltaMap.containsKey(PortalConfigurationKeys.PORTAL_STAGE)) {
LOGGER.debug("Change in portal stage configuration found, reconfigure");
initBean();
initialize();
}
}
}

0 comments on commit 2150380

Please sign in to comment.