title: Only a type can be imported drools
body: <p>I am using Drools and Liferay, and I am trying to insert in the BD a user when the rule was true, but Drools doesn't let me import a package. I don't have a .drl class, I pass a string to execute drools. This is my code:</p>
  
  <p>Code drools:</p>
  
  <pre><code>import com.liferay.portal.kernel.search.BooleanClause;
  import com.liferay.portal.kernel.search.BooleanClauseOccur;
  import com.liferay.portal.kernel.search.BooleanClauseFactoryUtil;
  import com.liferay.portal.kernel.search.BooleanQuery;
  import com.liferay.portal.kernel.search.BooleanQueryFactoryUtil;
  import com.liferay.portal.kernel.search.Document;
  import com.liferay.portal.kernel.search.Field;
  import com.liferay.portal.kernel.search.Hits;
  import com.liferay.portal.kernel.search.Indexer;
  import com.liferay.portal.kernel.search.IndexerRegistryUtil;
  import com.liferay.portal.kernel.search.SearchContext;
  import com.liferay.portal.kernel.util.GetterUtil;
  import com.liferay.portal.kernel.util.KeyValuePair;
  import com.liferay.portal.kernel.util.StringUtil;
  import com.liferay.portal.kernel.util.Validator;
  import com.liferay.portal.model.Address;
  import com.liferay.portal.model.Group;
  import com.liferay.portal.model.Contact;
  import com.liferay.portal.model.User;
  import com.liferay.portal.service.AddressLocalServiceUtil;
  import com.liferay.portal.util.PortalUtil;
  import com.liferay.portlet.asset.model.AssetEntry;
  import com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil;
  import com.liferay.portal.model.User;
  import com.liferay.portal.security.auth.PrincipalThreadLocal;
  import com.liferay.portal.security.permission.PermissionChecker;
  import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
  import com.liferay.portal.security.permission.PermissionThreadLocal;
  import com.liferay.portal.kernel.util.ObjectValuePair;
  import com.liferay.portlet.expando.model.ExpandoBridge;
  
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  
  import com.segmentationPortlet.controller.prova;
  
  rule "Initialize Rules"
  salience 1000
  when
      user : User(); 
  then
  end
  
  rule "Rule_1"
  when 
      userRule_2: User(emailAddress == "test@liferay.com")
  user: User();
  then
      prova p;
      p.classification(user,"SegmentUser");
  end
  </code></pre>
  
  <p>Code to execute Drools;
      //rule is a string that have Drools's code.
      ThemeDisplay td = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
      User user = td.getUser();
      facts.add(new Fact  ("user", user));</p>
  
  <pre><code>RulesResourceRetriever rulesResourceRetriever = new RulesResourceRetriever(new                                          StringResourceRetriever(rule), String.valueOf(RulesLanguage.                 RulesEngineUtil.update(domainName, rulesResourceRetriever,      PortalClassLoaderUtil.getClassLoader());
  RulesEngineUtil.execute(domainName, facts, Query.createStandardQuery(),      PortalClassLoaderUtil.getClassLoader());`
  </code></pre>
  
  <p>prova.java code:
      package com.segmentationPortlet.controller;</p>
  
  <pre><code>import com.liferay.counter.service.CounterLocalServiceUtil;
  import com.liferay.portal.model.User;
  import com.segmentationPortlet.model.UserRule;
  import com.segmentationPortlet.service.UserRuleLocalServiceUtil;
  import com.segmentationPortlet.service.persistence.UserRulePK;
  
  public class prova {
      public void classification(User user, String segmentValue)  {
          try {
              UserRule ur = null ;
              long id1 = CounterLocalServiceUtil.increment(UserRule.class.getName());
              long id2 = CounterLocalServiceUtil.increment(UserRule.class.getName());
              UserRulePK u = new UserRulePK(id1, id2); 
              ur= UserRuleLocalServiceUtil.createUserRule(u);
              Long id = (long) 1234;
              ur.setUserId(user.getUserId());
              ur.setRuleId(id);
              ur.setSegment(segmentValue);
              UserRuleLocalServiceUtil.addUserRule(ur);
          } catch (Exception ex) {
              ex.printStackTrace();
          }
      }
   }`
  </code></pre>
  
  <p>When I try to execute I have this error: </p>
  
  <p>Caused by: com.liferay.portal.kernel.bi.rules.RulesEngineException: Error importing : 'com.segmentationPortlet.controller.prova'
  Error importing : 'com.segmentationPortlet.controller.Classification.classification'
  Error importing : 'com.segmentationPortlet.controller.GetCustomAttribute.getCustomAttribute'
  [ function getCustomAttributegetCustomAttribute (line:53): Only a type can be imported. com.segmentationPortlet.controller.prova resolves to a package
   ]
  [ function classificationclassification (line:35): Only a type can be imported. com.segmentationPortlet.controller.prova resolves to a package
   ]
  [ function getCustomAttributegetCustomAttribute (line:53): Only a type can be imported. com.segmentationPortlet.controller.prova resolves to a package
   ]</p>
  
  <p>Any idea abaout how I can resolve the problem?</p>
  
  <p>Thank you very much.</p>