protected RoleAndPrivilegeListResource toDTO( Privilege privilege ) { RoleAndPrivilegeListResource resource = new RoleAndPrivilegeListResource(); resource.setId( privilege.getId() ); resource.setName( privilege.getName() ); resource.setDescription( privilege.getDescription() ); resource.setType( "privilege" ); return resource; }
protected RoleAndPrivilegeListResource toDTO(Privilege privilege) { RoleAndPrivilegeListResource resource = new RoleAndPrivilegeListResource(); resource.setId(privilege.getId()); resource.setName(privilege.getName()); resource.setDescription(privilege.getDescription()); resource.setType("privilege"); return resource; }
protected CPrivilege toPrivilege( Privilege privilege ) { CPrivilege secPriv = new CPrivilege(); secPriv.setId( privilege.getId() ); secPriv.setName( privilege.getName() ); secPriv.setDescription( privilege.getDescription() ); secPriv.setReadOnly( privilege.isReadOnly() ); secPriv.setType( privilege.getType() ); if ( privilege.getProperties() != null && privilege.getProperties().entrySet() != null ) { for ( Entry<String, String> entry : privilege.getProperties().entrySet() ) { CProperty prop = new CProperty(); prop.setKey( entry.getKey() ); prop.setValue( entry.getValue() ); secPriv.addProperty( prop ); } } return secPriv; }
public PrivilegeStatusResource securityToRestModel(Privilege privilege, Request request, boolean appendResourceId) { PrivilegeStatusResource resource = new PrivilegeStatusResource(); for (Entry<String, String> prop : privilege.getProperties().entrySet()) { PrivilegeProperty privProp = new PrivilegeProperty(); privProp.setKey(prop.getKey()); privProp.setValue(prop.getValue()); resource.addProperty(privProp); } resource.setType(privilege.getType()); resource.setId(privilege.getId()); resource.setName(privilege.getName()); resource.setDescription(privilege.getDescription()); String resourceId = ""; if (appendResourceId) { resourceId = resource.getId(); } resource.setResourceURI(this.createChildReference(request, resourceId).toString()); resource.setUserManaged(!privilege.isReadOnly()); return resource; }
public PrivilegeStatusResource securityToRestModel( Privilege privilege, Request request, boolean appendResourceId ) { PrivilegeStatusResource resource = new PrivilegeStatusResource(); for ( Entry<String, String> prop : privilege.getProperties().entrySet() ) { PrivilegeProperty privProp = new PrivilegeProperty(); privProp.setKey( prop.getKey() ); privProp.setValue( prop.getValue() ); resource.addProperty( privProp ); } resource.setType( privilege.getType() ); resource.setId( privilege.getId() ); resource.setName( privilege.getName() ); resource.setDescription( privilege.getDescription() ); String resourceId = ""; if ( appendResourceId ) { resourceId = resource.getId(); } resource.setResourceURI( this.createChildReference( request, resourceId ).toString() ); resource.setUserManaged( !privilege.isReadOnly() ); return resource; }