mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Search-2096: Added missing API to update Site (#37)
This commit is contained in:
@@ -166,6 +166,19 @@ public class JsonBodyGenerator
|
|||||||
.add("title", title).build();
|
.add("title", title).build();
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to create a Json object for SiteBody with site title, description, visibility
|
||||||
|
* @param siteModel
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static String updateSiteRequest(SiteModel siteModel)
|
||||||
|
{
|
||||||
|
JsonObject value = defineJSON()
|
||||||
|
.add("title", siteModel.getTitle())
|
||||||
|
.add("description", siteModel.getDescription())
|
||||||
|
.add("visibility", siteModel.getVisibility().toString()).build();
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public static String process(String processDefinitionKey, UserModel assignee, boolean sendEmailNotifications, Priority priority)
|
public static String process(String processDefinitionKey, UserModel assignee, boolean sendEmailNotifications, Priority priority)
|
||||||
{
|
{
|
||||||
|
@@ -192,6 +192,38 @@ public class Site extends ModelRequest<Site>
|
|||||||
return restWrapper.processModel(RestSiteModel.class, request);
|
return restWrapper.processModel(RestSiteModel.class, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a site: Site title, description, visibility can be updated
|
||||||
|
* Body:
|
||||||
|
* {
|
||||||
|
* "title": "string",
|
||||||
|
* "description": "string",
|
||||||
|
* "visibility": "PRIVATE"
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Response:
|
||||||
|
* {
|
||||||
|
* "entry": {
|
||||||
|
* "id": "string",
|
||||||
|
* "guid": "string",
|
||||||
|
* "title": "string",
|
||||||
|
* "description": "string",
|
||||||
|
* "visibility": "PRIVATE",
|
||||||
|
* "preset": "string",
|
||||||
|
* "role": "SiteConsumer"
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @return the properties of an updated site
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public RestSiteModel updateSite(SiteModel site) throws Exception
|
||||||
|
{
|
||||||
|
String siteBody = JsonBodyGenerator.updateSiteRequest(site);
|
||||||
|
RestRequest request = RestRequest.requestWithBody(HttpMethod.PUT, siteBody, "sites/{siteId}", site.getId());
|
||||||
|
return restWrapper.processModel(RestSiteModel.class, request);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get site membership requests by using GET /site-membership-requests
|
* Get site membership requests by using GET /site-membership-requests
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user