@Path(value="/registries") public class MetadataRegistryResource extends Resource
Modifier and Type | Field and Description |
---|---|
protected AuthorizeService |
authorizeService |
protected MetadataFieldService |
metadataFieldService |
protected MetadataSchemaService |
metadataSchemaService |
protected SiteService |
siteService |
servletContext
Constructor and Description |
---|
MetadataRegistryResource() |
Modifier and Type | Method and Description |
---|---|
MetadataField |
createMetadataField(String schemaPrefix,
MetadataField field,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Create a new metadata field within a schema.
|
MetadataSchema |
createSchema(MetadataSchema schema,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Create schema in the schema registry.
|
javax.ws.rs.core.Response |
deleteMetadataField(Integer fieldId,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Delete metadata field from the DSpace metadata registry
|
javax.ws.rs.core.Response |
deleteSchema(Integer schemaId,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Delete metadata schema from the DSpace metadata registry
|
MetadataField |
getMetadataField(Integer fieldId,
String expand,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Returns metadata field with basic properties.
|
MetadataField |
getMetadataFieldQualified(String schemaPrefix,
String element,
String qualifier,
String expand,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Returns metadata field with basic properties.
|
MetadataField |
getMetadataFieldUnqualified(String schemaPrefix,
String element,
String expand,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Returns metadata field with basic properties.
|
MetadataSchema |
getSchema(String schemaPrefix,
String expand,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Returns metadata schema with basic properties.
|
MetadataSchema[] |
getSchemas(String expand,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Return all metadata registry items in DSpace.
|
javax.ws.rs.core.Response |
updateMetadataField(Integer fieldId,
MetadataField field,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Update metadata field.
|
createContext, getActionString, mySplit, processException, processFinally, writeStats
protected AuthorizeService authorizeService
protected MetadataFieldService metadataFieldService
protected MetadataSchemaService metadataSchemaService
protected SiteService siteService
@GET @Path(value="/schema") @Produces(value={"application/json","application/xml"}) public MetadataSchema[] getSchemas(@QueryParam(value="expand") @DefaultValue(value="fields") String expand, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
expand
- String in which is what you want to add to returned instance
of metadata schema. Options are: "all", "fields". Default value "fields".user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the metadata schema as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- It can be caused by creating context or while was problem
with reading schema from database(SQLException).@GET @Path(value="/schema/{schema_prefix}") @Produces(value={"application/json","application/xml"}) public MetadataSchema getSchema(@PathParam(value="schema_prefix") String schemaPrefix, @QueryParam(value="expand") @DefaultValue(value="fields") String expand, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
schemaPrefix
- Prefix for schema in DSpace.expand
- String in which is what you want to add to returned instance
of metadata schema. Options are: "all", "fields". Default value "fields".user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the metadata schema as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- Thrown if there was a problem with creating context or problem
with database reading. Also if id/prefix of schema is incorrect
or logged user into context has no permission to read.@GET @Path(value="/schema/{schema_prefix}/metadata-fields/{element}") @Produces(value={"application/json","application/xml"}) public MetadataField getMetadataFieldUnqualified(@PathParam(value="schema_prefix") String schemaPrefix, @PathParam(value="element") String element, @QueryParam(value="expand") String expand, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
schemaPrefix
- Prefix for schema in DSpace.element
- Unqualified element name for field in the metadata registry.expand
- String in which is what you want to add to returned instance
of the metadata field. Options are: "all", "parentSchema". Default value "".user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- Thrown if there was a problem with creating context or problem
with database reading. Also if id of field is incorrect
or logged user into context has no permission to read.@GET @Path(value="/schema/{schema_prefix}/metadata-fields/{element}/{qualifier}") @Produces(value={"application/json","application/xml"}) public MetadataField getMetadataFieldQualified(@PathParam(value="schema_prefix") String schemaPrefix, @PathParam(value="element") String element, @PathParam(value="qualifier") @DefaultValue(value="") String qualifier, @QueryParam(value="expand") String expand, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
schemaPrefix
- Prefix for schema in DSpace.element
- Element name for field in the metadata registry.qualifier
- Element name qualifier for field in the metadata registry.expand
- String in which is what you want to add to returned instance
of the metadata field. Options are: "all", "parentSchema". Default value "".user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- Thrown if there was a problem with creating context or problem
with database reading. Also if id of field is incorrect
or logged user into context has no permission to read.@GET @Path(value="/metadata-fields/{field_id}") @Produces(value={"application/json","application/xml"}) public MetadataField getMetadataField(@PathParam(value="field_id") Integer fieldId, @QueryParam(value="expand") @DefaultValue(value="parentSchema") String expand, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
fieldId
- Id of metadata field in DSpace.expand
- String in which is what you want to add to returned instance
of the metadata field. Options are: "all", "parentSchema". Default value "parentSchema".user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- Thrown if there was a problem with creating context or problem
with database reading. Also if id of field is incorrect
or logged user into context has no permission to read.@POST @Path(value="/schema") @Consumes(value={"application/json","application/xml"}) public MetadataSchema createSchema(MetadataSchema schema, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
schema
- Schema that will be added to the metadata registry.user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the schema as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- It can be thrown by SQLException, AuthorizeException and
ContextException.@POST @Path(value="/schema/{schema_prefix}/metadata-fields") @Consumes(value={"application/json","application/xml"}) public MetadataField createMetadataField(@PathParam(value="schema_prefix") String schemaPrefix, MetadataField field, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
schemaPrefix
- Prefix for schema in DSpace.field
- Field that will be added to the metadata registry for a schema.user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the schema as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- It can be thrown by SQLException, AuthorizeException and
ContextException.@PUT @Path(value="/metadata-fields/{field_id}") @Consumes(value={"application/json","application/xml"}) public javax.ws.rs.core.Response updateMetadataField(@PathParam(value="field_id") Integer fieldId, MetadataField field, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
fieldId
- Id of the field in the DSpace metdata registry.field
- Instance of the metadata field which will replace actual metadata field in
DSpace.user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the metadata field as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- Thrown if there was a problem with creating context or problem
with database reading or writing. Or problem with writing to
community caused by authorization.@DELETE @Path(value="/metadata-fields/{field_id}") public javax.ws.rs.core.Response deleteMetadataField(@PathParam(value="field_id") Integer fieldId, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
fieldId
- Id of the metadata field in DSpace.user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the metadata field as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- Thrown if there was a problem with creating context or problem
with database reading or deleting. Or problem with deleting
metadata field caused by IOException or authorization.@DELETE @Path(value="/schema/{schema_id}") public javax.ws.rs.core.Response deleteSchema(@PathParam(value="schema_id") Integer schemaId, @QueryParam(value="userIP") String user_ip, @QueryParam(value="userAgent") String user_agent, @QueryParam(value="xforwardedfor") String xforwardedfor, @Context javax.ws.rs.core.HttpHeaders headers, @Context javax.servlet.http.HttpServletRequest request) throws javax.ws.rs.WebApplicationException
schemaId
- Id of the metadata schema in DSpace.user_ip
- User's IP address.user_agent
- User agent string (specifies browser used and its version).xforwardedfor
- When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers
- If you want to access the metadata schema as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request
- Servlet's HTTP request object.javax.ws.rs.WebApplicationException
- Thrown if there was a problem with creating context or problem
with database reading or deleting. Or problem with deleting
metadata schema caused by IOException or authorization.Copyright © 2019 DuraSpace. All rights reserved.