mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +00:00
ACS-9009 REST API for setting preferences
This commit is contained in:
@@ -25,6 +25,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api.impl;
|
package org.alfresco.rest.api.impl;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
import org.alfresco.rest.api.People;
|
import org.alfresco.rest.api.People;
|
||||||
import org.alfresco.rest.api.Preferences;
|
import org.alfresco.rest.api.Preferences;
|
||||||
@@ -35,12 +41,6 @@ import org.alfresco.rest.framework.resource.parameters.Paging;
|
|||||||
import org.alfresco.service.cmr.preference.PreferenceService;
|
import org.alfresco.service.cmr.preference.PreferenceService;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Centralises access to preference services and maps between representations.
|
* Centralises access to preference services and maps between representations.
|
||||||
*
|
*
|
||||||
|
@@ -25,6 +25,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api.people;
|
package org.alfresco.rest.api.people;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
import org.alfresco.rest.api.Preferences;
|
import org.alfresco.rest.api.Preferences;
|
||||||
import org.alfresco.rest.api.model.Preference;
|
import org.alfresco.rest.api.model.Preference;
|
||||||
import org.alfresco.rest.framework.WebApiDescription;
|
import org.alfresco.rest.framework.WebApiDescription;
|
||||||
@@ -34,9 +38,6 @@ import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResou
|
|||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
|
|
||||||
@RelationshipResource(name = "preferences", entityResource = PeopleEntityResource.class, title = "Person Preferences")
|
@RelationshipResource(name = "preferences", entityResource = PeopleEntityResource.class, title = "Person Preferences")
|
||||||
public class PersonPreferencesRelation implements RelationshipResourceAction.Read<Preference>, RelationshipResourceAction.ReadById<Preference>, RelationshipResourceAction.Update<Preference>, InitializingBean
|
public class PersonPreferencesRelation implements RelationshipResourceAction.Read<Preference>, RelationshipResourceAction.ReadById<Preference>, RelationshipResourceAction.Update<Preference>, InitializingBean
|
||||||
|
@@ -25,6 +25,20 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.framework.webscripts;
|
package org.alfresco.rest.framework.webscripts;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||||
|
import org.springframework.extensions.webscripts.WrappingWebScriptRequest;
|
||||||
|
import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.rest.framework.core.ResourceLocator;
|
import org.alfresco.rest.framework.core.ResourceLocator;
|
||||||
import org.alfresco.rest.framework.core.ResourceMetadata;
|
import org.alfresco.rest.framework.core.ResourceMetadata;
|
||||||
@@ -42,19 +56,6 @@ import org.alfresco.rest.framework.resource.parameters.Params;
|
|||||||
import org.alfresco.rest.framework.resource.parameters.Params.RecognizedParams;
|
import org.alfresco.rest.framework.resource.parameters.Params.RecognizedParams;
|
||||||
import org.alfresco.rest.framework.tools.RecognizedParamsExtractor;
|
import org.alfresco.rest.framework.tools.RecognizedParamsExtractor;
|
||||||
import org.alfresco.rest.framework.tools.RequestReader;
|
import org.alfresco.rest.framework.tools.RequestReader;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
|
||||||
import org.springframework.extensions.webscripts.WrappingWebScriptRequest;
|
|
||||||
import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest;
|
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the HTTP PUT for a Resource, equivalent to CRUD Update
|
* Handles the HTTP PUT for a Resource, equivalent to CRUD Update
|
||||||
@@ -131,7 +132,7 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//Fall through to unsupported.
|
// Fall through to unsupported.
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedResourceOperationException("PUT not supported for this request.");
|
throw new UnsupportedResourceOperationException("PUT not supported for this request.");
|
||||||
}
|
}
|
||||||
@@ -141,7 +142,7 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
|
|||||||
* Returns the basic content info from the request.
|
* Returns the basic content info from the request.
|
||||||
*
|
*
|
||||||
* @param req
|
* @param req
|
||||||
* WebScriptRequest
|
* WebScriptRequest
|
||||||
* @return BasicContentInfo
|
* @return BasicContentInfo
|
||||||
*/
|
*/
|
||||||
private BasicContentInfo getContentInfo(WebScriptRequest req)
|
private BasicContentInfo getContentInfo(WebScriptRequest req)
|
||||||
@@ -167,7 +168,7 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
|
|||||||
* Returns the input stream for the request
|
* Returns the input stream for the request
|
||||||
*
|
*
|
||||||
* @param req
|
* @param req
|
||||||
* WebScriptRequest
|
* WebScriptRequest
|
||||||
* @return InputStream
|
* @return InputStream
|
||||||
*/
|
*/
|
||||||
private InputStream getStream(WebScriptRequest req)
|
private InputStream getStream(WebScriptRequest req)
|
||||||
@@ -196,9 +197,9 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
|
|||||||
* Executes the action on the resource
|
* Executes the action on the resource
|
||||||
*
|
*
|
||||||
* @param resource
|
* @param resource
|
||||||
* ResourceWithMetadata
|
* ResourceWithMetadata
|
||||||
* @param params
|
* @param params
|
||||||
* parameters to use
|
* parameters to use
|
||||||
* @return anObject the result of the execute
|
* @return anObject the result of the execute
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user