Modified: 
openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java
URL: 
http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- 
openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java
 (original)
+++ 
openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/ServerWebService.java
 Fri Nov  6 06:18:44 2015
@@ -18,12 +18,31 @@
  */
 package org.apache.openmeetings.webservice;
 
+import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+
+import java.util.List;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.cxf.feature.Features;
 import org.apache.openmeetings.db.dao.server.ServerDao;
 import org.apache.openmeetings.db.dao.server.SessiondataDao;
 import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.dto.basic.ServiceResult;
+import org.apache.openmeetings.db.dto.basic.ServiceResult.Type;
+import org.apache.openmeetings.db.dto.server.ServerDTO;
 import org.apache.openmeetings.db.entity.server.Server;
 import org.apache.openmeetings.db.util.AuthLevelUtil;
-import org.apache.openmeetings.util.OpenmeetingsVariables;
 import org.apache.openmeetings.webservice.error.ServiceException;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -37,21 +56,24 @@ import org.springframework.beans.factory
  * @webservice ServerService
  * 
  */
+@WebService(serviceName="org.apache.openmeetings.webservice.ServerWebService")
+@Features(features = "org.apache.cxf.feature.LoggingFeature")
+@Produces({MediaType.APPLICATION_JSON})
+@Path("/server")
 public class ServerWebService {
-       private static final Logger log = Red5LoggerFactory.getLogger(
-                       ServerWebService.class, 
OpenmeetingsVariables.webAppRootKey);
+       private static final Logger log = 
Red5LoggerFactory.getLogger(ServerWebService.class, webAppRootKey);
 
        @Autowired
-       private SessiondataDao sessiondataDao;
+       private SessiondataDao sessionDao;
        @Autowired
        private UserDao userDao;
        @Autowired
-       private ServerDao serversDao;
+       private ServerDao serverDao;
 
        /**
         * Method to retrieve the list of the servers participating in cluster
         * 
-        * @param SID
+        * @param sid
         *            - session id to identify the user making request
         * @param start
         *            - server index to start with
@@ -59,15 +81,22 @@ public class ServerWebService {
         *            - Maximum server count
         * @return The list of servers participating in cluster
         */
-       public Server[] getServers(String SID, int start, int max) throws 
ServiceException {
+       @WebMethod
+       @GET
+       @Path("/{start}/{max}")
+       public List<ServerDTO> getServers(@QueryParam("sid") 
@WebParam(name="sid") String sid
+                       , @PathParam("start") @WebParam(name="start") int start
+                       , @PathParam("max") @WebParam(name="max") int max
+                       ) throws ServiceException
+       {
                log.debug("getServers enter");
-               Long users_id = sessiondataDao.checkSession(SID);
+               Long userId = sessionDao.checkSession(sid);
 
-               if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-                       return serversDao.get(start, max).toArray(new 
Server[0]);
+               if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(userId))) {
+                       return ServerDTO.list(serverDao.get(start, max));
                } else {
                        log.warn("Insuffisient permissions");
-                       return null;
+                       throw new ServiceException("Insufficient permissins"); 
//TODO code -26
                }
        }
 
@@ -75,99 +104,74 @@ public class ServerWebService {
         * Method to retrieve the total count of the servers participating in
         * cluster
         * 
-        * @param SID
+        * @param sid
         *            - session id to identify the user making request
         * @return total count of the servers participating in cluster
         */
-       public int getServerCount(String SID) throws ServiceException {
+       @WebMethod
+       @GET
+       @Path("/count")
+       public long count(@QueryParam("sid") @WebParam(name="sid") String sid) 
throws ServiceException {
                log.debug("getServerCount enter");
-               Long users_id = sessiondataDao.checkSession(SID);
+               Long userId = sessionDao.checkSession(sid);
 
-               if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-                       return (int) serversDao.count();
+               if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(userId))) {
+                       return serverDao.count();
                } else {
-                       log.warn("Insuffisient permissions");
-                       return -1;
+                       throw new ServiceException("Insufficient permissins"); 
//TODO code -26
                }
        }
 
        /**
         * Method to add/update server
         * 
-        * @param SID
+        * @param sid
         *            - session id to identify the user making request
-        * @param id
-        *            - the id of the server to save
-        * @param name
-        *            - the name of the server to save
-        * @param address
-        *            - the address(DNS name or IP) of the server to save
-        * @param port
-        *            - the http port of the slave
-        * @param user
-        *            - REST user to access the slave
-        * @param pass
-        *            - REST pass to access the slave
-        * @param webapp
-        *            - webapp name of the OpenMeetings instance
-        * @param protocol
-        *            - protocol to access the OpenMeetings instance
-        * @param active
-        *            - if the server currently participates in the cluster or 
not
-        * @param comment
-        *            - comment for the server
+        * @param server
+        *            - server to add/update
         * @return the id of saved server
         */
-       public long saveServer(String SID, long id, String name, String address,
-                       int port, String user, String pass, String webapp, 
String protocol,
-                       Boolean active, String comment) throws ServiceException 
{
+       @WebMethod
+       @POST
+       @Path("/")
+       public ServerDTO add(@WebParam(name="sid") @QueryParam("sid") String 
sid, @WebParam(name="server") @QueryParam("server") ServerDTO server) throws 
ServiceException {
                log.debug("saveServerCount enter");
-               Long users_id = sessiondataDao.checkSession(SID);
-
-               if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-                       Server s = serversDao.get(id);
-                       if (s == null) {
-                               s = new Server();
-                       }
-                       s.setName(name);
-                       s.setAddress(address);
-                       s.setPort(port);
-                       s.setUser(user);
-                       s.setPass(pass);
-                       s.setWebapp(webapp);
-                       s.setProtocol(protocol);
-                       s.setActive(active);
-                       s.setComment(comment);
-                       return serversDao.update(s, users_id).getId();
+               Long userId = sessionDao.checkSession(sid);
+               if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(userId))) {
+                       Server s = server.get();
+                       return new ServerDTO(serverDao.update(s, userId));
                } else {
                        log.warn("Insuffisient permissions");
-                       return -1;
+                       throw new ServiceException("Insufficient permissins"); 
//TODO code -26
                }
        }
 
        /**
         * Method to delete server
         * 
-        * @param SID
+        * @param sid
         *            - session id to identify the user making request
         * @param id
         *            - the id of the server to delete
         * @return true if the server was deleted, false otherwise
         */
