KM Repository Service for creating a folder structure

Hi All,
   We have a requirement in KM. Whenever a folder is created inside a folder (say '/documents/testFolder') ... .. a couple of subFolders need to be created inside this new folder.
For example, if the new folder's name being created is <i>parentFolder1</i> then, the following structure shud be created inside this folder.
parentFolder1
  |--> subFolder1
             |--> subFolder11
             |--> subFolder12
  |--> subFolder2
             |--> subFolder21
I tried to implement a KM repository service::
My Rep Service code::
package com.test;
import java.util.Collection;
import java.util.Iterator;
import com.sap.tc.logging.Location;
import com.sapportals.config.fwk.CannotAccessConfigException;
import com.sapportals.config.fwk.Configuration;
import com.sapportals.config.fwk.IConfigClientContext;
import com.sapportals.config.fwk.IConfigManager;
import com.sapportals.config.fwk.IConfigPlugin;
import com.sapportals.config.fwk.IMutableConfigurable;
import com.sapportals.config.fwk.InitialConfigException;
import com.sapportals.portal.security.usermanagement.UserManagementException;
import com.sapportals.wcm.WcmException;
import com.sapportals.wcm.crt.component.IReconfigurable;
import com.sapportals.wcm.crt.component.StartupException;
import com.sapportals.wcm.crt.configuration.ConfigurationException;
import com.sapportals.wcm.crt.configuration.IConfiguration;
import com.sapportals.wcm.repository.AccessDeniedException;
import com.sapportals.wcm.repository.ICollection;
import com.sapportals.wcm.repository.IResource;
import com.sapportals.wcm.repository.NotSupportedException;
import com.sapportals.wcm.repository.Property;
import com.sapportals.wcm.repository.ResourceException;
import com.sapportals.wcm.repository.manager.IRepositoryManager;
import com.sapportals.wcm.repository.manager.IResourceEvent;
import com.sapportals.wcm.repository.manager.IResourceEventReceiver;
import com.sapportals.wcm.repository.manager.ResourceEvent;
import com.sapportals.wcm.repository.service.AbstractRepositoryService;
import com.sapportals.wcm.repository.service.ServiceNotAvailableException;
import com.sapportals.wcm.util.config.ConfigCrutch;
import com.sapportals.wcm.util.events.IEvent;
// implements IMyNewRepositoryService interface
  Note: IReconfigurable and IResourceEventReceiver interfaces are optional
