mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Add clone REST service.
This commit is contained in:
parent
731df774a8
commit
5aca99a24f
@ -16,15 +16,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ...........................................................................................................
|
|
||||||
// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved
|
|
||||||
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc.
|
|
||||||
// The copyright notice above does not evidence any actual or intended
|
|
||||||
// publication of such source code.
|
|
||||||
//
|
|
||||||
// Last changed on 2007-04-03 09:29:20 (-0300), by: nachomanz. $Revision$
|
|
||||||
// ...........................................................................................................
|
|
||||||
|
|
||||||
package com.wisemapping.controller;
|
package com.wisemapping.controller;
|
||||||
|
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
|
@ -16,16 +16,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// ...........................................................................................................
|
|
||||||
// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved
|
|
||||||
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc.
|
|
||||||
// The copyright notice above does not evidence any actual or intended
|
|
||||||
// publication of such source code.
|
|
||||||
//
|
|
||||||
// Last changed on 2007-04-03 09:29:20 (-0300), by: nachomanz. $Revision$
|
|
||||||
// ...........................................................................................................
|
|
||||||
|
|
||||||
package com.wisemapping.controller;
|
package com.wisemapping.controller;
|
||||||
|
|
||||||
import com.wisemapping.exceptions.EmailNotExistsException;
|
import com.wisemapping.exceptions.EmailNotExistsException;
|
||||||
|
@ -16,15 +16,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ...........................................................................................................
|
|
||||||
// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved
|
|
||||||
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc.
|
|
||||||
// The copyright notice above does not evidence any actual or intended
|
|
||||||
// publication of such source code.
|
|
||||||
//
|
|
||||||
// Last changed on 2007-04-03 09:29:20 (-0300), by: nachomanz. $Revision$
|
|
||||||
// ...........................................................................................................
|
|
||||||
|
|
||||||
package com.wisemapping.controller;
|
package com.wisemapping.controller;
|
||||||
|
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
|
@ -16,14 +16,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ...........................................................................................................
|
|
||||||
// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved
|
|
||||||
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc.
|
|
||||||
// The copyright notice above does not evidence any actual or intended
|
|
||||||
// publication of such source code.
|
|
||||||
//
|
|
||||||
// Last changed on 2007-04-03 09:29:20 (-0300), by: nachomanz. $Revision$
|
|
||||||
// ...........................................................................................................
|
|
||||||
|
|
||||||
package com.wisemapping.mail;
|
package com.wisemapping.mail;
|
||||||
|
|
||||||
|
@ -16,15 +16,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ...........................................................................................................
|
|
||||||
// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved
|
|
||||||
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc.
|
|
||||||
// The copyright notice above does not evidence any actual or intended
|
|
||||||
// publication of such source code.
|
|
||||||
//
|
|
||||||
// Last changed on 2007-08-01 19:08:21 (-0300), by: imanzano. $Revision$
|
|
||||||
// ...........................................................................................................
|
|
||||||
|
|
||||||
package com.wisemapping.model;
|
package com.wisemapping.model;
|
||||||
|
|
||||||
import com.wisemapping.util.ZipUtils;
|
import com.wisemapping.util.ZipUtils;
|
||||||
@ -93,7 +84,11 @@ public class MindMap {
|
|||||||
|
|
||||||
public byte[] getZippedXml()
|
public byte[] getZippedXml()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return ZipUtils.stringToZip(new String(this.xml, UTF_8));
|
byte[] result = this.xml;
|
||||||
|
if (result != null) {
|
||||||
|
result = ZipUtils.stringToZip(new String(result, UTF_8));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZippedXml(byte[] xml)
|
public void setZippedXml(byte[] xml)
|
||||||
@ -234,4 +229,14 @@ public class MindMap {
|
|||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MindMap shallowClone() {
|
||||||
|
final MindMap result = new MindMap();
|
||||||
|
result.setDescription(this.getDescription());
|
||||||
|
result.setTitle(this.getTitle());
|
||||||
|
result.setProperties(this.getProperties());
|
||||||
|
result.setXml(this.getXml());
|
||||||
|
result.setTags(this.getTags());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class MindmapUser {
|
|||||||
return getRole() == UserRole.OWNER;
|
return getRole() == UserRole.OWNER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCollaborator() {
|
public boolean isColaborator() {
|
||||||
return getRole() == UserRole.COLLABORATOR;
|
return getRole() == UserRole.COLLABORATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.wisemapping.model.MindMap;
|
|||||||
import com.wisemapping.model.MindmapUser;
|
import com.wisemapping.model.MindmapUser;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.rest.model.RestMindmap;
|
import com.wisemapping.rest.model.RestMindmap;
|
||||||
|
import com.wisemapping.rest.model.RestMindmapInfo;
|
||||||
import com.wisemapping.rest.model.RestMindmapList;
|
import com.wisemapping.rest.model.RestMindmapList;
|
||||||
import com.wisemapping.security.Utils;
|
import com.wisemapping.security.Utils;
|
||||||
import com.wisemapping.service.MindmapService;
|
import com.wisemapping.service.MindmapService;
|
||||||
@ -25,7 +26,6 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Pendings:
|
* Pendings:
|
||||||
* Change map title
|
|
||||||
* List with filter
|
* List with filter
|
||||||
* Clone
|
* Clone
|
||||||
* Discard Changed
|
* Discard Changed
|
||||||
@ -175,14 +175,52 @@ public class MindmapController extends BaseController {
|
|||||||
if (xml == null || xml.isEmpty()) {
|
if (xml == null || xml.isEmpty()) {
|
||||||
xml = MindMap.getDefaultMindmapXml(restMindmap.getTitle());
|
xml = MindMap.getDefaultMindmapXml(restMindmap.getTitle());
|
||||||
}
|
}
|
||||||
delegated.setXmlStr(xml);
|
|
||||||
delegated.setOwner(user);
|
delegated.setOwner(user);
|
||||||
|
delegated.setXmlStr(xml);
|
||||||
|
|
||||||
// Add new mindmap ...
|
// Add new mindmap ...
|
||||||
mindmapService.addMindmap(delegated, user);
|
mindmapService.addMindmap(delegated, user);
|
||||||
|
|
||||||
|
|
||||||
// Return the new created map ...
|
// Return the new created map ...
|
||||||
response.setHeader("Location", "/service/maps/" + delegated.getId());
|
response.setHeader("Location", "/service/maps/" + delegated.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"})
|
||||||
|
@ResponseStatus(value = HttpStatus.CREATED)
|
||||||
|
public void copyMap(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
|
||||||
|
|
||||||
|
final String title = restMindmap.getTitle();
|
||||||
|
if (title == null || title.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("Map title can not be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
final String description = restMindmap.getDescription();
|
||||||
|
if (description == null || description.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("Map details can not be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some basic validations ...
|
||||||
|
final User user = Utils.getUser();
|
||||||
|
final MindMap searchByMap = mindmapService.getMindmapByTitle(title, user);
|
||||||
|
if (searchByMap != null) {
|
||||||
|
throw new IllegalArgumentException("Map already exists with title '" + title + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a shallowCopy of the map ...
|
||||||
|
final MindMap mindMap = mindmapService.getMindmapById(id);
|
||||||
|
final MindMap clonedMap = mindMap.shallowClone();
|
||||||
|
clonedMap.setTitle(restMindmap.getTitle());
|
||||||
|
clonedMap.setDescription(restMindmap.getDescription());
|
||||||
|
clonedMap.setOwner(user);
|
||||||
|
|
||||||
|
// Add new mindmap ...
|
||||||
|
mindmapService.addMindmap(clonedMap, user);
|
||||||
|
|
||||||
|
// Return the new created map ...
|
||||||
|
response.setHeader("Location", "/service/maps/" + clonedMap.getId());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -98,4 +98,9 @@ public class RestMindmapInfo {
|
|||||||
|
|
||||||
public void setLastModifierUser(String lastModifierUser) {
|
public void setLastModifierUser(String lastModifierUser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public MindMap getDelegated(){
|
||||||
|
return this.mindmap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2667,7 +2667,7 @@
|
|||||||
{
|
{
|
||||||
var oCol;
|
var oCol;
|
||||||
|
|
||||||
/* Take an independent copy of the data source so we can bash it about as we wish */
|
/* Take an independent shallowCopy of the data source so we can bash it about as we wish */
|
||||||
var aDataIn = ($.isArray(aDataSupplied)) ?
|
var aDataIn = ($.isArray(aDataSupplied)) ?
|
||||||
aDataSupplied.slice() :
|
aDataSupplied.slice() :
|
||||||
$.extend( true, {}, aDataSupplied );
|
$.extend( true, {}, aDataSupplied );
|
||||||
@ -3113,7 +3113,7 @@
|
|||||||
bIncludeHidden = false;
|
bIncludeHidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make a copy of the master layout array, but without the visible columns in it */
|
/* Make a shallowCopy of the master layout array, but without the visible columns in it */
|
||||||
for ( i=0, iLen=aoSource.length ; i<iLen ; i++ )
|
for ( i=0, iLen=aoSource.length ; i<iLen ; i++ )
|
||||||
{
|
{
|
||||||
aoLocal[i] = aoSource[i].slice();
|
aoLocal[i] = aoSource[i].slice();
|
||||||
@ -6487,7 +6487,7 @@
|
|||||||
*/
|
*/
|
||||||
iColShifted = fnShiftCol( aLayout, i, iColumn );
|
iColShifted = fnShiftCol( aLayout, i, iColumn );
|
||||||
|
|
||||||
/* If there is col / rowspan, copy the information into the layout grid */
|
/* If there is col / rowspan, shallowCopy the information into the layout grid */
|
||||||
for ( l=0 ; l<iColspan ; l++ )
|
for ( l=0 ; l<iColspan ; l++ )
|
||||||
{
|
{
|
||||||
for ( k=0 ; k<iRowspan ; k++ )
|
for ( k=0 ; k<iRowspan ; k++ )
|
||||||
@ -6964,7 +6964,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make a complete and independent copy of the settings object */
|
/* Make a complete and independent shallowCopy of the settings object */
|
||||||
var oSettings = new classSettings();
|
var oSettings = new classSettings();
|
||||||
_aoSettings.push( oSettings );
|
_aoSettings.push( oSettings );
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.wisemapping.rest.model.RestMindmap;
|
|||||||
import com.wisemapping.rest.model.RestMindmapList;
|
import com.wisemapping.rest.model.RestMindmapList;
|
||||||
import com.wisemapping.rest.model.RestUser;
|
import com.wisemapping.rest.model.RestUser;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||||
import org.springframework.security.crypto.codec.Base64;
|
import org.springframework.security.crypto.codec.Base64;
|
||||||
@ -39,7 +40,7 @@ public class RestMindmapTCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "ContentType-Provider-Function")
|
@Test(dataProvider = "ContentType-Provider-Function")
|
||||||
public void listMaps(final @NotNull MediaType mediaType) { // Configure media types ...
|
public void listMaps(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
||||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||||
final RestTemplate template = createTemplate();
|
final RestTemplate template = createTemplate();
|
||||||
|
|
||||||
@ -69,11 +70,10 @@ public class RestMindmapTCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertTrue(found1 && found2, "Map could not be found");
|
assertTrue(found1 && found2, "Map could not be found");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "ContentType-Provider-Function")
|
@Test(dataProvider = "ContentType-Provider-Function")
|
||||||
public void deleteMap(final @NotNull MediaType mediaType) { // Configure media types ...
|
public void deleteMap(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
||||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||||
final RestTemplate template = createTemplate();
|
final RestTemplate template = createTemplate();
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ public class RestMindmapTCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "ContentType-Provider-Function")
|
@Test(dataProvider = "ContentType-Provider-Function")
|
||||||
public void changeMapTitle(final @NotNull MediaType mediaType) { // Configure media types ...
|
public void changeMapTitle(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
||||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||||
final RestTemplate template = createTemplate();
|
final RestTemplate template = createTemplate();
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public class RestMindmapTCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "ContentType-Provider-Function")
|
@Test(dataProvider = "ContentType-Provider-Function")
|
||||||
public void changeMapDescription(final @NotNull MediaType mediaType) { // Configure media types ...
|
public void changeMapDescription(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
||||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||||
final RestTemplate template = createTemplate();
|
final RestTemplate template = createTemplate();
|
||||||
|
|
||||||
@ -130,32 +130,6 @@ public class RestMindmapTCase {
|
|||||||
assertEquals(newDescription, map.getDescription());
|
assertEquals(newDescription, map.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
private URI addNewMap(HttpHeaders requestHeaders, RestTemplate template, String title) {
|
|
||||||
final RestMindmapInfo restMindmap = new RestMindmapInfo();
|
|
||||||
restMindmap.setTitle(title);
|
|
||||||
restMindmap.setDescription("My Map Desc");
|
|
||||||
|
|
||||||
// Create a new map ...
|
|
||||||
HttpEntity<RestMindmapInfo> createUserEntity = new HttpEntity<RestMindmapInfo>(restMindmap, requestHeaders);
|
|
||||||
return template.postForLocation(BASE_REST_URL + "/maps", createUserEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(dataProvider = "ContentType-Provider-Function")
|
|
||||||
public void discardChange(final @NotNull MediaType mediaType) { // Configure media types ...
|
|
||||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
|
||||||
final RestTemplate template = createTemplate();
|
|
||||||
|
|
||||||
// Create a sample map ...
|
|
||||||
final String title = "Add map to discard " + mediaType.toString();
|
|
||||||
final URI resourceUri = addNewMap(requestHeaders, template, title);
|
|
||||||
|
|
||||||
// Update with "minor" flag ...
|
|
||||||
|
|
||||||
// Revert the change ...
|
|
||||||
|
|
||||||
// Check that the map is the
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(dataProvider = "ContentType-Provider-Function")
|
@Test(dataProvider = "ContentType-Provider-Function")
|
||||||
public void updateMapXml(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
public void updateMapXml(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
||||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||||
@ -177,12 +151,31 @@ public class RestMindmapTCase {
|
|||||||
assertEquals(response.getXml(), newXmlContent);
|
assertEquals(response.getXml(), newXmlContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestMindmap findMap(HttpHeaders requestHeaders, RestTemplate template, URI resourceUri) {
|
@Test(dataProvider = "ContentType-Provider-Function")
|
||||||
final HttpEntity findMapEntity = new HttpEntity(requestHeaders);
|
public void cloneMap(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
||||||
final ResponseEntity<RestMindmap> response = template.exchange(HOST_PORT + resourceUri.toString(), HttpMethod.GET, findMapEntity, RestMindmap.class);
|
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||||
return response.getBody();
|
final RestTemplate template = createTemplate();
|
||||||
|
|
||||||
|
// Create a sample map ...
|
||||||
|
final String title = "Map to clone sample " + mediaType.toString();
|
||||||
|
final String xml = "<map><node text='this is a cloned map'></map>";
|
||||||
|
final URI newMapUri = addNewMap(requestHeaders, template, title, xml);
|
||||||
|
|
||||||
|
// Clone map ...
|
||||||
|
final RestMindmapInfo restMindmap = new RestMindmapInfo();
|
||||||
|
restMindmap.setTitle("Cloned map but with previous content." + mediaType.toString());
|
||||||
|
restMindmap.setDescription("Cloned map desc");
|
||||||
|
|
||||||
|
// Create a new map ...
|
||||||
|
final HttpEntity<RestMindmapInfo> cloneEntity = new HttpEntity<RestMindmapInfo>(restMindmap, requestHeaders);
|
||||||
|
final URI clonedMapUri = template.postForLocation(HOST_PORT + newMapUri, cloneEntity);
|
||||||
|
|
||||||
|
// Check that the map has been updated ...
|
||||||
|
final RestMindmap response = findMap(requestHeaders, template, clonedMapUri);
|
||||||
|
assertEquals(response.getXml(), xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test(dataProvider = "ContentType-Provider-Function")
|
@Test(dataProvider = "ContentType-Provider-Function")
|
||||||
public void updateMap(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
public void updateMap(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
||||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||||
@ -204,12 +197,36 @@ public class RestMindmapTCase {
|
|||||||
template.put(resourceUrl, updateEntity);
|
template.put(resourceUrl, updateEntity);
|
||||||
|
|
||||||
// Check that the map has been updated ...
|
// Check that the map has been updated ...
|
||||||
HttpEntity<RestUser> findUserEntity = new HttpEntity<RestUser>(requestHeaders);
|
HttpEntity<RestUser> findMapEntity = new HttpEntity<RestUser>(requestHeaders);
|
||||||
final ResponseEntity<RestMindmap> response = template.exchange(HOST_PORT + resourceUri.toString(), HttpMethod.GET, findUserEntity, RestMindmap.class);
|
final ResponseEntity<RestMindmap> response = template.exchange(HOST_PORT + resourceUri.toString(), HttpMethod.GET, findMapEntity, RestMindmap.class);
|
||||||
assertEquals(response.getBody().getXml(), mapToUpdate.getXml());
|
assertEquals(response.getBody().getXml(), mapToUpdate.getXml());
|
||||||
assertEquals(response.getBody().getProperties(), mapToUpdate.getProperties());
|
assertEquals(response.getBody().getProperties(), mapToUpdate.getProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private RestMindmap findMap(HttpHeaders requestHeaders, RestTemplate template, URI resourceUri) {
|
||||||
|
final HttpEntity findMapEntity = new HttpEntity(requestHeaders);
|
||||||
|
final ResponseEntity<RestMindmap> response = template.exchange(HOST_PORT + resourceUri.toString(), HttpMethod.GET, findMapEntity, RestMindmap.class);
|
||||||
|
return response.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
private URI addNewMap(@NotNull HttpHeaders requestHeaders, @NotNull RestTemplate template, @NotNull String title, @Nullable String xml) throws IOException {
|
||||||
|
final RestMindmap restMindmap = new RestMindmap();
|
||||||
|
restMindmap.setTitle(title);
|
||||||
|
restMindmap.setDescription("My Map Desc");
|
||||||
|
if (xml != null) {
|
||||||
|
restMindmap.setXml(xml);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new map ...
|
||||||
|
HttpEntity<RestMindmap> createUserEntity = new HttpEntity<RestMindmap>(restMindmap, requestHeaders);
|
||||||
|
return template.postForLocation(BASE_REST_URL + "/maps", createUserEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private URI addNewMap(@NotNull HttpHeaders requestHeaders, @NotNull RestTemplate template, @NotNull String title) throws IOException {
|
||||||
|
return addNewMap(requestHeaders, template, title, null);
|
||||||
|
}
|
||||||
|
|
||||||
private HttpHeaders createHeaders(@NotNull MediaType mediaType) {
|
private HttpHeaders createHeaders(@NotNull MediaType mediaType) {
|
||||||
List<MediaType> acceptableMediaTypes = new ArrayList<MediaType>();
|
List<MediaType> acceptableMediaTypes = new ArrayList<MediaType>();
|
||||||
acceptableMediaTypes.add(mediaType);
|
acceptableMediaTypes.add(mediaType);
|
||||||
|
Loading…
Reference in New Issue
Block a user