cancel
Showing results for 
Search instead for 
Did you mean: 

EP5 - EP6 KM file path differences

Former Member
0 Kudos
268

Hello everyone,

I developed some code for EP5 and am trying to migrate to EP6. The issue i'm having regards paths to documents

sitting in KM. What is the link i need to use to reach

these files? Which ID do i use? Which code do i use?

I've searching about this for a few days but have yet to

come across something like this. If anyone can even just

point me to another post that replies to my questions

that would be great..

Thanks,

Alessandro

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What do you mean?

Example of a KM path: /documents/folder/

Answers (6)

Answers (6)

Former Member
0 Kudos

How do i give you points for your last reply?

It doesn't show me the radio boxes anymore.. How do i

get them back so i can give you the points?

Former Member
0 Kudos

Still no success. I edited the line you mentioned above

and deleted the 3 lines you said but i still get an

exception. This is the exception:

#1.5#001279A51BF1003D0000002E00000AB40003FE5B70D4FEC2#1124093618624#com.sap.portal.portal#sap.com/irj#com.sap.portal.portal#Administrator#434####7bd41c000d6411daaf2c001279a51bf1#SAPEngine_Application_Thread[impl:3]_16##0#0#Error#1#/System/Server#Java###Exception

ID:09:13_15/08/05_0005_9397250

[EXCEPTION]

#1#com.sapportals.portal.prt.component.PortalComponentException:

Error in init method

Component : com.bg.news.index.default

at com.sapportals.portal.prt.component.PortalComponentContext.init(PortalComponentContext.java:251)

at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.refresh(PortalComponentContextItem.java:267)

at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.getContext(PortalComponentContextItem.java:312)

at com.sapportals.portal.prt.component.PortalComponentRequest.getComponentContext(PortalComponentRequest.java:385)

at com.sapportals.portal.prt.connection.PortalRequest.getRootContext(PortalRequest.java:435)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:607)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:232)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:153)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: com.sapportals.portal.prt.core.broker.PortalComponentInstantiationException:

Could not instantiate implementation class KMNewsPack.KMNews of Portal

Component com.bg.news.index.default because: Linkage error while

loading implementation class

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getInstanceInternal(PortalComponentItemFacade.java:234)

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getComponentInstance(PortalComponentItemFacade.java:160)

at com.sapportals.portal.prt.core.broker.PortalComponentItem.getComponentInstance(PortalComponentItem.java:732)

at com.sapportals.portal.prt.component.PortalComponentContext.getComponent(PortalComponentContext.java:103)

at com.sapportals.portal.prt.component.PortalComponentContext.init(PortalComponentContext.java:242)

... 26 more

Caused by: java.lang.NoClassDefFoundError:

com/sapportals/wcm/repository/ResourceException

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:219)

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getInstanceInternal(PortalComponentItemFacade.java:228)

... 30 more

Do you recon i should leave in usermanagement in?

Thanks for the help! Really really appreciated..

Former Member
0 Kudos

By the way i thought i'd mention that i imported

this code into developer studio even though it's an

EP5 piece of code. Could it cause any issues? As in

do any of the files created by Eclipse interfere with

the developer studio?

Thanks...

Former Member
0 Kudos

Ok i tried applying the changes but i still got an error.

The error is the following:

#1.5#001279A51BF1004900000001000012A40003FE249D814A47#1123858144828#com.sap.portal.portal#sap.com/irj#com.sap.portal.portal#Administrator#440####3a8247c00b4011daae74001279a51bf1#SAPEngine_Application_Thread[impl:3]_39##0#0#Error#1#/System/Server#Java###Exception

ID:03:49_12/08/05_0001_9397250

[EXCEPTION]

#1#com.sapportals.portal.prt.component.PortalComponentException:

Error in init method

Component : com.bg.news.index.default

at com.sapportals.portal.prt.component.PortalComponentContext.init(PortalComponentContext.java:251)

at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.refresh(PortalComponentContextItem.java:267)

at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.getContext(PortalComponentContextItem.java:312)

at com.sapportals.portal.prt.component.PortalComponentRequest.getComponentContext(PortalComponentRequest.java:385)

at com.sapportals.portal.prt.connection.PortalRequest.getRootContext(PortalRequest.java:435)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:607)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:232)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:153)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: com.sapportals.portal.prt.core.broker.PortalComponentInstantiationException:

Could not instantiate implementation class KMNewsPack.KMNews of Portal

Component com.bg.news.index.default because: Could not instantiate

implementation class

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getInstanceInternal(PortalComponentItemFacade.java:269)

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getComponentInstance(PortalComponentItemFacade.java:160)

at com.sapportals.portal.prt.core.broker.PortalComponentItem.getComponentInstance(PortalComponentItem.java:732)

at com.sapportals.portal.prt.component.PortalComponentContext.getComponent(PortalComponentContext.java:103)

at com.sapportals.portal.prt.component.PortalComponentContext.init(PortalComponentContext.java:242)

... 26 more

Caused by: com.sapportals.portal.prt.core.broker.PortalApplicationNotFoundException:

Could not find portal application ivs

at com.sapportals.portal.prt.core.broker.PortalApplicationItem.prepare(PortalApplicationItem.java:413)

at com.sapportals.portal.prt.core.broker.PortalApplicationItem.prepare(PortalApplicationItem.java:385)

at com.sapportals.portal.prt.core.broker.PortalApplicationItem._refresh(PortalApplicationItem.java:505)

at com.sapportals.portal.prt.core.broker.PortalApplicationItem.getCoreLoader(PortalApplicationItem.java:1334)

at com.sapportals.portal.prt.core.broker.PortalComponentItem.getClassLoader(PortalComponentItem.java:569)

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getClassLoader(PortalComponentItemFacade.java:102)

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getInstanceInternal(PortalComponentItemFacade.java:228)

... 30 more

Any other ideas as to why it isn't working correctly?

Could i have setup the folder structure incorrectly?

Does this code work for you when you run it on your EP6?

Thanks for the help so far

Former Member
0 Kudos

Hi Alessandro,

I know what your problem is.

Fix the following line in your portalapp.xml

<property name="ServicesReference" value="htmlb,usermanagement,knowledgemanagement,navigation,config,ivs"/>

to

<property name="PrivateSharingReference" value="htmlb,knowledgemanagement"/>

Also, delete the following lines from your portalapp.xml.

<property name="ClassLoadingPolicy" value="5.0"/>

<property name="DeploymentPolicy" value="5.0"/>

<property name="AuthenticationPolicy" value="5.0"/>

Message was edited by: Prakash Singh

Former Member
0 Kudos

Here it is:


