Commit 024fed81 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #186 from Redor/openfire

Update to REST API plugin version 1.0.1
parents be20d0f0 090831d3
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html> <html>
<head> <head>
<title>REST API Plugin Changelog</title> <title>REST API Plugin Changelog</title>
<style type="text/css"> <style type="text/css">
BODY { BODY {
font-size : 100%; font-size : 100%;
} }
BODY, TD, TH { BODY, TD, TH {
font-family : tahoma, verdana, arial, helvetica, sans-serif; font-family : tahoma, verdana, arial, helvetica, sans-serif;
font-size : 0.8em; font-size : 0.8em;
} }
H2 { H2 {
font-size : 10pt; font-size : 10pt;
font-weight : bold; font-weight : bold;
padding-left : 1em; padding-left : 1em;
} }
A:hover { A:hover {
text-decoration : none; text-decoration : none;
} }
H1 { H1 {
font-family : tahoma, arial, helvetica, sans-serif; font-family : tahoma, arial, helvetica, sans-serif;
font-size : 1.4em; font-size : 1.4em;
font-weight: bold; font-weight: bold;
border-bottom : 1px #ccc solid; border-bottom : 1px #ccc solid;
padding-bottom : 2px; padding-bottom : 2px;
} }
TT { TT {
font-family : courier new; font-family : courier new;
font-weight : bold; font-weight : bold;
color : #060; color : #060;
} }
PRE { PRE {
font-family : courier new; font-family : courier new;
font-size : 100%; font-size : 100%;
} }
</style> </style>
</head> </head>
<body> <body>
<h1> <h1>
REST API Plugin Changelog REST API Plugin Changelog
</h1> </h1>
<p><b>1.0.0</b> -- February 3rd, 2015</p> <p><b>1.0.1</b> -- February 20th, 2015</p>
<ul> <ul>
<li>UserService plugin and MUC Service plugin are merged to the REST API plugin.</li> <li>Added possibility to rename a user (Thanks to JustMarried plugin)</li>
<li>Extended REST API with JSON data format.</li> <li>Adjusted HTTP Codes by conflict to HTTP CODE: 409</li>
</ul> <li>Added subject to Chat room</li>
<li>Disabled jersey logging on startup</li>
<p><b>0.1.0</b> -- November 14th, 2014</p> <li>By create a new chat room the chat room service will be created if it was not there</li>
<ul> </ul>
<li>Initial release of REST API Plugin with possibility to manage system properties.</li>
</ul> <p><b>1.0.0</b> -- February 3rd, 2015</p>
<ul>
</body> <li>UserService plugin and MUC Service plugin are merged to the REST API plugin.</li>
</html> <li>Extended REST API with JSON data format.</li>
</ul>
<p><b>0.1.0</b> -- November 14th, 2014</p>
<ul>
<li>Initial release of REST API Plugin with possibility to manage system properties.</li>
</ul>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<plugin> <plugin>
<class>org.jivesoftware.openfire.plugin.rest.RESTServicePlugin</class> <class>org.jivesoftware.openfire.plugin.rest.RESTServicePlugin</class>
<name>REST API</name> <name>REST API</name>
<description>Allows administration over a RESTful API.</description> <description>Allows administration over a RESTful API.</description>
<author>Roman Soldatow</author> <author>Roman Soldatow</author>
<version>1.0.0</version> <version>1.0.1</version>
<date>02/03/2015</date> <date>02/20/2015</date>
<minServerVersion>3.9.0</minServerVersion> <minServerVersion>3.9.0</minServerVersion>
<adminconsole> <adminconsole>
<tab id="tab-server"> <tab id="tab-server">
<sidebar id="sidebar-server-settings"> <sidebar id="sidebar-server-settings">
<item id="rest-api" name="REST API" url="rest-api.jsp" <item id="rest-api" name="REST API" url="rest-api.jsp"
description="Click to manage the service that allows to configure the Openfire over a RESTFul API" /> description="Click to manage the service that allows to configure the Openfire over a RESTFul API" />
</sidebar> </sidebar>
</tab> </tab>
</adminconsole> </adminconsole>
</plugin> </plugin>
This diff is collapsed.
package org.jivesoftware.openfire.plugin.rest.controller;
import java.util.List;
import javax.ws.rs.core.Response;
import org.dom4j.Element;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.SharedGroupException;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.auth.AuthFactory;
import org.jivesoftware.openfire.group.Group;
import org.jivesoftware.openfire.group.GroupManager;
import org.jivesoftware.openfire.plugin.rest.exceptions.ExceptionType;
import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException;
import org.jivesoftware.openfire.roster.Roster;
import org.jivesoftware.openfire.roster.RosterItem;
import org.jivesoftware.openfire.session.ClientSession;
import org.jivesoftware.openfire.user.User;
import org.jivesoftware.openfire.user.UserAlreadyExistsException;
import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.openfire.vcard.VCardManager;
import org.xmpp.packet.StreamError;
/**
* The Class JustMarriedController.
*/
public class JustMarriedController {
/**
* Change name.
*
* @param currentUserName
* the current user name
* @param newUserName
* the new user name
* @param deleteOldUser
* the delete old user
* @param newEmail
* the new email
* @param newRealName
* the new real name
* @return true, if successful
* @throws ServiceException
* the service exception
*/
public static boolean changeName(String currentUserName, String newUserName, boolean deleteOldUser,
String newEmail, String newRealName) throws ServiceException {
UserManager userManager = UserManager.getInstance();
try {
User currentUser = userManager.getUser(currentUserName);
// Old user found, create new one
String password = AuthFactory.getPassword(currentUserName);
String newName = (newRealName == null || newRealName.length() == 0) ? currentUser.getName() : newRealName;
String newMail = (newEmail == null || newEmail.length() == 0) ? currentUser.getEmail() : newEmail;
User newUser = userManager.createUser(newUserName, password, currentUser.getName(), newMail);
newUser.setName(newName);
newUser.setNameVisible(currentUser.isNameVisible());
newUser.setEmailVisible(currentUser.isEmailVisible());
newUser.setCreationDate(currentUser.getCreationDate());
copyRoster(currentUser, newUser, currentUserName);
copyProperties(currentUser, newUser);
copyToGroups(currentUserName, newUserName);
copyVCard(currentUserName, newUserName);
if (deleteOldUser) {
deleteUser(currentUser);
}
} catch (UserNotFoundException e) {
throw new ServiceException("Could not find user", currentUserName, ExceptionType.USER_NOT_FOUND_EXCEPTION,
Response.Status.NOT_FOUND, e);
} catch (UserAlreadyExistsException e) {
throw new ServiceException("Could not create new user", newUserName,
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.CONFLICT, e);
}
return true;
}
/**
* Copy v card.
*
* @param currentUserName
* the current user name
* @param newUserName
* the new user name
* @throws ServiceException
* the service exception
*/
private static void copyVCard(String currentUserName, String newUserName) throws ServiceException {
VCardManager vcardManager = VCardManager.getInstance();
Element vcard = vcardManager.getVCard(currentUserName);
if (vcard != null) {
try {
vcardManager.setVCard(newUserName, vcard);
} catch (Exception e) {
throw new ServiceException("Could not copy vcard to new user", newUserName,
ExceptionType.ILLEGAL_ARGUMENT_EXCEPTION, Response.Status.BAD_REQUEST, e);
}
}
}
/**
* Copy to groups.
*
* @param currentUser
* the current user
* @param newUser
* the new user
*/
private static void copyToGroups(String currentUser, String newUser) {
GroupManager groupManager = GroupManager.getInstance();
for (Group group : groupManager.getGroups()) {
if (group.isUser(currentUser)) {
group.getMembers().add(XMPPServer.getInstance().createJID(newUser, null));
}
}
}
/**
* Delete user.
*
* @param oldUser
* the old user
*/
private static void deleteUser(User oldUser) {
UserManager.getInstance().deleteUser(oldUser);
final StreamError error = new StreamError(StreamError.Condition.not_authorized);
for (ClientSession sess : SessionManager.getInstance().getSessions(oldUser.getUsername())) {
sess.deliverRawText(error.toXML());
sess.close();
}
}
/**
* Copy properties.
*
* @param currentUser
* the current user
* @param newUser
* the new user
*/
private static void copyProperties(User currentUser, User newUser) {
for (String key : currentUser.getProperties().keySet()) {
newUser.getProperties().put(key, User.getPropertyValue(currentUser.getUsername(), key));
}
}
/**
* Copy roster.
*
* @param currentUser
* the current user
* @param newUser
* the new user
* @param currentUserName
* the current user name
* @throws ServiceException
* the service exception
*/
private static void copyRoster(User currentUser, User newUser, String currentUserName) throws ServiceException {
Roster newRoster = newUser.getRoster();
Roster currentRoster = currentUser.getRoster();
for (RosterItem item : currentRoster.getRosterItems()) {
try {
List<String> groups = item.getGroups();
RosterItem justCreated = newRoster.createRosterItem(item.getJid(), item.getNickname(), groups, true,
true);
justCreated.setAskStatus(item.getAskStatus());
justCreated.setRecvStatus(item.getRecvStatus());
justCreated.setSubStatus(item.getSubStatus());
for (Group gr : item.getSharedGroups()) {
justCreated.addSharedGroup(gr);
}
for (Group gr : item.getInvisibleSharedGroups()) {
justCreated.addInvisibleSharedGroup(gr);
}
newRoster.updateRosterItem(justCreated);
addNewUserToOthersRoster(newUser, item, currentUserName);
} catch (UserAlreadyExistsException e) {
throw new ServiceException("Could not create roster item for user ", newUser.getUsername(),
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.CONFLICT, e);
} catch (SharedGroupException e) {
throw new ServiceException("Could not create roster item, because it is a contact from a shared group",
newUser.getUsername(), ExceptionType.USER_ALREADY_EXISTS_EXCEPTION,
Response.Status.BAD_REQUEST, e);
} catch (UserNotFoundException e) {
throw new ServiceException("Could not update roster item for user " + newUser.getUsername()
+ " because it was not properly created.", newUser.getUsername(),
ExceptionType.USER_NOT_FOUND_EXCEPTION, Response.Status.NOT_FOUND, e);
}
}
}
/**
* Adds the new user to others roster.
*
* @param newUser
* the new user
* @param otherItem
* the other item
* @param currentUser
* the current user
* @throws ServiceException
* the service exception
*/
private static void addNewUserToOthersRoster(User newUser, RosterItem otherItem, String currentUser)
throws ServiceException {
otherItem.getJid();
UserManager userManager = UserManager.getInstance();
// Is this user registered with our OF server?
String username = otherItem.getJid().getNode();
if (username != null && username.length() > 0 && userManager.isRegisteredUser(username)
&& XMPPServer.getInstance().isLocal(XMPPServer.getInstance().createJID(currentUser, null))) {
try {
User otherUser = userManager.getUser(username);
Roster otherRoster = otherUser.getRoster();
RosterItem oldUserOnOthersRoster = otherRoster.getRosterItem(XMPPServer.getInstance().createJID(
currentUser, null));
try {
if (!oldUserOnOthersRoster.isOnlyShared()) {
RosterItem justCreated = otherRoster.createRosterItem(
XMPPServer.getInstance().createJID(newUser.getUsername(), null),
oldUserOnOthersRoster.getNickname(), oldUserOnOthersRoster.getGroups(), true, true);
justCreated.setAskStatus(oldUserOnOthersRoster.getAskStatus());
justCreated.setRecvStatus(oldUserOnOthersRoster.getRecvStatus());
justCreated.setSubStatus(oldUserOnOthersRoster.getSubStatus());
otherRoster.updateRosterItem(justCreated);
}
} catch (UserAlreadyExistsException e) {
throw new ServiceException("Could not create roster item for user ", newUser.getUsername(),
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.CONFLICT, e);
} catch (SharedGroupException e) {
throw new ServiceException(
"Could not create roster item, because it is a contact from a shared group",
newUser.getUsername(), ExceptionType.USER_ALREADY_EXISTS_EXCEPTION,
Response.Status.BAD_REQUEST, e);
}
} catch (UserNotFoundException e) {
throw new ServiceException("Could not create roster item for user " + newUser.getUsername()
+ " because it is a contact from a shared group.", newUser.getUsername(),
ExceptionType.USER_NOT_FOUND_EXCEPTION, Response.Status.NOT_FOUND, e);
}
}
}
}
package org.jivesoftware.openfire.plugin.rest.exceptions; package org.jivesoftware.openfire.plugin.rest.exceptions;
/** /**
* The Class ExceptionType. * The Class ExceptionType.
*/ */
public final class ExceptionType { public final class ExceptionType {
/** The Constant ILLEGAL_ARGUMENT_EXCEPTION. */ /** The Constant ILLEGAL_ARGUMENT_EXCEPTION. */
public static final String ILLEGAL_ARGUMENT_EXCEPTION = "IllegalArgumentException"; public static final String ILLEGAL_ARGUMENT_EXCEPTION = "IllegalArgumentException";
/** The Constant SHARED_GROUP_EXCEPTION. */ /** The Constant SHARED_GROUP_EXCEPTION. */
public static final String SHARED_GROUP_EXCEPTION = "SharedGroupException"; public static final String SHARED_GROUP_EXCEPTION = "SharedGroupException";
/** The Constant PROPERTY_NOT_FOUND. */ /** The Constant PROPERTY_NOT_FOUND. */
public static final String PROPERTY_NOT_FOUND = "PropertyNotFoundException"; public static final String PROPERTY_NOT_FOUND = "PropertyNotFoundException";
/** The Constant USER_ALREADY_EXISTS_EXCEPTION. */ /** The Constant USER_ALREADY_EXISTS_EXCEPTION. */
public static final String USER_ALREADY_EXISTS_EXCEPTION = "UserAlreadyExistsException"; public static final String USER_ALREADY_EXISTS_EXCEPTION = "UserAlreadyExistsException";
/** The Constant USER_NOT_FOUND_EXCEPTION. */ /** The Constant USER_NOT_FOUND_EXCEPTION. */
public static final String USER_NOT_FOUND_EXCEPTION = "UserNotFoundException"; public static final String USER_NOT_FOUND_EXCEPTION = "UserNotFoundException";
/** The Constant GROUP_ALREADY_EXISTS. */ /** The Constant GROUP_ALREADY_EXISTS. */
public static final String GROUP_ALREADY_EXISTS = "GroupAlreadyExistsException"; public static final String GROUP_ALREADY_EXISTS = "GroupAlreadyExistsException";
/** The Constant GROUP_NOT_FOUND. */ /** The Constant GROUP_NOT_FOUND. */
public static final String GROUP_NOT_FOUND = "GroupNotFoundException"; public static final String GROUP_NOT_FOUND = "GroupNotFoundException";
/** The Constant ROOM_NOT_FOUND. */ /** The Constant ROOM_NOT_FOUND. */
public static final String ROOM_NOT_FOUND = "RoomNotFoundException"; public static final String ROOM_NOT_FOUND = "RoomNotFoundException";
/** The Constant NOT_ALLOWED. */ /** The Constant NOT_ALLOWED. */
public static final String NOT_ALLOWED = "NotAllowedException"; public static final String NOT_ALLOWED = "NotAllowedException";
/** /** The Constant ALREADY_EXISTS. */
* Instantiates a new exception type. public static final String ALREADY_EXISTS = "AlreadyExistsException";
*/ /**
private ExceptionType() { * Instantiates a new exception type.
} */
} private ExceptionType() {
}
}
...@@ -2,6 +2,8 @@ package org.jivesoftware.openfire.plugin.rest.service; ...@@ -2,6 +2,8 @@ package org.jivesoftware.openfire.plugin.rest.service;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
...@@ -43,8 +45,12 @@ public class JerseyWrapper extends ServletContainer { ...@@ -43,8 +45,12 @@ public class JerseyWrapper extends ServletContainer {
/** The prc. */ /** The prc. */
private static PackagesResourceConfig prc; private static PackagesResourceConfig prc;
/** The Constant JERSEY_LOGGER. */
private final static Logger JERSEY_LOGGER = Logger.getLogger("com.sun.jersey");
static { static {
JERSEY_LOGGER.setLevel(Level.SEVERE);
config = new HashMap<String, Object>(); config = new HashMap<String, Object>();
config.put(RESOURCE_CONFIG_CLASS_KEY, RESOURCE_CONFIG_CLASS); config.put(RESOURCE_CONFIG_CLASS_KEY, RESOURCE_CONFIG_CLASS);
prc = new PackagesResourceConfig(SCAN_PACKAGE_DEFAULT); prc = new PackagesResourceConfig(SCAN_PACKAGE_DEFAULT);
......
package org.jivesoftware.openfire.plugin.rest.service; package org.jivesoftware.openfire.plugin.rest.service;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.PUT; import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import org.jivesoftware.openfire.SharedGroupException; import org.jivesoftware.openfire.SharedGroupException;
import org.jivesoftware.openfire.plugin.rest.controller.UserServiceController; import org.jivesoftware.openfire.plugin.rest.controller.UserServiceController;
import org.jivesoftware.openfire.plugin.rest.entity.RosterEntities; import org.jivesoftware.openfire.plugin.rest.entity.RosterEntities;
import org.jivesoftware.openfire.plugin.rest.entity.RosterItemEntity; import org.jivesoftware.openfire.plugin.rest.entity.RosterItemEntity;
import org.jivesoftware.openfire.plugin.rest.exceptions.ExceptionType; import org.jivesoftware.openfire.plugin.rest.exceptions.ExceptionType;
import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException; import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException;
import org.jivesoftware.openfire.user.UserAlreadyExistsException; import org.jivesoftware.openfire.user.UserAlreadyExistsException;
import org.jivesoftware.openfire.user.UserNotFoundException; import org.jivesoftware.openfire.user.UserNotFoundException;
@Path("restapi/v1/users/{username}/roster") @Path("restapi/v1/users/{username}/roster")
public class UserRosterService { public class UserRosterService {
private static final String COULD_NOT_UPDATE_THE_ROSTER = "Could not update the roster"; private static final String COULD_NOT_UPDATE_THE_ROSTER = "Could not update the roster";
private static final String COULD_NOT_CREATE_ROSTER_ITEM = "Could not create roster item"; private static final String COULD_NOT_CREATE_ROSTER_ITEM = "Could not create roster item";
private UserServiceController plugin; private UserServiceController plugin;
@PostConstruct @PostConstruct
public void init() { public void init() {
plugin = UserServiceController.getInstance(); plugin = UserServiceController.getInstance();
} }
@GET @GET
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public RosterEntities getUserRoster(@PathParam("username") String username) throws ServiceException { public RosterEntities getUserRoster(@PathParam("username") String username) throws ServiceException {
return plugin.getRosterEntities(username); return plugin.getRosterEntities(username);
} }
@POST @POST
public Response createRoster(@PathParam("username") String username, RosterItemEntity rosterItemEntity) public Response createRoster(@PathParam("username") String username, RosterItemEntity rosterItemEntity)
throws ServiceException { throws ServiceException {
try { try {
plugin.addRosterItem(username, rosterItemEntity); plugin.addRosterItem(username, rosterItemEntity);
} catch (UserNotFoundException e) { } catch (UserNotFoundException e) {
throw new ServiceException(COULD_NOT_CREATE_ROSTER_ITEM, "", ExceptionType.USER_NOT_FOUND_EXCEPTION, throw new ServiceException(COULD_NOT_CREATE_ROSTER_ITEM, "", ExceptionType.USER_NOT_FOUND_EXCEPTION,
Response.Status.NOT_FOUND, e); Response.Status.NOT_FOUND, e);
} catch (UserAlreadyExistsException e) { } catch (UserAlreadyExistsException e) {
throw new ServiceException(COULD_NOT_CREATE_ROSTER_ITEM, "", ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, throw new ServiceException(COULD_NOT_CREATE_ROSTER_ITEM, "", ExceptionType.USER_ALREADY_EXISTS_EXCEPTION,
Response.Status.BAD_REQUEST, e); Response.Status.CONFLICT, e);
} catch (SharedGroupException e) { } catch (SharedGroupException e) {
throw new ServiceException(COULD_NOT_CREATE_ROSTER_ITEM, "", ExceptionType.SHARED_GROUP_EXCEPTION, throw new ServiceException(COULD_NOT_CREATE_ROSTER_ITEM, "", ExceptionType.SHARED_GROUP_EXCEPTION,
Response.Status.BAD_REQUEST, e); Response.Status.BAD_REQUEST, e);
} }
return Response.status(Response.Status.CREATED).build(); return Response.status(Response.Status.CREATED).build();
} }
@DELETE @DELETE
@Path("/{rosterJid}") @Path("/{rosterJid}")
public Response deleteRoster(@PathParam("username") String username, @PathParam("rosterJid") String rosterJid) public Response deleteRoster(@PathParam("username") String username, @PathParam("rosterJid") String rosterJid)
throws ServiceException { throws ServiceException {
try { try {
plugin.deleteRosterItem(username, rosterJid); plugin.deleteRosterItem(username, rosterJid);
} catch (SharedGroupException e) { } catch (SharedGroupException e) {
throw new ServiceException("Could not delete the roster item", rosterJid, throw new ServiceException("Could not delete the roster item", rosterJid,
ExceptionType.SHARED_GROUP_EXCEPTION, Response.Status.BAD_REQUEST, e); ExceptionType.SHARED_GROUP_EXCEPTION, Response.Status.BAD_REQUEST, e);
} }
return Response.status(Response.Status.OK).build(); return Response.status(Response.Status.OK).build();
} }
@PUT @PUT
@Path("/{rosterJid}") @Path("/{rosterJid}")
public Response updateRoster(@PathParam("username") String username, @PathParam("rosterJid") String rosterJid, public Response updateRoster(@PathParam("username") String username, @PathParam("rosterJid") String rosterJid,
RosterItemEntity rosterItemEntity) throws ServiceException { RosterItemEntity rosterItemEntity) throws ServiceException {
try { try {
plugin.updateRosterItem(username, rosterJid, rosterItemEntity); plugin.updateRosterItem(username, rosterJid, rosterItemEntity);
} catch (UserNotFoundException e) { } catch (UserNotFoundException e) {
throw new ServiceException(COULD_NOT_UPDATE_THE_ROSTER, rosterJid, ExceptionType.USER_NOT_FOUND_EXCEPTION, throw new ServiceException(COULD_NOT_UPDATE_THE_ROSTER, rosterJid, ExceptionType.USER_NOT_FOUND_EXCEPTION,
Response.Status.NOT_FOUND, e); Response.Status.NOT_FOUND, e);
} catch (SharedGroupException e) { } catch (SharedGroupException e) {
throw new ServiceException(COULD_NOT_UPDATE_THE_ROSTER, rosterJid, ExceptionType.SHARED_GROUP_EXCEPTION, throw new ServiceException(COULD_NOT_UPDATE_THE_ROSTER, rosterJid, ExceptionType.SHARED_GROUP_EXCEPTION,
Response.Status.BAD_REQUEST, e); Response.Status.BAD_REQUEST, e);
} catch (UserAlreadyExistsException e) { } catch (UserAlreadyExistsException e) {
throw new ServiceException(COULD_NOT_UPDATE_THE_ROSTER, rosterJid, throw new ServiceException(COULD_NOT_UPDATE_THE_ROSTER, rosterJid,
ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.BAD_REQUEST, e); ExceptionType.USER_ALREADY_EXISTS_EXCEPTION, Response.Status.CONFLICT, e);
} }
return Response.status(Response.Status.OK).build(); return Response.status(Response.Status.OK).build();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment