Skip to content

Commit

Permalink
BZ-1006481 - UI support for 'extends' rule keyword broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikkola committed Sep 23, 2013
1 parent 39276fe commit 406bbcc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
Expand Up @@ -16,6 +16,7 @@

package org.drools.workbench.models.commons.shared.oracle;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand All @@ -32,8 +33,12 @@ public interface ProjectDataModelOracle {
//Fact and Field related methods
String[] getFactTypes();

Map<String,Collection<String>> getRuleNamesMap();

List<String> getRuleNames();

Collection<String> getRuleNamesForPackage(String packageName);

String getFactNameFromType( final String classType );

boolean isFactTypeRecognized( final String factType );
Expand Down
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
Expand Down Expand Up @@ -59,7 +60,7 @@ public class ProjectDataModelOracleImpl implements ProjectDataModelOracle {
protected Map<String, Boolean> projectCollectionTypes = new HashMap<String, Boolean>();

// List of available rule names
private List<String> ruleNames = new ArrayList<String>();
private Map<String, Collection<String>> ruleNames = new HashMap<String, Collection<String>>();

// List of available package names
private List<String> packageNames = new ArrayList<String>();
Expand Down Expand Up @@ -775,15 +776,29 @@ public Map<String, Boolean> getProjectCollectionTypes() {
return this.projectCollectionTypes;
}

public void addRuleNames(List<String> ruleNames) {
this.ruleNames.addAll(ruleNames);
public void addRuleNames(String packageName, Collection<String> ruleNames) {
this.ruleNames.put(packageName, ruleNames);
}

@Override
public List<String> getRuleNames() {
public Map<String, Collection<String>> getRuleNamesMap() {
return ruleNames;
}

@Override
public List<String> getRuleNames() {
List<String> allTheRuleNames = new ArrayList<String>();
for (String packageName : ruleNames.keySet()) {
allTheRuleNames.addAll(ruleNames.get(packageName));
}
return allTheRuleNames;
}

@Override
public Collection<String> getRuleNamesForPackage(String packageName) {
return ruleNames.get(packageName);
}

public void addPackageNames(List<String> packageNames) {
this.packageNames.addAll(packageNames);
}
Expand Down

0 comments on commit 406bbcc

Please sign in to comment.