Package org.wso2.carbon.ui.deployment.beans

Examples of org.wso2.carbon.ui.deployment.beans.BreadCrumbItem


      String jspFileName = jspFilePath.substring(lastIndexofSlash+1, jspFilePath.length());
      //save query string for current url
      String queryString = request.getQueryString();
     
      //creating a new breadcrumb item for page request
      BreadCrumbItem breadCrumbItem = new BreadCrumbItem();     
      //creating breadcrumb id using jsp file path
      //This is guaranteed to be unique for a subcontext (eg: /modulemgt,/service-listing)
      breadCrumbItem.setId(jspFileName);
     
      String text = CarbonUIUtil.geti18nString(label, resourceBundle, request.getLocale());     
      breadCrumbItem.setConvertedText(text)
     
      //if request contains parameter 'toppage', override the value of this.topPage with
      //the value set in request.
      //This is useful when same page is being used @ different levels.
      //eg: wsdl2code/index.jsp
      //This page is being called from Tools -> WSDL2Code & Service Details -> Generate Client
      String topPageParameter = request.getParameter("toppage");
      if(topPageParameter != null){
        boolean topPageParamValue = Boolean.valueOf(topPageParameter).booleanValue();
        if(log.isDebugEnabled()){
          log.debug("toppage value set from request parameter.("+topPageParamValue+").");
        }
        this.topPage = topPageParamValue;
      }

      if(! topPage){
        // need to add this url as a breadcrumb
        HashMap<String,List<BreadCrumbItem>> links = (HashMap<String,List<BreadCrumbItem>>) request
            .getSession().getAttribute("page-breadcrumbs");
       
        String partUrl = "";
        if(queryString != null){
          partUrl = jspFilePath + "?" + queryString ;
        }else{
          partUrl = jspFilePath;
        }
       
        if (links != null) {
          //check if a breadcrumb exists for given sub context
          List<BreadCrumbItem> breadcrumbsForSubContext = links.get(subContextToJSP);
          int size = 0;
          if(breadcrumbsForSubContext != null){
            int sizeOfSubContextBreadcrumbs = breadcrumbsForSubContext.size();
            //removing to stop this array getting grown with duplicates
            ArrayList idsToRemove = new ArrayList();           
            for(int a = 0;a < sizeOfSubContextBreadcrumbs;a++){
              if(breadcrumbsForSubContext.get(a).getId().equals(jspFileName)){
                idsToRemove.add(new Integer(a));
              }
            }
            if(idsToRemove.size() > 0){
              for(int b = 0;b < idsToRemove.size();b++){
                Integer i = (Integer)idsToRemove.get(b);
                breadcrumbsForSubContext.remove(i.intValue());               
              }
            }
           
            size = breadcrumbsForSubContext.size();
            breadCrumbItem.setOrder(size + 1);
            breadCrumbItem.setLink(partUrl);
            breadcrumbsForSubContext.add(breadCrumbItem);
            links.put(subContextToJSP,breadcrumbsForSubContext);         
            request.getSession().setAttribute("page-breadcrumbs", links);       
          }else{
            breadcrumbsForSubContext = new ArrayList<BreadCrumbItem>();
            breadCrumbItem.setOrder(size + 1);
            breadCrumbItem.setLink(partUrl);
            breadcrumbsForSubContext.add(breadCrumbItem);
            links.put(subContextToJSP,breadcrumbsForSubContext);         
            request.getSession().setAttribute("page-breadcrumbs", links);     
          }
        } else {
          HashMap<String,List<BreadCrumbItem>> tmp = new HashMap<String,List<BreadCrumbItem>>();
          // Going inside for the first time
          breadCrumbItem.setOrder(1);
          breadCrumbItem.setLink(partUrl);
          List<BreadCrumbItem> list = new ArrayList<BreadCrumbItem>();
          list.add(breadCrumbItem);
          tmp.put(subContextToJSP,list);
          request.getSession().setAttribute("page-breadcrumbs", tmp);
        }       
View Full Code Here


      String jspFileName = jspFilePath.substring(lastIndexofSlash+1, jspFilePath.length());
      //save query string for current url
      String queryString = request.getQueryString();
     
      //creating a new breadcrumb item for page request
      BreadCrumbItem breadCrumbItem = new BreadCrumbItem();     
      //creating breadcrumb id using jsp file path
      //This is guaranteed to be unique for a subcontext (eg: /modulemgt,/service-listing)
      breadCrumbItem.setId(jspFileName);
     
            Locale locale = CarbonUIUtil.getLocaleFromSession(request);
            String text = CarbonUIUtil.geti18nString(label, resourceBundle, locale);
      breadCrumbItem.setConvertedText(text)
     
      //if request contains parameter 'toppage', override the value of this.topPage with
      //the value set in request.
      //This is useful when same page is being used @ different levels.
      //eg: wsdl2code/index.jsp
      //This page is being called from Tools -> WSDL2Code & Service Details -> Generate Client
      String topPageParameter = request.getParameter("toppage");
      if(topPageParameter != null){
        boolean topPageParamValue = Boolean.valueOf(topPageParameter).booleanValue();
        if(log.isDebugEnabled()){
          log.debug("toppage value set from request parameter.("+topPageParamValue+").");
        }
        this.topPage = topPageParamValue;
      }

      if(! topPage){
        // need to add this url as a breadcrumb
        HashMap<String,List<BreadCrumbItem>> links = (HashMap<String,List<BreadCrumbItem>>) request
            .getSession().getAttribute("page-breadcrumbs");
       
        String partUrl = "";
        if(queryString != null){
          partUrl = jspFilePath + "?" + queryString ;
        }else{
          partUrl = jspFilePath;
        }
       
        if (links != null) {
          //check if a breadcrumb exists for given sub context
          List<BreadCrumbItem> breadcrumbsForSubContext = links.get(subContextToJSP);
          int size = 0;
          if(breadcrumbsForSubContext != null){
            int sizeOfSubContextBreadcrumbs = breadcrumbsForSubContext.size();
            //removing to stop this array getting grown with duplicates
            ArrayList idsToRemove = new ArrayList();           
            for(int a = 0;a < sizeOfSubContextBreadcrumbs;a++){
              if(breadcrumbsForSubContext.get(a).getId().equals(jspFileName)){
                idsToRemove.add(a);
              }
            }
            if(idsToRemove.size() > 0){
                            for (Object anIdsToRemove : idsToRemove) {
                                Integer i = (Integer) anIdsToRemove;
                                breadcrumbsForSubContext.remove(i.intValue());
                            }
            }
           
            size = breadcrumbsForSubContext.size();
            breadCrumbItem.setOrder(size + 1);
            breadCrumbItem.setLink(partUrl);
            breadcrumbsForSubContext.add(breadCrumbItem);
            links.put(subContextToJSP,breadcrumbsForSubContext);         
            request.getSession().setAttribute("page-breadcrumbs", links);       
          }else{
            breadcrumbsForSubContext = new ArrayList<BreadCrumbItem>();
            breadCrumbItem.setOrder(size + 1);
            breadCrumbItem.setLink(partUrl);
            breadcrumbsForSubContext.add(breadCrumbItem);
            links.put(subContextToJSP,breadcrumbsForSubContext);         
            request.getSession().setAttribute("page-breadcrumbs", links);     
          }
        } else {
          HashMap<String,List<BreadCrumbItem>> tmp = new HashMap<String,List<BreadCrumbItem>>();
          // Going inside for the first time
          breadCrumbItem.setOrder(1);
          breadCrumbItem.setLink(partUrl);
          List<BreadCrumbItem> list = new ArrayList<BreadCrumbItem>();
          list.add(breadCrumbItem);
          tmp.put(subContextToJSP,list);
          request.getSession().setAttribute("page-breadcrumbs", tmp);
        }       
View Full Code Here

        HashMap<String, BreadCrumbItem> breadCrumbs = new HashMap<String, BreadCrumbItem>();
        if (menus != null) {
            for (int a = 0; a < menus.length; a++) {
                Menu menu = menus[a];
                if (menu.getId() != null) {
                    BreadCrumbItem bc = new BreadCrumbItem();
                    CarbonUIUtil.setLocaleToSession(request);

                    locale = CarbonUIUtil.getLocaleFromSession(request);
                    java.util.ResourceBundle bundle = null;
                    try {
                      if(menu.getI18nBundle() != null){
                            bundle = java.util.ResourceBundle.getBundle(menu.getI18nBundle(), locale);
                      }
                    } catch (java.util.MissingResourceException e) {
                        if (log.isDebugEnabled()) {
                            log.debug("Cannot find resource bundle : " + menu.getI18nBundle());
                        }
                    }

                    String menuText = menu.getI18nKey();
                    if (bundle != null) {
                        String tmp = null;
                        try {
                          if(menu.getI18nKey() != null){
                                tmp = bundle.getString(menu.getI18nKey());                           
                          }
                        } catch (java.util.MissingResourceException e) {
                            //Missing key should not be a blocking factor for UI rendering
                            if (log.isDebugEnabled()) {
                                log.debug("Cannot find resource for key :" + menu.getI18nKey());
                            }
                        }
                        if (tmp != null) {
                            menuText = tmp;
                        }
                    }

                    bc.setConvertedText(menuText);
                    bc.setI18nBundle(menu.getI18nBundle());
                    bc.setI18nKey(menu.getI18nKey());
                    bc.setId(menu.getId());
                    bc.setLink(menu.getLink() + "?region=" + menu.getRegion() + "&amp;item=" +
                            menu.getId() + (menu.getUrlParameters() != null ?
                            "&amp;" + menu.getUrlParameters() : "") + "&amp;ordinal=0");
                    breadCrumbs.put(menu.getId(), bc);
                }
            }
View Full Code Here

              breadcrumbItems = links.get("../"+jspSubContext);
            }
            if(breadcrumbItems != null){
              int bcSize = breadcrumbItems.size();
              for (int a = 0; a < bcSize ; a++) {
                BreadCrumbItem tmp = breadcrumbItems.get(a);
                if(tmp.getId().equals(jspFileName)){
                  if(tmp.getLink().startsWith("#")){
                    content.append("<td class=\"breadcrumb-link\">&nbsp;>&nbsp;"+tmp.getConvertedText()+"</td>");
                  }else{
                    //if((a+1) == bcSize){
                    //if((a+1) == bcSize && clickedBreadcrumbLocation > 0){
                    if((((a+1) == bcSize) && !(lastBreadcrumbItemAvailable))
                        || removeLastItem){
                      content.append("<td class=\"breadcrumb-link\">&nbsp;>&nbsp;"+tmp.getConvertedText()+"</td>");
                    }else{
                      content.append("<td class=\"breadcrumb-link\">&nbsp;>&nbsp;<a href=\""+appendOrdinal(tmp.getLink(),i+1)+"\">"+tmp.getConvertedText()+"</a></td>");
                    }
                  }
                  cookieContent.append(getSubContextFromUri(tmp.getLink())+"+"+token+"*");
                }
              }
            }
          }
        }
 
