-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
104 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,6 +316,7 @@ public class ProjectManagerConst { | |
public final static String PROJECT_DEFAULT_EXPIRATION_TIME_IN_DAYS = "PROJECT_DEFAULT_EXPIRATION_TIME_IN_DAYS"; | ||
public final static String PROJECT_MANAGER_EMAIL_FROM = "PROJECT_MANAGER_EMAIL_FROM"; | ||
public final static String EMAIL_TEMPLATES_CONFIG = "EMAIL_TEMPLATES_CONFIG"; | ||
public final static String ACTION_EXPLANATION_CONFIG = "ACTION_EXPLANATION_CONFIG"; | ||
public final static String EMAIL_TEMPLATES_DIRECTORY = "EMAIL_TEMPLATES_DIRECTORY"; | ||
public final static String EXPORT_TEMPLATES = "EXPORT_TEMPLATES"; | ||
public final static String DATASHIELD_TEMPLATES = "DATASHIELD_TEMPLATES"; | ||
|
@@ -414,6 +415,7 @@ public class ProjectManagerConst { | |
public final static String PROJECT_MANAGER_EMAIL_FROM_SV = | ||
HEAD_SV + PROJECT_MANAGER_EMAIL_FROM + ":[email protected]" + BOTTOM_SV; | ||
public final static String EMAIL_TEMPLATES_CONFIG_SV = HEAD_SV + EMAIL_TEMPLATES_CONFIG + BOTTOM_SV; | ||
public final static String ACTION_EXPLANATION_CONFIG_SV = HEAD_SV + ACTION_EXPLANATION_CONFIG + BOTTOM_SV; | ||
public final static String EMAIL_TEMPLATES_DIRECTORY_SV = HEAD_SV + EMAIL_TEMPLATES_DIRECTORY + BOTTOM_SV; | ||
public final static String EXPORT_TEMPLATES_SV = HEAD_SV + EXPORT_TEMPLATES + BOTTOM_SV; | ||
public final static String DATASHIELD_TEMPLATES_SV = HEAD_SV + DATASHIELD_TEMPLATES + BOTTOM_SV; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package de.samply.frontend; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import de.samply.project.ProjectType; | ||
import de.samply.project.state.ProjectBridgeheadState; | ||
import de.samply.project.state.ProjectState; | ||
import de.samply.query.QueryState; | ||
import de.samply.user.roles.OrganisationRole; | ||
import de.samply.user.roles.ProjectRole; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.Map; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ActionExplanation { | ||
|
||
private String module; | ||
private String site; | ||
|
||
@JsonProperty(value = "project-role") | ||
private ProjectRole projectRole; | ||
@JsonProperty(value = "organisation-role") | ||
private OrganisationRole organisationRole; | ||
@JsonProperty(value = "project-type") | ||
private ProjectType projectType; | ||
@JsonProperty(value = "project-state") | ||
private ProjectState projectState; | ||
@JsonProperty(value = "project-bridgehead-state") | ||
private ProjectBridgeheadState projectBridgeheadState; | ||
@JsonProperty(value = "query-state") | ||
private QueryState queryState; | ||
|
||
@JsonProperty(value = "messages", required = true) | ||
private Map<String, String> languageMessageMap; | ||
|
||
} |
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,21 @@ | ||
package de.samply.frontend; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
@Data | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ActionExplanations { | ||
|
||
@JsonProperty("explanations") | ||
private Map<String, ActionExplanation> actionExplanationMap; | ||
|
||
public Optional<ActionExplanation> getActionExplanation(String action) { | ||
return Optional.ofNullable(actionExplanationMap.get(action)); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/de/samply/frontend/ActionExplanationsFactory.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,25 @@ | ||
package de.samply.frontend; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import de.samply.app.ProjectManagerConst; | ||
import de.samply.utils.Base64Utils; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Optional; | ||
|
||
@Component | ||
public class ActionExplanationsFactory { | ||
|
||
@Bean | ||
public ActionExplanations actionExplanations(@Value(ProjectManagerConst.ACTION_EXPLANATION_CONFIG_SV) String template) throws JsonProcessingException { | ||
Optional<String> decodedTemplates = Base64Utils.decodeIfNecessary(template); | ||
if (decodedTemplates.isEmpty()) { | ||
throw new RuntimeException("No action explanation config found"); | ||
} | ||
return new ObjectMapper().readValue(decodedTemplates.get(), ActionExplanations.class); | ||
} | ||
|
||
} |
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,9 @@ | ||
{ | ||
"explanations": { | ||
"CREATE_QUERY": { | ||
"messages": { | ||
"EN": "Please create the project" | ||
} | ||
} | ||
} | ||
} |