-       public boolean deleteServer(String SID, long id) throws 
ServiceException {
+       @WebMethod
+       @DELETE
+       @Path("/{id}")
+       public ServiceResult delete(@WebParam(name="sid") @QueryParam("sid") 
String sid, @WebParam(name="id") @PathParam("id") long id) throws 
ServiceException {
                log.debug("saveServerCount enter");
-               Long users_id = sessiondataDao.checkSession(SID);
+               Long userId = sessionDao.checkSession(sid);
 
-               if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-                       Server s = serversDao.get(id);
+               if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(userId))) {
+                       Server s = serverDao.get(id);
                        if (s != null) {
-                               serversDao.delete(s, users_id);
-                               return true;
+                               serverDao.delete(s, userId);
+                               return new ServiceResult(id, "Deleted", 
Type.SUCCESS);
                        }
+                       return new ServiceResult(0L, "Not found", Type.SUCCESS);
                } else {
                        log.warn("Insuffisient permissions");
+                       throw new ServiceException("Insufficient permissins"); 
//TODO code -26
                }
-               return false;
        }
-
 }

Modified: 
openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
URL: 
http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- 
openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
 (original)
+++ 
openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
 Fri Nov  6 06:18:44 2015
@@ -20,31 +20,39 @@ package org.apache.openmeetings.webservi
 
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
 
-import java.util.ArrayList;
 import java.util.Date;
 
-import org.apache.openmeetings.core.remote.MainService;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.cxf.feature.Features;
+import org.apache.openmeetings.core.remote.ConferenceService;
 import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
-import org.apache.openmeetings.db.dao.basic.ErrorDao;
-import org.apache.openmeetings.db.dao.label.LabelDao;
 import org.apache.openmeetings.db.dao.server.SOAPLoginDao;
 import org.apache.openmeetings.db.dao.server.SessiondataDao;
-import org.apache.openmeetings.db.dao.user.OrganisationDao;
-import org.apache.openmeetings.db.dao.user.OrganisationUserDao;
+import org.apache.openmeetings.db.dao.user.IUserManager;
 import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.dto.basic.ErrorResult;
-import org.apache.openmeetings.db.dto.basic.SearchResult;
-import org.apache.openmeetings.db.dto.user.UserSearchResult;
-import org.apache.openmeetings.db.entity.basic.ErrorType;
-import org.apache.openmeetings.db.entity.basic.ErrorValue;
+import org.apache.openmeetings.db.dto.basic.ServiceResult;
+import org.apache.openmeetings.db.dto.basic.ServiceResult.Type;
+import org.apache.openmeetings.db.dto.room.RoomOptionsDTO;
+import org.apache.openmeetings.db.dto.user.ExternalUserDTO;
+import org.apache.openmeetings.db.dto.user.UserDTO;
 import org.apache.openmeetings.db.entity.server.RemoteSessionObject;
 import org.apache.openmeetings.db.entity.server.Sessiondata;
-import org.apache.openmeetings.db.entity.user.Organisation;
-import org.apache.openmeetings.db.entity.user.Organisation_Users;
+import org.apache.openmeetings.db.entity.user.Address;
+import org.apache.openmeetings.db.entity.user.State;
 import org.apache.openmeetings.db.entity.user.User;
 import org.apache.openmeetings.db.entity.user.User.Right;
 import org.apache.openmeetings.db.util.AuthLevelUtil;
-import org.apache.openmeetings.service.user.UserManager;
 import org.apache.openmeetings.util.OmException;
 import org.apache.openmeetings.webservice.error.ServiceException;
 import org.red5.logging.Red5LoggerFactory;
@@ -60,363 +68,131 @@ import org.springframework.beans.factory
  * @webservice UserService
  * 
  */
