Package de.innovationgate.wgpublisher.webtml.utils

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLAction


           
      try {
        actionLink = new TMLActionLink(URLDecoder.decode(actionKey, "UTF-8"),getCore());
               
                long starttime = System.currentTimeMillis();
        TMLAction action = callAction(actionLink, ajax);
                long endtime = System.currentTimeMillis();
               
                // We rebuild the session on the current context if the action was a master action
                // to be able to pick up modifications done there (F00004096)
                if (action != null && action.isMaster()) {
                    getTMLContext().db().reopenSession();
                }
               
                //F00004242
                if (actionLink.getMode() != null && actionLink.getMode().equals(TMLActionLink.MODE_AJAX_NO_PORTLET_REFRESH)) {
                    // this is an ajax action call do not render content result but portletEvents
                    status._isAjaxNoRefreshCall = true;
                    appendResult("");
                    setEvalBody(false);
                }
               
                actioncalled = true;                               
               
                if (debugNode != null) {
                    debugNode.addAttribute("actiontime", new Long(endtime - starttime).toString());
                }
      }
      catch (TMLInvalidActionLinkException e) {
          // Not logging these
      }
            catch (TMLActionException e) {
                addWarning("Error calling TML action: " + e.getMessage());
            }
            catch (IOException e) {
        addWarning("Error decoding action link: " + e.getMessage());
      }
            catch (WGAPIException e) {
                addWarning("Error calling TML action: " + e.getMessage());
            }
    }
   
    // Conditionally execute special action changeLanguage
        WGPRequestPath path = (WGPRequestPath) request.getAttribute(WGACore.ATTRIB_REQUESTPATH);
    if (path.getPreferredLanguageChange() != null) {
      actionLink = new TMLActionLink(request.getSession());
      actionLink.setDefaultAction(TMLAction.DEFAULTACTION_CHANGELANGUAGE);
           
            try {
                if (path.getPreferredLanguageChange().equals(WGPRequestPath.PREFERREDLANGUAGECHANGE_USECONTENT)) {
                    actionLink.setParam1((String) getTMLContext().meta("language"));
                }
                else {
                    actionLink.setParam1(path.getPreferredLanguageChange());
                }
               
          actionLink.setContextPath(getTMLContext().getpath());
                             
                TMLAction calledAction = callAction(actionLink, ajax);
                               
                // In case of a called master action we rebuild the session of the current db
                // To let the following WebTML request reflect eventually done changes in the action
                if (calledAction != null && calledAction.isMaster()) {
                    getTMLContext().db().reopenSession();
                }
               
            }
            catch (TMLActionException e) {
View Full Code Here


          }
          applyPortletContext(actionLink, actionContext);
          return null;
        }
        else {
          TMLAction tmlAction = (TMLAction) getTMLContext().getActionRegistration().get(actionLink.getActionKeyInteger());
          if (tmlAction == null) {
            throw new TMLActionException("Could not find action for key " + actionLink.getActionKey());
          }
          actionContext.callCustomAction(tmlAction, params);
          if (actionLink.getPortletmode() != null && actionContext.getportlet() != null) {
View Full Code Here

            else {
                correctSequence = false;
            }
        }
        else {
            TMLAction action = (TMLAction) getTMLContext().getActionRegistration().get(actionLink.getActionKeyInteger());
            if (action == null) {
                // Will fail later when action will be called. More speaking error message can be put out there.
                return true;
            }
           
            // if debouncing is disabled we do not care about sequencenumber
            if (!action.isDebounce() || (actionLink.getMode() != null && actionLink.getMode().equals(TMLActionLink.MODE_AJAX_NO_PORTLET_REFRESH))) {
                return true;
            }
           
            if (!action.sequenceIdAlreadyUsed(actionLink.getSequenceId())) {
                // action was not called with this sequenceId
                action.calledWithSequenceId(actionLink.getSequenceId());
            } else {
                correctSequence = false;
            }
        }
        return correctSequence;
View Full Code Here

            addWarning("Action with id '" + theId + "' cannot be defined without code block. To reference an already defined action use <tml:action ref='<id>'/>.", false);
            return;
        }
   
    // Get or create action
    TMLAction tmlAction = null;
    if (theResult != null) {
            // create action object
      String actionCode = this.getResultString();
            TMLAction currentAction =
                new TMLAction(actionCode, stringToBoolean(getMaster()), stringToBoolean(getAsync()), stringToBoolean(getDebounce()), TMLAction.ORIGIN_TML);
            currentAction.setModuleDatabase(getDesignDBKey());
            currentAction.setModuleName(getStatus().getTMLModuleName());
           
            String strTimeout = getTimeout();
            if (strTimeout != null) {
                try {
                    // set custom timeout on action
                    int timeout = Integer.valueOf(strTimeout).intValue();
                    currentAction.setTimeout(timeout);
                } catch (NumberFormatException e) {
                    addWarning("Unable to set timeout value because it cannot be parsed as a number", false);
                }                   
            }
           
View Full Code Here

        // Action has been stored in tml:action tag
        if (actionID != null) {

            List params = createParamList();

            TMLAction tmlAction = getTMLContext().getActionByID(actionID, getDesignDBKey());

            if (tmlAction == null) {
                addWarning("Action with id '" + actionID + "' not found.");
                return;
            }
View Full Code Here

        // ajaxCalls are JS calls - do not encode
        status.encodeURL = false;

        // Action has been stored in tml:action tag
        if (actionName != null) {
            TMLAction action = getTMLContext().getActionByID(actionName, getDesignDBKey());
            if (action != null) {
                url.append("javascript:" + getAjaxJSFunction(action, createParamList()));
            }
            else {
                addWarning("Action of id '" + actionName + "' is not defined");
View Full Code Here

        getStatus().urlparams.put(this.getSourcetag() + "Page", (new Integer(targetPage)).toString());
    }
   
    private void buildActionForeachURL(StringBuffer url, int targetPage) throws MalformedURLException, UnsupportedEncodingException, WGAPIException {
        Status status = (Status) getStatus();
        TMLAction tmlAction = getTMLContext().getActionByID("$" + TMLAction.DEFAULTACTION_SETVAR, getDesignDBKey());
       
        List params = new ArrayList();
        params.add("$" + this.getSourcetag() + "Page");
        params.add(String.valueOf(targetPage));
       
View Full Code Here

    private String registerInlineAction(Status status) throws WGAPIException {
        // Registration of inline action
        try {
            String actionCode = this.getResultString();
            // create actionObject
            TMLAction tmlAction = new TMLAction(actionCode, false, false, stringToBoolean(getDebounce()), TMLAction.ORIGIN_TML);
            tmlAction.setModuleDatabase(getDesignDBKey());
            tmlAction.setModuleName(getStatus().getTMLModuleName());
            tmlAction = getTMLContext().registerAction(tmlAction, null, getDesignDBKey());

            this.clearResult();
            String actionURL = "";
            // if we have a ajax call
View Full Code Here

           
            // Get root content and action
            TMLContext context = new TMLContext(db.getDummyContent(db.getDefaultLanguage()), _core, null, null);
            context.makeThreadMainContext();
           
            TMLAction action = context.getActionByID(actionID, null);
            if (action == null) {
                throw new WGAServiceException("Undefined action: " + actionID);
            }
           
            // Calculate execution context
View Full Code Here

        }
       
        // Register as client-side listener for this event
        String jsFunction;
        if (stringToBoolean(getAjax()) == true) {
            jsFunction = "new Function(\"" + getAjaxJSFunction(new TMLAction("$refresh"), getAjax(), getPortletmode(), getPortletcontext()) + "\")";
        }
        else {
            jsFunction = "new Function(\"" + getJSFunction(new TMLAction("$refresh"), getPortletmode(), getPortletcontext()) + "\")";
        }
       
        StringBuffer eventReg = new StringBuffer();
        eventReg.append("<script language=\"javascript\">\n");
        eventReg.append("<!--\n");
View Full Code Here

TOP

Related Classes of de.innovationgate.wgpublisher.webtml.utils.TMLAction

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.