Package org.opencustomer.framework.webapp.panel

Examples of org.opencustomer.framework.webapp.panel.DeletePanel


    }
   
    @Override
    public final ActionForward execute(ActionMapping mapping, DeleteForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        DeletePanel panel = null;
       
        if(Panel.getPanelStack(request).isTypeOnTop(Panel.Type.DELETE)) {
            panel = (DeletePanel)Panel.getPanelStack(request).peek();
        } else if(Panel.getPanelStack(request).isTypeOnTop(Panel.Type.EDIT)) {
            EditPanel editPanel = (EditPanel)Panel.getPanelStack(request).peek();
           
            panel = new DeletePanel();
            panel.setTitle((String)editPanel.getAttribute(TEXT_TITLE));
            panel.setQuestion((String)editPanel.getAttribute(TEXT_QUESTION));
            panel.setEntity(editPanel.getEntity());
           
            panel.setPath(editPanel.getAction(org.opencustomer.framework.webapp.panel.Action.Type.DELETE).getAction());
           
            preparePanel(editPanel, panel);
           
            Panel.getPanelStack(request).push(panel);
        } else {
            log.error("missing valid panel: "+Panel.getPanelStack(request).peek());
        }
       
        Status status = Status.NONE;
       
        if(this.isTokenValid(request) && form.getDoDelete() != null)
        {
            ActionMessages errors = new ActionMessages();
            if (log.isDebugEnabled())
                log.debug("delete entity (ID:" + panel.getEntity().getId() + ")");

            if (panel.getEntity().getId() != null) {
                boolean writeAllowed = true;
               
                if(panel.getEntity() instanceof EntityAccess) {
                    UserVO user = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
                    writeAllowed = EntityAccessUtility.isAccessGranted(user, (EntityAccess)panel.getEntity(), EntityAccess.Access.WRITE);
                   
                    if(log.isDebugEnabled())
                        log.debug("delete is allowed on entity for user: "+writeAllowed);
                }
               
                if(writeAllowed) {
                    deleteEntity(panel, request, response, errors);
                } else if(log.isDebugEnabled()) {
                    log.debug("user is not allowed to delete entity "+panel.getEntity());
                }
                   
            } else {
                errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.invalidEntity", panel.getEntity().getId()));
            }
           
            if (errors.isEmpty())
                status = Status.DELETED;
            else
View Full Code Here


    private static final long serialVersionUID = -2488736893082549514L;

    @Override
    public int doStartTag() throws JspException
    {
        DeletePanel panel = (DeletePanel)Panel.getPanelStack((HttpServletRequest)pageContext.getRequest()).peek();
       
        action = panel.getPath();
        styleClass = getProperty("form");

        int process = super.doStartTag();
       
        StringBuilder html = new StringBuilder();
View Full Code Here

    }
   
    @Override
    public int doEndTag() throws JspException
    {       
        DeletePanel panel = (DeletePanel)Panel.getPanelStack((HttpServletRequest)pageContext.getRequest()).peek();

        StringBuilder html = new StringBuilder();
       
        html.append("</fieldset>");
        html.append("<fieldset class=\"").append(getProperty("block.action")).append("\">");

        renderButton(html, "doCancel", "button.cancel", "button.cancel.title", null, 'c', false);       

        if(panel.getEntity().getId() == null)
            renderButton(html,  "doDelete", "button.delete", "button.delete.title.inactive", null, null, true);
        else
            renderButton(html, "doDelete", "button.delete", "button.delete.title.active", null, 'd', false);
       
        html.append("</fieldset>");
View Full Code Here

            EntityPanel entityPanel = (EntityPanel)panel;
            pageContext.setAttribute("panel_entity", entityPanel.getEntity());
        }

        if(panel instanceof DeletePanel) {
            DeletePanel deletePanel = (DeletePanel)panel;
            pageContext.setAttribute("panel_question", deletePanel.getQuestion());
        }
    }
View Full Code Here

TOP

Related Classes of org.opencustomer.framework.webapp.panel.DeletePanel

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.