public class MytestRepositoryService extends AbstractRepositoryService implements IReconfigurable, IResourceEventReceiver {
  private static final String TYPE = "com.test.MytestRepositoryService";
  private Collection repositoryManagers;
  private static final Location log = Location.getLocation(MytestRepositoryService.class);
  //variables
       private static final String PLUGIN_FOLDERCREATION_SERVICE = "/cm/repository_services";
       private static final String CONFIGCLASS_FOLDERCREATION_SERVICE = "com.test.MytestRepositoryService";
       private static final String readPlugins[] = { PLUGIN_FOLDERCREATION_SERVICE };
public static final String PROP_MYFOLDER = "myFolder";
  public MytestRepositoryService() {
    super();
    // Do not add code here. Add it to startUpImpl() instead
  public String getServiceType() {
    return MytestRepositoryService.TYPE;
  protected void startUpImpl(Collection repositoryManagers) throws ConfigurationException, StartupException {
    // implement this method as follows:
    // - Verify configuration data
    // - Get references to other needed (global) services
    // - Check whether other repository services (this service depends on) are also assigned to the repository managers
    // - Usually the service registers itself for certain events at all repository managers
    try  {
    catch (Exception e) {
      throw new StartupException(e.getMessage(), e);
     this.repositoryManagers = repositoryManagers;
     Iterator it = repositoryManagers.iterator();
     while (it.hasNext()){
       try {
          addRepositoryAssignment((IRepositoryManager) it.next());
       } catch (ServiceNotAvailableException e) {
          e.printStackTrace();
  protected void shutDownImpl() {
     Iterator it = repositoryManagers.iterator();
     while (it.hasNext()){
       try {
          removeRepositoryAssignment((IRepositoryManager) it.next());
       } catch (WcmException e) {
          e.printStackTrace();
  protected void addRepositoryAssignment(IRepositoryManager mgr) throws ServiceNotAvailableException {
    // Implement this method: Usually the service registers itself for certain events at the repository manager.
     try {
//       mgr.getEventBroker().register(this, ResourceEvent.ALL_TEMPLATE);
       mgr.getEventBroker().register(this, new ResourceEvent(ResourceEvent.CREATE_COLLECTION, null));
     } catch (WcmException e) {
       e.printStackTrace();
  protected void removeRepositoryAssignment(IRepositoryManager mgr) throws WcmException {
    // Implement this method: Usually the service must unregister itself as an event handler.
//     mgr.getEventBroker().unregister(this, ResourceEvent.ALL_TEMPLATE);
     mgr.getEventBroker().unregister(this, new ResourceEvent(ResourceEvent.CREATE_COLLECTION, null));
  public void reconfigure(IConfiguration config) throws ConfigurationException {
    this.stateHandler.preReconfigure();
    // check the new configuration data
    try {
    catch (ConfigurationException ex) {
      this.stateHandler.postReconfigure(ex);
      throw ex;
    this.config = config;
    this.stateHandler.postReconfigure();
  public void received(IEvent event) {
     IResourceEvent myEvent = (IResourceEvent) event;
     IResource resource = (IResource) myEvent.getParameter();
     String repositoryPath = "";
     String parentPath = "";
            //get the configuration...
            try {
                   IConfigClientContext context = IConfigClientContext.createContext(ConfigCrutch.getConfigServiceUser());
                 IConfigManager cfg = Configuration.getInstance().getConfigManager(context);
                 IConfigPlugin configPlugin = cfg.getConfigPlugin(PLUGIN_FOLDERCREATION_SERVICE);
                 if (configPlugin != null) {
                      IMutableConfigurable[] configurables = configPlugin.getConfigurables(CONFIGCLASS_FOLDERCREATION_SERVICE, false);
                      for (int i = 0; i < configurables.length; i++) {
                           IMutableConfigurable configurable = configurables<i>;
                           if (configurable.getConfigClass().getName().equals(CONFIGCLASS_FOLDERCREATION_SERVICE)) {
                                // now get the attribute value...
                                repositoryPath = configurable.getPropertyValue(PROP_MYFOLDER);  //// "documents/parentFolder1"
          } catch (InitialConfigException e2) {
               e2.printStackTrace();
          } catch (CannotAccessConfigException e2) {
               e2.printStackTrace();
          } catch (UserManagementException e2) {
               e2.printStackTrace();
          try {
               parentPath = resource.getParentCollection().getRID().toString();
          } catch (AccessDeniedException e1) {
               e1.printStackTrace();
          } catch (ResourceException e1) {
               e1.printStackTrace();
          if(repositoryPath.equals(parentPath))
               //write my code here
               if (resource != null && (resource.isCollection()) )
                    ICollection parentFolder = (ICollection) resource;
                    try {
                         <b>parentFolder.createCollection("subFolder1",null);</b>
                    } catch (NotSupportedException e) {
                         e.printStackTrace();
                    } catch (AccessDeniedException e) {
                         e.printStackTrace();
                    } catch (ResourceException e) {
                         e.printStackTrace();
<b>...MytestRepositoryService.co.xml:</b>
- <Configurable configclass="com.test.MytestRepositoryService">
  <property name="name" value="com.test.MytestRepositoryService" />
  <property name="active" value="true" />
<i>  <property name="myFolder" value="/documents/parentFolder1" /></i>
  <property name="description" />
  </Configurable>
<b>...MytestRepositoryService.cc.xml:</b>
- <ConfigClass name="com.test.MytestRepositoryService" extends="RepositoryService">
  <attribute name="class" type="class" constant="com.test.MytestRepositoryService" />
  </ConfigClass>
Have i done it right?? Where am i going wrong??? Plz advice.
I need to 'myFolder' as a configurable property in KM's <i>Content Management --> Repository Services</i> section.
Thanks!
Regards,
SK.

Hi,
I haven't check your code but you know that you can archive the same without writing a portal componente by using the template feature. It is a simple customizing. See http://help.sap.com/saphelp_nw70/helpdata/en/55/83bd402b8d8031e10000000a1550b0/frameset.htm
Best Regards
Frank

Similar Messages

  • Is there an app for creating a folder structure on the iPhone out there?

    I'm looking for an application to create folders (possibly password-protect them) on the iPhone, so I can add documents, PDFs, video clips etc to the phone and create subdivide them further in folders. There doesn't seem to be anything that does the right job in the app store. Is it not possible? Any feedback to help me understand would be appreciated.

    It is not possible. You cannot create the folder structure you're speaking of and you cannot save files to your iPhone, even if you had folders.
    There are no apps for folders or app organization. There are apps that allow you to access files from your desktop or the cloud from your iPhone. I use box.net. Dropbox and AirShare are others.

  • Access Denied for creating new folder

    Hi friends,
    When i tried to create a new folder under shared folders in catalog as a weblogic user, i couldnt get a option for creating new folder. But i have that option enabled in the My folders area.
    Im not sure why the create folder option is not enabled for the weblogic user in the shared folders.
    Im on OBIEE 11.1.1.7 and for a workaround i referred the below link
    https://forums.oracle.com/thread/2520389
    But i followed the steps mentioned in the above link, but not succeeded still facing the same create folder privilege issue under the shared folders for the weblogic user.
    Kindly suggest me your approach for solving this issue.
    Thanks
    Regards,
    Saro

    Hari,
    Restart the services (weblogic and BI) you should see it I have observed same kind of behavior in 11.1.1.7.0 (Admin tab missing and No Permissions icon for weblogic user) dont know exact reason
    Restart is not a solution but will see if you are able to see or not
    Thanks,
    Saichand

  • Repository service for counting downloaded documents

    Hi, 
        I want to write a repository Service for counting downloaded documents.
    In addRepositoryAssignment method, for which resource event type I have to register.
    (i.e)
      mgr.getEventBroker().register(this, ResourceEvent.??);
    or any other way to do this.
    Regards
    Ganesan S

    Hi Ganesan,
    Seems you have an index on the resources.
    I had a look into the repository service implementation on the blog. THis is what could be the reason:
    In <b>received</b> method you catch the GET resourceEvent (<b>first</b> hit). Then you get the resource in question and change/increment the property on this resource. For TREX in fact you change the resource. The event is catched by the IndexService and the TREX asks the CM for the document (<b>second</b> hit).
    I would suggest to store the hitcount in an Application property (this does not change the resource and fires no ResourceEvents) as here (could be some compilation errors - I haven't tested it but it should work):
    public void received(IEvent event) {
      IResourceEvent myEvent = (IResourceEvent) event;
      try {
        IResource res = myEvent.getResource();
        // get the app property service
        IRepositoryService repositoryService = repServiceFactory.getRepositoryService(res, IWcmConst.APP_PROPERTIES_SERVICE);
        IApplicationProperties aApplicationProperty = (IApplicationProperties) repositoryService;
        /// app property name
        PropertyName propertyNameHitCount = new PropertyName("http://sapportals.com/xmlns/cm","hitscount");
        //get the old value...
        IAppProperty hitcountOld = aApplicationProperty.getProperty(propertyNameHitCount, res);
        long hitcount_l = 0;
        if(hitcountOld!=null)  {
          hitcount_l = hitcountOld.getLongValue().longValue();
        hitcount_l++;
        // set the new value...
        AppProperty aAppProperty = new AppProperty(propertyNameHitCount, new Long(hitcount_l), null, true);
        aApplicationProperty.setProperty(aAppProperty, res);
      } catch (Exception e) {
        e.printStackTrace();
    I hope Detlev is ok with my solution
    Romano

  • HT2476 Why when clicking the right mouse button for my external hard drive there is no option for "create new folder"?

    Hi there. I'm having a problem with my external hard drive. Actually with only one of them (others seem to be ok...). The problem is that when clicking the right mouse button (or using other ways to do the same), in the drop-down list there isn't an option for "create new folder". Please, can anyone help with this issue?

    The drive is NTFS formated. Most probably that's the reason, but there is some info on the drive which I wouldn't like to loose. If there is a way to re-format the drive and save the files, that would be great. If there isn't such a way, then please, tell me how to re-format it. But bear in mind as well that I'm using Parellels and the drive is to be used in Mac and Win modes, both. Just to add some more info: my other drive is FAT32 formated and all seems to go well with it.

  • Repository Service for Auto Submit for Approval

    Hi all,
    Can anyone help me with the creation of a Repository Service to auto 'submit for approval' any document created.
    My main problem is in two methods:
    1) removeRepositoryAssignment(IRepositoryManager mgr)
      In some samples, I saw always this code line:
      mgr.getEventBroker().unregister(this, ResourceEvent.CREATE_CHILD);
      But in my project the unregister method doesn't have that parameters
    2) received(IEvent event)
      I need some help to know what code should I put
    The remaining steps, I think I can handle by myself.
    Many Thanks,
    Luis

    Hi,
    1) make sure you use com.sapportals.wcm.repository.manager.IRepositoryManager, use the JAR (bc.rf.framework_api.jar from the \usr\sap\XXX\JCXX\j2ee\cluster\serverX\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.netweaver.bc.rf\lib folder) from the portal you are willing to develop to make sure you have the actual libraries.
    2) in this method you have to catch the events that creates the resource (ResourceEvent.CREATE_CHILD) - later you will see, that you have to handle also the CHANGE events and so on. When you have the event, get the resource - for CREATE_CHILD it is
    event.getResource()
    Now you can handle the submit for approval by yourself.
    Romano

  • Is it possible to create a folder structure while using archivelink?

    We work with Archivelink and use SAPERION software/server for storing documents. We created a business object Advertisement. In a custom made application, users can open the GOS on Advertisement and now they have the possibility to select an extension out of a big list of document types like AVI, BMP etc. They doubleclick on a type and then they drag and drop a file from their desktop into the screen and then the file will be saved on saperion server.
    As the lists of document classes linked to the business object is quit big (about 15), we would like to add a folder structure. Now it looks like
    Advertisement
    BMP
    TXT
    AVI
    etc.
    and we would like to have
    Advertisement
    Folder Texts
    TXT
    PDF
    Folder Pictures
    JPG
    TIF
    Is this possible and if yes, how can this be achieved?

    Hi Angelique,
    sorry to tell you, but this is the wrong forum to ask application questions...
    KR Lars

  • Permissions for creating a folder in Bi Publisher

    Hi All,
    I am unable to create a folder in Bi Publisher Shared Folder.
    Regards,
    Vishwanath

    hi vishwam,
    do u have permissions that for u r login user? please check the permissions
    Bi Publisher-->Admin>Roles and Permissions>Add Folders: ( Login User name)
    Thanks,
    Saichand.v

  • Web Service for "Creating Sales Order" by using BAPI

    Hello All,
    I am trying to create a WS for "Creating Sales Order". The corresponding BAPI that I am using for this purpose is BAPI_SALESORDER_CREATEFROMDAT1. I am able to create the Web Service and run the WSDL on WS Navigator.
    But there is a problem whil executing the Web Service. In the interface of WS, we can only enter item level details of "Order Partner". So when I enter the details and click on Execute, it returns me an error message "Please enter Ship to Party and Sold to Party". I have already given these details.
    Does any one have any idea of what is going wrong?
    Regards,
    Abhishek

    As you suggested i have passed the suggested parameters in item level..But this time i was not ablet to create the SO also..earlier i am able to creat SO but not line item, But now ia m not able to creat salesdocuement also.
    Return talbe filled with belwo messages.
    S V4                   233 SALES_HEADER_IN has been processed successfully   
    E V1                   320 No item category available (Table T184 ZKB  TEXT )
    E V4                   248 Error in SALES_ITEM_IN 000000                     
    W V1                   555 The sales document is not yet complete: Edit data 
    E V4                   219 Sales document  was not changed

  • Service for creating customer master - company code data....

    Hi
    I would like to know if there is a service to create customer master company code data?
    I have identified 2 services one for general data (CustomerERPCreateRequestConfirmation_In) and sales area data (SalesArrangementERPCreateRequestConfirmation_In).
    Regards
    Srinivas Dusi

    Here is the answer: Yes it is possible. Download the file, using option - File Download. File should include all key attributes & also attributes that needs to be updated. (Key here is to have appropriate assignment ID. )
    Use the same file for File Upload (modify attributes like Sort Key as required).

  • Enterprise services for create employee

    hi all,
    I need to know if there are any Enterprise Services to create an Employee?
    thanks!

    Hi Pablo,
    You can find Enterprise Services to manage Employees in the "Employee Administration" business process from ERP.
    [http://esworkplace.sap.com/socoview(bD1lbiZjPTAwMSZkPW1pbg==)/render.asp?packageid=DE0426DD9B0249F19515001A64D3F462&id=0F76CD395C2E4CACA3CC9368E3E9CF52]
    I Could find the service "EmployeePersonalAddressCreateRequestConfirmation_In".
    [http://esworkplace.sap.com/socoview(bD1lbiZjPTAwMSZkPW1pbg==)/render.asp?packageid=DE0426DD9B0249F19515001A64D3F462&id=9C2B7FD0AF4D11DA2B24000F20DAC9EF]
    But I doesn't create the employee itself... It adds an address to a Employee.
    Regards,
    Cezar

  • Tool needed for creating the package structure

    I need to create a package structure of an existing application. I don�t know much of UML and so I was just wondering if there's any tool available to do so.I researched and came to one such tool(not free to use) i.e
    http://javacentral.compuware.com/pasta/
    Please let me know if you guys know of something similar to this.
    Thanks

    No. There should be an option to 'import java sources' somewhere in the 'file' menu (I think). Unpack the WAR. You will need to locate the JAVA source files, and then import from ArgoUML. The classes will all come in. You simply have to drag which ones you want onto the applicable blank diagram(s) you create.
    - Saish

  • Folio : Document on Folio services for creating folio etc.,

    Hi,
    I need help to customize the existing folio pages, also looking for a document on Folio services.
    Kindly point me to document on above area.
    Thanks in advance
    Siva

    Hi there
    Unless you are desiring to create web based output from Frame files, I'd say you likely won't gain anything by moving to RoboHelp. If you did, I'd say investigate the Tech Comms Suite where you get Frame, RoboHelp, Photoshop, Captivate and Acrobat. Then you would continue to author in Frame and simply use RoboHelp as a conduit to web based outputs or CHM files.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Creating a folder structure when burning an MP3 format CD

    I have just purchased a new car that has a stereo system capable of playing MP3 encoded discs. This obviously allows for multiple albums to fit on one CD. The stereo allows you to browse hierarchical folders on the CD and select tracks from witihn each folder. The problem I have is iTunes appears to only let you burn from one playlist. I would like each album to appear as a separate playlist on the CD. Any ideas?

    Take a look at this topic:
    http://discussions.apple.com/message.jspa?messageID=3073462
    The article Chris CA and I referred to, is far from up-to-date, but it works.
    Hope this helps.
    M

  • Changing the regedit for creating new folder on desktop

    Below is the registry subkey I need to change.  However, I get to the ContextMenuHandlers and can not find the New.  How do I add New to the directory string???
    2. Locate and then click the following registry subkey:
    HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\New\

    Below is the registry subkey I need to change.  However, I get to the ContextMenuHandlers and can not find the New.  How do I add New to the directory string???
    2. Locate and then click the following registry subkey:
    HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\New\
    You say you want to change the key ‘New’, somehow I suspect that ‘New’ is a reserved word and would not be used as a key name, perhaps it should be New Folder.
    However, if you want to add an entry named New, it can be done by right-clicking ContextMenuHandlers and choosing Key (if it is to have sub entries) or any of the other types, e.g. String Value (you have to know this otherwise it probably won't work). If
    it doesn’t work, it can be deleted by right-clicking it and choosing delete.
    You cannot mess up anything by adding an entry, but it is advisable to backup the registry or create a system restore point before making any changes.

Maybe you are looking for

  • I-tunes 7.7.1 only plays one song at a time

    Hi, help me please. My i-tunes is now only playing one song at a time, the song will end and i-tunes stops. It will not move onto the next song even when I've got the song as part of a gapless album. This has just happened, it used to work fine befor

  • Transport control program tp ended with error code 0249

    Hello guys,       I am facing an when importing transport.  After I click import to the transport in STMS, before it runs, a message window is displayed immediately. This was working find until last week, any kind of transport is followed by the same

  • What's the maximum number of view criteria that a view object can contain?

    We are making extensive use of view criteria in our view objects, mainly for LOV purposes. Is there a figure on the maximum amount of view criteria a view object can contain. Regards Ollyando Somewhere in Canada

  • Iphone could not be restored error?

    Trying to do routine update on my iPhone 4.  Then was prompted to restore my phone to original settings. Went through 3 hours of that, then an error occured saying unable to restore the phone.  Now, I can't do anything with my phone.  Tried disconnec

  • Podcast import audio problem

    I've made several podcasts without problems before, suddenly when trying to import an audio track from my library, it does not place the track at all into the podcast. Anyone else experience this, or have suggestions on what to do to fix this? Thanks