<?xml version="1.0" encoding="iso-8859-1"?>
<application>
  <application-config>
    <property name="ClassLoadingPolicy" value="5.0"></property>
    <property name="DeploymentPolicy" value="5.0"></property>
    <property name="AuthenticationPolicy" value="5.0"></property>
    <property name="ServicesReference" value="htmlb,usermanagement,knowledgemanagement,navigation,config,ivs"></property>
  </application-config>
  <components>
    <component name="default">
      <component-config>
        <property name="ClassName" value="KMNewsPack.KMNews"></property>
        <property name="SecurityZone" value="com.sap.portal.ep50/ep50_safety"></property>
      </component-config>
      <component-profile>
        <property name="hsseFolder" value="HSSE"></property>
        <property name="regionRID" value="/documents/newNews/Region"></property>
        <property name="PressSummaryCategory" value="BG_PRESS"></property>
        <property name="corporateRID" value="/documents/newNews/Corporate"></property>
        <property name="imFolder" value="IM"></property>
        <property name="PressSummaryURL" value="http://kite/intranet/p/PressSummary3.nsf/newscontent?OpenView"></property>
        <property name="otherRID" value="/documents/newNews/Other"></property>
        <property name="travelImgAlt" value="Travel"></property>
        <property name="hsseImage" value="HSE.gif"></property>
        <property name="numCountryArticles" value="3"></property>
        <property name="defaultImgAlt" value="Announcement"></property>
        <property name="Fontname" value="Arial"></property>
        <property name="descName" value="description"></property>
        <property name="modifiedName" value="modified"></property>
        <property name="travelFolder" value="Travel"></property>
        <property name="hsseImgAlt" value="HSSE"></property>
        <property name="numRegionArticles" value="3"></property>
        <property name="travelImage" value="TRAVEL.gif"></property>
        <property name="namespace" value="http://sapportals.com/xmlns/cm"></property>
        <property name="imImgAlt" value="Information Management"></property>
        <property name="countryRID" value="/documents/newNews/Country"></property>
        <property name="defaultImage" value="announcement.gif"></property>
        <property name="pressImage" value="sissors.gif"></property>
        <property name="docURL" value="/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs"></property>
        <property name="archiveURL" value="/irj/servlet/prt/?prtroot=%2fglobal%2fservices%2fjava-iviews%2fArchiveViewer&amp;prttheme=BG_Group_s&amp;iviewid=ArchiveViewer&amp;rid="></property>
        <property name="numCorporateArticles" value="10"></property>
        <property name="archiveLinkValue" value="more..."></property>
        <property name="archiveURLCont" value="&amp;isolationlevel=4&amp;usecache=false&amp;use_browser_cache=false"></property>
        <property name="imageUrl" value="/documents/newNews/images"></property>
        <property name="Fontsize" value="8"></property>
        <property name="imImage" value="IM.gif"></property>
      </component-profile>
    </component>
  </components>
  <services></services>
</application>

And the code is as follows:


// Generated by Par Wizard

package KMNewsPack;

//import java libraries required for methods and interface used below
import java.io.PrintWriter;
import java.util.Calendar;

import com.sapportals.portal.prt.component.*;
import com.sapportals.portal.prt.session.*;
import com.sapportals.portal.security.usermanagement.IUser;

import com.sapportals.wcm.repository.*;
import com.sapportals.wcm.util.uri.*;
//end of imports

public class KMNews extends AbstractPortalComponent
{

	private PrintWriter out;
	private IResourceList fullResourceList;
	private IResourceListIterator orderListIterator;
	private IResource orderResource;
	private IResourceFactory aResourceFactory;
	private IPropertyName iPropModified, iPropDesc, iPropDisplay;
	private final int CORPORATE = 0, OTHER = 1, REGION = 2, COUNTRY = 3;
	private ResourceContext rContext = null;
	private boolean showLatestCorporate = true;
	private boolean moreCorpOther = false;
	
	private String[][] vars = new String[3][3];
	
	private String pressImage, defaultImage, defaultAlt, strOpenDoc, imageUrl, docURL, 
				   archiveURL, archiveURLCont, archiveLinkValue, Fontname;
	
	private int Fontsize_int, type, numCountryArticles, numRegionArticles, 
				numCorporateArticles, numResources;
				
	private boolean isLoopOne = true;



	public void doContent(IPortalComponentRequest request, IPortalComponentResponse response){

		//declare objects/variables for use later
		IResource irHSSE = null;
		IResource irTravel = null;
		IResource irIM = null;
		IResource irTwoHSSE = null;
		IResource irTwoTravel = null;
		IResource irTwoIM = null;
		IResourceList newResourceList = null;
		IResourceListIterator newlistIterator = null;
		ICollection aCollection = null;

		boolean ascending = false;
		boolean twoOfEach = false;
		boolean hasHSSE = false;
		boolean hasTravel = false;
		boolean hasIM = false;
		boolean hasTwoHSSE = false;
		boolean hasTwoTravel = false;
		boolean hasTwoIM = false;
		ResourcePropertyComparator rRPC;

		//get user object
		IUserContext userContext = request.getUser();
		IUser aUser = (IUser)userContext.getUser();
	
		//create a component profile to access the default.properties file value
		IPortalComponentProfile userProfile = request.getComponentContext().getProfile();
	
		//retrieve all values from the properties file
		docURL = userProfile.getProperty("docURL");
		archiveURL = userProfile.getProperty("archiveURL");
		archiveURLCont = userProfile.getProperty("archiveURLCont");
		archiveLinkValue = userProfile.getProperty("archiveLinkValue");
	
		RID rid = null;
		RID rids[] = new RID[4];
		rids[0] = RID.getRID(userProfile.getProperty("corporateRID"));
		rids[1] = RID.getRID(userProfile.getProperty("otherRID"));
		rids[2] = RID.getRID(userProfile.getProperty("regionRID"));
		rids[3] = RID.getRID(userProfile.getProperty("countryRID"));
		
		vars[0][0] = userProfile.getProperty("hsseFolder");
		vars[0][1] = userProfile.getProperty("hsseImage");
		vars[0][2] = userProfile.getProperty("hsseImgAlt");

		vars[1][0] = userProfile.getProperty("travelFolder");
		vars[1][1] = userProfile.getProperty("travelImage");
		vars[1][2] = userProfile.getProperty("travelImgAlt");
		
		vars[2][0] = userProfile.getProperty("imFolder");
		vars[2][1] = userProfile.getProperty("imImage");
		vars[2][2] = userProfile.getProperty("imImgAlt");		
		
		numCountryArticles = Integer.parseInt(userProfile.getProperty("numCountryArticles"));
		numRegionArticles = Integer.parseInt(userProfile.getProperty("numRegionArticles"));
		numCorporateArticles = Integer.parseInt(userProfile.getProperty("numCorporateArticles"));

		defaultAlt = userProfile.getProperty("defaultImgAlt");
		defaultImage = userProfile.getProperty("defaultImage");
		pressImage = userProfile.getProperty("pressImage");
		imageUrl = userProfile.getProperty("imageUrl");
		
		String PressSummaryURL = userProfile.getProperty("PressSummaryURL");
		String PressSummaryCategory = userProfile.getProperty("PressSummaryCategory");

		//Get strings for property names
		String namespace = userProfile.getProperty("namespace");
		String namespace2 = userProfile.getProperty("descNamespace");
		String modifiedName = userProfile.getProperty("modifiedName");
		String descName = userProfile.getProperty("descName"); 
		
		//Get font name of iView
		Fontname = userProfile.getProperty("Fontname");
		
		//Get Fontsize of iView
		String Fontsize = userProfile.getProperty("Fontsize");
		Integer Fontsize_integer = Integer.decode(Fontsize);
		Fontsize_int = Fontsize_integer.intValue();
	
//////////////////////	end retrieval of properties file values	//////////////////////
	
		//create user context	
		rContext = new ResourceContext(aUser);
	
		//create calendar instance of system time and date
		Calendar sysCalendar = Calendar.getInstance();
	
		//retrieve date, month and year values
		Integer integerDate = new Integer(sysCalendar.get(Calendar.DAY_OF_MONTH));
		String strgetDate = integerDate.toString();
		Integer integerMonth = new Integer((sysCalendar.get(Calendar.MONTH)+1));
		String strgetMonth = integerMonth.toString();
		int intYear = sysCalendar.get(Calendar.YEAR);
	
		//format single character dates and months
		if (strgetMonth.length() < 2)
			strgetMonth = "0" + strgetMonth;
		if (strgetDate.length() < 2)
			strgetDate = "0" + strgetDate;
	
		//build the string to use in the Press Summaries URL
		String currentDate = strgetDate + "_" + strgetMonth + "_" + intYear;
	
		try
		{
	
			//create raiseDoc function to call the raiseEvent for the Lead Article Listener
			response.write("<script language="javascript">n function raiseDoc(slink)n {EPCM.raiseEvent('urn:com.acn.uk.bg:KMNews', 'viewDocument', slink);}n </script>n");
			//create newWindow function to open a new window for the Department articles
			response.write("<script language="javascript">n function newWindow(plink)n {openWindow = window.open(plink, '', 'toolbar=no, resizable=yes, scrollbars=yes, width=500, height=500');}n </script>n");
	
			//create display table
			response.write("<style>n");
			response.write("t.inside { MARGIN: 5px; }n");
			response.write("t.more { TEXT-ALIGN: right; FONT-SIZE: 7pt; FONT-FAMILY: " + Fontname + "; COLOR: black; }n");
			response.write("</style>n");
			response.write ("<table class=borderer border='0' width='90%' cellpadding='0' cellspacing='0' valign='top' bgcolor='white'>n");
			
			// get an instance of a resource factory
			aResourceFactory = ResourceFactory.getInstance();
			//Loop through all the rids
			for(int i = 0; i < rids.length; i++)
			{
				rid = rids<i>;
   	    		
				//assign type based on RID index value
				type = i;
   	    		
				if(rid.toString().length() != 0 && !rid.isRoot())
				{
					//retrieve a collection with context
					aCollection = (ICollection) aResourceFactory.getResource(rid, rContext);
   	    						
					if(aCollection.isCollection())
					{
						//retrieving all children from a collection into a resource list object
						newResourceList = aCollection.getChildren();
						
						//initialising resource list object	
						fullResourceList = aCollection.getChildren();
						for(int j = fullResourceList.size() - 1; j >= 0; j--)		
							fullResourceList.remove(j);								
							
						//create an iterator to loop over all resources
						newlistIterator = newResourceList.listIterator();
						
						while (newlistIterator.hasNext())
						{
							IResource obj = newlistIterator.next();
							if(obj.isCollection())
							{
								//retrieve every resources within this resource list
								ICollection subFolderCollection = (ICollection) aResourceFactory.getResource(obj.getAccessRID(), rContext);
								getResources(subFolderCollection, response);	
							}	

						} //end while

						//create property names to index properties
						iPropModified = new PropertyName(namespace,modifiedName);
						iPropDesc = new PropertyName(namespace2,descName);

						//create a comparator to order the resource list
						rRPC = new ResourcePropertyComparator(iPropModified, ascending);
						//order the resource list
						fullResourceList.sort(rRPC);
						
						switch(type)
						{
							case CORPORATE:
								// Reassign resource list with as many resources as need to be displayed
								if(fullResourceList.size() > numCorporateArticles)
									fullResourceList = fullResourceList.subList(0, numCorporateArticles);
								presentationLayer(response, fullResourceList, rid, false);
								break;
								
							case OTHER:
								orderListIterator = fullResourceList.listIterator();
								//loop over all resources or until one of each report is processed
								while(orderListIterator.hasNext() && !twoOfEach){
									//iterate over all resources
									orderResource = orderListIterator.next();			
									//retrieve the article URL path in the KM
									strOpenDoc = orderResource.getRID().toString();
									
									if(!hasHSSE && strOpenDoc.indexOf("/" + vars[0][0]) != -1){
										irHSSE = orderResource;
										hasHSSE = true;
									}
									else if(!hasTravel && strOpenDoc.indexOf("/" + vars[1][0]) != -1){
										irTravel = orderResource;
										hasTravel = true;
									}
									else if(!hasIM && strOpenDoc.indexOf("/" + vars[2][0]) != -1){
										irIM = orderResource;
										hasIM = true;
									}
									else if(hasHSSE && !hasTwoHSSE && strOpenDoc.indexOf("/" + vars[0][0]) != -1){
										irTwoHSSE = orderResource;
										hasTwoHSSE = true;
									}
									else if(hasTravel && !hasTwoTravel && strOpenDoc.indexOf("/" + vars[1][0]) != -1){
										irTwoTravel = orderResource;
										hasTwoTravel = true;
									}
									else if(hasIM && !hasTwoIM && strOpenDoc.indexOf("/" + vars[2][0]) != -1){
										irTwoIM = orderResource;
										hasTwoIM = true;
									}
									//check if each report type has been accessed
									if(hasHSSE && hasTravel && hasIM &&
									   hasTwoHSSE && hasTwoTravel && hasTwoIM){
										twoOfEach = true;
									}
								}
								for(int j = fullResourceList.size() - 1; j >= 0; j--)		
									fullResourceList.remove(j);								
								if(hasHSSE)
									fullResourceList.add(irHSSE);
								if(hasTwoHSSE)
									fullResourceList.add(irTwoHSSE);
								if(hasTravel)
									fullResourceList.add(irTravel);
								if(hasTwoTravel)
									fullResourceList.add(irTwoTravel);
								if(hasIM)
									fullResourceList.add(irIM);		
								if(hasTwoIM)
									fullResourceList.add(irTwoIM);	
								break;
							
							case REGION:
								if(fullResourceList.size() > numRegionArticles)
									fullResourceList = fullResourceList.subList(0, numRegionArticles);
								presentationLayer(response, fullResourceList, rid, false);
								break;

							case COUNTRY:
								if(fullResourceList.size() > numCountryArticles)
									fullResourceList = fullResourceList.subList(0, numCountryArticles);
								presentationLayer(response, fullResourceList, rid, false);
								break;
						}

						// Display press summaries afer Corporate Announcements section	
						if(type == OTHER) {
							//press summaries section of the table
							response.write("<tr><td width='100%' class=separator><table class=inside border = '0' width='100%' cellpadding='1' cellspacing='0' valign='top' bgcolor='white'>");
							presentationLayer(response, fullResourceList, rid, true);
							response.write("<tr><td align='left' width='10'>");
							response.write("<img src='" + docURL + imageUrl + "/" + pressImage + "' alt="Press Summary" border=0></td><td>");
							response.write ("<a href="javascript:raiseDoc('" + PressSummaryURL + "&DATE=" + currentDate + "&CATEGORY=" + PressSummaryCategory + "')" title="Press Summary">");
							response.write ("<span style="FONT-SIZE:" + Fontsize_int + "pt;COLOR:black;FONT-FAMILY:" + Fontname + "">Daily Press Summary</span>");
							response.write("</a>");
							response.write("</td><td> </td></tr>");
							//Write URL for report archive to iView
							response.write("<tr><td colspan="3"><a href="javascript:raiseDoc('" + archiveURL + rid + archiveURLCont + "')"><span class=more>" + archiveLinkValue + "</span></a></td></tr>");
							response.write("</table></td>nt</tr>n");
						}//end if			
					} //end if
				}//end if
			} //end for
			
			//close table
			response.write("</table>");
	
		}
		catch (AccessDeniedException ex)
		{
			//Exception commented out as users can not access all IResources
		}
		catch (ResourceException ex)
		{
			//a resource exception occured
			writeException(ex.getLocalizedMessage(), response);
		}
		catch(Exception ex)
		{
			writeException(ex.getLocalizedMessage(), response);
		}
	}//end method
	
	
	/**
	 *  This Method extracts all the Resources found under a particular collection.
	 *
	 *@return  IResourceList  List of resources in the collection passed through
	 */
	private void getResources(ICollection ic, IPortalComponentResponse response)
	{
		try
		{
			if (ic.isCollection())
			{
				IResourceList irl = ic.getChildren();
				IResourceListIterator irli = irl.listIterator();
				while(irli.hasNext())
				{
					IResource ir = irli.next();
					if(ir.toString().indexOf("Z_Archive")==-1) {		
						if(ir.isCollection())
							getResources((ICollection) ir, response);
						else
							fullResourceList.add(ir);
					} 
				}			
			}
		}
		catch (AccessDeniedException ex)
		{
			//Exception commented out as users can not access all IResources
		}
		catch (ResourceException ex)
		{
			//a resource exception occured
			writeException(ex.getLocalizedMessage(), response);
		}
		catch(Exception ex)
		{
			writeException(ex.getLocalizedMessage(), response);
		}
	}
	

	/**
	 *  This Method writes to the Portal the news
	 *
	 *@param  message  Error message to be displayed
	 */
	private void presentationLayer(IPortalComponentResponse response, IResourceList fullResourceList, RID rid, boolean isOther) //, IPropertyName propMod, IPropertyName propDesc)
	{
		try
		{
			
			orderListIterator = fullResourceList.listIterator();
			boolean isFirst = true;
			boolean isLast = false;
			String displayStr = "";
			String announceStr = "";
			String description;
			String writeMe = "";
			
			//loop over all resources in the new ordered resource list
			while (orderListIterator.hasNext())
			{
				orderResource = orderListIterator.next();
				
				if(!orderListIterator.hasNext()){
					isLast = true;
				}
				
				//retrieve the article URL path in the KM
				strOpenDoc = orderResource.getRID().toString();

				description = "";
				//write description if one assigned in KM
				if(orderResource.getProperty(iPropDesc) != null)
					description = orderResource.getProperty(iPropDesc).getStringValue();
				else
					description = orderResource.getDisplayName(true);

				//display latest corporate report in viewing pane
				if(type == CORPORATE && showLatestCorporate)
				{
					writeMe = "n<script>n raiseDoc('" + docURL + "" + strOpenDoc + "');n</script>n";
					showLatestCorporate = false;
				}
						
				//write table separators between report sections
				if(isFirst && !isOther)
				{
					String css = "";
					if(isLoopOne)
						isLoopOne = false;
					else
						css = " class=separator";
					response.write("t<tr>ntt<td width='100%'" + css + ">nttt<table class=inside border = '0' width='100%' cellpadding='1' cellspacing='0' valign='top' bgcolor='white'>");
					isFirst = false;
				}

				String img = "";
				String imgAlt = "";
						
				// print images next to Corporate Other reports
				if(isOther){
					for(int x = 0; x < vars.length; x++)
					{
						if(strOpenDoc.indexOf("/" + vars[x][0] + "/") != -1)
						{
							img = vars[x][1];
							imgAlt = vars[x][2];
						}
					}
					if(img == "")
						img = defaultImage;
					if(imgAlt == "")
						imgAlt = defaultAlt;
					
					// Write link to any Other report
					displayStr = "ntttt<tr>nttttt<td align='left' width='10'>" +
							 "<img src='" + docURL + imageUrl + "/" + img + "' alt="" + imgAlt + "" border=0></td>n" +
							 "ttttt<td>" +
							 "<a alt="" + description + "" href="javascript:raiseDoc('" + docURL + 
							 "" + strOpenDoc + "')" title="" + orderResource.getDescription()+ 
							 ""><span style="FONT-SIZE:" + Fontsize_int + "pt;COLOR:black;FONT-FAMILY:" + Fontname + "">" +
							 orderResource.getDisplayName(true) +
							 "</span></a>" +
							 "</td><td> </td>ntttt</tr>";
				} else {
							
					// Write link to any non-Other report
					displayStr = "ntttt<tr>" +
							 "nttttt<td align='left' width='2'>" +
							 "ttttt<td>" +
							 "<a alt="" + description + "" href="javascript:raiseDoc('" + docURL + 
							 "" + strOpenDoc + "')" title="" + orderResource.getDescription()+ 
							 ""><span style="FONT-SIZE:" + Fontsize_int + "pt;COLOR:black;FONT-FAMILY:" + Fontname + "">" +
							 orderResource.getDisplayName(true) +
							 "</span></a>" +
							 "</td><td> </td>ntttt</tr>";

				}
				
				// Write report link to iView
				response.write(displayStr);
			} //end while

			if(!isFirst)
			{
				//Write URL for report archive to iView
				response.write("<tr><td colspan="3"><a href="javascript:raiseDoc('" + archiveURL + rid + archiveURLCont + "')"><span class=more>" + archiveLinkValue + "</span></a></td></tr>");
				response.write("</table></td>nt</tr>n");
			}
			if(!showLatestCorporate)
			{
				response.write(writeMe);
			}
		}
		catch (AccessDeniedException ex)
		{
			//Exception commented out as users can not access all IResources
		}
		catch (ResourceException ex)
		{
			//a resource exception occured
			writeException(ex.getLocalizedMessage(), response);
		}
		catch(Exception ex)
		{
			writeException(ex.getLocalizedMessage(), response);
		}
	}
	


	/**
	 *  This Method writes exception information for the iView
	 *
	 *@param  message  	Error message to be displayed
	 *@param  response  Used to send error message to the browser
	 */
	private void writeException(String message, IPortalComponentResponse response)
	{
		response.write("<tr><td><b><font color="red">Error: </font>An issue has occurred whilst generating this page.<br>Please try refreshing the browser.<br> If the problem persists please contact the helpdesk.</b></td></tr>");
	}

}

Thank you very much.

Former Member
0 Kudos

Hi Alessandro,

I see one problem with your code.

Replace the following line of code.

//get user object
IUserContext userContext = request.getUser();
IUser aUser = (IUser)userContext.getUser()

to

IUser aUser = WPUMFactory.getUserFactory().getEP5User(request.getUser());

Former Member
0 Kudos

Yes, that's what i mean.

I used the API for KM from EP5 and setup all the folder structure in EP6 just like it was on EP5 but i get the following error:

#1.5#001279A51BF1005E00000118000012C00003FDFB8CA4F826#1123681768392#com.sap.portal.portal#sap.com/irj#com.sap.portal.portal#Administrator#59992####91f5f48009a511da827f001279a51bf1#SAPEngine_Application_Thread[impl:3]_39##0#0#Error#1#/System/Server#Java###Exception

ID:02:49_10/08/05_0025_9397250

[EXCEPTION]

#1#com.sapportals.portal.prt.component.PortalComponentException:

Error in init method

Component : com.bg.news.index.default

at com.sapportals.portal.prt.component.PortalComponentContext.init(PortalComponentContext.java:251)

at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.refresh(PortalComponentContextItem.java:267)

at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.getContext(PortalComponentContextItem.java:312)

at com.sapportals.portal.prt.component.PortalComponentRequest.getComponentContext(PortalComponentRequest.java:385)

at com.sapportals.portal.prt.connection.PortalRequest.getRootContext(PortalRequest.java:435)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:607)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:232)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:153)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: com.sapportals.portal.prt.core.broker.PortalComponentInstantiationException:

