5 Replies Latest reply on Dec 2, 2013 10:37 PM by Vu Viet Phuong

    Cant create a user page using gatein public api

    Anish Antony Newbie

      When i create a user page using gatein public api i got an org.gatein.api.EntityNotFoundException exception. Here follows my code for creating user page

       

      User user = PortalRequest.getInstance().getUser();

      Portal portal = PortalRequest.getInstance().getPortal();

      f(portal.getPage(new PageId(user, pageName))==null){

      Page newpage = portal.createPage(new PageId(user, pageName));// Here i got the exception

      }

       

      Here follows the stack trace of exception

      org.gatein.api.EntityNotFoundException: Site Site.Id[type=dashboard, name=supervisor] doesn't exist

          at org.gatein.api.PortalImpl.createPage(PortalImpl.java:271) [exo.portal.component.api-3.6.0.Final.jar:3.6.0.Final]

          at com.radiant.cisms.view.bean.DynamicDashBoardBean.createUserSpecificPage(DynamicDashBoardBean.java:146)

          at com.radiant.cisms.view.bean.DynamicDashBoardBean.saveNewPortlets(DynamicDashBoardBean.java:115)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_45]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_45]

          at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_45]

          at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)

          ... 121 more


      can you help me why happen this?

        • 1. Re: Cant create a user page using gatein public api
          Thomas Heute Master

          Anish , I would appreciate if you could avoid to post in 2 different forums the same question.

          Either you downloaded GateIn Portal, and you should ask here *or* you downloaded JBoss Portal and you would ask where you did your other post The specified item was not found.

           

          Thanks in advance and I hope you understand

          • 2. Re: Cant create a user page using gatein public api
            Anish Antony Newbie

            Sorry thomas, i downloaded and checked on GateIn 3.6. Thanks for your advice i am going to delete my post from jboss portal fourm. Also i am expecting an answer for my above problem

            • 3. Re: Cant create a user page using gatein public api
              Nick Scavelli Novice

              Make sure you log in as that user first. The portal doesn't create a dashboard (user site) until they log in.

              • 4. Re: Cant create a user page using gatein public api
                Anish Antony Newbie

                Thanks Nick

                I am sure that i am logged in with as  user in GateIn. But the user page worked if  i add that user under predefinedOwner tag in portal-configuration.xml like following way

                       <object-param>

                            <name>user.configuration</name>

                            <description>description</description>

                            <object type="org.exoplatform.portal.config.NewPortalConfig">

                              <field name="predefinedOwner">

                                <collection type="java.util.HashSet">

                                  <value>

                                    <string>manager</string>

                                  </value>

                                  <value>

                                    <string>admin</string>

                                  </value>

                                </collection>

                              </field>

                              <field name="ownerType">

                                <string>user</string>

                              </field>

                              <field name="templateLocation">

                                <string>war:/conf/portal</string>

                              </field>

                            </object>

                          </object-param>

                (In above manager and admin can create user page because they are under predefinedOwner tag )

                But in the case of adding  user page for users who are added programatically i got the above exception. I am using the following code for adding users programatically

                 

                OrganizationService orgService = (OrganizationService)PortalContainer.getInstance().getComponentInstanceOfType(OrganizationService.class);

                User user =new UserImpl("supervisor");

                user.setPassword("supervisor");

                user.setEmail("supervisor@gmail.com");

                user.setFirstName("supervisor");

                user.setLastName("supervisor");

                orgService.getUserHandler().createUser(user, false);


                • 5. Re: Cant create a user page using gatein public api
                  Vu Viet Phuong Novice

                  By default, user site is lazily created (performance reason). You can change this behaviour by changing this property:

                  gatein.portal.idm.createuserportal in tomcat/gatein/conf/configuration.properties

                   

                  Or you'll need to create User site first, before creating User site's pages:

                  Site userSite = portal.createSite(new SiteId(user));

                  portal.saveSite(userSite);

                  //Now create user site's page