Package org.jayasoft.woj.common.model

Examples of org.jayasoft.woj.common.model.Answer


   
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ServletHelper.setCurrentRequest(request);
        Map parameterMap = ServletHelper.getParameters(request);
        String command = (String) parameterMap.remove(Parameters.PARAM_COMMAND);
        Answer a = new Answer();
        doPost(a, request, response, command, parameterMap, true);
        ResponseHelper.sendObject(response, a);
    }
View Full Code Here


                _targetServer.setNewTargetServer(target);
                if (urlContent != null && decode) {
                    Object result = ServiceProvider.getDefault().getEncodingService().decode(urlContent);
                    //if object is encapsulate in an answer
                    if (result instanceof Answer) {
                        Answer a = (Answer) result;
                        if (a.getNewUak() != null) {
                            getUnifiedAuthentificationService().setUAK(a.getNewUak());
                        }
                        Object object = a.getObject();
                        switch (a.getStatus()) {
                        case Answer.STATUS_OK:
                            return object;
                        case Answer.STATUS_FAILED:
                        case Answer.STATUS_INVALID:
                        case Answer.STATUS_BAD_UAK:
View Full Code Here

        String url = docURL.toString();
    return url;
  }
   
    public ActionForward promote(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        Answer a = new Answer();
        a.setStatus(Answer.STATUS_FAILED);
        a.setObject("promotion");
       
        String userID = request.getParameter(Params.MODULES.PROMOTE.PARAMS.USER_ID);
        String module = request.getParameter(Params.MODULES.PROMOTE.PARAMS.MODULE);
       
        User u = ServiceFactory.getUserService().getUserById(userID);
View Full Code Here

public class SyncAction extends AbstractWOJAction {
    private static Logger LOGGER = LoggingManager.getLogger(SyncAction.class.getName());
   
    public ActionForward getUsers(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        Answer a = new Answer();
       
        try {
            Map params = URLHelper.getParametersMap(request.getParameterMap());
           
            String sinceStr = request.getParameter(Params.SYNC.PARAMS.SINCE);
            Long since = Long.valueOf((sinceStr==null)?"-1":sinceStr);
           
            User[] foundUsers = DaoFactory.getUserDao().findUpdatedUsers(since);
            User[] uSend = new User[foundUsers.length];
            for (int i = 0; i < foundUsers.length; i++) {
                 uSend[i] = new User();
                 BeanHelper.copy(foundUsers[i], uSend[i], User.class);
                 if (foundUsers[i].getGroup() != null) {
                     Group g = new Group();
                     BeanHelper.copy(foundUsers[i].getGroup(), g, Group.class);
                     uSend[i].setGroup(g);
                 }
            }
            a.setStatus(Answer.STATUS_OK);
            a.setObject(uSend);
        } catch (Exception e) {
            LOGGER.warn("error getting user list", e);
            // One of the parameters was eroneous
            a.setStatus(Answer.STATUS_INVALID);
            a.setObject(new IllegalArgumentException("at least one of the waited parameters " + Params.SYNC.PARAMS.SINCE + " & " + Params.SYNC.PARAMS.UAK + " was invalid"));
        }

        XMLResponseHelper.writeXMLResponse(response, a);
        return null;
    }
View Full Code Here

        return null;
    }

    public ActionForward getGroups(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        DynaActionForm f = (DynaActionForm)form;
        Answer a = new Answer();
       
        try {
            String sinceStr = request.getParameter(Params.SYNC.PARAMS.SINCE);
            Long since = Long.valueOf((sinceStr==null)?"-1":sinceStr);
            Group[] groupsFound = Portal.getInstance().getSecurityService().findUpdatedGroups(since);
            Group[] gSend = new Group[groupsFound.length];
            for (int i = 0; i < groupsFound.length; i++) {
                gSend[i] = new Group();
                BeanHelper.copy(groupsFound[i], gSend[i], Group.class);
           }
           a.setStatus(Answer.STATUS_OK);
           a.setObject(gSend);
        } catch (Exception e) {
            LOGGER.debug("error getting group list", e);
            // One of the parameters was eroneous
            a.setStatus(Answer.STATUS_INVALID);
            a.setObject(new IllegalArgumentException("at least one of the waited parameters " + Params.SYNC.PARAMS.SINCE + " & " + Params.SYNC.PARAMS.UAK + " was invalid"));
        }
        XMLResponseHelper.writeXMLResponse(response, a);
        return null;
    }
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.common.model.Answer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.