Examples of WGPortlet


Examples of de.innovationgate.webgate.api.WGPortlet

        }
       
        Iterator<String> regs = _profile.getPortletkeys().iterator();
        while (regs.hasNext()) {
            String reg = (String) regs.next();
            WGPortlet portlet = deserializePortlet(reg, appDb);
           
            // We do not need to check appDb here bc. in this portlet registry impl the appDb is implicitly contained in the portlet key
            if (portlet.getKey().equals(key)) {
                return portlet;
            }
        }
       
        return null;
View Full Code Here

Examples of de.innovationgate.webgate.api.WGPortlet

        Iterator<String> regs = _profile.getPortletkeys().iterator();
        List<String> keys = new ArrayList<String>();
       
        while (regs.hasNext()) {
            String reg = (String) regs.next();
            WGPortlet portlet = deserializePortlet(reg, appDb);
            if (doesPortletKeyMatchAppDb(appDb, portlet)) {
                keys.add(portlet.getKey());
            }
        }
        return keys;
    }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGPortlet

        }
       
        // First unregister child portlets
        Iterator<WGPortlet> children = getChildPortlets(portlet).iterator();
        while (children.hasNext()) {
            WGPortlet child = (WGPortlet) children.next();
            removePortlet(child);
        }
       
        // Cleanup all items
        clearItems(portlet);
       
        // Remove registration
        Iterator<String> regs = _profile.getPortletkeys().iterator();
        while (regs.hasNext()) {
            String reg = (String) regs.next();
            WGPortlet p = deserializePortlet(reg, portlet.getApplicationDb());
           
            // We do not need to check appDb here bc. in this portlet registry impl the appDb is implicitly contained in the portlet key
            if (p.getKey().equals(portlet.getKey())) {
                regs.remove();
            }
        }
    }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGPortlet

        }
       
        List regs = _profile.getPortletkeys();
        for (int idx=0; idx < regs.size(); idx++) {
            String reg = (String) regs.get(idx);
            WGPortlet portlet = deserializePortlet(reg, portletToUpdate.getApplicationDb());
           
            // We do not need to check appDb here bc. in this portlet registry impl the appDb is implicitly contained in the portlet key
            if (portlet.getKey().equals(portletToUpdate.getKey())) {
                regs.set(idx, serializePortlet(portletToUpdate));
                return;
            }
        }
       
View Full Code Here

