<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: FlexibleUI - UICommands with Path KM and User KM from the context. in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/flexibleui-uicommands-with-path-km-and-user-km-from-the-context/qaa-p/2401903#M1029699</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;To get the KM Path:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;String path = getResource().getRID().getPath();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get the present User:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IPortalComponentRequest pcr =
                (IPortalComponentRequest) getProxy().getDynamicPage().getPageContext().getRequest();
pcr.getUser();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To create URL call with datas when UICommand is clicked. You should modify your getLinkAttributes method.&lt;/P&gt;&lt;P&gt;Check this for an example:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.sdn.sap.com/thread.jspa?threadID=334529" target="test_blank"&gt;https://forums.sdn.sap.com/thread.jspa?threadID=334529&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;Praveen Gudapati&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Points are always welcome for helpful answers]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jun 2007 18:21:12 GMT</pubDate>
    <dc:creator>praveenkumar_gudapati</dc:creator>
    <dc:date>2007-06-13T18:21:12Z</dc:date>
    <item>
      <title>FlexibleUI - UICommands with Path KM and User KM from the context.</title>
      <link>https://community.sap.com/t5/technology-q-a/flexibleui-uicommands-with-path-km-and-user-km-from-the-context/qaq-p/2401902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to write one new Java Portal Class, for new KM Command. This command should do the following action:&lt;/P&gt;&lt;P&gt;- get context information of KMC (specifically portal user and KM path)&lt;/P&gt;&lt;P&gt;- call URL with this data. (Example: &lt;A href="http://domain:port/service?userkm=valueuserkm&amp;amp;pathkm=valuepathkm" target="test_blank"&gt;http://domain:port/service?userkm=valueuserkm&amp;amp;pathkm=valuepathkm&lt;/A&gt; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have modify example of FlexibleUI - UICommands, and create a new class that call a URL, but can't find the class and method for get context and catch the user and path of KM user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is the code for the class of UICommands:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
package com.sap.example.flexible.ui.command;

import java.util.List;

import com.sapportals.wcm.WcmException;
import com.sapportals.wcm.rendering.base.IRenderingEvent;
import com.sapportals.wcm.rendering.base.IScreenflowData;
import com.sapportals.wcm.rendering.uicommand.AbstractCommand;
import com.sapportals.wcm.rendering.uicommand.ICommand;
import com.sapportals.wcm.rendering.uicommand.LinkAttributes;
import com.sapportals.wcm.repository.IResourceContext;
import com.sapportals.wcm.repository.IResource;

/**
 * Copyright (c) 2005 by SAP AG. All Rights Reserved.
 *
 * SAP, mySAP, mySAP.com and other SAP products and
 * services mentioned herein as well as their respective
 * logos are trademarks or registered trademarks of
 * SAP AG in Germany and in several other countries all
 * over the world. MarketSet and Enterprise Buyer are
 * jointly owned trademarks of SAP AG and Commerce One.
 * All other product and service names mentioned are
 * trademarks of their respective companies.
 * 
 * This class is a sample implementation for a 
 * UICommand using external eventing.
 * 
 * @author Thilo Brandt, SAP AG
 * @version 1.0
 */
public class SimpleExternalCommand extends AbstractCommand {

	protected String getLabel() {
	   return "myButtonLabelDURO";
		  }

		  protected String getTooltip() {
				return " myButtonTooltipDURO";
		  }

	public SimpleExternalCommand() {
		//super("SimpleExternalCommand", "SimpleExternalCommand");
		super("myButtonTextKey", "myTooltipTextKey");
	}

	public ICommand getNewInstance() {
		return this.initNewInstance(new SimpleExternalCommand());
	}

	public IRenderingEvent execute(IScreenflowData arg0) throws WcmException {
		return null;
	}

	public String[] getTargetParameters() throws WcmException {
		return new String[0];
	}

	//public void setTargetParameters(List arg0, IResourceContext arg1)
	public void setTargetParameters(List list, IResourceContext context)
		throws WcmException {
	}

	public boolean isExecutable() {
		return true;
	}

	public boolean raisesEvent() {
		return false;
	}

// Inicio de Modificación de Código para uso de Parámetros
   	public LinkAttributes getLinkAttributes() {
		String Target = "_blank";
		String lURL1  = "http://www.google.com/search?hl=es&amp;amp;q="; 
		String lURL2  = "PARAMETRO";
		String lURL3  = "&amp;amp;lr=";

// Get User KM from context 
// lURL2 = UserKM;
// Get path KM from context
		
        String lURL   = lURL1 + lURL2 + lURL3;

		return new LinkAttributes(lURL, Target);
	} 
}

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please helpme to get userKM and pathKM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Junior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 17:19:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/flexibleui-uicommands-with-path-km-and-user-km-from-the-context/qaq-p/2401902</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-13T17:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: FlexibleUI - UICommands with Path KM and User KM from the context.</title>
      <link>https://community.sap.com/t5/technology-q-a/flexibleui-uicommands-with-path-km-and-user-km-from-the-context/qaa-p/2401903#M1029699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;To get the KM Path:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;String path = getResource().getRID().getPath();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get the present User:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IPortalComponentRequest pcr =
                (IPortalComponentRequest) getProxy().getDynamicPage().getPageContext().getRequest();
pcr.getUser();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To create URL call with datas when UICommand is clicked. You should modify your getLinkAttributes method.&lt;/P&gt;&lt;P&gt;Check this for an example:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.sdn.sap.com/thread.jspa?threadID=334529" target="test_blank"&gt;https://forums.sdn.sap.com/thread.jspa?threadID=334529&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;Praveen Gudapati&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Points are always welcome for helpful answers]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 18:21:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/flexibleui-uicommands-with-path-km-and-user-km-from-the-context/qaa-p/2401903#M1029699</guid>
      <dc:creator>praveenkumar_gudapati</dc:creator>
      <dc:date>2007-06-13T18:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: FlexibleUI - UICommands with Path KM and User KM from the context.</title>
      <link>https://community.sap.com/t5/technology-q-a/flexibleui-uicommands-with-path-km-and-user-km-from-the-context/qaa-p/2401904#M1029700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem resolved!!!.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, get KM User: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;String KMUser = context.getUser().getDisplayId();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 22:14:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/flexibleui-uicommands-with-path-km-and-user-km-from-the-context/qaa-p/2401904#M1029700</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-13T22:14:12Z</dc:date>
    </item>
  </channel>
</rss>

