public class BaseMdsResource extends AbstractResource
Modifier and Type | Field and Description |
---|---|
static String |
DOI_PARAMETER
The parameter that describes the DOI name "doi".
|
private DoiMdsApplication |
doiApp
DOI Mds application.
|
protected org.apache.logging.log4j.Logger |
LOG
Logger.
|
static String |
URL_PARAMETER
The parameter that describes the landing page related to the DOI
"url".
|
Constructor and Description |
---|
BaseMdsResource() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkPermission(String doiName,
String selectedRole)
Checks permissions to access according to the role of the user and the
DOI name.
|
protected void |
describeDelete(org.restlet.ext.wadl.MethodInfo info)
Describes WADL representation for
checkPermission(java.lang.String, java.lang.String) method. |
protected void |
describePost(org.restlet.ext.wadl.MethodInfo info)
Describes WADL representation for
checkPermission(java.lang.String, java.lang.String) method. |
protected void |
doInit()
Init.
|
protected org.restlet.ext.wadl.RepresentationInfo |
explainRepresentation()
Body representation.
|
String |
extractSelectedRoleFromRequestIfExists()
Extract selectedRole from HTTP header.
|
String |
getAttributePath(String basePath)
Retrieves path by cleaning query parameters.
|
DoiMdsApplication |
getDoiApp()
Returns the Mds application.
|
private String |
getRoleName(String selectedRole)
Returns the suffix project with which the user is associated.
|
private String |
getRoleNameWhenNotProvidedInHeader()
Get the role when the role is not provided in the header.
|
private String |
getRoleNameWhenRoleInHeader(String selectedRole)
Get the role when the role is in the header.
|
private boolean |
hasNoRole(List<org.restlet.security.Role> roles)
Tests if the user has no role.
|
private boolean |
hasSelectedRole(String suffusedWithRole)
Tests if the user has selected a role.
|
private boolean |
hasSingleRole(List<org.restlet.security.Role> roles)
Tests if the user has only one single role.
|
addRequestDocToMethod, addRequestDocToMethod, addRequestDocToMethod, addResponseDocToMethod, createQueryParamDoc, createQueryRepresentationDoc, createResponseDoc, createResponseDoc, createResponseDoc, htmlRepresentation, isObjectExist, isObjectNotExist, isValueExist, isValueNotExist, stringRepresentation
canDescribe, createHtmlRepresentation, createWadlRepresentation, describe, describe, describe, describe, describe, describe, describe, describe, describeGet, describeMethod, describeMethod, describeOptions, describeParameters, describePatch, describePut, getDescription, getName, getParameter, getParameters, getPreferredWadlVariant, getResourcePath, getResourcesBase, getWadlVariants, isAutoDescribing, options, setAutoDescribing, setDescription, setName
abort, commit, delete, delete, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doNegotiatedHandle, get, get, getAttribute, getInfo, getInfo, getOnSent, getPreferredVariant, getRole, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, patch, patch, post, post, put, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDimensions, setExisting, setLocationRef, setLocationRef, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions
doError, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toString
public static final String DOI_PARAMETER
public static final String URL_PARAMETER
protected volatile org.apache.logging.log4j.Logger LOG
private volatile DoiMdsApplication doiApp
protected void doInit() throws DoiServerException
doInit
in class AbstractResource
DoiServerException
- - if a problem happensprivate boolean hasSingleRole(List<org.restlet.security.Role> roles)
roles
- rolesprivate boolean hasNoRole(List<org.restlet.security.Role> roles)
roles
- rolesprivate boolean hasSelectedRole(String suffusedWithRole)
suffusedWithRole
- selected roleprivate String getRoleName(String selectedRole) throws DoiServerException
selectedRole
- selected roleDoiServerException
- - CLIENT_ERROR_FORBIDDEN if the role is not
allowed to use this feature - CLIENT_ERROR_UNAUTHORIZED if no role is
provided - CLIENT_ERROR_CONFLICT if a user is associated to more than one
roleprivate String getRoleNameWhenNotProvidedInHeader()
private String getRoleNameWhenRoleInHeader(String selectedRole)
selectedRole
- role from the header@Requirement(reqId="DOI_AUTO_030", reqName="V\u00e9rification du projet") protected void checkPermission(String doiName, String selectedRole) throws DoiServerException
doiName
- DOI nameselectedRole
- Selected roleDoiServerException
- Creates a
suffixProject for a given project name
@Requirement(reqId="DOI_AUTO_020", reqName="S\u00e9lection du r\u00f4le") public String extractSelectedRoleFromRequestIfExists()
protected org.restlet.ext.wadl.RepresentationInfo explainRepresentation()
protected void describeDelete(org.restlet.ext.wadl.MethodInfo info)
checkPermission(java.lang.String, java.lang.String)
method. The
different representations are the followings:
describeDelete
in class org.restlet.ext.wadl.WadlServerResource
info
- Method informationprotected void describePost(org.restlet.ext.wadl.MethodInfo info)
checkPermission(java.lang.String, java.lang.String)
method. The
different representations are the followings:
describePost
in class org.restlet.ext.wadl.WadlServerResource
info
- Method informationpublic String getAttributePath(String basePath)
basePath
- base path to removepublic DoiMdsApplication getDoiApp()
Copyright © 2017–2020 CNES. All rights reserved.