Skip to Content
author's profile photo Former Member
Former Member

Need urgent help!!!!

I have a local web dynpro project that I created and I am trying to create a KM folder. Everything goes fine with it until I add the following line of code:

IResourceFactory factory = ResourceFactory.getInstance();

ICollection folder = (ICollection) factory.getResource(aRid,resourceContext);

There are no compilation errors or build errors and it says it deploys fine. However, with in Design Time of guided procedures, I go to create a callable object of type Web Dynpro Component (GP Interface) and when I highlight it, it has nothing for the code or description and acts like the description was never created for it. I removed the code above and everything below and tried to deploy and it works fine. I was just wondering what would be causing this and what the solution is. I am at a total loss.

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Aug 22, 2011 at 11:09 AM

    Create a file node containing 2 attributes filename and filedata.This filename can be used to access the name of the file.The data stored in the file is being passed as a binary stream.

    Therefore the filedata should be of binary type.

    fileelement = wdContext.createFilenodeElement();

    wdContext.nodeFilenode().bind(fileelement);

    /Make a simple type of that type/

    IWDAttributeInfo attInfo = wdContext.nodeFilenode().getNodeInfo().getAttribute("filedata");

    ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();

    Following is the code for uploading files

    /*Get an object of current Portal user */ IWDClientUser wdClientUser =

    WDClientUser.getCurrentUser(); com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();

    /*create an ep5 user from the retrieved user

    IUser ep5User =WPUMFactory.getUserFactory().getEP5User(sapUser);

    ResourceContext context = new ResourceContext(ep5User);

    /*Give the path to KM in the variable path */

    RID rid = RID.getRID(path);

    IResourceFactory factory =

    ResourceFactory.getInstance();

    ICollection folder = (ICollection) factory.getResource(rid,context);

    Using the upload element we can upload the files to a location in the server drive

    /*temperory location for writing */

    String location = u201Cgive the location hereu201D;

    String fileName = location+fileelement.getFilename();

    file = new File(fileName);

    /Create an output stream for writing to the temperory location/

    FileOutputStream out = new FileOutputStream(file);

    out.write(fileelement.getFiledata());

    out.close();

    /From the temporary location read the file using an input stream/

    FileInputStream fin = new FileInputStream(fileName);

    fin.read();

    /*Using this input stream we can write to the repository

    Content content = new Content(fileelement.getFiledata(),fileelement.get) */

    Content content = new Content(fin,"byte", -1);

    IResource newResource = folder.createResource(fileelement.getFilename(),null, content);

    After uploading files to KM repository delete the file from its temporary location .Close the input stream when you have uploaded

    fin.close();

    file.delete();

    write the above code within a try-catch block. After writing the code organize imports .

    These are the imports to be organised

    import com.sapportals.portal.security.usermanagement.IUser;

    import com.sapportals.wcm.repository.Content;

    import com.sapportals.wcm.repository.ICollection;

    import com.sapportals.wcm.repository.IResource;

    import com.sapportals.wcm.repository.IResourceContext;

    import com.sapportals.wcm.repository.IResourceFactory;

    import com.sapportals.wcm.repository.IResourceList;

    import com.sapportals.wcm.repository.IResourceListIterator;

    import com.sapportals.wcm.repository.ResourceContext;

    import com.sapportals.wcm.repository.ResourceFactory;

    import com.sapportals.wcm.util.uri.RID;

    import com.sapportals.wcm.util.usermanagement.WPUMFactory

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.