View Full Code Here

    int tokenCount = st.countTokens();
    int count = 0;
    while (st.hasMoreTokens()) {
      count++;
      String token = st.nextToken();
      BreadCrumbItem breadcrumbItem = (BreadCrumbItem) breadcrumbs.get(token);
      if (breadcrumbItem != null) {
        //if (count == tokenCount) {
        //  content.append("<td class=\"breadcrumb-current-page\"><a href=\""+breadcrumbItem.getLink()+"\">"+breadcrumbItem.getConvertedText()+"</a></td>");
        //} else {
          if (breadcrumbItem.getLink().startsWith("#")) {
            content.append("<td class=\"breadcrumb-link\">"+"&nbsp;>&nbsp;"+breadcrumbItem.getConvertedText()+"</td>");
          } else {
            if(count == tokenCount && (clickFromMenu)){//if last breadcrumb item, do not put the link
              content.append("<td class=\"breadcrumb-link\">&nbsp;>&nbsp;"+breadcrumbItem.getConvertedText()+"</td>");
            }else{
              content.append("<td class=\"breadcrumb-link\">&nbsp;>&nbsp;<a href=\""+breadcrumbItem.getLink()+"\">"+breadcrumbItem.getConvertedText()+"</a></td>");
            }
          }
        //}
      }
    }
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here

            // Adding static subscriptions
            List<Subscription> staticSubscriptionList =
                    eventSource.getSubscriptionManager().getStaticSubscriptions();
            for (Iterator<Subscription> iterator = staticSubscriptionList.iterator();
                 iterator.hasNext();) {
                Subscription staticSubscription = iterator.next();
                OMElement staticSubElem =
                        fac.createOMElement("subscription", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                staticSubElem.addAttribute(
                        fac.createOMAttribute("id", nullNS, staticSubscription.getId()));
                OMElement filterElem =
                        fac.createOMElement("filter", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                filterElem.addAttribute(fac.createOMAttribute("source", nullNS,
                        (String) staticSubscription.getFilterValue()));
                filterElem.addAttribute(fac.createOMAttribute("dialect", nullNS,
                        (String) staticSubscription.getFilterDialect()));
                staticSubElem.addChild(filterElem);
                OMElement endpointElem =
                        fac.createOMElement("endpoint", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                OMElement addressElem =
                        fac.createOMElement("address", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                addressElem.addAttribute(
                        fac.createOMAttribute("uri", nullNS, staticSubscription.getEndpointUrl()));
                endpointElem.addChild(addressElem);
                staticSubElem.addChild(endpointElem);
                if (staticSubscription.getExpires() != null) {
                    OMElement expiresElem =
                            fac.createOMElement("expires", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                    fac.createOMText(expiresElem,
                            ConverterUtil.convertToString(staticSubscription.getExpires()));
                    staticSubElem.addChild(expiresElem);
                }
                evenSourceElem.addChild(staticSubElem);
            }
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

                    .getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "class"));
            if (clazz != null) {
                String className = clazz.getAttributeValue();
                try {
                    Class subscriptionManagerClass = Class.forName(className);
                    SubscriptionManager manager =
                            (SubscriptionManager) subscriptionManagerClass.newInstance();
                    Iterator itr = subscriptionManagerElem.getChildrenWithName(PROPERTIES_QNAME);
                    while (itr.hasNext()) {
                        OMElement propElem = (OMElement) itr.next();
                        String propName =
                                propElem.getAttribute(new QName("name")).getAttributeValue();
                        String propValue =
                                propElem.getAttribute(new QName("value")).getAttributeValue();
                        if (propName != null && !"".equals(propName.trim()) &&
                                propValue != null && !"".equals(propValue.trim())) {

                            propName = propName.trim();
                            propValue = propValue.trim();

                            PasswordManager passwordManager =
                                    PasswordManager.getInstance();
                            String key = eventSource.getName() + "." + propName;

                            if (passwordManager.isInitialized()
                                    && passwordManager.isTokenProtected(key)) {
                                eventSource.putConfigurationProperty(propName, propValue);
                                propValue = passwordManager.resolve(propValue);
                            }

                            manager.addProperty(propName, propValue);
                        }
                    }
                    eventSource.setSubscriptionManager(manager);
                    eventSource.getSubscriptionManager()
                            .init(); // Initialise before doing further processing, required for static subscriptions
View Full Code Here

TOP

Related Classes of org.wso2.carbon.ui.deployment.beans.BreadCrumbItem

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.