diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/api/API.java b/src/main/java/ch/ethz/seb/sebserver/gbl/api/API.java index 5921303c..12e3b718 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/api/API.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/api/API.java @@ -10,10 +10,17 @@ package ch.ethz.seb.sebserver.gbl.api; public final class API { + public enum BulkActionType { + HARD_DELETE, + DEACTIVATE, + ACTIVATE; + } + public static final String PARAM_LOGO_IMAGE = "logoImageBase64"; public static final String PARAM_INSTITUTION_ID = "institutionId"; public static final String PARAM_MODEL_ID = "modelId"; public static final String PARAM_ENTITY_TYPE = "entityType"; + public static final String PARAM_BULK_ACTION_TYPE = "bulkActionType"; public static final String INSTITUTION_VAR_PATH_SEGMENT = "/{" + PARAM_INSTITUTION_ID + "}"; public static final String MODEL_ID_VAR_PATH_SEGMENT = "/{" + PARAM_MODEL_ID + "}"; diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityType.java b/src/main/java/ch/ethz/seb/sebserver/gbl/api/EntityType.java similarity index 89% rename from src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityType.java rename to src/main/java/ch/ethz/seb/sebserver/gbl/api/EntityType.java index daa65ae9..77dd0889 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityType.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/api/EntityType.java @@ -1,4 +1,4 @@ -package ch.ethz.seb.sebserver.gbl.model; +package ch.ethz.seb.sebserver.gbl.api; import javax.annotation.Generated; diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/authorization/Privilege.java b/src/main/java/ch/ethz/seb/sebserver/gbl/authorization/Privilege.java index d4fa2561..84ffbe83 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/authorization/Privilege.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/authorization/Privilege.java @@ -11,7 +11,7 @@ package ch.ethz.seb.sebserver.gbl.authorization; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import ch.ethz.seb.sebserver.gbl.model.EntityType; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.user.UserRole; /** Defines a Privilege by combining a PrivilegeType for base (overall) rights, diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/Entity.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/Entity.java index e6e4de8b..ef52448c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/Entity.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/Entity.java @@ -11,6 +11,7 @@ package ch.ethz.seb.sebserver.gbl.model; import com.fasterxml.jackson.annotation.JsonIgnore; import ch.ethz.seb.sebserver.gbl.api.API; +import ch.ethz.seb.sebserver.gbl.api.EntityType; public interface Entity extends ModelIdAware { diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityKey.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityKey.java index 5a287d6e..978c8085 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityKey.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityKey.java @@ -14,6 +14,8 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import ch.ethz.seb.sebserver.gbl.api.EntityType; + public class EntityKey { @JsonProperty(value = "modelId", required = true) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityName.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityName.java index b53b9d0e..4a18402a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityName.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityName.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import ch.ethz.seb.sebserver.gbl.api.API; +import ch.ethz.seb.sebserver.gbl.api.EntityType; @JsonIgnoreProperties(ignoreUnknown = true) public class EntityName implements ModelIdAware, ModelNameAware { diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java index a6d0d774..b8d450f9 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java @@ -19,10 +19,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.api.POSTMapper; import ch.ethz.seb.sebserver.gbl.model.Activatable; import ch.ethz.seb.sebserver.gbl.model.Domain.EXAM; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.GrantEntity; public final class Exam implements GrantEntity, Activatable { diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Indicator.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Indicator.java index 266d7423..51647d4f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Indicator.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Indicator.java @@ -16,10 +16,10 @@ import javax.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.Domain.EXAM; import ch.ethz.seb.sebserver.gbl.model.Domain.INDICATOR; import ch.ethz.seb.sebserver.gbl.model.Domain.THRESHOLD; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.GrantEntity; diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/Institution.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/Institution.java index e6a6c19e..452b0bbb 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/Institution.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/Institution.java @@ -16,10 +16,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.api.POSTMapper; import ch.ethz.seb.sebserver.gbl.model.Activatable; import ch.ethz.seb.sebserver.gbl.model.Domain.INSTITUTION; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.GrantEntity; @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/LmsSetup.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/LmsSetup.java index 962f5bf6..99c50cb1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/LmsSetup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/LmsSetup.java @@ -15,12 +15,12 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.api.POSTMapper; import ch.ethz.seb.sebserver.gbl.model.Activatable; import ch.ethz.seb.sebserver.gbl.model.Domain.INSTITUTION; import ch.ethz.seb.sebserver.gbl.model.Domain.LMS_SETUP; import ch.ethz.seb.sebserver.gbl.model.EntityName; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.GrantEntity; public final class LmsSetup implements GrantEntity, Activatable { diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserActivityLog.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserActivityLog.java index e968c2d5..060efb9a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserActivityLog.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserActivityLog.java @@ -13,8 +13,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import ch.ethz.seb.sebserver.gbl.model.Domain.USER_ACTIVITY_LOG; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.Entity; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserActivityLogDAO.ActivityType; public class UserActivityLog implements Entity { diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserInfo.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserInfo.java index b6a83c1a..4f7faab0 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserInfo.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserInfo.java @@ -19,10 +19,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.Activatable; import ch.ethz.seb.sebserver.gbl.model.Domain.USER; import ch.ethz.seb.sebserver.gbl.model.Domain.USER_ROLE; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.GrantEntity; diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserMod.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserMod.java index 16128e59..ae915b64 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserMod.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserMod.java @@ -22,10 +22,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.api.POSTMapper; import ch.ethz.seb.sebserver.gbl.model.Domain.USER; import ch.ethz.seb.sebserver.gbl.model.Domain.USER_ROLE; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.GrantEntity; public final class UserMod implements GrantEntity { diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserRole.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserRole.java index 355cd9fd..e92c49ff 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserRole.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserRole.java @@ -8,8 +8,8 @@ package ch.ethz.seb.sebserver.gbl.model.user; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.Entity; -import ch.ethz.seb.sebserver.gbl.model.EntityType; /** Defines the possible user roles of SEB Server users. */ public enum UserRole implements Entity { diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/GuiWebsecurityConfig.java b/src/main/java/ch/ethz/seb/sebserver/gui/GuiWebsecurityConfig.java index 3f1e95c7..392d9f78 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/GuiWebsecurityConfig.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/GuiWebsecurityConfig.java @@ -35,7 +35,9 @@ public class GuiWebsecurityConfig extends WebSecurityConfigurerAdapter { // RAP/RWT resources has to be accessible new AntPathRequestMatcher("/rwt-resources/**"), // project specific static resources - new AntPathRequestMatcher("/images/**")); + new AntPathRequestMatcher("/images/**"), + + new AntPathRequestMatcher("/favicon.ico")); @Override public void configure(final WebSecurity web) { diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/PageContext.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/PageContext.java index 63de0b8a..a8842e16 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/PageContext.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/PageContext.java @@ -12,6 +12,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; import ch.ethz.seb.sebserver.gbl.model.EntityKey; +import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; import ch.ethz.seb.sebserver.gui.service.page.action.Action; import ch.ethz.seb.sebserver.gui.service.page.action.ActionDefinition; import ch.ethz.seb.sebserver.gui.service.page.activity.ActivitySelection; @@ -129,9 +130,9 @@ public interface PageContext { /** Apply a confirm dialog with a specified confirm message and a callback code * block that will be executed on users OK selection. * - * @param confirmMessage + * @param confirmMessage the localized confirm message key * @param onOK callback code block that will be executed on users OK selection */ - void applyConfirmDialog(String confirmMessage, Runnable onOK); + void applyConfirmDialog(LocTextKey confirmMessage, Runnable onOK); void forwardToPage( PageDefinition pageDefinition, diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/action/Action.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/action/Action.java index dbf08893..3a6891b8 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/action/Action.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/action/Action.java @@ -9,15 +9,14 @@ package ch.ethz.seb.sebserver.gui.service.page.action; import java.util.Set; -import java.util.function.BooleanSupplier; import java.util.function.Function; import java.util.function.Supplier; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ch.ethz.seb.sebserver.gbl.util.Result; +import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; import ch.ethz.seb.sebserver.gui.service.page.PageContext; import ch.ethz.seb.sebserver.gui.service.page.PageMessageException; import ch.ethz.seb.sebserver.gui.service.page.event.ActionEvent; @@ -29,9 +28,8 @@ public final class Action implements Runnable { private static final Logger log = LoggerFactory.getLogger(Action.class); public final ActionDefinition definition; - String confirmationMessage; - BooleanSupplier confirmComdition = () -> true; - String successMessage; + Supplier confirm; + LocTextKey successMessage; boolean updateOnSelection; final RestService restService; @@ -51,10 +49,11 @@ public final class Action implements Runnable { @Override public void run() { - if (StringUtils.isNotBlank(this.confirmationMessage) && this.confirmComdition.getAsBoolean()) { - this.pageContext.applyConfirmDialog( - this.confirmationMessage, - () -> exec()); + if (this.confirm != null) { + final LocTextKey confirmMessage = this.confirm.get(); + if (confirmMessage != null) { + this.pageContext.applyConfirmDialog(confirmMessage, () -> exec()); + } } else { exec(); } @@ -89,13 +88,18 @@ public final class Action implements Runnable { return this; } - public Action withConfirm(final String confirmationMessage) { - this.confirmationMessage = confirmationMessage; + public Action withConfirm(final String confirmationMessageKey) { + this.confirm = () -> new LocTextKey(confirmationMessageKey); return this; } - public Action withSuccess(final String successMessage) { - this.successMessage = successMessage; + public Action withConfirm(final Supplier confirm) { + this.confirm = confirm; + return this; + } + + public Action withSuccess(final String successMessageKey) { + this.successMessage = new LocTextKey(successMessageKey); return this; } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/action/InstitutionActions.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/action/InstitutionActions.java index 18b9dd47..aa281d51 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/action/InstitutionActions.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/action/InstitutionActions.java @@ -14,8 +14,8 @@ import java.util.Collection; import java.util.function.Function; import ch.ethz.seb.sebserver.gbl.api.API; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.institution.Institution; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.gui.service.page.PageContext; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/content/InstitutionForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/content/InstitutionForm.java index c23422cf..82870bdd 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/content/InstitutionForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/content/InstitutionForm.java @@ -8,7 +8,9 @@ package ch.ethz.seb.sebserver.gui.service.page.content; +import java.util.Set; import java.util.UUID; +import java.util.function.Supplier; import org.apache.commons.lang3.BooleanUtils; import org.eclipse.swt.SWT; @@ -16,13 +18,17 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import ch.ethz.seb.sebserver.gbl.api.API; +import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType; import ch.ethz.seb.sebserver.gbl.authorization.PrivilegeType; import ch.ethz.seb.sebserver.gbl.model.Domain; import ch.ethz.seb.sebserver.gbl.model.Entity; +import ch.ethz.seb.sebserver.gbl.model.EntityKey; import ch.ethz.seb.sebserver.gbl.model.institution.Institution; import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; @@ -36,6 +42,7 @@ import ch.ethz.seb.sebserver.gui.service.page.form.FormHandle; import ch.ethz.seb.sebserver.gui.service.page.form.PageFormService; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestService; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.institution.GetInstitution; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.institution.GetInstitutionDependency; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.institution.NewInstitution; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.institution.SaveInstitution; import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.CurrentUser; @@ -46,6 +53,8 @@ import ch.ethz.seb.sebserver.gui.service.widget.WidgetFactory; @GuiProfile public class InstitutionForm implements TemplateComposer { + private static final Logger log = LoggerFactory.getLogger(InstitutionForm.class); + private final PageFormService pageFormService; private final RestService restService; private final CurrentUser currentUser; @@ -62,8 +71,12 @@ public class InstitutionForm implements TemplateComposer { @Override public void compose(final PageContext pageContext) { - final WidgetFactory widgetFactory = this.pageFormService.getWidgetFactory(); + if (log.isDebugEnabled()) { + log.debug("Compose Institutoion Form"); + } + + final WidgetFactory widgetFactory = this.pageFormService.getWidgetFactory(); final boolean readonly = BooleanUtils.toBoolean( pageContext.getAttribute(AttributeKeys.READ_ONLY, "true")); final boolean createNew = BooleanUtils.toBoolean( @@ -165,6 +178,7 @@ public class InstitutionForm implements TemplateComposer { } else { formContext.createAction(ActionDefinition.INSTITUTION_DEACTIVATE) .withExec(InstitutionActions::deactivateInstitution) + .withConfirm(confirmDeactivation(institution)) .publish(); } } @@ -177,7 +191,27 @@ public class InstitutionForm implements TemplateComposer { .withConfirm("sebserver.overall.action.modify.cancel.confirm") .publish(); } + } + private Supplier confirmDeactivation(final Institution institution) { + return () -> { + try { + final Set dependencies = this.restService.getBuilder(GetInstitutionDependency.class) + .withURIVariable(API.PARAM_MODEL_ID, String.valueOf(institution.id)) + .withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.DEACTIVATE.name()) + .call() + .getOrThrow(); + final int size = dependencies.size(); + if (size > 0) { + return new LocTextKey("sebserver.institution.form.confirm.deactivation", String.valueOf(size)); + } else { + return new LocTextKey("sebserver.institution.form.confirm.deactivation.noDependencies"); + } + } catch (final Exception e) { + log.error("Failed to get dependencyies for Institution: {}", institution, e); + return new LocTextKey("sebserver.institution.form.confirm.deactivation", ""); + } + }; } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java index 8f7b2a11..7c244c41 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java @@ -24,10 +24,11 @@ import org.slf4j.LoggerFactory; import ch.ethz.seb.sebserver.gbl.api.APIMessage; import ch.ethz.seb.sebserver.gbl.api.APIMessageError; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; +import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; import ch.ethz.seb.sebserver.gui.service.page.ComposerService; import ch.ethz.seb.sebserver.gui.service.page.PageContext; import ch.ethz.seb.sebserver.gui.service.page.PageDefinition; @@ -250,12 +251,13 @@ public class PageContextImpl implements PageContext { @Override @SuppressWarnings("serial") - public void applyConfirmDialog(final String confirmMessage, final Runnable onOK) { + public void applyConfirmDialog(final LocTextKey confirmMessage, final Runnable onOK) { final Message messageBox = new Message( this.root.getShell(), this.i18nSupport.getText("org.sebserver.dialog.confirm.title"), this.i18nSupport.getText(confirmMessage), SWT.OK | SWT.CANCEL); + messageBox.setMarkupEnabled(true); messageBox.open(new DialogCallback() { @Override public void dialogClosed(final int returnCode) { diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/CurrentUser.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/CurrentUser.java index 5428c25d..f17db32c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/CurrentUser.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/CurrentUser.java @@ -26,10 +26,10 @@ import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; import ch.ethz.seb.sebserver.gbl.api.API; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.authorization.Privilege; import ch.ethz.seb.sebserver.gbl.authorization.Privilege.RoleTypeKey; import ch.ethz.seb.sebserver.gbl.authorization.PrivilegeType; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.user.UserInfo; import ch.ethz.seb.sebserver.gbl.model.user.UserRole; import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationService.java index 2f1fdb79..b4118f24 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationService.java @@ -11,9 +11,9 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.authorization; import java.util.Collection; import java.util.Set; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.authorization.Privilege; import ch.ethz.seb.sebserver.gbl.authorization.PrivilegeType; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.user.UserInfo; import ch.ethz.seb.sebserver.gbl.model.user.UserRole; import ch.ethz.seb.sebserver.gbl.util.Result; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceImpl.java index 2d6ee586..41831cd6 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceImpl.java @@ -19,10 +19,10 @@ import javax.annotation.PostConstruct; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.authorization.Privilege; import ch.ethz.seb.sebserver.gbl.authorization.Privilege.RoleTypeKey; import ch.ethz.seb.sebserver.gbl.authorization.PrivilegeType; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.user.UserRole; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/PermissionDeniedException.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/PermissionDeniedException.java index e82552f9..cf2f9926 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/PermissionDeniedException.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/PermissionDeniedException.java @@ -8,8 +8,8 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.authorization; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.authorization.PrivilegeType; -import ch.ethz.seb.sebserver.gbl.model.EntityType; public class PermissionDeniedException extends RuntimeException { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkAction.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkAction.java index 97e758ff..fa5fd94f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkAction.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkAction.java @@ -16,27 +16,16 @@ import java.util.LinkedHashSet; import java.util.Set; import java.util.stream.Collectors; +import ch.ethz.seb.sebserver.gbl.api.EntityType; +import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserActivityLogDAO.ActivityType; public final class BulkAction { - public enum Type { - HARD_DELETE(ActivityType.DELETE), - DEACTIVATE(ActivityType.DEACTIVATE), - ACTIVATE(ActivityType.ACTIVATE); - - public final ActivityType activityType; - - private Type(final ActivityType activityType) { - this.activityType = activityType; - } - } - - public final Type type; + public final BulkActionType type; public final EntityType sourceType; public final Set sources; @@ -46,7 +35,7 @@ public final class BulkAction { boolean alreadyProcessed = false; public BulkAction( - final Type type, + final BulkActionType type, final EntityType sourceType, final Collection sources) { @@ -60,7 +49,7 @@ public final class BulkAction { } public BulkAction( - final Type type, + final BulkActionType type, final EntityType sourceType, final EntityKey... sources) { @@ -86,6 +75,23 @@ public final class BulkAction { return Collections.emptySet(); } + public ActivityType getActivityType() { + if (this.type == null) { + return null; + } + + switch (this.type) { + case ACTIVATE: + return ActivityType.ACTIVATE; + case DEACTIVATE: + return ActivityType.DEACTIVATE; + case HARD_DELETE: + return ActivityType.DELETE; + default: + throw new IllegalStateException("There is no ActivityType mapped to the BulkActionType " + this.type); + } + } + @Override public String toString() { return "BulkAction [type=" + this.type + ", sourceType=" + this.sourceType + ", sources=" + this.sources + "]"; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkActionService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkActionService.java index 05b9f550..92a11f29 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkActionService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkActionService.java @@ -17,12 +17,13 @@ import java.util.Map; import org.springframework.stereotype.Service; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserActivityLogDAO; +import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserActivityLogDAO.ActivityType; @Service @WebServiceProfile @@ -103,13 +104,15 @@ public class BulkActionService { } private void processUserActivityLog(final BulkAction action) { - if (action.type.activityType == null) { + final ActivityType activityType = action.getActivityType(); + + if (activityType == null) { return; } for (final EntityKey key : action.dependencies) { this.userActivityLogDAO.log( - action.type.activityType, + activityType, key.entityType, key.modelId, "bulk action dependency"); @@ -117,7 +120,7 @@ public class BulkActionService { for (final EntityKey key : action.sources) { this.userActivityLogDAO.log( - action.type.activityType, + activityType, key.entityType, key.modelId, "bulk action source"); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkActionSupportDAO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkActionSupportDAO.java index 0fa16f81..20029f62 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkActionSupportDAO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/BulkActionSupportDAO.java @@ -17,9 +17,9 @@ import java.util.stream.Collectors; import org.springframework.transaction.annotation.Transactional; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.Entity; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ActivatableEntityDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.DAOLoggingSupport; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/EntityDAO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/EntityDAO.java index bdead224..a8efc8ff 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/EntityDAO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/EntityDAO.java @@ -17,10 +17,10 @@ import java.util.stream.Collectors; import org.springframework.transaction.annotation.Transactional; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.Entity; import ch.ethz.seb.sebserver.gbl.model.EntityKey; import ch.ethz.seb.sebserver.gbl.model.EntityName; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.ModelIdAware; import ch.ethz.seb.sebserver.gbl.util.Result; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ResourceNotFoundException.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ResourceNotFoundException.java index 455319dc..af2103b1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ResourceNotFoundException.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ResourceNotFoundException.java @@ -11,8 +11,8 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.dao; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; @ResponseStatus(HttpStatus.NOT_FOUND) public final class ResourceNotFoundException extends RuntimeException { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserActivityLogDAO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserActivityLogDAO.java index 414a5a46..5be4a6d6 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserActivityLogDAO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/UserActivityLogDAO.java @@ -11,8 +11,8 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.dao; import java.util.Collection; import java.util.function.Predicate; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.Entity; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.user.UserActivityLog; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.SEBServerUser; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java index f7006f5b..4f756eca 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java @@ -28,8 +28,8 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import ch.ethz.seb.sebserver.gbl.Constants; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.exam.Exam; import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamStatus; import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamType; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/IndicatorDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/IndicatorDAOImpl.java index 2ad0dbcd..1abb16ec 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/IndicatorDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/IndicatorDAOImpl.java @@ -23,8 +23,8 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.exam.Indicator; import ch.ethz.seb.sebserver.gbl.model.exam.Indicator.IndicatorType; import ch.ethz.seb.sebserver.gbl.model.exam.Indicator.Threshold; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/InstitutionDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/InstitutionDAOImpl.java index 81369231..810f5071 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/InstitutionDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/InstitutionDAOImpl.java @@ -26,9 +26,9 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.api.APIMessage.FieldValidationException; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.institution.Institution; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.InstitutionRecordDynamicSqlSupport; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/LmsSetupDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/LmsSetupDAOImpl.java index 3e7932ef..423d9b9b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/LmsSetupDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/LmsSetupDAOImpl.java @@ -28,8 +28,8 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import ch.ethz.seb.sebserver.WebSecurityConfig; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup; import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup.LmsType; import ch.ethz.seb.sebserver.gbl.util.Result; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserActivityLogDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserActivityLogDAOImpl.java index b9da697f..f7b1bb8b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserActivityLogDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserActivityLogDAOImpl.java @@ -27,9 +27,9 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import ch.ethz.seb.sebserver.gbl.Constants; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.Entity; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.user.UserActivityLog; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.UserActivityLogRecordDynamicSqlSupport; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDaoImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDaoImpl.java index 661931b8..596a8fe1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDaoImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDaoImpl.java @@ -32,10 +32,10 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import ch.ethz.seb.sebserver.WebSecurityConfig; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.api.APIMessage.APIMessageException; import ch.ethz.seb.sebserver.gbl.api.APIMessage.ErrorMessage; import ch.ethz.seb.sebserver.gbl.model.EntityKey; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.user.UserInfo; import ch.ethz.seb.sebserver.gbl.model.user.UserMod; import ch.ethz.seb.sebserver.gbl.util.Result; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ActivatableEntityController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ActivatableEntityController.java index ca248612..5b0ae119 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ActivatableEntityController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ActivatableEntityController.java @@ -15,10 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import ch.ethz.seb.sebserver.gbl.api.API; +import ch.ethz.seb.sebserver.gbl.api.EntityType; +import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType; import ch.ethz.seb.sebserver.gbl.model.Entity; import ch.ethz.seb.sebserver.gbl.model.EntityKey; import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.Page; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.UserRecordDynamicSqlSupport; @@ -27,7 +28,6 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.Authorization import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.GrantEntity; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.UserService; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkAction; -import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkAction.Type; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkActionService; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ActivatableEntityDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserActivityLogDAO; @@ -124,7 +124,7 @@ public abstract class ActivatableEntityController setActive(final String id, final boolean active) { final EntityType entityType = this.entityDAO.entityType(); final BulkAction bulkAction = new BulkAction( - (active) ? Type.ACTIVATE : Type.DEACTIVATE, + (active) ? BulkActionType.ACTIVATE : BulkActionType.DEACTIVATE, entityType, new EntityKey(id, entityType)); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/EntityController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/EntityController.java index 7ae2ee31..69777a5c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/EntityController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/EntityController.java @@ -28,13 +28,14 @@ import org.springframework.web.bind.annotation.RequestParam; import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.api.API; +import ch.ethz.seb.sebserver.gbl.api.EntityType; +import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType; import ch.ethz.seb.sebserver.gbl.api.POSTMapper; import ch.ethz.seb.sebserver.gbl.authorization.PrivilegeType; import ch.ethz.seb.sebserver.gbl.model.Entity; import ch.ethz.seb.sebserver.gbl.model.EntityKey; import ch.ethz.seb.sebserver.gbl.model.EntityName; import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.Page; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.servicelayer.PaginationService; @@ -42,7 +43,6 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.Authorization import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.GrantEntity; import ch.ethz.seb.sebserver.webservice.servicelayer.authorization.UserService; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkAction; -import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkAction.Type; import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkActionService; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.EntityDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap; @@ -150,14 +150,14 @@ public abstract class EntityController getDependencies( @PathVariable final String modelId, - @RequestParam final BulkAction.Type type) { + @RequestParam(API.PARAM_BULK_ACTION_TYPE) final BulkActionType bulkActionType) { this.entityDAO .byModelId(modelId) .flatMap(this.authorization::checkReadonly); final BulkAction bulkAction = new BulkAction( - type, + bulkActionType, this.entityDAO.entityType(), Arrays.asList(new EntityKey(modelId, this.entityDAO.entityType()))); @@ -302,7 +302,7 @@ public abstract class EntityControllerThose will also be deactivated by deactivating this Institution.

Are You sure to deactivate this Institution? +sebserver.institution.form.confirm.deactivation.noDependencies=Are You sure to deactivate this Institution? sebserver.form.validation.fieldError.name=Name is mandatory and must have a size between 3 and 255 character sebserver.form.validation.fieldError.urlSuffix=URL Suffix must have a size between 3 and 255 character diff --git a/src/test/java/ch/ethz/seb/sebserver/gbl/model/user/UserActivityLogTest.java b/src/test/java/ch/ethz/seb/sebserver/gbl/model/user/UserActivityLogTest.java index efe971ed..0f3cf6a8 100644 --- a/src/test/java/ch/ethz/seb/sebserver/gbl/model/user/UserActivityLogTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/gbl/model/user/UserActivityLogTest.java @@ -14,8 +14,8 @@ import java.io.IOException; import org.junit.Test; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.api.JSONMapper; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.UserActivityLogDAO.ActivityType; public class UserActivityLogTest { diff --git a/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/admin/InstitutionAPITest.java b/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/admin/InstitutionAPITest.java index dfd60ee5..538d72d1 100644 --- a/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/admin/InstitutionAPITest.java +++ b/src/test/java/ch/ethz/seb/sebserver/webservice/integration/api/admin/InstitutionAPITest.java @@ -24,14 +24,14 @@ import org.springframework.test.context.jdbc.Sql; import com.fasterxml.jackson.core.type.TypeReference; import ch.ethz.seb.sebserver.gbl.api.API; +import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType; import ch.ethz.seb.sebserver.gbl.api.APIMessage; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; import ch.ethz.seb.sebserver.gbl.model.EntityName; import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.Page; import ch.ethz.seb.sebserver.gbl.model.institution.Institution; -import ch.ethz.seb.sebserver.webservice.servicelayer.bulkaction.BulkAction; @Sql(scripts = { "classpath:schema-test.sql", "classpath:data-test.sql" }) public class InstitutionAPITest extends AdministrationAPIIntegrationTester { @@ -411,7 +411,7 @@ public class InstitutionAPITest extends AdministrationAPIIntegrationTester { .withPath(API.INSTITUTION_ENDPOINT) .withPath("1") .withPath(API.DEPENDENCY_PATH_SEGMENT) - .withAttribute("type", BulkAction.Type.DEACTIVATE.name()) + .withAttribute(API.PARAM_BULK_ACTION_TYPE, BulkActionType.DEACTIVATE.name()) .withExpectedStatus(HttpStatus.OK) .getAsObject(new TypeReference>() { }); diff --git a/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceTest.java b/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceTest.java index de2cf105..dc056c27 100644 --- a/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/AuthorizationServiceTest.java @@ -21,8 +21,8 @@ import org.joda.time.DateTimeZone; import org.junit.Test; import org.mockito.Mockito; +import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.authorization.PrivilegeType; -import ch.ethz.seb.sebserver.gbl.model.EntityType; import ch.ethz.seb.sebserver.gbl.model.user.UserInfo; import ch.ethz.seb.sebserver.gbl.model.user.UserRole;