Examples of de.innovationgate.webgate.api.WGPortlet

        if (pKey == null && pName != null) {
            pKey = parentPortlet.getPortletKeyForName(pName);
        }
       
        // Fetch registration info if key provided
        WGPortlet pReg = null;
        if (pKey != null) {
            pReg = parentPortlet.getPortletRegistration(pKey);
        }

        // If reg not retrievable and auto registration info available try auto registration, else cancel
        if (pReg == null) {
            if (pName != null && status.ref != null) {
                pKey = parentPortlet.registerportletforname(pName, status.designdb, status.ref, false);
                pReg = parentPortlet.getPortletRegistration(pKey);
            }
            else {
                if (pName != null) {
                    throw new TMLException("Portlet name not registered: " + pName, true);
                }
                else if (pKey != null) {
                    throw new TMLException("Portlet key not registered: " + pKey, true);
                }
                else {
                    throw new TMLException("No portlet key provided.", true);
                }
            }
        }

        // Check if registration matchtes the autoregister TML. If not, reregister with the given TML.
        else if (status.ref != null) {
       
                // If the registration has no design database specified we take the current design db (which is always equal)
                if (pReg.getDesignDb() == null) {
                    pReg.setDesignDb(status.designdb);
                }
           
               if (!WGUtils.nullSafeEquals(status.ref, pReg.getDesign(), true) ||
                   (!WGUtils.nullSafeEquals(status.designdb, pReg.getDesignDb(), true))) {
                     pKey = parentPortlet.registerportletforname(pName, status.designdb, status.ref, true);
                     pReg = parentPortlet.getPortletRegistration(pKey);
               }
              
        }
       
        // Prepare environment
        status.setOption(Base.OPTION_PORTLET_NAMESPACE, pKey, null);
        if (pReg.getDesignDb() != null) {
            status.designdb = pReg.getDesignDb();
        }
        status.ref = getTMLContext().resolveDesignReference(pReg.getDesign());
       
        // Update portlet event index information
        TMLPortlet childPortlet = getTMLContext().getportlet();       
        childPortlet.prepareEventProcessing(this);
       
        // set child tag context to portlet context if set
        TMLContext portletContext = childPortlet.getcontext();
        if (portletContext != null) {
          setChildTagContext(portletContext);
        }
       
        // if ajax enabled
        if (status.ajax) {
            String uniquePortletID = pReg.getKey();
           
            // create prefix buffer
            StringBuffer prefix = new StringBuffer();
            // create suffix buffer
            StringBuffer suffix = new StringBuffer();
           
            // set id as option, so tags from included module can retrieve it for rendering ajaxCall
            status.setOption(OPTION_AJAX_DIVTAG_ID, uniquePortletID, null);
            // set tmlModule as option, so tags from included module can retrieve the tmlmodulename
            status.setOption(OPTION_PORTLET_TMLMODULE, pReg.getDesign(), null);
                               
            // create ajaxInfo
            AjaxInfo ajaxInfo = new AjaxInfo(uniquePortletID);
            try {
        URLBuilder builder = new URLBuilder(getTMLContext().getrequest());
        builder.removeParameter("$action");
        java.net.URL url = builder.rebuild();
        ajaxInfo.setQueryString(url.getQuery());
      } catch (Exception e1) {
        getTMLContext().addwarning("Unable to build request querystring for ajax environment.");
      }
            ajaxInfo.setTmlmodule(pReg.getDesign());
            ajaxInfo.setDesignDB(pReg.getDesignDb() != null ? pReg.getDesignDb() : getDesigndb());
            ajaxInfo.setMediaKey((String)this.getOption(OPTION_CURRENT_MEDIAKEY));
            if (portletContext != null) {
              ajaxInfo.setContextPath(portletContext.getpath());
            } else {
              ajaxInfo.setContextPath(this.getTMLContext().getpath());
            }
            ajaxInfo.setOptions(getStatus().getTagOptions());
            if (getTMLContext().getprofile() != null) {
                ajaxInfo.setSaveProfileOnEnd(getTMLContext().getprofile().isSavedOnEnd());
            }
            else {
                ajaxInfo.setSaveProfileOnEnd(false);
            }
            ajaxInfo.setSuperform(getStatus().getRelevantForm());

           
            // create javascript object with ajaxInfo                   
            // serialize       
            String serAjaxInfo = new XStream(new Dom4JDriver()).toXML(ajaxInfo);
            // zip
            byte[] zipped  = Zipper.zip(serAjaxInfo);
            String encryptedAjaxInfo = "";
            if (zipped != null) {
                // encrypt
                try {
                    encryptedAjaxInfo= this.getTMLContext().getwgacore().getDesEncrypter().encrypt(zipped);
                }
                catch (UnsupportedEncodingException e) {
                   throw new TMLException("Cannot render ajax enabled include because of unsupported encoding: " + e.getMessage(), true);
                }
            }                   
           
            // iframe for form submit
            // to prevent iframe from deletion by ajaxCall it has to be outside the divTag
            // the iframe must be rendered with a blank-html page which exists on the wgaserver
            // otherwise IE reacts with a security warning when wga runs on https
            // @see http://support.microsoft.com/default.aspx?scid=kb;de;184960
           
            /**
             * WGA 4.0.7:
             * WGA.ajax.action now generates iframes dynamicaly so static iframes are no longer needed
             *
            String blankIFrameURL = this.getWGPPath() + "/static/html/blank.htm";
            prefix.append("<iframe name=\"$ajaxIFrame_" + uniquePortletID + "\" style=\"display:none\" src=\"" + blankIFrameURL + "\"></iframe>");
             *
             */
           
            // div tag for ajax paste
            prefix.append("<div id=\"$ajaxDiv_" + uniquePortletID + "\">");
            prefix.append("<div id=\"$ajaxContentDiv_" + uniquePortletID + "\">");                   
            // javascript variable ajaxInfo
            prefix.append("<script type=\"text/javascript\">");
            prefix.append("var $ajaxInfo_" + uniquePortletID + " = '"  + encryptedAjaxInfo + "';");
            prefix.append("</script>");
           
           
            suffix.append("</div></div>");      
           
            // set prefix and suffix
            this.setPrefix(prefix.toString());                                       
            this.setSuffix(suffix.toString());
        }  
       
        // register portlet on client side
        String javaScriptPRegistration = getTMLContext().createJavaScriptPortletRegistration(pReg.getKey(), false);
        if (javaScriptPRegistration != null) {
            this.setPrefix(this.getPrefix() + javaScriptPRegistration);
        }
        // render events
        String javaScriptPEvents = getTMLContext().createJavaScriptPortletEvents(pReg.getKey(), false)
        if (javaScriptPEvents != null) {
            this.setSuffix(this.getSuffix() + javaScriptPEvents);
        }
       
        // If an initial mode is determined set it
View Full Code Here

Examples of de.innovationgate.webgate.api.WGPortlet

        }
       
        // First unregister child portlets
        Iterator<WGPortlet> children = getChildPortlets(portlet).iterator();
        while (children.hasNext()) {
            WGPortlet child = (WGPortlet) children.next();
            removePortlet(child);
        }
       
        // Cleanup all items
        clearItems(portlet);
View Full Code Here

Examples of de.innovationgate.webgate.api.WGPortlet

        WGPortletRegistry portletRegistry = profile.getprofile().getPortletRegistry();
        if (portletRegistry == null) {
            return null;
        }
       
    WGPortlet portlet;
        if (nameSpace != null) {
        portlet = portletRegistry.getPortlet(getmaincontext().db().getDbReference(), nameSpace);
    }
    else {
      portlet = portletRegistry.getRootPortlet(getmaincontext().db().getDbReference());
View Full Code Here

Examples of de.innovationgate.webgate.api.WGPortlet

    }


  public TMLPortlet getportlet(String key) throws WGAPIException {
   
    WGPortlet portlet  = getPortletRegistration(key);
     
    if (portlet != null) {
      return new TMLPortlet(tag, profile, portlet);
    }
    else {
View Full Code Here

Examples of de.innovationgate.webgate.api.WGPortlet

 
  public List getchildrenkeys() throws WGAPIException {
      Iterator<WGPortlet> childRegs = profile.getprofile().getPortletRegistry().getChildPortlets(reg).iterator();
            List childKeys = new ArrayList();
            while (childRegs.hasNext()) {
                WGPortlet portlet = childRegs.next();
                childKeys.add(portlet.getKey());
            }
            return childKeys;
  }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGPortlet

   
    public List getdescendantkeys() throws WGAPIException {
        Iterator childRegs = getChildRegistrations(reg, true).iterator();
        List childKeys = new ArrayList();
        while (childRegs.hasNext()) {
            WGPortlet reg = (WGPortlet) childRegs.next();
            childKeys.add(reg.getKey());
        }
        return childKeys;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.