8 Replies Latest reply: Feb 28, 2013 10:30 AM by teachMySelf RSS

    Catalog Service API in 11gR2

    923197
      Hi,
      I could not find a method to read the values of the fields defined in the catalog of an application instance using API. Has anyone tried this ?? It would be great if you can provide a sample code for the same.

      The method "      getCatalogItemDetails()" exposed, required "CatalogID" of the application instance/entitlement which I am not sure how to get it based on the app. instance name.



      Thanks,
      Hrushikesh
        • 1. Re: Catalog Service API in 11gR2
          Nishith Nayan
          I don't remember execatly method name but you can get this using below API

          using CatalogService you will get the entity id, then pass this to ApplicationInstanceService api which will give you ApplicationInstance Object. now get all the attribute using ApplicationInstance.
          • 2. Re: Catalog Service API in 11gR2
            923197
            Hi Nishit,
            I am not looking for application instance details but the catalog details. Any idea which method I can use to get "CatalogID" of an application instance.
            • 3. Re: Catalog Service API in 11gR2
              Nishith Nayan
              first use search method using CatalogService API which will return CatalogSearchResults/Catalog object
              now there is method like getKey or getId which will give you the catalog id
              • 4. Re: Catalog Service API in 11gR2
                923197
                Hi Nishit,
                I am getting the below error while using search method. Any idea ??


                Object leftOperand="ENTITY_NAME";
                               Object rightOperand="SRO2AI";
                               CatalogSearchCriteria ctlgsch=new CatalogSearchCriteria(leftOperand,rightOperand,CatalogSearchCriteria.Operator.EQUAL);
                               CatalogSearchResult ctlgschresult=catalogsvc.search(ctlgsch, 0, 1, "", CatalogSearchCriteria.SortCriteria.ASCENDING);

                Error:

                Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to oracle.iam.catalog.vo.CatalogSearchCriteria$Argument
                     at oracle.iam.catalog.util.Utility.getSqlPredicatesFromSearchCriteria(Utility.java:104)
                     at oracle.iam.catalog.repository.DBRepository.authorisedSearch(DBRepository.java:135)
                     at oracle.iam.catalog.repository.DBRepository.search(DBRepository.java:125)
                     at oracle.iam.catalog.impl.CatalogServiceImpl.search(CatalogServiceImpl.java:147)
                     at sun.reflect.GeneratedMethodAccessor4541.invoke(Unknown Source)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                     at java.lang.reflect.Method.invoke(Method.java:597)
                     at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
                     at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
                     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
                     at oracle.iam.platform.utils.DMSMethodInterceptor.invoke(DMSMethodInterceptor.java:25)
                     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                     at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
                     at $Proxy366.search(Unknown Source)
                     at oracle.iam.catalog.api.CatalogServiceEJB.searchx(Unknown Source)
                     at sun.reflect.GeneratedMethodAccessor4540.invoke(Unknown Source)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                     at java.lang.reflect.Method.invoke(Method.java:597)
                     at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
                     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
                     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
                     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
                     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
                     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                     at com.oracle.pitchfork.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
                     at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
                     at com.oracle.pitchfork.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
                     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                     at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
                     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
                     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
                     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                     at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
                     at $Proxy365.searchx(Unknown Source)
                     at oracle.iam.catalog.api.CatalogService_vxl1s5_CatalogServiceRemoteImpl.__WL_invoke(Unknown Source)
                     at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
                     at oracle.iam.catalog.api.CatalogService_vxl1s5_CatalogServiceRemoteImpl.searchx(Unknown Source)
                     at oracle.iam.catalog.api.CatalogService_vxl1s5_CatalogServiceRemoteImpl_WLSkel.invoke(Unknown Source)
                     at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
                     at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
                     at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
                     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
                     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
                     at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
                     at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
                     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
                     at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)


                Thanks,
                Hrushi
                • 5. Re: Catalog Service API in 11gR2
                  pkulka
                  It should be as follows:

                  CatalogSearchCriteria ctgSearch = new CatalogSearchCriteria(CatalogSearchCriteria.Argument.TAG,"Active Directory", CatalogSearchCriteria.Operator.EQUAL);
                  CatalogSearchResult rslt;
                  try {
                  rslt = ctlgSrv.search(ctgSearch, 1, 10, "CATALOG_ID", CatalogSearchCriteria.SortCriteria.ASCENDING);
                  System.out.println(rslt.getCatalogs());
                  } catch (CatalogException e) {
                  e.printStackTrace();
                  }

                  Please note the first argument for CatalogSearchCriteria must use an enum.
                  • 6. Re: Catalog Service API in 11gR2
                    teachMySelf
                    Hello,

                    I need to fetch all the items from catalog owned by an approver user. what should I use as the first parameter of CatalogSearchCriteria? I dont think TAG,CATGORY, or TYPE would help. Any assistance is appreciated.

                    Thanks
                    • 7. Re: Catalog Service API in 11gR2
                      Rajiv Dewan
                      Use only TAG. It will work. Tag must have atleast 2 characters and don't use special character like - for search.

                      http://rajivdewan.blogspot.com/2013/02/catalog-search-api-usage.html
                      • 8. Re: Catalog Service API in 11gR2
                        teachMySelf
                        Hello Rajiv,

                        Thanks for reply. I think I had already tried TAG before. It does not work for my requirement. I want to get all the catalog Items that an 'Approver User' Owns. For eg. So the search criteria that basic api provides is only supporting search on TAG, TYPE, CATEORY of a catalog Item. None of these cover the Approver user field.

                        Thanks