+@WebService(serviceName="org.apache.openmeetings.webservice.UserWebService")
+@Features(features = "org.apache.cxf.feature.LoggingFeature")
+@Produces({MediaType.APPLICATION_JSON})
+@Path("/user")
 public class UserWebService {
        private static final Logger log = 
Red5LoggerFactory.getLogger(UserWebService.class, webAppRootKey);
-
-       @Autowired
-       private SessiondataDao sessiondataDao;
-       @Autowired
-       private ConfigurationDao configurationDao;
-       @Autowired
-       private UserManager userManagement;
        @Autowired
-       private ErrorDao errorDao;
+       private ConfigurationDao cfgDao;
        @Autowired
-       private OrganisationDao orgDao;
-       @Autowired
-       private OrganisationUserDao orgUserDao;
+       private IUserManager userManagement;
        @Autowired
        private SOAPLoginDao soapLoginDao;
        @Autowired
        private UserDao userDao;
        @Autowired
-       private MainService mainService;
+       private SessiondataDao sessionDao;
        @Autowired
-       private LabelDao labelDao;
-
-       /**
-        * load this session id before doing anything else Returns an Object of 
Type
-        * Sessiondata, this contains a sessionId, use that sessionId in all 
Methods
-        * 
-        * @return - creates new session
-        */
-       public Sessiondata getSession() {
-               log.debug("SPRING LOADED getSession -- ");
-               return mainService.getsessiondata();
-       }
+       private ConferenceService conferenceService;
 
        /**
-        * Auth function, use the SID you get by getSession, return positive 
means
-        * logged-in, if negative its an ErrorCode, you have to invoke the 
Method
-        * getErrorByCode to get the Text-Description of that ErrorCode
-        * 
-        * @param SID - The SID from getSession
-        * @param username - Username from OpenMeetings, the user has to have 
Admin-rights
-        * @param userpass - Userpass from OpenMeetings
+        * @param user - login or email of Openmeetings user with admin or 
SOAP-rights
+        * @param pass - password
         *            
-        * @return - id of the logged in user, -1 in case of the error
+        * @return - {@link ServiceResult} with error code or SID and userId
         */
-       public Long loginUser(String SID, String username, String userpass) 
throws ServiceException {
+       @WebMethod
+       @GET
+       @Path("/login")
+       public ServiceResult login(@WebParam(name="user") @QueryParam("user") 
String user, @WebParam(name="pass") @QueryParam("pass") String pass) {
                try {
-                       log.debug("Login user SID : " + SID);
-                       User u = userDao.login(username, userpass);
+                       log.debug("Login user");
+                       User u = userDao.login(user, pass);
                        if (u == null) {
-                               return -1L;
+                               return new ServiceResult(-1L, "Login failed", 
Type.ERROR);
                        }
                        
-                       boolean bool = sessiondataDao.updateUser(SID, 
u.getUser_id(), false, u.getLanguage_id());
-                       if (!bool) {
-                               // invalid Session-Object
-                               return -35L;
+                       Sessiondata sd = sessionDao.startsession();
+                       log.debug("Login user SID : " + sd.getSessionId());
+                       if (!sessionDao.updateUser(sd.getSessionId(), 
u.getId(), false, u.getLanguageId())) {
+                               return new ServiceResult(-35L, "invalid 
Session-Object", Type.ERROR);
                        }
                        
-                       return u.getUser_id();
+                       return new ServiceResult(u.getId(), sd.getSessionId(), 
Type.SUCCESS);
                } catch (OmException oe) {
-                       if (oe.getCode() != null) {
-                               return oe.getCode();
-                       }
-               } catch (Exception err) {
-                       log.error("[loginUser]", err);
-               }
-               return -1L;
-       }
-
-       /**
-        * loads an Error-Object. If a Method returns a negative Result, its an
-        * Error-id, it needs a language_id to specify in which language you 
want to
-        * display/read the error-message. English has the Language-ID one, for
-        * different one see the list of languages
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param errorid
-        *            the error id (negative Value here!)
-        * @param langId
-        *            The id of the language
-        *            
-        * @return - error with the code given
-        */
-       public ErrorResult getErrorByCode(String SID, long errorid, long 
langId) {
-               try {
-                       if (errorid < 0) {
-                               ErrorValue eValues = errorDao.get(-1 * errorid);
-                               if (eValues != null) {
-                                       ErrorType eType = 
errorDao.getErrorType(eValues.getErrortype_id());
-                                       log.debug("eValues.getFieldvalues_id() 
= " + eValues.getFieldvalues_id());
-                                       log.debug("eValues.getErrorType() = " + 
eType);
-                                       String eValue = 
labelDao.getString(eValues.getFieldvalues_id(), langId);
-                                       String tValue = 
labelDao.getString(eType.getFieldvalues_id(), langId);
-                                       if (eValue != null) {
-                                               return new ErrorResult(errorid, 
eValue, tValue);
-                                       }
-                               }
-                       } else {
-                               return new ErrorResult(errorid, "Error ... 
please check your input", "Error");
-                       }
+                       return new ServiceResult(oe.getCode() == null ? -1 : 
oe.getCode(), oe.getMessage(), Type.ERROR);
                } catch (Exception err) {
-                       log.error("[getErrorByCode] ", err);
+                       log.error("[login]", err);
+                       return new ServiceResult(-1L, err.getMessage(), 
Type.ERROR);
                }
-               return null;
        }
 
        /**
         * Adds a new User like through the Frontend, but also does activates 
the
         * Account To do SSO see the methods to create a hash and use those 
ones!
         * 
-        * @param SID
+        * @param sid
         *            The SID from getSession
-        * @param username
-        *            any username
-        * @param userpass
-        *            any userpass
-        * @param lastname
-        *            any lastname
-        * @param firstname
-        *            any firstname
-        * @param email
-        *            any email
-        * @param additionalname
-        *            any additionalname
-        * @param street
-        *            any street
-        * @param zip
-        *            any zip
-        * @param fax
-        *            any fax
-        * @param states_id
-        *            a valid states_id
-        * @param town
-        *            any town
-        * @param language_id
-        *            the language_id
+        * @param user
+        *            user object
+        * @param confirm
+        *            whatever or not to send email, leave empty for auto-send
         *            
         * @return - id of the user added or error code
         * @throws ServiceException
         */
-       public Long addNewUser(String SID, String username, String userpass,
-                       String lastname, String firstname, String email,
-                       String additionalname, String street, String zip, 
String fax,
-                       long states_id, String town, long language_id)
-                       throws ServiceException {
-               try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
-                               String jName_timeZone = 
configurationDao.getConfValue("default.timezone", String.class, "");
-
-                               Long user_id = 
userManagement.registerUser(username, userpass,
-                                               lastname, firstname, email, new 
Date(), street,
-                                               additionalname, fax, zip, 
states_id, town, language_id,
-                                               "", false, true, // generate 
SIP Data if the config is enabled
-                                               jName_timeZone);
-
-                               if (user_id == null || user_id < 0) {
-                                       return user_id;
-                               }
-
-                               User user = userDao.get(user_id);
-
-                               // activate the User
-                               user.getRights().add(Right.Dashboard);
-                               user.getRights().add(Right.Login);
-                               user.getRights().add(Right.Room);
-                               user.setUpdatetime(new Date());
-
-                               userDao.update(user, users_id);
-
-                               return user_id;
-
-                       } else {
-                               return new Long(-26);
-                       }
-               } catch (Exception err) {
-                       log.error("addNewUser", err);
-                       throw new ServiceException(err.getMessage());
-               }
-       }
-
-       /**
-        * Adds a new User like through the Frontend, but also does activates 
the
-        * Account
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param username
-        *            any username
-        * @param userpass
-        *            any userpass
-        * @param lastname
-        *            any lastname
-        * @param firstname
-        *            any firstname
-        * @param email
-        *            any email
-        * @param additionalname
-        *            any additionalname
-        * @param street
-        *            any street
-        * @param zip
-        *            any zip
-        * @param fax
-        *            any fax
-        * @param states_id
-        *            a valid states_id
-        * @param town
-        *            any town
-        * @param language_id
-        *            the language_id
-        * @param jNameTimeZone
-        *            the name of the timezone for the user
-        *            
-        * @return - id of the user added or the error code
-        * @throws ServiceException
-        */
-       public Long addNewUserWithTimeZone(String SID, String username,
-                       String userpass, String lastname, String firstname, 
String email,
-                       String additionalname, String street, String zip, 
String fax,
-                       long states_id, String town, long language_id, String 
jNameTimeZone) throws ServiceException {
-               try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
-                               Long user_id = 
userManagement.registerUser(username, userpass,
-                                               lastname, firstname, email, new 
Date(), street,
-                                               additionalname, fax, zip, 
states_id, town, language_id,
-                                               "", false, true, // generate
-                                                                               
        // SIP
-                                                                               
        // Data
-                                                                               
        // if
-                                                                               
        // the
-                                                                               
        // config
-                                                                               
        // is
-                                                                               
        // enabled
-                                               jNameTimeZone); 
-
-                               if (user_id == null || user_id < 0) {
-                                       return user_id;
-                               }
-
-                               User user = userDao.get(user_id);
-
-                               // activate the User
-                               user.getRights().add(Right.Login);
-                               user.setUpdatetime(new Date());
-
-                               userDao.update(user, users_id);
-
-                               return user_id;
-
-                       } else {
-                               return new Long(-26);
-                       }
-               } catch (Exception err) {
-                       log.error("addNewUserWithTimeZone", err);
-                       throw new ServiceException(err.getMessage());
-               }
-       }
-
-       /**
-        * Adds a new User like through the Frontend, but also does activates 
the
-        * Account, sends NO email (no matter what you configured) and sets the
-        * users external user id and type
-        * 
-        * Use the methods to create a hash for SSO, creating users is not 
required
-        * for SSO
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param username
-        *            any username
-        * @param userpass
-        *            any userpass
-        * @param lastname
-        *            any lastname
-        * @param firstname
-        *            any firstname
-        * @param email
-        *            any email
-        * @param additionalname
-        *            any additionalname
-        * @param street
-        *            any street
-        * @param zip
-        *            any zip
-        * @param fax
-        *            any fax
-        * @param states_id
-        *            a valid states_id
-        * @param town
-        *            any town
-        * @param language_id
-        *            the language_id
-        * @param jNameTimeZone
-        *            the name of the timezone for the user
-        * @param externalUserId
-        *            externalUserId
-        * @param externalUserType
-        *            externalUserType
-        *            
-        * @return - id of user added or error code
-        * @throws ServiceException
-        */
-       public Long addNewUserWithExternalType(String SID, String username,
-                       String userpass, String lastname, String firstname, 
String email,
-                       String additionalname, String street, String zip, 
String fax,
-                       long states_id, String town, long language_id,
-                       String jNameTimeZone, String externalUserId, String 
externalUserType)
-                       throws ServiceException {
+       @WebMethod
+       @POST
+       @Path("/")
+       public UserDTO add(
+                       @WebParam(name="sid") @QueryParam("sid") String sid
+                       , @WebParam(name="user") @QueryParam("user") UserDTO 
user
+                       , @WebParam(name="confirm") @QueryParam("confirm") 
Boolean confirm
+                       ) throws ServiceException
+       {
                try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-
-                       if 
(AuthLevelUtil.hasAdminLevel(userDao.getRights(users_id))) {
+                       Long authUserId = sessionDao.checkSession(sid);
 
-                               User testUser = 
userDao.getExternalUser(externalUserId, externalUserType);
+                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(authUserId))) {
+                               User testUser = 
userDao.getExternalUser(user.getExternalId(), user.getExternalType());
 
                                if (testUser != null) {
-                                       throw new Exception("User does already 
exist!");
+                                       throw new ServiceException("User does 
already exist!");
                                }
 
-                               // This will send no email to the users
-                               Long user_id = 
userManagement.registerUserNoEmail(username,
-                                               userpass, lastname, firstname, 
email, new Date(),
-                                               street, additionalname, fax, 
zip, states_id, town,
-                                               language_id, "", false, true, 
// generate SIP Data if the config is enabled
-                                               jNameTimeZone);
+                               String jName_timeZone = 
cfgDao.getConfValue("default.timezone", String.class, "");
+                               if (user.getAddress() == null) {
+                                       user.setAddress(new Address());
+                                       State s = new State();
+                                       s.setId(1L);
+                                       user.getAddress().setState(s);
+                               }
+                               if (user.getLanguageId() == null) {
+                                       user.setLanguageId(1L);
+                               }
+                               Long userId = 
userManagement.registerUser(user.getLogin(), user.getPassword(),
+                                               user.getLastname(), 
user.getFirstname(), user.getAddress().getEmail(), new Date(), 
user.getAddress().getStreet(),
+                                               
user.getAddress().getAdditionalname(), user.getAddress().getFax(), 
user.getAddress().getZip(), user.getAddress().getState().getId()
+                                               , user.getAddress().getTown(), 
user.getLanguageId(),
+                                               "", false, true, // generate 
SIP Data if the config is enabled
+                                               jName_timeZone, confirm);
 
-                               if (user_id == null || user_id < 0) {
-                                       return user_id;
+                               if (userId == null || userId < 0) {
+                                       throw new ServiceException("Unknown 
error");
                                }
 
-                               User user = userDao.get(user_id);
-
-                               // activate the User
-                               user.getRights().add(Right.Login);
-                               user.setUpdatetime(new Date());
-                               user.setExternalUserId(externalUserId);
-                               user.setExternalUserType(externalUserType);
+                               User u = userDao.get(userId);
 
-                               userDao.update(user, users_id);
+                               u.getRights().add(Right.Room);
+                               if (user.getExternalId() == null && 
user.getExternalType() == null) {
+                                       // activate the User
+                                       u.getRights().add(Right.Login);
+                                       u.getRights().add(Right.Dashboard);
+                               } else {
+                                       u.setExternalId(user.getExternalId());
+                                       
u.setExternalType(user.getExternalType());
+                               }
 
-                               return user_id;
+                               u = userDao.update(u, authUserId);
 
+                               return new UserDTO(u);
                        } else {
-                               return new Long(-26);
+                               throw new ServiceException("Insufficient 
permissins"); //TODO code -26
                        }
-
                } catch (Exception err) {
-                       log.error("addNewUserWithExternalType", err);
+                       log.error("addNewUser", err);
                        throw new ServiceException(err.getMessage());
                }
        }
@@ -425,29 +201,28 @@ public class UserWebService {
         * 
         * Delete a certain user by its id
         * 
-        * @param SID
+        * @param sid
         *            The SID from getSession
-        * @param userId
+        * @param id
         *            the openmeetings user id
         *            
         * @return - id of the user deleted, error code otherwise
         * @throws ServiceException
         */
-       public Long deleteUserById(String SID, Long userId) throws 
ServiceException {
+       @WebMethod
+       @DELETE
+       @Path("/{id}")
+       public ServiceResult delete(@WebParam(name="sid") @QueryParam("sid") 
String sid, @WebParam(name="id") @PathParam("id") long id) throws 
ServiceException {
                try {
-                       Long users_id = sessiondataDao.checkSession(SID);
+                       Long authUserId = sessionDao.checkSession(sid);
 
-                       if 
(AuthLevelUtil.hasAdminLevel(userDao.getRights(users_id))) {
-
-                               // Setting user deleted
-                               userDao.deleteUserID(userId);
-
-                               return userId;
+                       if 
(AuthLevelUtil.hasAdminLevel(userDao.getRights(authUserId))) {
+                               userDao.deleteUserID(id);
 
+                               return new ServiceResult(id, "Deleted", 
Type.SUCCESS);
                        } else {
-                               return new Long(-26);
+                               return new ServiceResult(-26L, "Insufficient 
permissins", Type.ERROR);
                        }
-
                } catch (Exception err) {
                        log.error("deleteUserById", err);
                        throw new ServiceException(err.getMessage());
@@ -458,36 +233,39 @@ public class UserWebService {
         * 
         * Delete a certain user by its external user id
         * 
-        * @param SID
+        * @param sid
         *            The SID from getSession
-        * @param externalUserId
+        * @param externalId
         *            externalUserId
-        * @param externalUserType
+        * @param externalType
         *            externalUserId
         *            
         * @return - id of user deleted, or error code
         * @throws ServiceException
         */
-       public Long deleteUserByExternalUserIdAndType(String SID,
-                       String externalUserId, String externalUserType) throws 
ServiceException {
+       @DELETE
+       @Path("/{externaltype}/{externalid}")
+       public ServiceResult deleteExternal(
+                       @WebParam(name="sid") @QueryParam("sid") String sid
+                       , @WebParam(name="externaltype") 
@PathParam("externaltype") String externalType
+                       , @WebParam(name="externalid") @PathParam("externalid") 
String externalId
+                       ) throws ServiceException
+       {
                try {
-                       Long users_id = sessiondataDao.checkSession(SID);
+                       Long authUserId = sessionDao.checkSession(sid);
 
-                       if 
(AuthLevelUtil.hasAdminLevel(userDao.getRights(users_id))) {
+                       if 
(AuthLevelUtil.hasAdminLevel(userDao.getRights(authUserId))) {
+                               User userExternal = 
userDao.getExternalUser(externalId, externalType);
 
-                               User userExternal = 
userDao.getExternalUser(externalUserId, externalUserType);
-
-                               Long userId = userExternal.getUser_id();
+                               Long userId = userExternal.getId();
 
                                // Setting user deleted
                                userDao.deleteUserID(userId);
 
-                               return userId;
-
+                               return new ServiceResult(userId, "Deleted", 
Type.SUCCESS);
                        } else {
-                               return new Long(-26);
+                               return new ServiceResult(-26L, "Insufficient 
permissins", Type.ERROR);
                        }
-
                } catch (Exception err) {
                        log.error("deleteUserByExternalUserIdAndType", err);
                        throw new ServiceException(err.getMessage());
@@ -499,45 +277,32 @@ public class UserWebService {
         * Session-Object you can use the SID + a RoomId to enter any Room. ...
         * Session-Hashs are deleted 15 minutes after the creation if not used.
         * 
-        * @param SID
+        * @param sid
         *            The SID from getSession
-        * @param username
-        *            any username
-        * @param firstname
-        *            any firstname
-        * @param lastname
-        *            any lastname
-        * @param profilePictureUrl
-        *            any profilePictureUrl
-        * @param email
-        *            any email
-        * @param externalUserId
-        *            if you have any external user Id you may set it here
-        * @param externalUserType
-        *            you can specify your system-name here, for example 
"moodle"
-        * @param room_id
-        *            the room id the user should be logged in
-        * @param becomeModeratorAsInt
-        *            0 means no Moderator, 1 means Moderator
-        * @param showAudioVideoTestAsInt
-        *            0 means don't show Audio/Video Test, 1 means show 
Audio/Video
-        *            Test Application before the user is logged into the room
+        * @param user
+        *            user details to set
+        * @param options
+        *            room options to set
         *            
         * @return - secure hash or error code
         * @throws ServiceException
         */
-       public String setUserObjectAndGenerateRoomHash(String SID, String 
username,
-                       String firstname, String lastname, String 
profilePictureUrl,
-                       String email, String externalUserId, String 
externalUserType,
-                       Long room_id, int becomeModeratorAsInt, int 
showAudioVideoTestAsInt)
-                       throws ServiceException {
+       @WebMethod
+       @POST
+       @Path("/hash")
+       public ServiceResult getRoomHash(
+                       @WebParam(name="sid") @QueryParam("sid") String sid
+                       , @WebParam(name="user") @QueryParam("user") 
ExternalUserDTO user
+                       , @WebParam(name="options") @QueryParam("options") 
RoomOptionsDTO options
+                       ) throws ServiceException
+       {
                try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
+                       Long userId = sessionDao.checkSession(sid);
+                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(userId))) {
                                RemoteSessionObject remoteSessionObject = new 
RemoteSessionObject(
-                                               username, firstname, lastname, 
profilePictureUrl,
-                                               email, externalUserId, 
externalUserType);
+                                               user.getLogin(), 
user.getFirstname(), user.getLastname()
+                                               , user.getProfilePictureUrl(), 
user.getEmail()
+                                               , user.getExternalId(), 
user.getExternalType());
 
                                log.debug(remoteSessionObject.toString());
 
@@ -545,580 +310,76 @@ public class UserWebService {
 
                                log.debug("xmlString " + xmlString);
 
-                               sessiondataDao.updateUserRemoteSession(SID, 
xmlString);
-
-                               boolean becomeModerator = false;
-                               if (becomeModeratorAsInt != 0) {
-                                       becomeModerator = true;
-                               }
-
-                               boolean showAudioVideoTest = false;
-                               if (showAudioVideoTestAsInt != 0) {
-                                       showAudioVideoTest = true;
-                               }
+                               sessionDao.updateUserRemoteSession(sid, 
xmlString);
 
-                               String hash = soapLoginDao.addSOAPLogin(SID, 
room_id,
-                                               becomeModerator, 
showAudioVideoTest, false, // allowSameURLMultipleTimes
-                                               null, // recording_id
-                                               false, // 
showNickNameDialogAsInt
+                               //TODO LandingZone are not configurable for now
+                               String hash = soapLoginDao.addSOAPLogin(sid, 
options.getRoomId(),
+                                               options.isModerator(), 
options.isShowAudioVideoTest(), options.isAllowSameURLMultipleTimes(),
+                                               options.getRecordingId(),
+                                               options.isShowNickNameDialog(),
                                                "room", // LandingZone,
-                                               true // allowRecording
+                                               options.isAllowRecording()
                                                );
 
                                if (hash != null) {
-                                       return hash;
+                                       return new ServiceResult(0, hash, 
Type.SUCCESS);
                                }
-
                        } else {
-                               return "" + new Long(-26);
+                               return new ServiceResult(-26L, "Insufficient 
permissins", Type.ERROR);
                        }
                } catch (Exception err) {
                        log.error("setUserObjectWithAndGenerateRoomHash", err);
                        throw new ServiceException(err.getMessage());
                }
-               return "" + new Long(-1);
-       }
-
-       /**
-        * 
-        * Description: sets the SessionObject for a certain SID, after setting 
this
-        * Session-Object you can use the SID + a RoomId to enter any Room.
-        * 
-        * ++ the user can press f5 to reload the page / use the link several 
times,
-        * the SOAP Gateway does remember the IP of the user and the will only 
the
-        * first user that enters the room allow to re-enter. ... Session-Hashs 
are
-        * deleted 15 minutes after the creation if not used.
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param username
-        *            any username
-        * @param firstname
-        *            any firstname
-        * @param lastname
-        *            any lastname
-        * @param profilePictureUrl
-        *            any profilePictureUrl
-        * @param email
-        *            any email any email
-        * @param externalUserId
-        *            if you have any external user Id you may set it here
-        * @param externalUserType
-        *            you can specify your system-name here, for example 
"moodle"
-        * @param room_id
-        *            the room id the user should be logged in
-        * @param becomeModeratorAsInt
-        *            0 means no Moderator, 1 means Moderator
-        * @param showAudioVideoTestAsInt
-        *            0 means don't show Audio/Video Test, 1 means show 
Audio/Video
-        *            Test Application before the user is logged into the room
-        *            
-        * @return - secure hash or error code
-        */
-       public String setUserObjectAndGenerateRoomHashByURL(String SID,
-                       String username, String firstname, String lastname,
-                       String profilePictureUrl, String email, String 
externalUserId,
-                       String externalUserType, Long room_id, int 
becomeModeratorAsInt,
-                       int showAudioVideoTestAsInt) throws ServiceException {
-
-               log.debug("UserService.setUserObjectAndGenerateRoomHashByURL");
-               try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
-                               RemoteSessionObject remoteSessionObject = new 
RemoteSessionObject(
-                                               username, firstname, lastname, 
profilePictureUrl,
-                                               email, externalUserId, 
externalUserType);
-
-                               log.debug(remoteSessionObject.toString());
-
-                               String xmlString = remoteSessionObject.toXml();
-
-                               log.debug("xmlString " + xmlString);
-
-                               sessiondataDao.updateUserRemoteSession(SID, 
xmlString);
-
-                               boolean becomeModerator = false;
-                               if (becomeModeratorAsInt != 0) {
-                                       becomeModerator = true;
-                               }
-
-                               boolean showAudioVideoTest = false;
-                               if (showAudioVideoTestAsInt != 0) {
-                                       showAudioVideoTest = true;
-                               }
-
-                               String hash = soapLoginDao.addSOAPLogin(SID, 
room_id,
-                                               becomeModerator, 
showAudioVideoTest, true, // allowSameURLMultipleTimes
-                                               null, // recording_id
-                                               false, // 
showNickNameDialogAsInt
-                                               "room", // LandingZone,
-                                               true // allowRecording
-                                               );
-
-                               if (hash != null) {
-                                       return hash;
-                               }
-
-                       } else {
-                               return "" + new Long(-26);
-                       }
-               } catch (Exception err) {
-                       log.error("setUserObjectAndGenerateRoomHashByURL", err);
-                       throw new ServiceException(err.getMessage());
-               }
-               return "" + new Long(-1);
-       }
-
-       /**
-        * 
-        * Description: sets the SessionObject for a certain SID, after setting 
this
-        * Session-Object you can use the SID + a RoomId to enter any Room.
-        * 
-        * ++ the user can press f5 to reload the page / use the link several 
times,
-        * the SOAP Gateway does remember the IP of the user and the will only 
the
-        * first user that enters the room allow to re-enter. ... Session-Hashs 
are
-        * deleted 15 minutes after the creation if not used.
-        * 
-        * ++ sets the flag if the user can do recording in the conference room
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param username
-        *            any username
-        * @param firstname
-        *            any firstname
-        * @param lastname
-        *            any lastname
-        * @param profilePictureUrl
-        *            any profilePictureUrl
-        * @param email
-        *            any email
-        * @param externalUserId
-        *            if you have any external user Id you may set it here
-        * @param externalUserType
-        *            you can specify your system-name here, for example 
"moodle"
-        * @param room_id
-        *            the room id the user should be logged in
-        * @param becomeModeratorAsInt
-        *            0 means no Moderator, 1 means Moderator
-        * @param showAudioVideoTestAsInt
-        *            0 means don't show Audio/Video Test, 1 means show 
Audio/Video
-        *            Test Application before the user is logged into the room
-        * @param allowRecording
-        *            0 means don't allow Recording, 1 means allow Recording
-        *            
-        * @return - secure hash or error code
-        */
-       public String setUserObjectAndGenerateRoomHashByURLAndRecFlag(String 
SID,
-                       String username, String firstname, String lastname,
-                       String profilePictureUrl, String email, String 
externalUserId,
-                       String externalUserType, Long room_id, int 
becomeModeratorAsInt,
-                       int showAudioVideoTestAsInt, int allowRecording) {
-               try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
-                               RemoteSessionObject remoteSessionObject = new 
RemoteSessionObject(
-                                               username, firstname, lastname, 
profilePictureUrl,
-                                               email, externalUserId, 
externalUserType);
-
-                               log.debug(remoteSessionObject.toString());
-
-                               String xmlString = remoteSessionObject.toXml();
-
-                               log.debug("xmlString " + xmlString);
-
-                               sessiondataDao.updateUserRemoteSession(SID, 
xmlString);
-
-                               boolean becomeModerator = false;
-                               if (becomeModeratorAsInt != 0) {
-                                       becomeModerator = true;
-                               }
-
-                               boolean showAudioVideoTest = false;
-                               if (showAudioVideoTestAsInt != 0) {
-                                       showAudioVideoTest = true;
-                               }
-
-                               boolean allowRecordingBool = false;
-                               if (allowRecording != 0) {
-                                       allowRecordingBool = true;
-                               }
-
-                               String hash = soapLoginDao.addSOAPLogin(SID, 
room_id,
-                                               becomeModerator, 
showAudioVideoTest, true, // allowSameURLMultipleTimes
-                                               null, // recording_id
-                                               false, // 
showNickNameDialogAsInt
-                                               "room", // LandingZone,
-                                               allowRecordingBool // 
allowRecording
-                                               );
-
-                               if (hash != null) {
-                                       return hash;
-                               }
-
-                       } else {
-                               return "" + new Long(-26);
-                       }
-               } catch (Exception err) {
-                       log.error("setUserObjectWithAndGenerateRoomHash", err);
-               }
-               return "" + new Long(-1);
-       }
-
-       /**
-        * 
-        * Description: sets the SessionObject for a certain SID, after setting 
this
-        * Session-Object you can use the SID and directly login into the 
dashboard
-        * 
-        * ++ the user can press f5 to reload the page / use the link several 
times,
-        * the SOAP Gateway does remember the IP of the user and the will only 
the
-        * first user that enters the room allow to re-enter. ... Session-Hashs 
are
-        * deleted 15 minutes after the creation if not used.
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param username
-        *            any username
-        * @param firstname
-        *            any firstname
-        * @param lastname
-        *            any lastname
-        * @param profilePictureUrl
-        *            any absolute profilePictureUrl
-        * @param email
-        *            any email
-        * @param externalUserId
-        *            if you have any external user Id you may set it here
-        * @param externalUserType
-        *            you can specify your system-name here, for example 
"moodle"
-        *            
-        * @return - secure hash or error code
-        */
-       public String setUserObjectMainLandingZone(String SID, String username,
-                       String firstname, String lastname, String 
profilePictureUrl,
-                       String email, String externalUserId, String 
externalUserType) {
-               log.debug("UserService.setUserObjectMainLandingZone");
-
-               try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
-                               RemoteSessionObject remoteSessionObject = new 
RemoteSessionObject(
-                                               username, firstname, lastname, 
profilePictureUrl,
-                                               email, externalUserId, 
externalUserType);
-
-                               log.debug(remoteSessionObject.toString());
-
-                               String xmlString = remoteSessionObject.toXml();
-
-                               log.debug("xmlString " + xmlString);
-
-                               sessiondataDao.updateUserRemoteSession(SID, 
xmlString);
-
-                               String hash = soapLoginDao.addSOAPLogin(SID, 
null, false, true,
-                                               true, // 
allowSameURLMultipleTimes
-                                               null, // recording_id
-                                               false, // 
showNickNameDialogAsInt
-                                               "dashboard", // LandingZone,
-                                               true // allowRecording
-                                               );
-
-                               if (hash != null) {
-                                       return hash;
-                               }
-
-                       } else {
-                               return "" + -26L;
-                       }
-               } catch (Exception err) {
-                       log.error("setUserObjectWithAndGenerateRoomHash", err);
-               }
-               return "" + -1L;
-       }
-
-       /**
-        * 
-        * Description: sets the SessionObject for a certain SID, after setting 
this
-        * Session-Object you can use the SID + a RoomId to enter any Room.
-        * 
-        * ++ the user can press f5 to reload the page / use the link several 
times,
-        * the SOAP Gateway does remember the IP of the user and the will only 
the
-        * first user that enters the room allow to re-enter. ... Session-Hashs 
are
-        * deleted 15 minutes after the creation if not used.
-        * 
-        * ++ Additionally you can set a param showNickNameDialogAsInt, the 
effect
-        * if that param is 1 is, that the user gets a popup where he can enter 
his
-        * nickname right before he enters the conference room. All nicknames 
and
-        * emails users enter are logged in the conferencelog table.
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param username
-        *            any username
-        * @param firstname
-        *            any firstname
-        * @param lastname
-        *            any lastname
-        * @param profilePictureUrl
-        *            any profilePictureUrl
-        * @param email
-        *            any email
-        * @param externalUserId
-        *            if you have any external user Id you may set it here
-        * @param externalUserType
-        *            you can specify your system-name here, for example 
"moodle"
-        * @param room_id
-        *            the room id the user should be logged in
-        * @param becomeModeratorAsInt
-        *            0 means no Moderator, 1 means Moderator
-        * @param showAudioVideoTestAsInt
-        *            0 means don't show Audio/Video Test, 1 means show 
Audio/Video
-        *            Test Application before the user is logged into the room
-        * @param showNickNameDialogAsInt
-        *            0 means do not show the popup to enter a nichname, 1 means
-        *            that there is a popup to enter the nickname for the 
conference
-        *            
-        * @return - secure hash, or error code 
-        */
-       public String setUserAndNickName(String SID, String username,
-                       String firstname, String lastname, String 
profilePictureUrl,
-                       String email, String externalUserId, String 
externalUserType,
-                       Long room_id, int becomeModeratorAsInt,
-                       int showAudioVideoTestAsInt, int 
showNickNameDialogAsInt) {
-               try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
-                               RemoteSessionObject remoteSessionObject = new 
RemoteSessionObject(
-                                               username, firstname, lastname, 
profilePictureUrl,
-                                               email, externalUserId, 
externalUserType);
-
-                               log.debug(remoteSessionObject.toString());
-                               log.debug("showNickNameDialogAsInt" + 
showNickNameDialogAsInt);
-
-                               String xmlString = remoteSessionObject.toXml();
-
-                               log.debug("xmlString " + xmlString);
-
-                               sessiondataDao.updateUserRemoteSession(SID, 
xmlString);
-
-                               boolean becomeModerator = false;
-                               if (becomeModeratorAsInt != 0) {
-                                       becomeModerator = true;
-                               }
-
-                               boolean showAudioVideoTest = false;
-                               if (showAudioVideoTestAsInt != 0) {
-                                       showAudioVideoTest = true;
-                               }
-
-                               boolean showNickNameDialog = false;
-                               if (showNickNameDialogAsInt != 0) {
-                                       showNickNameDialog = true;
-                               }
-
-                               String hash = soapLoginDao.addSOAPLogin(SID, 
room_id,
-                                               becomeModerator, 
showAudioVideoTest, true, null,
-                                               showNickNameDialog, "room", // 
LandingZone,
-                                               true // allowRecording
-                                               );
-
-                               if (hash != null) {
-                                       return hash;
-                               }
-
-                       } else {
-                               return "" + new Long(-26);
-                       }
-               } catch (Exception err) {
-                       log.error("setUserObjectWithAndGenerateRoomHash", err);
-               }
-               return "" + new Long(-1);
-       }
-
-       /**
-        * Use this method to access a Recording instead of Room
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param username
-        *            any username
-        * @param firstname
-        *            any firstname
-        * @param lastname
-        *            any lastname
-        * @param externalUserId
-        *            if you have any external user Id you may set it here
-        * @param externalUserType
-        *            you can specify your system-name here, for example 
"moodle"
-        * @param recording_id
-        *            the id of the recording, get a List of all Recordings with
-        *            RoomService::getFlvRecordingByExternalRoomType
-        *            
-        * @return - hash of the recording, or error id
-        */
-       public String setUserObjectAndGenerateRecordingHashByURL(String SID,
-                       String username, String firstname, String lastname,
-                       String externalUserId, String externalUserType, Long 
recording_id) {
-               try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-
-                               RemoteSessionObject remoteSessionObject = new 
RemoteSessionObject(
-                                               username, firstname, "", "", 
"", externalUserId,
-                                               externalUserType);
-
-                               log.debug(remoteSessionObject.toString());
-
-                               String xmlString = remoteSessionObject.toXml();
-
-                               log.debug("xmlString " + xmlString);
-
-                               sessiondataDao.updateUserRemoteSession(SID, 
xmlString);
-
-                               String hash = soapLoginDao.addSOAPLogin(SID, 
null, false,
-                                               false, true, // 
allowSameURLMultipleTimes
-                                               recording_id, // recording_id
-                                               false, // 
showNickNameDialogAsInt
-                                               "room", // LandingZone,
-                                               true // allowRecording
-                                               );
-
-                               if (hash != null) {
-                                       return hash;
-                               }
-
-                       } else {
-                               return "" + new Long(-26);
-                       }
-               } catch (Exception err) {
-                       log.error("setUserObjectWithAndGenerateRoomHash", err);
-               }
-               return "" + new Long(-1);
-       }
-
-       /**
-        * 
-        * Add a user to a certain organization
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param user_id
-        *            the user id
-        * @param organisation_id
-        *            the organization id
-        * @param insertedby
-        *            user id of the operating user
-        * @return - id of the user added, or error id in case of the error
-        */
-       public Long addUserToOrganisation(String SID, Long user_id,
-                       Long organisation_id, Long insertedby) {
-               try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-                               if 
(!orgUserDao.isUserInOrganization(organisation_id, user_id)) {
-                                       User u = userDao.get(user_id);
-                                       u.getOrganisation_users().add(new 
Organisation_Users(orgDao.get(organisation_id)));
-                                       userDao.update(u, users_id);
-                               }
-                               return user_id;
-                       } else {
-                               return new Long(-26);
-                       }
-               } catch (Exception err) {
-                       log.error("addUserToOrganisation", err);
-               }
-               return new Long(-1);
-       }
-
-       /**
-        * Search users and return them
-        * 
-        * @param SID
-        *            The SID from getSession
-        * @param organisation_id
-        *            the organization id
-        * @param start
-        *            first record
-        * @param max
-        *            max records
-        * @param orderby
-        *            orderby clause
-        * @param asc
-        *            asc or desc
-        * @return - users found
-        */
-       public UserSearchResult getUsersByOrganisation(String SID,
-                       long organisation_id, int start, int max, String 
orderby,
-                       boolean asc) {
-               try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       SearchResult<User> result = new SearchResult<User>();
-                       result.setObjectName(User.class.getName());
-                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-                               
result.setRecords(orgUserDao.count(organisation_id));
-                               result.setResult(new ArrayList<User>());
-                               for (Organisation_Users ou : 
orgUserDao.get(organisation_id, null, start, max, orderby + " " + (asc ? "ASC" 
: "DESC"))) {
-                                       result.getResult().add(ou.getUser());
-                               }
-                       } else {
-                               log.error("Need Administration Account");
-                               result.setErrorId(-26L);
-                       }
-                       return new UserSearchResult(result);
-               } catch (Exception err) {
-                       log.error("getUsersByOrganisation", err);
-               }
-               return null;
+               return new ServiceResult(-1L, "Unknown error", Type.ERROR);
        }
 
        /**
         * Kick a user by its public SID
         * 
-        * @param SID
+        * @param sid
         *            The SID from getSession
         * @param publicSID
         *            the publicSID (you can get it from the call to get users 
in a
         *            room)
         * @return - <code>true</code> if user was kicked
         */
-       public Boolean kickUserByPublicSID(String SID, String publicSID) {
-               try {
-                       Boolean success = false;
-
-                       success = userManagement.kickUserByPublicSID(SID, 
publicSID);
-
-                       if (success == null)
-                               success = false;
-
-                       return success;
+       @WebMethod
+       @POST
+       @Path("/kick/{publicsid}")
+       public ServiceResult kick(@WebParam(name="sid") @QueryParam("sid") 
String sid, @WebParam(name="publicsid") @PathParam("publicsid") String 
publicSID) throws ServiceException {
+               try {
+                       Long userId = sessionDao.checkSession(sid);
+                       if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(userId))) {
+                               Boolean success = 
userManagement.kickUserByPublicSID(sid, publicSID);
+       
+                               return new 
ServiceResult(Boolean.TRUE.equals(success) ? 1L : 0L, 
Boolean.TRUE.equals(success) ? "deleted" : "not deleted", Type.SUCCESS);
+                       } else {
+                               return new ServiceResult(-26L, "Insufficient 
permissins", Type.ERROR);
+                       }
                } catch (Exception err) {
-                       log.error("[kickUser]", err);
+                       log.error("[kick]", err);
+                       throw new ServiceException(err.getMessage());
                }
-               return null;
        }
-       
+
        /**
-        * add a new organisation
+        * Returns the count of users currently in the Room with given id
+        * No admin rights are necessary for this call
         * 
-        * @param SID
-        *            The SID from getSession
-        * @param name
-        *            the name of the org
-        * @return the new id of the org or -1 in case an error happened
-        * @throws ServiceException
-        */
-       public Long addOrganisation(String SID, String name) throws 
ServiceException {
-               Long users_id = sessiondataDao.checkSession(SID);
-               if 
(AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
-                       Organisation o = new Organisation();
-                       o.setName(name);
-                       return orgDao.update(o, users_id).getOrganisation_id();
+        * @param sid The SID from UserService.getSession
+        * @param roomId id of the room to get users
+        * @return number of users as int
+        */
+       @WebMethod
+       @GET
+       @Path("/count/{roomid}")
+       public int count(@WebParam(name="sid") @QueryParam("sid") String sid, 
@WebParam(name="roomid") @PathParam("roomid") Long roomId) {
+               Long userId = sessionDao.checkSession(sid);
+
+               if (AuthLevelUtil.hasUserLevel(userDao.getRights(userId))) {
+                       return 
conferenceService.getRoomClientsListByRoomId(roomId).size();
                }
-               log.error("Could not create organization");
-               return -1L;
+               return -1;
        }
-
 }

Modified: 
openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java
URL: 
http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java?rev=1712911&r1=1712910&r2=1712911&view=diff
==============================================================================
--- 
openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java
 (original)
+++ 
openmeetings/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/cluster/RestClient.java
 Fri Nov  6 06:18:44 2015
@@ -25,6 +25,7 @@ import java.net.URL;
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
 
+import org.apache.openmeetings.db.dto.basic.ServiceResult;
 import org.apache.openmeetings.db.entity.server.Server;
 import org.apache.openmeetings.webservice.UserWebService;
 import org.red5.logging.Red5LoggerFactory;
@@ -201,7 +202,7 @@ public class RestClient {
                        }
 
                        UserWebService client = getUserClient();
-                       ServiceResult result = 
client.kickUserByPublicSID(sessionId, publicSID);
+                       ServiceResult result = client.kick(sessionId, 
publicSID);
 
                        if (result.getCode() == 0) {
                                throw new Exception("Could not delete user from 
slave host");


Reply via email to