Remove REST API application/xml type support

This commit is contained in:
Paulo Gustavo Veiga 2022-04-02 12:59:54 -03:00
parent ad20d06d19
commit a618849afc
24 changed files with 25 additions and 176 deletions

View File

@ -68,7 +68,7 @@ public class AccountController extends BaseController {
userService.changePassword(user); userService.changePassword(user);
} }
@RequestMapping(method = RequestMethod.GET, value = "/account", produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.GET, value = "/account", produces = {"application/json"})
public RestUser fetchAccount() { public RestUser fetchAccount() {
final User user = Utils.getUser(true); final User user = Utils.getUser(true);
return new RestUser(user); return new RestUser(user);

View File

@ -50,7 +50,7 @@ public class AdminController extends BaseController {
@Autowired @Autowired
private MindmapService mindmapService; private MindmapService mindmapService;
@RequestMapping(method = RequestMethod.GET, value = "admin/users/{id}", produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.GET, value = "admin/users/{id}", produces = {"application/json"})
@ResponseBody @ResponseBody
public RestUser getUserById(@PathVariable int id) throws IOException { public RestUser getUserById(@PathVariable int id) throws IOException {
final User userBy = userService.getUserBy(id); final User userBy = userService.getUserBy(id);
@ -60,7 +60,7 @@ public class AdminController extends BaseController {
return new RestUser(userBy); return new RestUser(userBy);
} }
@RequestMapping(method = RequestMethod.GET, value = "admin/users/email/{email:.+}", produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.GET, value = "admin/users/email/{email:.+}", produces = {"application/json"})
@ResponseBody @ResponseBody
public RestUser getUserByEmail(@PathVariable String email) throws IOException { public RestUser getUserByEmail(@PathVariable String email) throws IOException {
final User user = userService.getUserBy(email); final User user = userService.getUserBy(email);
@ -70,7 +70,7 @@ public class AdminController extends BaseController {
return new RestUser(user); return new RestUser(user);
} }
@RequestMapping(method = RequestMethod.POST, value = "admin/users", consumes = {"application/xml", "application/json"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.POST, value = "admin/users", consumes = { "application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.CREATED) @ResponseStatus(value = HttpStatus.CREATED)
public void createUser(@RequestBody RestUser user, HttpServletResponse response) throws WiseMappingException { public void createUser(@RequestBody RestUser user, HttpServletResponse response) throws WiseMappingException {
if (user == null) { if (user == null) {

View File

@ -46,7 +46,7 @@ public class LabelController extends BaseController {
private LabelService labelService; private LabelService labelService;
@RequestMapping(method = RequestMethod.POST, value = "/labels", consumes = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.POST, value = "/labels", consumes = {"application/json"})
@ResponseStatus(value = HttpStatus.CREATED) @ResponseStatus(value = HttpStatus.CREATED)
public void createLabel(@RequestBody RestLabel restLabel, @NotNull HttpServletResponse response, @RequestParam(required = false) String title) throws WiseMappingException { public void createLabel(@RequestBody RestLabel restLabel, @NotNull HttpServletResponse response, @RequestParam(required = false) String title) throws WiseMappingException {
// Overwrite title if it was specified by parameter. // Overwrite title if it was specified by parameter.
@ -64,7 +64,7 @@ public class LabelController extends BaseController {
response.setHeader("ResourceId", Long.toString(label.getId())); response.setHeader("ResourceId", Long.toString(label.getId()));
} }
@RequestMapping(method = RequestMethod.GET, value = "/labels", produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.GET, value = "/labels", produces = {"application/json"})
public RestLabelList retrieveList() { public RestLabelList retrieveList() {
final User user = Utils.getUser(); final User user = Utils.getUser();
assert user != null; assert user != null;

View File

@ -58,7 +58,7 @@ public class MindmapController extends BaseController {
@Autowired @Autowired
private LabelService labelService; private LabelService labelService;
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/json", "application/xml", "text/html"}) @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/json"})
@ResponseBody @ResponseBody
public RestMindmap retrieve(@PathVariable int id) throws WiseMappingException { public RestMindmap retrieve(@PathVariable int id) throws WiseMappingException {
final User user = Utils.getUser(); final User user = Utils.getUser();
@ -66,7 +66,7 @@ public class MindmapController extends BaseController {
return new RestMindmap(mindMap, user); return new RestMindmap(mindMap, user);
} }
@RequestMapping(method = RequestMethod.GET, value = "/maps/", produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.GET, value = "/maps/", produces = {"application/json"})
public RestMindmapList retrieveList(@RequestParam(required = false) String q) throws IOException { public RestMindmapList retrieveList(@RequestParam(required = false) String q) throws IOException {
final User user = Utils.getUser(); final User user = Utils.getUser();
@ -80,7 +80,7 @@ public class MindmapController extends BaseController {
return new RestMindmapList(mindmaps, user); return new RestMindmapList(mindmaps, user);
} }
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/history/", produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/history/", produces = {"application/json"})
public RestMindmapHistoryList fetchHistory(@PathVariable int id) { public RestMindmapHistoryList fetchHistory(@PathVariable int id) {
final List<MindMapHistory> histories = mindmapService.findMindmapHistory(id); final List<MindMapHistory> histories = mindmapService.findMindmapHistory(id);
final RestMindmapHistoryList result = new RestMindmapHistoryList(); final RestMindmapHistoryList result = new RestMindmapHistoryList();
@ -109,7 +109,7 @@ public class MindmapController extends BaseController {
} }
} }
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/document", consumes = {"application/xml", "application/json"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/document", consumes = {"application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws WiseMappingException, IOException { public void updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws WiseMappingException, IOException {
@ -169,7 +169,7 @@ public class MindmapController extends BaseController {
/** /**
* The intention of this method is the update of several properties at once ... * The intention of this method is the update of several properties at once ...
*/ */
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}", consumes = {"application/xml", "application/json"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}", consumes = { "application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateProperties(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException { public void updateProperties(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
@ -223,7 +223,7 @@ public class MindmapController extends BaseController {
return result; return result;
} }
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/title", consumes = {"text/plain"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/title", consumes = {"text/plain"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateTitle(@RequestBody String title, @PathVariable int id) throws WiseMappingException { public void updateTitle(@RequestBody String title, @PathVariable int id) throws WiseMappingException {
@ -241,7 +241,7 @@ public class MindmapController extends BaseController {
mindmapService.updateMindmap(mindMap, false); mindmapService.updateMindmap(mindMap, false);
} }
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/collabs/", consumes = {"application/json", "application/xml"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException { public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException {
final Mindmap mindMap = findMindmapById(id); final Mindmap mindMap = findMindmapById(id);
@ -288,7 +288,7 @@ public class MindmapController extends BaseController {
} }
} }
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs/", consumes = {"application/json", "application/xml"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void addCollab(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException { public void addCollab(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException {
final Mindmap mindMap = findMindmapById(id); final Mindmap mindMap = findMindmapById(id);
@ -351,7 +351,7 @@ public class MindmapController extends BaseController {
} }
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/collabs", produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/collabs", produces = {"application/json"})
public RestCollaborationList retrieveList(@PathVariable int id) throws MapCouldNotFoundException, AccessDeniedSecurityException { public RestCollaborationList retrieveList(@PathVariable int id) throws MapCouldNotFoundException, AccessDeniedSecurityException {
final Mindmap mindMap = findMindmapById(id); final Mindmap mindMap = findMindmapById(id);
@ -367,7 +367,7 @@ public class MindmapController extends BaseController {
return result; return result;
} }
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/description", consumes = {"text/plain"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/description", consumes = {"text/plain"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateDescription(@RequestBody String description, @PathVariable int id) throws WiseMappingException { public void updateDescription(@RequestBody String description, @PathVariable int id) throws WiseMappingException {
final Mindmap mindmap = findMindmapById(id); final Mindmap mindmap = findMindmapById(id);
@ -375,7 +375,7 @@ public class MindmapController extends BaseController {
mindmapService.updateMindmap(mindmap, false); mindmapService.updateMindmap(mindmap, false);
} }
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updatePublishState(@RequestBody String value, @PathVariable int id) throws WiseMappingException { public void updatePublishState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
@ -431,7 +431,7 @@ public class MindmapController extends BaseController {
} }
} }
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/starred", consumes = {"text/plain"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/starred", consumes = {"text/plain"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateStarredState(@RequestBody String value, @PathVariable int id) throws WiseMappingException { public void updateStarredState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
@ -503,7 +503,7 @@ public class MindmapController extends BaseController {
response.setHeader("ResourceId", Integer.toString(mindmap.getId())); response.setHeader("ResourceId", Integer.toString(mindmap.getId()));
} }
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"}, produces = {"application/xml", "application/json", "text/plain"}) @RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/json"}, produces = { "application/json", "text/plain"})
@ResponseStatus(value = HttpStatus.CREATED) @ResponseStatus(value = HttpStatus.CREATED)
public void createDuplicate(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException { public void createDuplicate(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
// Validate ... // Validate ...
@ -558,7 +558,7 @@ public class MindmapController extends BaseController {
mindmapService.updateMindmap(mindmap, false); mindmapService.updateMindmap(mindmap, false);
} }
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/labels", consumes = {"application/xml", "application/json"}) @RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/labels", consumes = {"application/json"})
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
public void updateLabel(@PathVariable int id, @RequestBody int lid) throws WiseMappingException { public void updateLabel(@PathVariable int id, @RequestBody int lid) throws WiseMappingException {
final User user = Utils.getUser(); final User user = Utils.getUser();
@ -572,7 +572,7 @@ public class MindmapController extends BaseController {
mindmapService.updateMindmap(mindmap, false); mindmapService.updateMindmap(mindmap, false);
} }
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/lock", consumes = {"text/plain"}, produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/lock", consumes = {"text/plain"}, produces = {"application/json"})
public ResponseEntity<RestLockInfo> lockMindmap(@RequestBody String value, @PathVariable int id) throws WiseMappingException { public ResponseEntity<RestLockInfo> lockMindmap(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
final User user = Utils.getUser(); final User user = Utils.getUser();
final LockManager lockManager = mindmapService.getLockManager(); final LockManager lockManager = mindmapService.getLockManager();

View File

@ -1,46 +0,0 @@
/*
* Copyright [2022] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.rest;
import org.jetbrains.annotations.Nullable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@Controller
public class TransformerController extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"application/freemind"}, consumes = {"application/xml"})
@ResponseBody
public ModelAndView transformFreemind(@RequestBody @Nullable final String content) throws IOException {
final Map<String, Object> values = new HashMap<String, Object>();
if (content == null || content.length() == 0) {
throw new IllegalArgumentException("Body can not be null.");
}
values.put("content", content);
return new ModelAndView("transformViewFreemind", values);
}
}

View File

@ -55,7 +55,7 @@ public class UserController extends BaseController {
private static final Logger logger = Logger.getLogger(UserController.class); private static final Logger logger = Logger.getLogger(UserController.class);
private static final String REAL_IP_ADDRESS_HEADER = "X-Real-IP"; private static final String REAL_IP_ADDRESS_HEADER = "X-Real-IP";
@RequestMapping(method = RequestMethod.POST, value = "/users", produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.POST, value = "/users", produces = {"application/json"})
@ResponseStatus(value = HttpStatus.CREATED) @ResponseStatus(value = HttpStatus.CREATED)
public void registerUser(@RequestBody RestUserRegistration registration, @NotNull HttpServletRequest request, @NotNull HttpServletResponse response) throws WiseMappingException, BindException { public void registerUser(@RequestBody RestUserRegistration registration, @NotNull HttpServletRequest request, @NotNull HttpServletResponse response) throws WiseMappingException, BindException {
logger.debug("Register new user:" + registration.getEmail()); logger.debug("Register new user:" + registration.getEmail());
@ -80,7 +80,7 @@ public class UserController extends BaseController {
response.setHeader("Location", "/service/users/" + user.getId()); response.setHeader("Location", "/service/users/" + user.getId());
} }
@RequestMapping(method = RequestMethod.PUT, value = "/users/resetPassword", produces = {"application/json", "application/xml"}) @RequestMapping(method = RequestMethod.PUT, value = "/users/resetPassword", produces = {"application/json"})
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
public void resetPassword(@RequestParam String email) throws InvalidAuthSchemaException, EmailNotExistsException { public void resetPassword(@RequestParam String email) throws InvalidAuthSchemaException, EmailNotExistsException {
try { try {

View File

@ -24,12 +24,6 @@ import com.wisemapping.model.Collaboration;
import com.wisemapping.model.CollaborationRole; import com.wisemapping.model.CollaborationRole;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "collaboration")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -22,15 +22,9 @@ package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@XmlRootElement(name = "collaborations")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,
@ -52,7 +46,6 @@ public class RestCollaborationList {
} }
@XmlElement(name = "collaborations")
public List<RestCollaboration> getCollaborations() { public List<RestCollaboration> getCollaborations() {
return collaborations; return collaborations;
} }

View File

@ -29,8 +29,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.util.Calendar; import java.util.Calendar;
@XmlRootElement(name = "collaborator")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -35,8 +35,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.util.*; import java.util.*;
@XmlRootElement(name = "errors")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -7,15 +7,9 @@ import com.wisemapping.model.Label;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
@XmlRootElement(name = "label")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = NONE, fieldVisibility = NONE,
setterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY,

View File

@ -4,15 +4,10 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.wisemapping.model.Label; import com.wisemapping.model.Label;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@XmlRootElement(name = "labels")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -21,18 +21,11 @@ package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wisemapping.model.Collaborator;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import com.wisemapping.service.LockInfo; import com.wisemapping.service.LockInfo;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "lock")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -22,12 +22,6 @@ package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "logitem")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -35,8 +35,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar; import java.util.Calendar;
@XmlRootElement(name = "map")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -25,16 +25,11 @@ import com.wisemapping.model.MindMapHistory;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.TimeZone; import java.util.TimeZone;
@XmlRootElement(name = "history")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -22,15 +22,9 @@ package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@XmlRootElement(name = "history")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,
@ -51,7 +45,6 @@ public class RestMindmapHistoryList {
} }
@XmlElement(name = "changes")
public List<RestMindmapHistory> getChanges() { public List<RestMindmapHistory> getChanges() {
return changes; return changes;
} }

View File

@ -28,17 +28,11 @@ import com.wisemapping.util.TimeUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Calendar; import java.util.Calendar;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@XmlRootElement(name = "mapinfo")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -33,8 +33,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@XmlRootElement(name = "maps")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -26,14 +26,9 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Calendar; import java.util.Calendar;
@XmlRootElement(name = "user")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -24,13 +24,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "user")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect( @JsonAutoDetect(
fieldVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,

View File

@ -22,25 +22,6 @@
</mvc:message-converters> </mvc:message-converters>
</mvc:annotation-driven> </mvc:annotation-driven>
<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>com.wisemapping.rest.model.RestMindmap</value>
<value>com.wisemapping.rest.model.RestMindmapInfo</value>
<value>com.wisemapping.rest.model.RestMindmapList</value>
<value>com.wisemapping.rest.model.RestUser</value>
<value>com.wisemapping.rest.model.RestErrors</value>
<value>com.wisemapping.rest.model.RestCollaboration</value>
<value>com.wisemapping.rest.model.RestCollaborationList</value>
<value>com.wisemapping.rest.model.RestLogItem</value>
<value>com.wisemapping.rest.model.RestLockInfo</value>
<value>com.wisemapping.rest.model.RestLabel</value>
<value>com.wisemapping.rest.model.RestLabelList</value>
<value>com.wisemapping.rest.model.RestUserRegistration</value>
</list>
</property>
</bean>
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"> <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorParameter" value="true"/> <property name="favorParameter" value="true"/>
<property name="parameterName" value="mediaType"/> <property name="parameterName" value="mediaType"/>
@ -66,9 +47,6 @@
<bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"> <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView">
<property name="extractValueFromSingleKeyModel" value="true"/> <property name="extractValueFromSingleKeyModel" value="true"/>
</bean> </bean>
<bean class="org.springframework.web.servlet.view.xml.MarshallingView">
<constructor-arg ref="jaxbMarshaller"/>
</bean>
</list> </list>
</property> </property>
</bean> </bean>

View File

@ -46,7 +46,7 @@ public class RestHelper {
@DataProvider(name = "ContentType-Provider-Function") @DataProvider(name = "ContentType-Provider-Function")
static Object[][] contentTypes() { static Object[][] contentTypes() {
return new Object[][]{{MediaType.APPLICATION_XML}, {MediaType.APPLICATION_JSON}}; return new Object[][]{{MediaType.APPLICATION_JSON}};
} }
} }

View File

@ -201,10 +201,6 @@ public class RestMindmapITCase {
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function") @Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
public void updateMap(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ... public void updateMap(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
if (MediaType.APPLICATION_XML == mediaType) {
throw new SkipException("Some research need to check why it's falling.");
}
final HttpHeaders requestHeaders = createHeaders(mediaType); final HttpHeaders requestHeaders = createHeaders(mediaType);
final RestTemplate template = createTemplate(userEmail); final RestTemplate template = createTemplate(userEmail);
@ -223,7 +219,7 @@ public class RestMindmapITCase {
// Update map ... // Update map ...
final String resourceUrl = HOST_PORT + resourceUri.toString() + "/document"; final String resourceUrl = HOST_PORT + resourceUri.toString() + "/document";
requestHeaders.setContentType(MediaType.APPLICATION_XML); requestHeaders.setContentType(MediaType.APPLICATION_JSON);
final HttpEntity<RestMindmap> updateEntity = new HttpEntity<>(mapToUpdate, requestHeaders); final HttpEntity<RestMindmap> updateEntity = new HttpEntity<>(mapToUpdate, requestHeaders);
template.put(resourceUrl, updateEntity); template.put(resourceUrl, updateEntity);
@ -396,10 +392,6 @@ public class RestMindmapITCase {
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function") @Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
public void addLabelToMindmap(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ... public void addLabelToMindmap(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
if (MediaType.APPLICATION_XML == mediaType) {
throw new SkipException("Some research need to check why it's falling.");
}
final HttpHeaders requestHeaders = createHeaders(mediaType); final HttpHeaders requestHeaders = createHeaders(mediaType);
final RestTemplate template = createTemplate(userEmail); final RestTemplate template = createTemplate(userEmail);