Skip to content
Snippets Groups Projects
Commit a7a2cd87 authored by Lukasz Lopatowski's avatar Lukasz Lopatowski
Browse files

Merge branch '1.6.4-merge' into 'release/1.6.4'

Create separate appState for domains

See merge request !40
parents 1ea50298 5f3bcabd
No related branches found
No related tags found
2 merge requests!41release/1.6.4 into 'develop',!40Create separate appState for domains
Pipeline #89971 passed
...@@ -18,6 +18,7 @@ import net.geant.nmaas.notifications.types.persistence.entity.FormType; ...@@ -18,6 +18,7 @@ import net.geant.nmaas.notifications.types.persistence.entity.FormType;
import net.geant.nmaas.notifications.types.service.FormTypeService; import net.geant.nmaas.notifications.types.service.FormTypeService;
import net.geant.nmaas.portal.api.configuration.ConfigurationView; import net.geant.nmaas.portal.api.configuration.ConfigurationView;
import net.geant.nmaas.portal.api.domain.UserView; import net.geant.nmaas.portal.api.domain.UserView;
import net.geant.nmaas.portal.api.domain.VlabAppListElement;
import net.geant.nmaas.portal.api.exception.MissingElementException; import net.geant.nmaas.portal.api.exception.MissingElementException;
import net.geant.nmaas.portal.api.exception.ProcessingException; import net.geant.nmaas.portal.api.exception.ProcessingException;
import net.geant.nmaas.portal.persistent.entity.Role; import net.geant.nmaas.portal.persistent.entity.Role;
...@@ -32,6 +33,8 @@ import org.springframework.ui.freemarker.FreeMarkerTemplateUtils; ...@@ -32,6 +33,8 @@ import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
...@@ -153,7 +156,15 @@ public class NotificationManager { ...@@ -153,7 +156,15 @@ public class NotificationManager {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
List<Object> datesList = objectMapper.convertValue(datesObject, new TypeReference<List<Object>>() {}); List<Object> datesList = objectMapper.convertValue(datesObject, new TypeReference<List<Object>>() {});
Map<String,Object> dates = objectMapper.convertValue(datesList.get(0), new TypeReference<Map<String, Object>>() {}); Map<String,Object> dates = objectMapper.convertValue(datesList.get(0), new TypeReference<Map<String, Object>>() {});
dates.forEach((k,v) -> mailAttributes.getOtherAttributes().put(k,v));
dates.forEach((k,v) -> {
OffsetDateTime offsetDateTime = OffsetDateTime.parse(v.toString());
mailAttributes.getOtherAttributes().put(k,offsetDateTime.format(DateTimeFormatter.ofPattern("dd.MM.yyyy")));
});
List<VlabAppListElement> appList = objectMapper.convertValue(mailAttributes.getOtherAttributes().get("appList"), new TypeReference<List<VlabAppListElement>>() {});
mailAttributes.getOtherAttributes().put("appList",appList.stream().map(VlabAppListElement::getAppListName).collect(Collectors.joining(", "))) ;
} }
if (contactFormKey.isEmpty()) { if (contactFormKey.isEmpty()) {
log.error("Invalid contact form request, subType is null"); log.error("Invalid contact form request, subType is null");
......
package net.geant.nmaas.portal.api.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class VlabAppListElement {
private String appListName;
}
...@@ -47,9 +47,10 @@ public class ApplicationStatePerDomainServiceImpl implements ApplicationStatePer ...@@ -47,9 +47,10 @@ public class ApplicationStatePerDomainServiceImpl implements ApplicationStatePer
List<Domain> allDomains = domainRepository.findAll(); List<Domain> allDomains = domainRepository.findAll();
allDomains.forEach(domain -> domain.addApplicationState(appState)); allDomains.forEach(domain -> domain.addApplicationState(appState));
//update domains groups - set app to false by default //update domains groups - set app to false by default
appState.setEnabled(false); ApplicationStatePerDomain appState2 = new ApplicationStatePerDomain(applicationBase);
appState2.setEnabled(false);
domainGroupRepository.findAll().forEach(d -> { domainGroupRepository.findAll().forEach(d -> {
d.getApplicationStatePerDomain().add(appState); d.getApplicationStatePerDomain().add(appState2);
}); });
return domainRepository.saveAll(allDomains); return domainRepository.saveAll(allDomains);
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"subject": "nmaas: New vLAB request", "subject": "nmaas: New vLAB request",
"template": { "template": {
"HEADER": "Dear ${username},", "HEADER": "Dear ${username},",
"CONTENT": "<p>New vLAB request was sent from the contact form.</p><p>Requester email: ${email}</p><p>Requester institution: ${institution}</p><p>Requested number of lab participants: ${students}</p><p>Requested number of lab managers: ${managers}</p><p>List of considered applications:</p><#list appList as app><span>${app.appListName}, </span></#list><p>vLAB start date: ${startDay}</p><p>vLAB end date: ${endDay}</p><p>Additional information: ${message}</p>", "CONTENT": "<p>New vLAB request was sent from the contact form.</p><p>Requester email: ${email}</p><p>Requester institution: ${institution}</p><p>Requested number of lab participants: ${students}</p><p>Requested number of lab managers: ${managers}</p><p>List of considered applications:</p><p>${appList}</p><p>vLAB start date: ${startDay}</p><p>vLAB end date: ${endDay}</p><p>Additional information: ${message}</p>",
"SENDER": "Best regards,<br />nmaas Team", "SENDER": "Best regards,<br />nmaas Team",
"NOREPLY": "This is an automatically generated message, please do not reply.", "NOREPLY": "This is an automatically generated message, please do not reply.",
"SENDER_POLICY": "" "SENDER_POLICY": ""
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"subject": "nmaas: New vLAB request", "subject": "nmaas: New vLAB request",
"template": { "template": {
"HEADER": "Dear ${username},", "HEADER": "Dear ${username},",
"CONTENT": "<p>New vLAB request was sent from the contact form.</p><p>Requester email: ${email}</p><p>Requester institution: ${institution}</p><p>Requested number of lab participants: ${students}</p><p>Requested number of lab managers: ${managers}</p><p>List of considered applications:</p><#list appList as app><span>${app.appListName}, </span></#list><p>vLAB start date: ${startDay}</p><p>vLAB end date: ${endDay}</p><p>Additional information: ${message}</p>", "CONTENT": "<p>New vLAB request was sent from the contact form.</p><p>Requester email: ${email}</p><p>Requester institution: ${institution}</p><p>Requested number of lab participants: ${students}</p><p>Requested number of lab managers: ${managers}</p><p>List of considered applications:</p><p>${appList}</p><p>vLAB start date: ${startDay}</p><p>vLAB end date: ${endDay}</p><p>Additional information: ${message}</p>",
"SENDER": "Best regards,<br />nmaas Team", "SENDER": "Best regards,<br />nmaas Team",
"NOREPLY": "This is an automatically generated message, please do not reply.", "NOREPLY": "This is an automatically generated message, please do not reply.",
"SENDER_POLICY": "" "SENDER_POLICY": ""
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"subject": "nmaas: New vLAB request", "subject": "nmaas: New vLAB request",
"template": { "template": {
"HEADER": "Dear ${username},", "HEADER": "Dear ${username},",
"CONTENT": "<p>New vLAB request was sent from the contact form.</p><p>Requester email: ${email}</p><p>Requester institution: ${institution}</p><p>Requested number of lab participants: ${students}</p><p>Requested number of lab managers: ${managers}</p><p>List of considered applications:</p><#list appList as app><span>${app.appListName}, </span></#list><p>vLAB start date: ${startDay}</p><p>vLAB end date: ${endDay}</p><p>Additional information: ${message}</p>", "CONTENT": "<p>New vLAB request was sent from the contact form.</p><p>Requester email: ${email}</p><p>Requester institution: ${institution}</p><p>Requested number of lab participants: ${students}</p><p>Requested number of lab managers: ${managers}</p><p>List of considered applications:</p><p>${appList}</p><p>vLAB start date: ${startDay}</p><p>vLAB end date: ${endDay}</p><p>Additional information: ${message}</p>",
"SENDER": "Best regards,<br />nmaas Team", "SENDER": "Best regards,<br />nmaas Team",
"NOREPLY": "This is an automatically generated message, please do not reply.", "NOREPLY": "This is an automatically generated message, please do not reply.",
"SENDER_POLICY": "" "SENDER_POLICY": ""
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
"subject": "nmaas: New vLAB request", "subject": "nmaas: New vLAB request",
"template": { "template": {
"HEADER": "Dear ${username},", "HEADER": "Dear ${username},",
"CONTENT": "<p>New vLAB request was sent from the contact form.</p><p>Requester email: ${email}</p><p>Requester institution: ${institution}</p><p>Requested number of lab participants: ${students}</p><p>Requested number of lab managers: ${managers}</p><p>List of considered applications:</p><#list appList as app><span>${app.appListName}, </span></#list><p>vLAB start date: ${startDay}</p><p>vLAB end date: ${endDay}</p><p>Additional information: ${message}</p>", "CONTENT": "<p>New vLAB request was sent from the contact form.</p><p>Requester email: ${email}</p><p>Requester institution: ${institution}</p><p>Requested number of lab participants: ${students}</p><p>Requested number of lab managers: ${managers}</p><p>List of considered applications:</p><p>${appList}</p><p>vLAB start date: ${startDay}</p><p>vLAB end date: ${endDay}</p><p>Additional information: ${message}</p>",
"SENDER": "Best regards,<br />nmaas Team", "SENDER": "Best regards,<br />nmaas Team",
"NOREPLY": "This is an automatically generated message, please do not reply.", "NOREPLY": "This is an automatically generated message, please do not reply.",
"SENDER_POLICY": "" "SENDER_POLICY": ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment