Retrieving iViews ,Pages and Worksets from roles

Hi All,
I am using the code given here..
Retreive a list of workets, iViews, pages from Roles
but while getting pcdFactory its giving class cast exception.
Could anyone tell me what might be the mistake?
Regards,
Karthick

Hi Karthick,
I think I answered on another post, but here it is again:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.PERSISTENCY_ASPECT);
env.put(Context.SECURITY_PRINCIPAL, request.getUser());
env.put(IPcdContext.PCD_PERSONALIZATION_PRINCIPAL, request.getUser());
InitialContext iCtx = null;
String roleID = "pcd:portal_content/DanielContent/DanRole";
try{
    iCtx = new InitialContext(env);
    IPcdContext attrSet = (IPcdContext) iCtx.lookup(roleID);
    response.write(attrSet.getAttributes("").get("com.sap.portal.pcd.gl.CreatedAt").get() +"--PP<BR>");
Hope it helps.
Daniel

Similar Messages

  • Find the iViews, Pages and Folders assigned to Role

    Hi,
    Does any one has the idea about how to retrieve the worksets, pages and iviews assigned to a role.
    I found a piece of code that will retrieve the roles, worksets, pages and iviews from PCD.
    Here is the code, that is to retrieve the roles, worksets, pages and iviews from PCD
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
    env.put(Context.SECURITY_PRINCIPAL, WDClientUser.getCurrentUser().getSAPUser());
    env.put(com.sap.portal.directory.Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_ADMINISTRATION);
    InitialContext initialContext = null;
    DirContext dirCtx;
    initialContext = new InitialContext(env);
    dirCtx = (DirContext) initialContext.lookup("pcd:portal_content/");
    PcdSearchControls pcdSearchControls = new PcdSearchControls();
    pcdSearchControls.setReturningObjFlag(false);
    pcdSearchControls.setSearchScope(PcdSearchControls.SUBTREE_WITH_UNIT_ROOTS_SCOPE);
    dirCtx.addToEnvironment(Constants.APPLY_ASPECT_TO_CONTEXTS,Constants.APPLY_ASPECT_TO_CONTEXTS);
    // Gets the full path of the iViews from the PCD
    NamingEnumeration ne =      dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.iview)",     pcdSearchControls);
    while (ne.hasMoreElements())
         IPcdSearchResult searchResult = (IPcdSearchResult) ne.nextElement();
         String location = "pcd:portal_content/" + searchResult.getName();
         wdComponentAPI.getMessageManager().reportSuccess("View ="+location);
    // Gets the full path of the pages from the PCD
    NamingEnumeration nePage = dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.page)",pcdSearchControls);
    while (nePage.hasMoreElements())
         IPcdSearchResult searchResult = (IPcdSearchResult) nePage.nextElement();
         String location = "pcd:portal_content/" + searchResult.getName();
         wdComponentAPI.getMessageManager().reportSuccess("Page ="+location);
    // Gets the full path of the worksets from the PCD
    NamingEnumeration neWorkSet = dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.workset)",pcdSearchControls);
    while (neWorkSet.hasMoreElements())
         IPcdSearchResult searchResult = (IPcdSearchResult) neWorkSet.nextElement();
         String location = "pcd:portal_content/" + searchResult.getName();
         wdComponentAPI.getMessageManager().reportSuccess("WorkSet ="+location);
    But my requirements is, if I have the role as "Sales Role", I want to find the iViews, Pages and worksets assinged to this role.
    Your help is really appreciated.
    Thanks in Advance,
    Chinna.

    Hi,
    All you need to do is to change the search root object:
    DirContext dirCtx;
    initialContext = new InitialContext(env);
    dirCtx = (DirContext) initialContext.lookup("pcd:portal_content/mypath/myrole");
    PcdSearchControls pcdSearchControls = new PcdSearchControls();
    pcdSearchControls.setReturningObjFlag(false);
    pcdSearchControls.setSearchScope(PcdSearchControls.SUBTREE_WITH_UNIT_ROOTS_SCOPE);
    dirCtx.addToEnvironment(Constants.APPLY_ASPECT_TO_CONTEXTS,Constants.APPLY_ASPECT_TO_CONTEXTS);
    all the rest stays the same.
    BTW - you can also retrieve all the objects using one search by putting
    (|(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.iview),(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.page),(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.workset))
    In the search query. Then you can get the type using PCM (portal content model) APIs.
    Hope this helps, Elisha

  • How to assign pages to workset and workset to roles in ep5sp6

    hai,
        how to assign pages to workset and workset to roles
    in ep5sp6 . can any one help me in this regard .
    Regards
    praveen

    Hi Praveen,
       You can find the documentation you are looking for on the SAP help portal.  This link will take you to the Administration Guide for EP5 SP6.
    http://help.sap.com/saphelp_ep50sp6/helpdata/en/38/76bd3b6e74d708e10000000a11402f/frameset.htm
    In the left hand navigation you can pick the topics that you are interested in.  e.g. pages, roles, iviews.
    Hope this helps.
    John

  • Can computer expert retrieve deleted videos and photo from and iphone 4 which the photos and video are not sync before? is there any tools or software to retrieve it?

    can computer expert retrieve deleted videos and photo from and iphone 4 which the photos and video are not sync before? Are there any tools or software to retrieve it?

    kimberlyq wrote:
    That means it is possible for sure there is a chance to retrieve back those photos and video.
    No, there are no gurantees. The capabilitty exists to retrive deleted data from an iPhone, but like many things in life it is not 100% successful all the time. Be careful, there are a lot of scam artists out there. They take your money & retrive nothing. This guy is one of the best in the business, but he does not work for people in the private sector. Perhaps he can recommend a service to you. But, as already pointed out, you're looking at thousands of dollars out of pocket whether these folks are successful or not:
    http://www.zdziarski.com/blog/

  • Need to move pages and sections from one doc to another

    I have a long document loaded with graphics. I need to repurpose pages and sections from that document and use them in another document.
    How do I move a section or page from one to another. A simple copy and paste doesn't seem to be the answer since it copies only the text, not the illustrations and format.
    Also, it would help if I could unlock sections - is that possible and how do I do it?

    You will have to do it manually, but you can do it whole sections at a time. Open your files & show thumbnails. Sections have a yellow border around all of the pages in that section. Now click on the page in the thumbnail pane & copy. If the file is more than one page & you only want one, you'll need to insert a section break to separate the pages. Then go to your other file & paste. The whole copied page will be pasted in. I found that pasting in the body of the target document only pasted the text but, if I clicked in the thumbnail area of the target document & pasted, I got both text & graphics. Repeat with another section. Styles will copy over with the sections but headers & footers will not.

  • Cannot update my keynote, pages and numbers from my ipad. I have different accounts, one for app store and other for icloud. What can I do?

    Cannot update my keynote, pages and numbers from my ipad. I have different accounts, one for app store and other for icloud. What can I do?

    You can't merge accounts or transfer iTunes purchases from one Apple ID to another: but there is no problem about using two IDs.
    Use your iCloud ID for iCloud for syncing email, contacts, calendars, bookmarks, and PhotoStream.
    Use your other Apple ID as before for iTunes, iTunes in the Cloud and iTunes Match.
    There's no conflict about doing this, and you won't even notice as Keychain will log you in with the correct ID in each case. It's also better security not to have your iTunes login also your email address, given the number of complaints about hacked iTunes accounts.

  • HT201559 my iphone 4 has completely died.. how can I retrieve my contacts and photos from icloud?

    my iphone 4 has completely died.. how can I retrieve my contacts and photos from icloud?

    Hi you can take to Apple Store they may Replace with a Refurbished, one but you will need to pay part of cost. Make an Appointment, if you do get Another iphone when you set it up Just use the same Apple, id & password then you will get all your Apps & Data back. Cheers Brian

  • How to move the pages and reports from one dashboard to another

    hi all
    can please any one tel me hw to copy the reports along with pages from one dashboard to another
    Thanks

    Hi,
    Go to Administrator->Manage Presentation Catalg->Click on Group folder under which the dashboard and reports are present
    1)Create one folder and copy the reports which are present in the dashboard pages you want(reports will be under some specific folder,open and copy one after the other to the newly created folder).Do this if you want other set of same reports for new dashboard that you are creating
    2)Click on _portal and create a new folder(new dashboard)
    3)Click on dashboad that is to be copied
    4)copy the pages one after the other into new dashboard folder
    If you are not keeping new set of reports then no need to point reports in pages,if reports are placed under new folder then go to each page and pull those reports from newly created folder.
    Regards,
    Srikanth

  • Two Pages and Layout from One Data Source

    Hi
    I need to find a solution where i can based on if a flag in the data is true or not generate a 2nd page which is slightly different in layout to the 1st page.
    But at this moment in time i'm struggling to understand how i can even get crystal to generate a 2nd page.
    Background is that our system generates a delivery note with a price on it and as a part of new legislation now there has to be a 2nd page provided for the end user. Now we have a data source linked to the report and we would just like to pass in another field which is true/false to print End User Page.
    So if the flag is true i need to create a Delivery page and a end user page and if false then only the Delivery page would be generated.
    I just need some guidance as to how we may achieve this.  Iu2019m ok with crystal but not really done advanced level reports hence why iu2019m probably stuck.
    Thanks for any advice in advance

    And i suppose i could suppress any other fields from page one based on the same flag. But ideally as they layout is common i was hoping not to have to do a subreport to lay it all out again.
    Could i not based on a flag on the group footer or header say if this flag is true start a new page and then on the feilds the ones i want to hide or show say something like if page two and x is ture then show or hide as need be??

  • Problems opening files in pages and keynote from iCloud. Other IOS-devices show no problem

    I have problems in getting files opened on computer from Icloud. For both Pages and Keynote. Happens when they have been opened on Iphone og Ipad 

    I had this problem this morning also - couldn't open a Numbers file on my mac.  It hasn't been used on ipad or iphone but was shared with another mac user who accessed yesterday.  Now I also can't save a text edit file.  It is sitting on my screen but when I go to save it I get a message saying "the file untitled.rtf couldn't be opened".  My other numbers files (not shared) in icloud also get the same message when I try to open them.  I think this is an icloud server problem.  Hopefully they will fix it quickly.  I can open the files by going to icloud.com and using the webapps.

  • How can i set up my itunes to automatically retrieve my photos and videos from my iphone when i connect it to my computer?

    when i connect my phone to the computer it used to auto retrieve my photos and videos, but some how it has changes, is there some setting that i change or somethig to auto upload my photos and videos from my phone to my computer?

    There is Settings > General > Restrictions > Require Password which you can set to '15 minutes' - the only other option for the setting is 'Immediately', you won't be able to have it as 2 or 3 minutes.

  • Cant retrieve keynote,pages and numbers after ios5, cant retrieve keynote,pages and numbers after ios5, cant retrieve keynote,pages and numbers after ios5

    installed ios5 onto my ipad. it updated and restored all info except that although it reinstalled keynote, pages and numbers, the enclosed documents werent there! what can i do?

    Just to further clarify. In Settings the Restrictions are not limiting anything. They are not enabled. When I attenpt to delet any app they all start shaking (like normal with the little cross displayed) but when you select on for deletion the ipad freezes for several minutes then reboots. It is a 64G iPad with 25G free space. I have many apps on it and they all work fine. Just Pages, Keynote, and Numbers that have stopped working. When you start them they go to a grey (pre start up) screen with no buttons. Then after a few minutes the ipad reboots.
    Note I'm on 6.1.3 not 6.1.4 !!!!!!!!!

  • Retrieve pages and numbers from trash

    I can no longer use pages or numbers because it says it's in my trash. How do I get it out of trash so I can use it again.

    Open the Trash. What's in there?

  • Single adf task flow portlet with multiple pages and paramter from url

    Hi ,
    I have made a adf task flow portlet with a parameter.
    I have made a portal applcation and added multiple pages . in each of the page I am consuming that portlet through wsrp2.
    I have mapped the task flow parameter in page bindings of the pages with #{param.code}. where code is the get parameter.
    I have edited navigatinoal template so that when i click the pages , code parameter also get added in the url.
    issue
    When I run the applcation and visits first page with get parameter i get the right result. but when i click the on the other page which has some other value for the same get parameter , it doesnt display the value. But the other page shows me correct value if I go this page first but the later page doesnt display any value.
    thanks

    1001446 wrote:
    Hi ,
    I have edited navigatinoal template so that when i click the pages , code parameter also get added in the url.Can you paste the code from the template here?

  • Two selectOneMenu in a page and action from one to other

    Hi everybody. I have two selectOneMenu in a jsf page. In the fist there is a list of students, and in the second there is a list of courses. I want, when I select a student, to launch a methot that show me in the second selectOneMenu only the courses that the studend is enrolled. Because I new on Jsf, I think to use the onClick property, but I don't know how I can use it. I don't use AJAX, so I must reload all the page. There is any other way to do this? Thanks to all.

    Thanks, I use it, and now I have this jsf page:
    <h:selectOneMenu id="lista_studenti" binding="#{svolgiSingoloEsercizioBean.menuStudenti}" onchange="this.form.submit();" valueChangeListener="#{svolgiSingoloEsercizioBean.studenteSelezionato}" immediate="true">
              <f:selectItems id="studente" value="#{svolgiSingoloEsercizioBean.studenti}" />
    </h:selectOneMenu>
    <f:verbatim>
    </f:verbatim>
    <h:selectOneMenu id="lista_corsi" binding="#{svolgiSingoloEsercizioBean.menuCorsi}" onchange="this.form.submit();" valueChangeListener="#{svolgiSingoloEsercizioBean.corsoSelezionato}" immediate="true" rendered="#{svolgiSingoloEsercizioBean.menuStudenti.value != null}">
              <f:selectItems id="corso" value="#{svolgiSingoloEsercizioBean.corsi}" />
    </h:selectOneMenu>
    <f:verbatim>
    </f:verbatim>
    <h:selectOneMenu id="lista_esercizi" binding="#{svolgiSingoloEsercizioBean.menuEsercizi}" rendered="#{svolgiSingoloEsercizioBean.menuCorsi.value != null}" >
              <f:selectItems id="esercizio" value="#{svolgiSingoloEsercizioBean.esercizi}" />
    </h:selectOneMenu>
    When I change the second selectOneMenu, I have this error:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Value binding '#{svolgiSingoloEsercizioBean.corsi}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /cercaesercizi_studentecorso.jsp][Class: javax.faces.component.html.HtmlForm,Id: _idJsp0][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: lista_corsi][Class: javax.faces.component.UISelectItems,Id: corso]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
    root cause
    java.lang.IllegalArgumentException: Value binding '#{svolgiSingoloEsercizioBean.corsi}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /cercaesercizi_studentecorso.jsp][Class: javax.faces.component.html.HtmlForm,Id: _idJsp0][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: lista_corsi][Class: javax.faces.component.UISelectItems,Id: corso]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
         javax.faces.component._SelectItemsIterator.hasNext(_SelectItemsIterator.java:131)
         javax.faces.component._SelectItemsUtil.matchValue(_SelectItemsUtil.java:46)
         javax.faces.component.UISelectOne.validateValue(UISelectOne.java:62)
         javax.faces.component.UIInput.validate(UIInput.java:353)
         javax.faces.component.UIInput.processDecodes(UIInput.java:158)
         javax.faces.component.UIForm.processDecodes(UIForm.java:53)
         javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:602)
         javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:135)
         org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(LifecycleImpl.java:219)
         org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
    Is because I don't use the converter?

Maybe you are looking for