6 Replies Latest reply on Oct 12, 2012 4:14 PM by Georgeo-Oracle

    want to display items in a folder using TargetingForEach

    PratikMhatre
      Hi All,
           I want to display some content using TargetingForEach. following is the rule set
      Items in folder(s):
      Offer1 and
      Items whose {
      type
      is
      contentItem
      }.

      while executing the following code it gives error.
      <dsp:droplet name="/atg/targeting/TargetingForEach">
           <dsp:param name="targeter" bean="/atg/registry/RepositoryTargeters/ShippingOffer/Offer1ContentTargeter"/>
           <dsp:param name="elementName" value="mediaItem"/>
           <dsp:oparam name="output">
                <dsp:getvalueof var="img" param="mediaItem.image.url" vartype="java.lang.String"/>
                <img src="${img}" alt="Current shipping " />
           </dsp:oparam>
      </dsp:droplet>
      Error:
      Caused by :atg.repository.RepositoryException: can't execute in folders query against non-content/folder item descriptor
      at atg.adapter.gsa.query.Builder.createInFoldersQuery(Builder.java:2108)
      at atg.targeting.rules.InFoldersRuleTree.createQueryExpression(InFoldersRuleTree.java:275)
      at atg.targeting.rules.RuleNode.createQuery(RuleNode.java:437)
      at atg.targeting.rules.OrRuleTree.createQueryExpression(OrRuleTree.java:349)
      at atg.targeting.rules.RuleNode.createQuery(RuleNode.java:437)
      at atg.targeting.rules.AndRuleTree.createQueryExpression(AndRuleTree.java:365)
      at atg.targeting.rules.RuleNode.createQuery(RuleNode.java:437)
      at atg.targeting.rules.RuleNode.createQueryWithConversion(RuleNode.java:543)
      at atg.targeting.RuleBasedRepositoryTargeter.target(RuleBasedRepositoryTargeter.java:527).......

      the above code works fine for rule set “show these content of type contentitem”.
      How can we access items in folder?
      Please reply ASAP.
      Thanks & Regards,
      Pratik
        • 1. Re: want to display items in a folder using TargetingForEach
          Nitin Khare
          I think there is something fundamentally wrong. Most likely you are getting this error because the the item descriptor that you would have specified as the content source in your targeter is not of "folder" item-type and you are trying to use "Items in folder(s)". It seems like you have specified "media" item as content source so in that case I don't think you will be able to use "Items in folder(s)" in your targeter.

          What you can try to do is to create a new Content Group in ACC (Targeting -> Profile & Content Groups) by selecting the content source and content type just like you do for creating a targeter. You can then specify the include and/or exclude rule for the items so that the content group gets the items you want. Let's say the content group you defined is "Offer1Group". Then you can use this "Offer1Group" content group in your targeter and define your rule like:

          items in group(s) "Offer1Group" and items whose type is ...
          • 2. Re: want to display items in a folder using TargetingForEach
            PratikMhatre
            Hi,

            It is still showing the same error.Is there any other solution for the same?
            I tried displaying content using normal OOTB content source & type. It was working. For this the new item descriptor do We need to change any configurations?

            Thanks & regards,
            Pratik
            • 3. Re: want to display items in a folder using TargetingForEach
              Nitin Khare
              I am not sure how you are doing it... can you post the full content of your targeter properties file along with some details about the new item descriptor that you are trying to use?
              • 4. Re: want to display items in a folder using TargetingForEach
                PratikMhatre
                Hi,

                We are extending contentItem itemDescriptor. following is code snippet in customCatalog.xml
                <item-descriptor name="contentItem" display-name-resource="ContentItem" sub-type-property="type" folder-id-property="parentFolder" display-property="displayName">

                we are specifying one property called parentFolder in the same itemDescriptor as follows
                <property name="parentFolder" column-name="parent_folder_id" item-type="folder" display-name-resource="parentFolder"/>

                & it is throwing error in Builder.class OOTB class in following method

                DECOMPILED SOURCE CODE REMOVED

                -follwing is the ruleset that has been created in localconfig

                rulesets=<ruleset>\n <accepts>\n <rule op\=and tag\="Show">\n <rule op\=and tag\="Content">\n <rule op\=any tag\="ContentSources">\n <rule op\=infolders tag\="Folders">\n <valueof constant\="fld140006">\n </rule>\n </rule>\n <rule op\=and tag\="ContentConditions">\n </rule>\n </rule>\n </rule>\n </accepts>\n</ruleset>

                I have checked for normal OOTB item-types. For that the rule, "items in folder" is working. only the problem is with this custom code.
                do u have any other solution.

                Thanks & regards,
                Pratik

                Edited by: georgeo on Oct 12, 2012 12:07 PM
                • 5. Re: want to display items in a folder using TargetingForEach
                  Nitin Khare
                  So it appears that you are already working on a custom item-descriptor because as far as I know there there is no "contentItem" type item in OOB ATG. It must be a content repository in your application on which are trying to apply the rule and you would be having a folder type item which would have folder="true" and there would be a content type item "contentItem" with content="true" in your repository definition. As you have mentioned folder-id-property attribute in item descriptor so your property "parentFolder" is pointing to a "folder" item. I think you can try changing your targeter rule as:

                  Show this content: items whose parentFolder is "fld140006"

                  Try changing the "items in folder" to "item whose" as mentioned above.
                  • 6. Re: want to display items in a folder using TargetingForEach
                    Georgeo-Oracle
                    Pratik,
                    From your earlier post on this thread on Oct 12, 2012 3:24 AM we have learned that you used a decompilation or re-engineering tool to get insight into Oracle/ATG proprietary source code. We consider this a breach of the license agreement as well as a violation of US Copyright Law.

                    You must:

                    1) Agree to stop decompiling Oracle ATG product code (we strongly recommend to remove or disable decompilation tools like JAD from your IDE when working with Oracle/ATG products)

                    2) Agree to destroy all copies of the decompiled code in your possession

                    You can send a confirmation of the above actions to george.oprica@oracle.com. This thread is now locked and no further messages are allowed.

                    If you should decide to not comply to this request we will have to forward this violation to the Oracle legal department for further investigation and action.

                    Kind regards,
                    George Oprica