Could not instantiate implementation class KMNewsPack.KMNews of Portal

Component com.bg.news.index.default because: Could not instantiate

implementation class

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getInstanceInternal(PortalComponentItemFacade.java:269)

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getComponentInstance(PortalComponentItemFacade.java:160)

at com.sapportals.portal.prt.core.broker.PortalComponentItem.getComponentInstance(PortalComponentItem.java:732)

at com.sapportals.portal.prt.component.PortalComponentContext.getComponent(PortalComponentContext.java:103)

at com.sapportals.portal.prt.component.PortalComponentContext.init(PortalComponentContext.java:242)

... 26 more

Caused by: com.sapportals.portal.prt.core.broker.PortalApplicationNotFoundException:

Could not find portal application navigation

at com.sapportals.portal.prt.core.broker.PortalApplicationItem.prepare(PortalApplicationItem.java:413)

at com.sapportals.portal.prt.core.broker.PortalApplicationItem.prepare(PortalApplicationItem.java:385)

at com.sapportals.portal.prt.core.broker.PortalApplicationItem._refresh(PortalApplicationItem.java:505)

at com.sapportals.portal.prt.core.broker.PortalApplicationItem.getCoreLoader(PortalApplicationItem.java:1334)

at com.sapportals.portal.prt.core.broker.PortalComponentItem.getClassLoader(PortalComponentItem.java:569)

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getClassLoader(PortalComponentItemFacade.java:102)

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getInstanceInternal(PortalComponentItemFacade.java:228)

... 30 more

#

Thanks

Former Member
0 Kudos

Can you post your code & portalapp.xml.