Examples of DroolsPackage


Examples of org.openiaml.docs.modeldoc.DroolsPackage

  protected void loadInferenceSemantics(final ModeldocFactory factory,
      ModelDocumentation root, String plugin, String pkg,
      String name, File file) throws IOException, DocumentationGenerationException {
   
    // create a package for this rule file
    final DroolsPackage drools = factory.createDroolsPackage();
    drools.setPlugin(plugin);
    drools.setPackage(pkg);
    drools.setName(name);
    root.getReferences().add(drools);
   
    BasicJavadocParser parser = new BasicJavadocParser(getSemanticTagHandlers());
   
    try {
      // try and find the first comment from the file, in order to
      // provide documentation on the entire rule file
      JavadocFragment packageComment = parser.findFirstCommentOfFile(file, this, factory, drools, root);
      if (packageComment != null) {
        drools.getJavadocs().add(packageComment);
      }
     
      // parse all the semantics from the rules
      String[] lines = parser.findJavadocTagsInTextFile(file, this, factory, root, new IJavadocReferenceCreator() {
       
        public JavaElement createReference(String[] lines, int line) {
          DroolsRule rule = createDroolsRule(factory, line, lines);
          if (rule != null) {
            drools.getRules().add(rule);
          }
          return rule;
        }
       
      });

      // finally, find the number of unique rules
      drools.setUniqueRules(getUniqueRuleCount(factory, lines));

    } catch (SemanticHandlerException e) {
      throw new DocumentationGenerationException("Could not process rule file '" + file + "': " + e.getMessage(), e);
    }
View Full Code Here

Examples of org.openiaml.docs.modeldoc.DroolsPackage

    StringBuffer buf = new StringBuffer();
    int violations = 0;
    for (Reference ref : doc.getReferences()) {
      if (ref instanceof DroolsPackage) {
        DroolsPackage pkg = (DroolsPackage) ref;
       
        // get the count of all @inference tags
        // (we need to ignore tags such as @implementation)
        int inferenceTags = getInferenceTags(pkg.getRules());
       
        // count the unique number of all rules
        Set<String> allRules = new HashSet<String>();
        for (DroolsRule r : pkg.getRules()) {
          allRules.add(r.getName());
        }
       
        // ModelDoc does not load all rules, but only
        // those with Javadoc tags. therefore, we can't
        // check that each rule has documentation; but rather,
        // check that the number of rules saved == the number
        // of unique rules in the package
        if (pkg.getUniqueRules() != inferenceTags) {
          violations++;
          buf.append("Package ")
            .append(pkg.getPlugin())
            .append("/")
            .append(pkg.getPackage())
            .append("/")
            .append(pkg.getName())
            .append(".drl: Expected ")
            .append(pkg.getUniqueRules())
            .append(" tags for ")
            .append(allRules.size())
            .append(" rules, found ")
            .append(inferenceTags)
            .append(" @inference tags out of ")
            .append(pkg.getRules().size())
            .append(" total tags")
            .append("\n");
        }
       
      }
View Full Code Here

Examples of org.openiaml.docs.modeldoc.DroolsPackage

    EObject root = ModelLoader.load("test.modeldoc");
    ModelDocumentation doc = (ModelDocumentation) root;

    for (Reference ref : doc.getReferences()) {
      if (ref instanceof DroolsPackage) {
        DroolsPackage pkg = (DroolsPackage) ref;
       
        for (DroolsRule r : pkg.getRules()) {
          for (JavadocTagElement j : r.getJavadocs()) {
            assertTrue("Expected tags did not contain " + j.getName(),
                expectedTags.contains(j.getName()));
          }
        }
View Full Code Here

Examples of org.openiaml.docs.modeldoc.DroolsPackage

   */
  public static int getTotalRuleCount(ModelDocumentation root) {
    int count = 0;
    for (Reference ref : root.getReferences()) {
      if (ref instanceof DroolsPackage) {
        DroolsPackage pkg = (DroolsPackage) ref;
        count += pkg.getUniqueRules();
      }
    }
    return count;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.