started to add application support for roles
This commit is contained in:
@ -6,6 +6,7 @@ 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.AccountStatus;
|
||||
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;
|
||||
@ -56,9 +57,9 @@ public class AccountView implements Serializable {
|
||||
return accountList;
|
||||
}
|
||||
|
||||
public List<ApplicationRoleEntity> getAllApplicationRoles() {
|
||||
public List<ApplicationRoleEntity> getAllApplicationRoles(ApplicationEntity application) {
|
||||
if (applicationRoles == null) {
|
||||
applicationRoles = appliationRoleService.getAllRoles();
|
||||
applicationRoles = appliationRoleService.getAllRoles(application);
|
||||
}
|
||||
return applicationRoles;
|
||||
}
|
||||
|
||||
@ -19,14 +19,15 @@ import de.muehlencord.shared.account.business.account.boundary.ApplicationRoleCo
|
||||
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.enterprise.context.SessionScoped;
|
||||
import javax.inject.Named;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.ManagedProperty;
|
||||
import org.primefaces.event.SelectEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -35,23 +36,19 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@ManagedBean(name = "roleView")
|
||||
@SessionScoped
|
||||
@Named
|
||||
public class GroupView implements Serializable {
|
||||
public class RoleView implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1669321020398119007L;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GroupView.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RoleView.class);
|
||||
|
||||
@ManagedProperty(value = "#{applicationView}")
|
||||
private ApplicationView applicationView;
|
||||
|
||||
@EJB
|
||||
ApplicationRoleControl applicationRoleControl;
|
||||
|
||||
@Size(max = 80)
|
||||
private String newRoleName;
|
||||
@Size(max = 200)
|
||||
private String newRoleDescription;
|
||||
// flag to determine whether a role is selected or not
|
||||
private boolean isPermissionSelected = false;
|
||||
|
||||
private List<ApplicationRoleEntity> allRoles = null;
|
||||
private List<ApplicationPermissionEntity> currentRolePermissions = null;
|
||||
private List<ApplicationPermissionEntity> missingApplicationsPermissions = null;
|
||||
@ -62,31 +59,30 @@ public class GroupView implements Serializable {
|
||||
|
||||
public List<ApplicationRoleEntity> getAllRoles() {
|
||||
if (allRoles == null) {
|
||||
allRoles = applicationRoleControl.getAllRoles();
|
||||
allRoles = applicationRoleControl.getAllRoles(applicationView.getCurrentApplication());
|
||||
}
|
||||
return allRoles;
|
||||
}
|
||||
|
||||
public void newRole() {
|
||||
if ((newRoleName == null) || (newRoleName.trim().length() == 0)) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Permission name must not be null");
|
||||
} else if ((newRoleDescription == null) || (newRoleDescription.trim().length() == 0)) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Permission name must not be null");
|
||||
} else {
|
||||
applicationRoleControl.createOrUpdate(newRoleName, newRoleDescription);
|
||||
allRoles = null; // force reload
|
||||
newRoleName = null;
|
||||
newRoleDescription = null;
|
||||
}
|
||||
public void startNewRole() {
|
||||
this.currentRole = new ApplicationRoleEntity(applicationView.getCurrentApplication());
|
||||
}
|
||||
|
||||
public void editRole() {
|
||||
if (currentRole == null) {
|
||||
FacesUtil.addGlobalErrorMessage("Error", "Please select a permission to edit");
|
||||
} else {
|
||||
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
|
||||
newRoleName = currentRole.getRoleName();
|
||||
newRoleDescription = currentRole.getRoleDescription();
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Role " + currentRole.getRoleName() + " created");
|
||||
} else {
|
||||
applicationRoleControl.create(currentRole);
|
||||
allRoles = null; // force reload
|
||||
FacesUtil.addGlobalInfoMessage("Info", "Role " + currentRole.getRoleName() + " updated");
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,6 +106,10 @@ public class GroupView implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getPermissionSelected() {
|
||||
return currentPermission != null;
|
||||
}
|
||||
|
||||
public void onRoleSelect(SelectEvent event) {
|
||||
currentRolePermissions = null;
|
||||
currentRolePermissions = getRolePermissions();
|
||||
@ -192,15 +192,19 @@ public class GroupView implements Serializable {
|
||||
|
||||
}
|
||||
|
||||
public void selectPermission() {
|
||||
this.isPermissionSelected = true;
|
||||
}
|
||||
|
||||
public void deselectPermission() {
|
||||
this.isPermissionSelected = false;
|
||||
}
|
||||
// public void selectPermission() {
|
||||
// this.isPermissionSelected = true;
|
||||
// }
|
||||
//
|
||||
// public void deselectPermission() {
|
||||
// this.isPermissionSelected = false;
|
||||
// }
|
||||
|
||||
/* *** getter / setter *** */
|
||||
public void setApplicationView(ApplicationView applicationView) {
|
||||
this.applicationView = applicationView;
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity getCurrentRole() {
|
||||
return currentRole;
|
||||
}
|
||||
@ -217,22 +221,6 @@ public class GroupView implements Serializable {
|
||||
this.currentPermission = currentPermission;
|
||||
}
|
||||
|
||||
public String getNewRoleName() {
|
||||
return newRoleName;
|
||||
}
|
||||
|
||||
public void setNewRoleName(String newRoleName) {
|
||||
this.newRoleName = newRoleName;
|
||||
}
|
||||
|
||||
public String getNewRoleDescription() {
|
||||
return newRoleDescription;
|
||||
}
|
||||
|
||||
public void setNewRoleDescription(String newRoleDescription) {
|
||||
this.newRoleDescription = newRoleDescription;
|
||||
}
|
||||
|
||||
public ApplicationPermissionEntity getNewPermission() {
|
||||
return newPermission;
|
||||
}
|
||||
@ -241,12 +229,4 @@ public class GroupView implements Serializable {
|
||||
this.newPermission = newPermission;
|
||||
}
|
||||
|
||||
public boolean isIsPermissionSelected() {
|
||||
return isPermissionSelected;
|
||||
}
|
||||
|
||||
public void setIsPermissionSelected(boolean isPermissionSelected) {
|
||||
this.isPermissionSelected = isPermissionSelected;
|
||||
}
|
||||
|
||||
}
|
||||
@ -129,3 +129,4 @@ label_phoneNumber=Phone Number
|
||||
label_template_waitlist_cancelled=Waitlist cancelled mail template
|
||||
msgs_menu_status=Status
|
||||
menu_status=Status
|
||||
button_add=Add
|
||||
|
||||
@ -130,3 +130,4 @@ label_phoneNumber=Telefonnummer
|
||||
label_template_waitlist_cancelled=Vorlage Warteliste Abbruch
|
||||
msgs_menu_status=Status
|
||||
menu_status=Status
|
||||
button_add=Hinzuf\u00fcgen
|
||||
|
||||
@ -130,3 +130,4 @@ label_phoneNumber=Phone Number
|
||||
label_template_waitlist_cancelled=Waitlist cancelled mail template
|
||||
msgs_menu_status=Status
|
||||
menu_status=Status
|
||||
button_add=Add
|
||||
|
||||
@ -86,9 +86,6 @@
|
||||
<p:commandButton styleClass="btn btn-success btn-block" onclick="showBar()"
|
||||
action="#{loginView.authenticate}" oncomplete="if(args.validationFailed) { hideBar()}"
|
||||
value="Sign In" process="@form" update="@form" icon="fa fa-sign-in" iconPos="left"/>
|
||||
<p> </p>
|
||||
<p:commandButton styleClass="btn btn-primary btn-block" action="#{menuView.publicHome}"
|
||||
value="Home" immediate="true" icon="fa fa-home" iconPos="left" ajax="false"/>
|
||||
</div>
|
||||
</div>
|
||||
</h:form>
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
</ui:define>
|
||||
|
||||
<ui:define name="description">
|
||||
List all accounts
|
||||
for #{applicationView.currentApplication.applicationName}
|
||||
</ui:define>
|
||||
|
||||
<ui:define name="body">
|
||||
|
||||
@ -9,60 +9,51 @@
|
||||
xmlns:composite="http://xmlns.jcp.org/jsf/composite/composite">
|
||||
|
||||
<ui:define name="title">
|
||||
Group Overview
|
||||
Roles Overview
|
||||
</ui:define>
|
||||
|
||||
<ui:define name="description">
|
||||
List all groups
|
||||
for #{applicationView.currentApplication.applicationName}
|
||||
</ui:define>
|
||||
|
||||
<ui:define name="body">
|
||||
<h:form id="groupForm">
|
||||
<p:panel styleClass="card no-border">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-12 ui-md-3">
|
||||
<div class="ui-inputgroup">
|
||||
<span class="ui-inputgroup-addon"><i style="font-size: 20px" class="fa fa-user"></i></span>
|
||||
<p:inputText id="newName" value="#{groupView.newRoleName}" placeholder="#{msgs.label_name}" maxlength="80" size="30" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-12 ui-md-3">
|
||||
<div class="ui-inputgroup">
|
||||
<span class="ui-inputgroup-addon"><i style="font-size: 20px" class="fa fa-user"></i></span>
|
||||
<p:inputText id="newDescription" value="#{groupView.newRoleDescription}" placeholder="#{msgs.label_description}" maxlength="200" size="40" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-12 ui-md-2">
|
||||
<p:commandButton icon="fa fa-plus" value="#{msgs.button_save}" action="#{groupView.newRole}" update="groupForm" styleClass="btn-primary btn-block"/>
|
||||
</div>
|
||||
<div class="ui-g-12 ui-md-2">
|
||||
<p:commandButton icon="fa fa-pencil" value="#{msgs.button_edit}" action="#{groupView.editRole}" update="groupForm" styleClass="btn-teal btn-block"/>
|
||||
</div>
|
||||
<div class="ui-g-12 ui-md-2">
|
||||
<p:commandButton icon="fa fa-trash-o" value="#{msgs.button_delete}" action="#{groupView.deleteRole}" update="groupForm" styleClass="btn-danger btn-block">
|
||||
<p:confirm header="Confirmation" message="Are you sure?" icon="fa fa-exclamation-triangle" />
|
||||
</p:commandButton>
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
|
||||
|
||||
|
||||
<p:dataTable id="groupTable" value="#{groupView.allRoles}" var="role" rowKey="#{role.id}" styleClass="box-solid box-primary"
|
||||
selectionMode="single" selection="#{groupView.currentRole}">
|
||||
<p:ajax event="rowSelect" update=":groupForm:permissionTable" listener="#{groupView.onRoleSelect}" />
|
||||
<h:form id="roleForm">
|
||||
<p:dataTable id="roleTable" value="#{roleView.allRoles}" var="role" rowKey="#{role.id}" styleClass="box-primary"
|
||||
selectionMode="single" selection="#{roleView.currentRole}">
|
||||
<!--<p:ajax event="rowSelect" update="roleForm:permissionTable:addPermissionButton,:roleForm:permissionTable:deletePermissionButton" listener="#{roleView.onRoleSelect}" />-->
|
||||
<p:column headerText="Role name">
|
||||
<h:outputText value="#{role.roleName}" />
|
||||
</p:column>
|
||||
<p:column headerText="Role description">
|
||||
<h:outputText value="#{role.roleDescription}" />
|
||||
</p:column>
|
||||
|
||||
|
||||
<f:facet name="footer">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="col-sm-12 col-md-2" style="margin-top:10px">
|
||||
<p:commandButton id="newRoleButton" icon="fa fa-plus" value="#{msgs.button_new}" actionListener="#{roleView.startNewRole}"
|
||||
update="editDialog" oncomplete="PF('editDialogVar').show();" styleClass="btn-primary btn-block"/>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-2" style="margin-top:10px">
|
||||
<p:commandButton id="editRoleButton" icon="fa fa-pencil" value="#{msgs.button_edit}"
|
||||
update="editDialog" oncomplete="PF('editDialogVar').show();" styleClass="btn-teal btn-block"/>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-2" style="margin-top:10px">
|
||||
<p:commandButton id="deleteRoleButton" icon="fa fa-trash-o" value="#{msgs.button_delete}" action="#{roleView.deleteRole}" update="roleTable" styleClass="btn-danger btn-block">
|
||||
<p:confirm header="Confirmation" message="Are you sure?" icon="fa fa-exclamation-triangle" />
|
||||
</p:commandButton>
|
||||
</div>
|
||||
</div>
|
||||
</f:facet>
|
||||
</p:dataTable>
|
||||
|
||||
<p:dataTable id="permissionTable" value="#{groupView.rolePermissions}" var="permission" rowKey="#{permission.id}" styleClass="box-teal"
|
||||
selectionMode="single" selection="#{groupView.currentPermission}">
|
||||
<p:ajax event="rowSelect" update="deletePermissionButton" listener="#{groupView.selectPermission}" />
|
||||
<p:ajax event="rowUnselect" update="deletePermissionButton" listener="#{groupView.deselectPermission}" />
|
||||
<p:spacer height="15px;" />
|
||||
|
||||
<p:dataTable id="permissionTable" value="#{roleView.rolePermissions}" var="permission" rowKey="#{permission.id}" styleClass="box-teal"
|
||||
selectionMode="single" selection="#{roleView.currentPermission}">
|
||||
<p:ajax event="rowSelect" update="addPermissionButton, deletePermissionButton" />
|
||||
<p:ajax event="rowUnselect" update="addPermissionButton, deletePermissionButton" />
|
||||
|
||||
<p:column headerText="Permission name">
|
||||
<h:outputText value="#{permission.permissionName}" />
|
||||
@ -71,17 +62,17 @@
|
||||
<h:outputText value="#{permission.permissionDescription}" />
|
||||
</p:column>
|
||||
<f:facet name="footer" >
|
||||
<p:selectOneMenu value="#{groupView.newPermission}" converter="omnifaces.SelectItemsConverter" >
|
||||
<f:selectItems id="permissionListItems" value="#{groupView.missingPermissions}" var="missingPermission" itemLabel="#{missingPermission.permissionName}" itemValue="#{missingPermission}" />
|
||||
<p:selectOneMenu value="#{roleView.newPermission}" converter="omnifaces.SelectItemsConverter" >
|
||||
<f:selectItems id="permissionListItems" value="#{roleView.missingPermissions}" var="missingPermission" itemLabel="#{missingPermission.permissionName}" itemValue="#{missingPermission}" />
|
||||
</p:selectOneMenu>
|
||||
<div class="ui-g-12 ui-md-2">
|
||||
<p:commandButton id="addPermissionButton" icon="fa fa-plus" value="#{msgs.button_new}" action="#{groupView.addRolePermission}"
|
||||
update=":groupForm:permissionTable" styleClass="btn-primary btn-block"/>
|
||||
<p:commandButton id="addPermissionButton" icon="fa fa-plus" value="#{msgs.button_add}" action="#{roleView.addRolePermission}"
|
||||
update=":roleForm:permissionTable" styleClass="btn-primary btn-block" disabled="#"/>
|
||||
</div>
|
||||
<div class="ui-g-12 ui-md-2">
|
||||
<p:commandButton id="deletePermissionButton" icon="fa fa-trash-o" value="Delete" update=":groupForm:groupTable,:groupForm:permissionTable"
|
||||
action="#{groupView.removeRolePermission}" styleClass="btn-danger btn-block"
|
||||
disabled="#{!groupView.isPermissionSelected}" >
|
||||
<p:commandButton id="deletePermissionButton" icon="fa fa-trash-o" value="#{msgs.button_delete}" update=":roleForm:permissionTable"
|
||||
action="#{roleView.removeRolePermission}" styleClass="btn-danger btn-block"
|
||||
disabled="#{!roleView.permissionSelected}" >
|
||||
<p:confirm header="Confirmation" message="Are you sure?" icon="fa fa-exclamation-triangle" />
|
||||
</p:commandButton>
|
||||
</div>
|
||||
@ -91,6 +82,47 @@
|
||||
<composite:confirmationDialog />
|
||||
|
||||
</h:form>
|
||||
</ui:define>
|
||||
|
||||
<p:dialog id="editDialog" widgetVar="editDialogVar" header="Edit account" width="600"
|
||||
modal="true" appendTo="@(body)" showEffect="fade" hideEffect="fade" styleClass="box-solid box-primary" >
|
||||
<h:form id="editDialogForm">
|
||||
<p:messages id="editDialogMessages" showDetail="true" showIcon="true" showSummary="true">
|
||||
<p:autoUpdate />
|
||||
</p:messages>
|
||||
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="col-sm-12 col-md-3">
|
||||
<p:outputLabel for="newName" value="Role name" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6">
|
||||
<p:inputText id="newName" value="#{roleView.currentRole.roleName}" placeholder="#{msgs.label_name}" maxlength="80" size="30" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-3">
|
||||
<p:message for="newName"><p:autoUpdate /></p:message>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-3">
|
||||
<p:outputLabel for="newDescription" value="Description" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6">
|
||||
<p:inputText id="newDescription" value="#{roleView.currentRole.roleDescription}" placeholder="#{msgs.label_description}" maxlength="200" size="40" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-3">
|
||||
<p:message for="newDescription"><p:autoUpdate /></p:message>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-md-6">
|
||||
<p:spacer height="10px" />
|
||||
<p:commandButton value="Save" action="#{roleView.saveEditRole}" styleClass="btn-primary btn-block"
|
||||
oncomplete="if (args && !args.validationFailed) PF('editDialogVar').hide();" update=":roleForm:roleTable" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6">
|
||||
<p:spacer height="10px" />
|
||||
<p:commandButton value="Cancel" action="#{roleView.cancelEditRole}" immediate="true" styleClass="btn-teal btn-block"
|
||||
oncomplete="PF('editDialogVar').hide();" />
|
||||
</div>
|
||||
</div>
|
||||
</h:form>
|
||||
</p:dialog>
|
||||
</ui:define>
|
||||
|
||||
</ui:composition>
|
||||
|
||||
@ -8,6 +8,7 @@ package de.muehlencord.shared.account.business.account.boundary;
|
||||
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 java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -37,8 +38,9 @@ public class ApplicationRoleControl implements Serializable {
|
||||
@PersistenceContext
|
||||
EntityManager em;
|
||||
|
||||
public List<ApplicationRoleEntity> getAllRoles() {
|
||||
public List<ApplicationRoleEntity> getAllRoles(ApplicationEntity application) {
|
||||
Query query = em.createNamedQuery("ApplicationRoleEntity.findAll");
|
||||
query.setParameter ("application", application);
|
||||
|
||||
List<ApplicationRoleEntity> roles = query.getResultList();
|
||||
if (roles == null) {
|
||||
@ -49,10 +51,10 @@ public class ApplicationRoleControl implements Serializable {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void createOrUpdate(String name, String description) {
|
||||
public void createOrUpdate(ApplicationEntity application, String name, String description) {
|
||||
ApplicationRoleEntity role = findByName(name);
|
||||
if (role == null) {
|
||||
role = new ApplicationRoleEntity(name, description);
|
||||
role = new ApplicationRoleEntity(application, name, description);
|
||||
em.persist(role);
|
||||
} else {
|
||||
role.setRoleDescription(description);
|
||||
@ -60,14 +62,24 @@ public class ApplicationRoleControl implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public void delete(ApplicationRoleEntity permission) throws AccountException {
|
||||
ApplicationRoleEntity existingPermission = attach(permission);
|
||||
em.remove(existingPermission);
|
||||
@Transactional
|
||||
public void create(ApplicationRoleEntity role) {
|
||||
em.persist(role);
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity attach(ApplicationRoleEntity permission) throws AccountException {
|
||||
@Transactional
|
||||
public void update (ApplicationRoleEntity role) {
|
||||
em.merge(role);
|
||||
}
|
||||
|
||||
public void delete(ApplicationRoleEntity role) throws AccountException {
|
||||
ApplicationRoleEntity existingRole = attach(role);
|
||||
em.remove(existingRole);
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity attach(ApplicationRoleEntity role) throws AccountException {
|
||||
try {
|
||||
return em.merge(permission);
|
||||
return em.merge(role);
|
||||
} catch (OptimisticLockException ex) {
|
||||
throw new AccountException("Entity updated / deleted, please reload", true);
|
||||
}
|
||||
|
||||
@ -31,9 +31,9 @@ import org.hibernate.annotations.Type;
|
||||
@Table(name = "application_role")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "ApplicationRoleEntity.findAll", query = "SELECT a FROM ApplicationRoleEntity a ORDER BY a.roleName")
|
||||
, @NamedQuery(name = "ApplicationRoleEntity.findByRoleName", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.roleName = :roleName")
|
||||
, @NamedQuery(name = "ApplicationRoleEntity.findByRoleDescription", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.roleDescription = :roleDescription")})
|
||||
@NamedQuery(name = "ApplicationRoleEntity.findAll", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.application = :application ORDER BY a.roleName"),
|
||||
@NamedQuery(name = "ApplicationRoleEntity.findByRoleName", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.application = :application AND a.roleName = :roleName"),
|
||||
@NamedQuery(name = "ApplicationRoleEntity.findByRoleDescription", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.application = :application AND a.roleDescription = :roleDescription")})
|
||||
|
||||
public class ApplicationRoleEntity implements Serializable {
|
||||
|
||||
@ -71,18 +71,23 @@ public class ApplicationRoleEntity implements Serializable {
|
||||
public ApplicationRoleEntity() {
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity(UUID id) {
|
||||
this.id = id;
|
||||
public ApplicationRoleEntity(ApplicationEntity application) {
|
||||
this.id = null;
|
||||
this.application = application;
|
||||
this.roleName = null;
|
||||
this.roleDescription = null;
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity(String roleName, String roleDescription) {
|
||||
public ApplicationRoleEntity(ApplicationEntity application, String roleName, String roleDescription) {
|
||||
this.id = null;
|
||||
this.application = application;
|
||||
this.roleName = roleName;
|
||||
this.roleDescription = roleDescription;
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity(UUID id, String roleName, String roleDescription) {
|
||||
public ApplicationRoleEntity(UUID id, ApplicationEntity application, String roleName, String roleDescription) {
|
||||
this.id = id;
|
||||
this.application = application;
|
||||
this.roleName = roleName;
|
||||
this.roleDescription = roleDescription;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user