reogranized source code
This commit is contained in:
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Joern Muehlencord <joern at muehlencord.de>.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package de.muehlencord.shared.account.web;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.boundary.AccountControl;
|
||||
import de.muehlencord.shared.account.business.account.entity.Account;
|
||||
import java.io.Serializable;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.annotation.ManagedBean;
|
||||
import javax.ejb.EJB;
|
||||
import javax.enterprise.context.SessionScoped;
|
||||
import javax.enterprise.inject.Produces;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@ManagedBean
|
||||
@SessionScoped
|
||||
public class AccountProducer implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3806204732038165311L;
|
||||
private final Map<String, Object> objectMap = new ConcurrentHashMap<>();
|
||||
|
||||
@EJB
|
||||
AccountControl accountController;
|
||||
|
||||
private Account account = null;
|
||||
|
||||
@Produces
|
||||
public Account getAccount() {
|
||||
String accountName;
|
||||
if (account == null) {
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
if (subject == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((subject.isAuthenticated() == false) && (subject.isRemembered() == false)) {
|
||||
accountName = "web";
|
||||
} else {
|
||||
accountName = subject.getPrincipal().toString();
|
||||
}
|
||||
account = accountController.getAccountEntity(accountName, true);
|
||||
}
|
||||
return account;
|
||||
}
|
||||
|
||||
public <T> T getValue(String key, Class<T> clazz) {
|
||||
if (objectMap.containsKey(key)) {
|
||||
Object obj = objectMap.get(key);
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return clazz.cast(obj);
|
||||
} catch (ClassCastException ex) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(String key, Object obj) {
|
||||
objectMap.put(key, obj);
|
||||
}
|
||||
|
||||
@Produces
|
||||
public Locale getLocale() {
|
||||
return Locale.ENGLISH; // TODO depend lcoale on account or on incoming request
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.account.web;
|
||||
|
||||
import de.muehlencord.shared.account.business.config.boundary.ConfigService;
|
||||
import de.muehlencord.shared.account.business.accountconfig.entity.AccountConfigurationKey;
|
||||
import de.muehlencord.shared.account.business.accountconfig.entity.AccountConfigurationValue;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigException;
|
||||
import javax.ejb.EJB;
|
||||
import javax.enterprise.context.Dependent;
|
||||
import javax.enterprise.inject.Produces;
|
||||
import javax.enterprise.inject.spi.Annotated;
|
||||
import javax.enterprise.inject.spi.InjectionPoint;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@Dependent
|
||||
public class ConfigurationProducer {
|
||||
|
||||
@EJB
|
||||
ConfigService configService;
|
||||
|
||||
@Produces
|
||||
@AccountConfigurationValue(key = AccountConfigurationKey.Producer)
|
||||
public String produceConfigurationValue(InjectionPoint injectionPoint) {
|
||||
Annotated annotated = injectionPoint.getAnnotated();
|
||||
AccountConfigurationValue annotation = annotated.getAnnotation(AccountConfigurationValue.class);
|
||||
if (annotation != null) {
|
||||
AccountConfigurationKey key = annotation.key();
|
||||
if (key != null) {
|
||||
try {
|
||||
switch (key) {
|
||||
case BaseUrl:
|
||||
return configService.getConfigValue("base.url");
|
||||
case PasswordResetUrl:
|
||||
return configService.getConfigValue("base.url") + "/login.xhtml";
|
||||
default:
|
||||
throw new IllegalStateException("Invalid key " + key + " for injection point: " + injectionPoint);
|
||||
}
|
||||
} catch (ConfigException ex) {
|
||||
throw new IllegalStateException("Invalid key " + key + " for injection point: " + injectionPoint + ". Exception: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("No key for injection point: " + injectionPoint);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package de.muehlencord.shared.account.web;
|
||||
|
||||
import javax.annotation.Priority;
|
||||
import javax.inject.Inject;
|
||||
import javax.interceptor.AroundInvoke;
|
||||
import javax.interceptor.Interceptor;
|
||||
import javax.interceptor.InvocationContext;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.transaction.Transactional;
|
||||
import static javax.transaction.Transactional.TxType.REQUIRED;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@Transactional(value = REQUIRED)
|
||||
@Interceptor
|
||||
@Priority(value=TransactionJoinInterceptor.PRIORITY)
|
||||
public class TransactionJoinInterceptor {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TransactionJoinInterceptor.class);
|
||||
|
||||
// attach behind the interceptor of the container
|
||||
public static final int PRIORITY = Interceptor.Priority.PLATFORM_BEFORE+250;
|
||||
|
||||
private final EntityManager em;
|
||||
|
||||
@Inject
|
||||
public TransactionJoinInterceptor(@NotNull EntityManager em) {
|
||||
this.em = em;
|
||||
}
|
||||
|
||||
|
||||
@AroundInvoke
|
||||
public Object joinTransaction(InvocationContext context) throws Exception {
|
||||
if (em.isJoinedToTransaction()) {
|
||||
LOGGER.info("transaction already joined");
|
||||
} else {
|
||||
LOGGER.info("joining transaction");
|
||||
em.joinTransaction();
|
||||
}
|
||||
return context.proceed();
|
||||
}
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 Joern Muehlencord <joern at muehlencord.de>.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package de.muehlencord.shared.account.web.business.application.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.account.business.config.boundary.ConfigService;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigException;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.enterprise.context.Initialized;
|
||||
import javax.enterprise.event.Observes;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class StartupBean {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StartupBean.class);
|
||||
|
||||
@Inject
|
||||
ConfigService configService;
|
||||
|
||||
@Inject
|
||||
ApplicationEntity application;
|
||||
|
||||
public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {
|
||||
try {
|
||||
LOGGER.info("Starting application {}", application.getApplicationName());
|
||||
String instanceName = configService.getConfigValue("base.instance", "Development System", true);
|
||||
LOGGER.info("instanceName={}", instanceName);
|
||||
|
||||
// ensure maxFailedLogins is available
|
||||
configService.getConfigValue("account.maxFailedLogins", "5", true);
|
||||
|
||||
LOGGER.info("Application startup complete");
|
||||
} catch (ConfigException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.error(ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void shutdown() {
|
||||
LOGGER.info("Shutting down application {}", application.getApplicationName());
|
||||
|
||||
|
||||
LOGGER.info("Application shutdown complete");
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 Joern Muehlencord <joern at muehlencord.de>.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package de.muehlencord.shared.account.web.business.application.control;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.boundary.ApplicationService;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ejb.EJB;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.enterprise.inject.Produces;
|
||||
import javax.inject.Named;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@Named("applicationController")
|
||||
@ApplicationScoped
|
||||
public class ApplicationController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationController.class);
|
||||
|
||||
@EJB
|
||||
ApplicationService applicationService;
|
||||
|
||||
private String version;
|
||||
private String buildDate;
|
||||
private UUID uuid;
|
||||
private ApplicationEntity application = null;
|
||||
|
||||
@PostConstruct
|
||||
public void readBuildInfoProperties() {
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("Trying to read buildInfo.properties");
|
||||
}
|
||||
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("buildInfo.properties");
|
||||
if (in == null) {
|
||||
return;
|
||||
}
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
props.load(in);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("properties read from buildInfo.properties");
|
||||
}
|
||||
|
||||
version = props.getProperty("build.version");
|
||||
buildDate = props.getProperty("build.timestamp");
|
||||
uuid = UUID.fromString(props.getProperty("application.uuid"));
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("buildInfo.properties parsed successfully");
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
LOGGER.error("Cannot find buildInfo.properties. ", ex);
|
||||
version = "??";
|
||||
buildDate = "??";
|
||||
uuid = null;
|
||||
LOGGER.error("Application id not readable, application will not be able to run");
|
||||
}
|
||||
|
||||
if (uuid != null) {
|
||||
this.application = applicationService.findById(uuid);
|
||||
if (application == null) {
|
||||
LOGGER.error("Could not find application with id ");
|
||||
} else {
|
||||
LOGGER.info("Found application {} with id {}", application.getApplicationName(), uuid.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* needs to return link to "Account UI" and not to current selected
|
||||
* application TODO: ensure only Account UI can call functions where
|
||||
* appliction can be handed in - all other applications need to call the
|
||||
* function which use the injected application
|
||||
*/
|
||||
@Produces
|
||||
public ApplicationEntity getApplication() {
|
||||
return application;
|
||||
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getBuildDate() {
|
||||
return buildDate;
|
||||
}
|
||||
|
||||
public UUID getApplicationId() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.boundary.AccountControl;
|
||||
import de.muehlencord.shared.account.business.account.boundary.ApplicationRoleControl;
|
||||
import de.muehlencord.shared.account.business.account.control.AccountControl;
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountException;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountLoginEntity;
|
||||
|
||||
@ -1,126 +1,126 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.boundary.ApplicationService;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.jeeutil.FacesUtil;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.inject.Named;
|
||||
import javax.enterprise.context.SessionScoped;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@SessionScoped
|
||||
@Named("applicationView")
|
||||
public class ApplicationView implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5515249316880163539L;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationView.class);
|
||||
|
||||
@Inject
|
||||
ApplicationService applicationService;
|
||||
|
||||
private ApplicationEntity currentApplication = null;
|
||||
private ApplicationEntity editApplication = null;
|
||||
private List<ApplicationEntity> applicationList = null;
|
||||
|
||||
@PostConstruct
|
||||
public void selectDefaultCurrentApplication() {
|
||||
// force applications to be loaded from database
|
||||
getAllApplications();
|
||||
if ((applicationList != null) && (!applicationList.isEmpty())) {
|
||||
currentApplication = applicationList.get(0);
|
||||
}
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("post construct executed");
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void predestroy() {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Predestroy executed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<ApplicationEntity> getAllApplications() {
|
||||
if (applicationList == null) {
|
||||
applicationList = applicationService.getAllApplications();
|
||||
}
|
||||
return applicationList;
|
||||
}
|
||||
|
||||
public void selectApplication() {
|
||||
if (currentApplication != null) {
|
||||
LOGGER.info("selected application: {}", currentApplication.getApplicationName());
|
||||
FacesUtil.addGlobalInfoMessage("Success", "Selected application " + currentApplication.getApplicationName());
|
||||
}
|
||||
}
|
||||
|
||||
public void newApplication() {
|
||||
this.editApplication = new ApplicationEntity();
|
||||
}
|
||||
|
||||
public void cancelEditApplication() {
|
||||
this.editApplication = null;
|
||||
}
|
||||
|
||||
public void saveEditApplication() {
|
||||
if (editApplication == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
|
||||
} else if ((editApplication.getApplicationName() == null) || (editApplication.getApplicationName().trim().equals(""))) {
|
||||
String hint;
|
||||
if (editApplication.getId() == null) {
|
||||
hint = "Cannot create application";
|
||||
} else {
|
||||
hint = "Cannot save application";
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage(hint, "Application name must not be empty");
|
||||
} else {
|
||||
currentApplication = applicationService.createOrUpdate(editApplication);
|
||||
// force reload of to update view
|
||||
applicationList = null;
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Application saved");
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteApplication() {
|
||||
if (currentApplication == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
|
||||
} else if (currentApplication.getId() == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Cannot delete non persistent data");
|
||||
} else {
|
||||
String applicationName = currentApplication.getApplicationName();
|
||||
applicationService.delete(currentApplication);
|
||||
applicationList = null; // force reload to update view
|
||||
currentApplication = null;
|
||||
selectDefaultCurrentApplication();
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Application " + applicationName + " deleted");
|
||||
}
|
||||
}
|
||||
|
||||
/* *** getter / setter *** */
|
||||
public ApplicationEntity getCurrentApplication() {
|
||||
return currentApplication;
|
||||
}
|
||||
|
||||
public void setCurrentApplication(ApplicationEntity currentApplication) {
|
||||
this.currentApplication = currentApplication;
|
||||
}
|
||||
|
||||
public ApplicationEntity getEditApplication() {
|
||||
return editApplication;
|
||||
}
|
||||
|
||||
public void setEditApplication(ApplicationEntity editApplication) {
|
||||
this.editApplication = editApplication;
|
||||
}
|
||||
}
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.boundary.ApplicationService;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.jeeutil.FacesUtil;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.inject.Named;
|
||||
import javax.enterprise.context.SessionScoped;
|
||||
import javax.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@SessionScoped
|
||||
@Named("applicationView")
|
||||
public class ApplicationView implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5515249316880163539L;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationView.class);
|
||||
|
||||
@Inject
|
||||
ApplicationService applicationService;
|
||||
|
||||
private ApplicationEntity currentApplication = null;
|
||||
private ApplicationEntity editApplication = null;
|
||||
private List<ApplicationEntity> applicationList = null;
|
||||
|
||||
@PostConstruct
|
||||
public void selectDefaultCurrentApplication() {
|
||||
// force applications to be loaded from database
|
||||
getAllApplications();
|
||||
if ((applicationList != null) && (!applicationList.isEmpty())) {
|
||||
currentApplication = applicationList.get(0);
|
||||
}
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("post construct executed");
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void predestroy() {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Predestroy executed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<ApplicationEntity> getAllApplications() {
|
||||
if (applicationList == null) {
|
||||
applicationList = applicationService.getAllApplications();
|
||||
}
|
||||
return applicationList;
|
||||
}
|
||||
|
||||
public void selectApplication() {
|
||||
if (currentApplication != null) {
|
||||
LOGGER.info("selected application: {}", currentApplication.getApplicationName());
|
||||
FacesUtil.addGlobalInfoMessage("Success", "Selected application " + currentApplication.getApplicationName());
|
||||
}
|
||||
}
|
||||
|
||||
public void newApplication() {
|
||||
this.editApplication = new ApplicationEntity();
|
||||
}
|
||||
|
||||
public void cancelEditApplication() {
|
||||
this.editApplication = null;
|
||||
}
|
||||
|
||||
public void saveEditApplication() {
|
||||
if (editApplication == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
|
||||
} else if ((editApplication.getApplicationName() == null) || (editApplication.getApplicationName().trim().equals(""))) {
|
||||
String hint;
|
||||
if (editApplication.getId() == null) {
|
||||
hint = "Cannot create application";
|
||||
} else {
|
||||
hint = "Cannot save application";
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage(hint, "Application name must not be empty");
|
||||
} else {
|
||||
currentApplication = applicationService.createOrUpdate(editApplication);
|
||||
// force reload of to update view
|
||||
applicationList = null;
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Application saved");
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteApplication() {
|
||||
if (currentApplication == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
|
||||
} else if (currentApplication.getId() == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Cannot delete non persistent data");
|
||||
} else {
|
||||
String applicationName = currentApplication.getApplicationName();
|
||||
applicationService.delete(currentApplication);
|
||||
applicationList = null; // force reload to update view
|
||||
currentApplication = null;
|
||||
selectDefaultCurrentApplication();
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Application " + applicationName + " deleted");
|
||||
}
|
||||
}
|
||||
|
||||
/* *** getter / setter *** */
|
||||
public ApplicationEntity getCurrentApplication() {
|
||||
return currentApplication;
|
||||
}
|
||||
|
||||
public void setCurrentApplication(ApplicationEntity currentApplication) {
|
||||
this.currentApplication = currentApplication;
|
||||
}
|
||||
|
||||
public ApplicationEntity getEditApplication() {
|
||||
return editApplication;
|
||||
}
|
||||
|
||||
public void setEditApplication(ApplicationEntity editApplication) {
|
||||
this.editApplication = editApplication;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,46 +1,46 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.config.boundary.ConfigService;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigException;
|
||||
import javax.ejb.EJB;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.inject.Named;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@Named(value = "instanceView")
|
||||
@ApplicationScoped
|
||||
public class InstanceView {
|
||||
|
||||
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(InstanceView.class);
|
||||
|
||||
@EJB
|
||||
ConfigService configService;
|
||||
|
||||
public boolean isDevelopmentVersion() {
|
||||
String instanceName = getInstanceName();
|
||||
return !instanceName.equals("Production");
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
String instanceName;
|
||||
try {
|
||||
instanceName = configService.getConfigValue("base.instance");
|
||||
} catch (ConfigException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.error(ex.toString());
|
||||
}
|
||||
instanceName = "unknown (" + ex.toString() + ")";
|
||||
}
|
||||
if (instanceName == null) {
|
||||
return "unknown";
|
||||
} else {
|
||||
return instanceName;
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.config.boundary.ConfigService;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigException;
|
||||
import javax.ejb.EJB;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.inject.Named;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@Named(value = "instanceView")
|
||||
@ApplicationScoped
|
||||
public class InstanceView {
|
||||
|
||||
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(InstanceView.class);
|
||||
|
||||
@EJB
|
||||
ConfigService configService;
|
||||
|
||||
public boolean isDevelopmentVersion() {
|
||||
String instanceName = getInstanceName();
|
||||
return !instanceName.equals("Production");
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
String instanceName;
|
||||
try {
|
||||
instanceName = configService.getConfigValue("base.instance");
|
||||
} catch (ConfigException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.error(ex.toString());
|
||||
}
|
||||
instanceName = "unknown (" + ex.toString() + ")";
|
||||
}
|
||||
if (instanceName == null) {
|
||||
return "unknown";
|
||||
} else {
|
||||
return instanceName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,9 +15,9 @@
|
||||
*/
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.boundary.ApplicationPermissionControl;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountException;
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationPermissionEntity;
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationPermissionControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.jeeutil.FacesUtil;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -1,240 +1,240 @@
|
||||
/*
|
||||
* Copyright 2017 Joern Muehlencord <joern at muehlencord.de>.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.boundary.ApplicationRoleControl;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountException;
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationPermissionEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.jeeutil.FacesUtil;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Inject;
|
||||
import org.primefaces.event.SelectEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@ViewScoped
|
||||
@Named("roleView")
|
||||
public class RoleView implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1669321020398119007L;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RoleView.class);
|
||||
|
||||
@Inject
|
||||
private ApplicationView applicationView;
|
||||
|
||||
@EJB
|
||||
ApplicationRoleControl applicationRoleControl;
|
||||
|
||||
private List<ApplicationRoleEntity> allRoles = null;
|
||||
private List<ApplicationPermissionEntity> currentRolePermissions = null;
|
||||
private List<ApplicationPermissionEntity> missingApplicationsPermissions = null;
|
||||
|
||||
private ApplicationRoleEntity currentRole;
|
||||
private ApplicationPermissionEntity currentPermission;
|
||||
private ApplicationPermissionEntity newPermission;
|
||||
|
||||
public ApplicationEntity getCurrentApplication() {
|
||||
return applicationView.getCurrentApplication();
|
||||
}
|
||||
|
||||
public List<ApplicationRoleEntity> getAllRoles() {
|
||||
if (allRoles == null) {
|
||||
allRoles = applicationRoleControl.getAllRoles(applicationView.getCurrentApplication());
|
||||
}
|
||||
return allRoles;
|
||||
}
|
||||
|
||||
public void startNewRole() {
|
||||
this.currentRole = new ApplicationRoleEntity(applicationView.getCurrentApplication());
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Created new current role: {}", currentRole.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void cancelEditRole() {
|
||||
this.currentRole = null;
|
||||
}
|
||||
|
||||
public void saveEditRole() {
|
||||
if ((currentRole == null) || (currentRole.getRoleName() == null) || (currentRole.getRoleName().trim().length() == 0)) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Permission name must not be null");
|
||||
} else if (currentRole.getId() == null) {
|
||||
applicationRoleControl.create(currentRole);
|
||||
allRoles = null; // force reload
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Role " + currentRole.getRoleName() + " created");
|
||||
} else {
|
||||
applicationRoleControl.update(currentRole);
|
||||
allRoles = null; // force reload
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Role " + currentRole.getRoleName() + " updated");
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteRole() {
|
||||
if (currentRole == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Please select a permission to edit");
|
||||
} else {
|
||||
try {
|
||||
applicationRoleControl.delete(currentRole);
|
||||
allRoles = null; // force reload
|
||||
currentRole = null;
|
||||
currentRolePermissions = null;
|
||||
} catch (AccountException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.debug(ex.toString());
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error while deleting permission.", ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getRoleSelected() {
|
||||
return currentRole != null;
|
||||
}
|
||||
|
||||
public boolean getPermissionSelected() {
|
||||
return currentPermission != null;
|
||||
}
|
||||
|
||||
public boolean getMissingPermissionAvailable() {
|
||||
return ((missingApplicationsPermissions != null) && (!missingApplicationsPermissions.isEmpty()));
|
||||
}
|
||||
|
||||
public void onRoleSelect(SelectEvent event) {
|
||||
currentRolePermissions = null;
|
||||
currentRolePermissions = getRolePermissions();
|
||||
missingApplicationsPermissions = null;
|
||||
missingApplicationsPermissions = getMissingPermissions();
|
||||
}
|
||||
|
||||
public List<ApplicationPermissionEntity> getRolePermissions() {
|
||||
if (currentRole == null) {
|
||||
currentRolePermissions = new ArrayList<>();
|
||||
return currentRolePermissions;
|
||||
} else {
|
||||
if (currentRolePermissions == null) {
|
||||
try {
|
||||
currentRolePermissions = applicationRoleControl.getRolePermissions(currentRole);
|
||||
} catch (AccountException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.debug(ex.toString());
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error while fetching role permissions", "see log for details");
|
||||
currentRolePermissions = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return currentRolePermissions;
|
||||
}
|
||||
}
|
||||
|
||||
public List<ApplicationPermissionEntity> getMissingPermissions() {
|
||||
if (currentRole == null) {
|
||||
missingApplicationsPermissions = new ArrayList<>();
|
||||
return missingApplicationsPermissions;
|
||||
} else {
|
||||
if (missingApplicationsPermissions == null) {
|
||||
missingApplicationsPermissions = applicationRoleControl.getNotAssignedApplicationPermissions(currentRole);
|
||||
|
||||
}
|
||||
return missingApplicationsPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
public void addRolePermission() {
|
||||
if (newPermission == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Please select a new permission first");
|
||||
} else {
|
||||
try {
|
||||
applicationRoleControl.addPermission(currentRole, newPermission);
|
||||
currentRolePermissions = null;
|
||||
missingApplicationsPermissions = null;
|
||||
} catch (AccountException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.debug(ex.toString());
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error while adding permission", ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeRolePermission() {
|
||||
if (currentPermission == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Please select a permission first");
|
||||
} else {
|
||||
try {
|
||||
applicationRoleControl.removePermission(currentRole, currentPermission);
|
||||
currentRolePermissions = null;
|
||||
missingApplicationsPermissions = null;
|
||||
} catch (AccountException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.debug(ex.toString());
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error while adding permission", ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* *** getter / setter *** */
|
||||
public void setApplicationView(ApplicationView applicationView) {
|
||||
this.applicationView = applicationView;
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity getCurrentRole() {
|
||||
return currentRole;
|
||||
}
|
||||
|
||||
public void setCurrentRole(ApplicationRoleEntity currentRole) {
|
||||
this.currentRole = currentRole;
|
||||
}
|
||||
|
||||
public ApplicationPermissionEntity getCurrentPermission() {
|
||||
return currentPermission;
|
||||
}
|
||||
|
||||
public void setCurrentPermission(ApplicationPermissionEntity currentPermission) {
|
||||
this.currentPermission = currentPermission;
|
||||
}
|
||||
|
||||
public ApplicationPermissionEntity getNewPermission() {
|
||||
return newPermission;
|
||||
}
|
||||
|
||||
public void setNewPermission(ApplicationPermissionEntity newPermission) {
|
||||
this.newPermission = newPermission;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2017 Joern Muehlencord <joern at muehlencord.de>.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountException;
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationPermissionEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.jeeutil.FacesUtil;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Inject;
|
||||
import org.primefaces.event.SelectEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@ViewScoped
|
||||
@Named("roleView")
|
||||
public class RoleView implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1669321020398119007L;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RoleView.class);
|
||||
|
||||
@Inject
|
||||
private ApplicationView applicationView;
|
||||
|
||||
@EJB
|
||||
ApplicationRoleControl applicationRoleControl;
|
||||
|
||||
private List<ApplicationRoleEntity> allRoles = null;
|
||||
private List<ApplicationPermissionEntity> currentRolePermissions = null;
|
||||
private List<ApplicationPermissionEntity> missingApplicationsPermissions = null;
|
||||
|
||||
private ApplicationRoleEntity currentRole;
|
||||
private ApplicationPermissionEntity currentPermission;
|
||||
private ApplicationPermissionEntity newPermission;
|
||||
|
||||
public ApplicationEntity getCurrentApplication() {
|
||||
return applicationView.getCurrentApplication();
|
||||
}
|
||||
|
||||
public List<ApplicationRoleEntity> getAllRoles() {
|
||||
if (allRoles == null) {
|
||||
allRoles = applicationRoleControl.getAllRoles(applicationView.getCurrentApplication());
|
||||
}
|
||||
return allRoles;
|
||||
}
|
||||
|
||||
public void startNewRole() {
|
||||
this.currentRole = new ApplicationRoleEntity(applicationView.getCurrentApplication());
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Created new current role: {}", currentRole.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void cancelEditRole() {
|
||||
this.currentRole = null;
|
||||
}
|
||||
|
||||
public void saveEditRole() {
|
||||
if ((currentRole == null) || (currentRole.getRoleName() == null) || (currentRole.getRoleName().trim().length() == 0)) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Permission name must not be null");
|
||||
} else if (currentRole.getId() == null) {
|
||||
applicationRoleControl.create(currentRole);
|
||||
allRoles = null; // force reload
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Role " + currentRole.getRoleName() + " created");
|
||||
} else {
|
||||
applicationRoleControl.update(currentRole);
|
||||
allRoles = null; // force reload
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Role " + currentRole.getRoleName() + " updated");
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteRole() {
|
||||
if (currentRole == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Please select a permission to edit");
|
||||
} else {
|
||||
try {
|
||||
applicationRoleControl.delete(currentRole);
|
||||
allRoles = null; // force reload
|
||||
currentRole = null;
|
||||
currentRolePermissions = null;
|
||||
} catch (AccountException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.debug(ex.toString());
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error while deleting permission.", ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getRoleSelected() {
|
||||
return currentRole != null;
|
||||
}
|
||||
|
||||
public boolean getPermissionSelected() {
|
||||
return currentPermission != null;
|
||||
}
|
||||
|
||||
public boolean getMissingPermissionAvailable() {
|
||||
return ((missingApplicationsPermissions != null) && (!missingApplicationsPermissions.isEmpty()));
|
||||
}
|
||||
|
||||
public void onRoleSelect(SelectEvent event) {
|
||||
currentRolePermissions = null;
|
||||
currentRolePermissions = getRolePermissions();
|
||||
missingApplicationsPermissions = null;
|
||||
missingApplicationsPermissions = getMissingPermissions();
|
||||
}
|
||||
|
||||
public List<ApplicationPermissionEntity> getRolePermissions() {
|
||||
if (currentRole == null) {
|
||||
currentRolePermissions = new ArrayList<>();
|
||||
return currentRolePermissions;
|
||||
} else {
|
||||
if (currentRolePermissions == null) {
|
||||
try {
|
||||
currentRolePermissions = applicationRoleControl.getRolePermissions(currentRole);
|
||||
} catch (AccountException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.debug(ex.toString());
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error while fetching role permissions", "see log for details");
|
||||
currentRolePermissions = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return currentRolePermissions;
|
||||
}
|
||||
}
|
||||
|
||||
public List<ApplicationPermissionEntity> getMissingPermissions() {
|
||||
if (currentRole == null) {
|
||||
missingApplicationsPermissions = new ArrayList<>();
|
||||
return missingApplicationsPermissions;
|
||||
} else {
|
||||
if (missingApplicationsPermissions == null) {
|
||||
missingApplicationsPermissions = applicationRoleControl.getNotAssignedApplicationPermissions(currentRole);
|
||||
|
||||
}
|
||||
return missingApplicationsPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
public void addRolePermission() {
|
||||
if (newPermission == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Please select a new permission first");
|
||||
} else {
|
||||
try {
|
||||
applicationRoleControl.addPermission(currentRole, newPermission);
|
||||
currentRolePermissions = null;
|
||||
missingApplicationsPermissions = null;
|
||||
} catch (AccountException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.debug(ex.toString());
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error while adding permission", ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeRolePermission() {
|
||||
if (currentPermission == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Please select a permission first");
|
||||
} else {
|
||||
try {
|
||||
applicationRoleControl.removePermission(currentRole, currentPermission);
|
||||
currentRolePermissions = null;
|
||||
missingApplicationsPermissions = null;
|
||||
} catch (AccountException ex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
} else {
|
||||
LOGGER.debug(ex.toString());
|
||||
}
|
||||
FacesUtil.addGlobalErrorMessage("Error while adding permission", ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* *** getter / setter *** */
|
||||
public void setApplicationView(ApplicationView applicationView) {
|
||||
this.applicationView = applicationView;
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity getCurrentRole() {
|
||||
return currentRole;
|
||||
}
|
||||
|
||||
public void setCurrentRole(ApplicationRoleEntity currentRole) {
|
||||
this.currentRole = currentRole;
|
||||
}
|
||||
|
||||
public ApplicationPermissionEntity getCurrentPermission() {
|
||||
return currentPermission;
|
||||
}
|
||||
|
||||
public void setCurrentPermission(ApplicationPermissionEntity currentPermission) {
|
||||
this.currentPermission = currentPermission;
|
||||
}
|
||||
|
||||
public ApplicationPermissionEntity getNewPermission() {
|
||||
return newPermission;
|
||||
}
|
||||
|
||||
public void setNewPermission(ApplicationPermissionEntity newPermission) {
|
||||
this.newPermission = newPermission;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.boundary.ApplicationRoleControl;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.business.application.boundary.ApplicationService;
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import java.io.Serializable;
|
||||
import javax.ejb.EJB;
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.boundary.ApplicationPermissionControl;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationPermissionEntity;
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationPermissionControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import java.io.Serializable;
|
||||
import javax.ejb.EJB;
|
||||
|
||||
Reference in New Issue
Block a user