protected RoleAndPrivilegeListResource toDTO(Role role) { RoleAndPrivilegeListResource resource = new RoleAndPrivilegeListResource(); resource.setId(role.getRoleId()); resource.setName(role.getName()); resource.setDescription(role.getDescription()); resource.setType("role"); return resource; }
protected RoleAndPrivilegeListResource toDTO( Role role ) { RoleAndPrivilegeListResource resource = new RoleAndPrivilegeListResource(); resource.setId( role.getRoleId() ); resource.setName( role.getName() ); resource.setDescription( role.getDescription() ); resource.setType( "role" ); return resource; }
protected CRole toRole( Role role ) { CRole secRole = new CRole(); secRole.setId( role.getRoleId() ); secRole.setName( role.getName() ); secRole.setDescription( role.getDescription() ); secRole.setReadOnly( role.isReadOnly() ); // null check if ( role.getPrivileges() != null ) { secRole.setPrivileges( new ArrayList<String>( role.getPrivileges() ) ); } else { secRole.setPrivileges( new ArrayList<String>() ); } // null check if ( role.getRoles() != null ) { secRole.setRoles( new ArrayList<String>( role.getRoles() ) ); } else { secRole.setRoles( new ArrayList<String>() ); } return secRole; }
public RoleResource securityToRestModel(Role role, Request request, boolean appendResourceId) { // and will convert to the rest object RoleResource resource = new RoleResource(); resource.setDescription(role.getDescription()); resource.setId(role.getRoleId()); resource.setName(role.getName()); String resourceId = ""; if (appendResourceId) { resourceId = resource.getId(); } resource.setResourceURI(this.createChildReference(request, resourceId).toString()); resource.setUserManaged(!role.isReadOnly()); for (String roleId : role.getRoles()) { resource.addRole(roleId); } for (String privId : role.getPrivileges()) { resource.addPrivilege(privId); } return resource; }
public RoleResource securityToRestModel( Role role, Request request, boolean appendResourceId ) { // and will convert to the rest object RoleResource resource = new RoleResource(); resource.setDescription( role.getDescription() ); resource.setId( role.getRoleId() ); resource.setName( role.getName() ); String resourceId = ""; if ( appendResourceId ) { resourceId = resource.getId(); } resource.setResourceURI( this.createChildReference( request, resourceId ).toString() ); resource.setUserManaged( !role.isReadOnly() ); for ( String roleId : role.getRoles() ) { resource.addRole( roleId ); } for ( String privId : role.getPrivileges() ) { resource.addPrivilege( privId ); } return resource; }