Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-5923

ResourceType does not work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • None
    • None
    • None
    • 2020 Week 52-03 (from Dec 21)
    • Undefined
    • NEW
    • NEW
    • ---
    • ---

    Description

      I use drools as follow:

      import org.kie.internal.utils.KieHelper;
      // code placeholder
      public static final ResourceType LOCAL_DRL = ResourceType.addResourceTypeToRegistry("DRL",
       "Drools Rule Language",
       "src/main/resources/com/jiang",
       "drl");
      
      
      public KieSession loadForRule2(String drlStr) {
       KieHelper helper = new KieHelper();
       helper.addContent(drlStr, LOCAL_DRL);
       return helper.build().newKieSession();
      }
      

      This param defaultPath dose not work, I see that the code is fixed,

       

      // code placeholder
      private String generateResourceName(ResourceType type) {
          return "src/main/resources/file" + counter++ + "." + type.getDefaultExtension();
      }
      

      I think it should be changed as follows

      // code placeholder
      private String generateResourceName(ResourceType type) {
          return type.getDefaultPath() + counter++ + "." + type.getDefaultExtension();
      }

      Now,i use another function to temporarily solve

      // code placeholder
      helper.addContent(drlStr, "/com/jiang/ww.drl");
      

       

       

       

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            ruffianjiang yj jiang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: