Restrict access to "internal" API

There are some interfaces, like Action, that are used only by this
plugin and not by the its-* child plugins. Their access could not be
restricted as they are used by other classes in a different package.

Remove the 'action' package and move the classes inside it to the
'workflow' package so that interface can be defined package-private. In
the same idea, limit the access to the methods in some classes in the
'util' package.

This change is needed work in order to simplify the gathering and
storage of events properties, which is done in a follow-up commit.

Change-Id: I198985da4ecda582846729d7f441e5b835aadf85
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/ItsHookModule.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/ItsHookModule.java
index a85a4e9..148874d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/ItsHookModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/ItsHookModule.java
@@ -30,13 +30,13 @@
 import com.googlesource.gerrit.plugins.its.base.validation.ItsValidateComment;
 import com.googlesource.gerrit.plugins.its.base.workflow.ActionController;
 import com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest;
+import com.googlesource.gerrit.plugins.its.base.workflow.AddComment;
+import com.googlesource.gerrit.plugins.its.base.workflow.AddSoyComment;
+import com.googlesource.gerrit.plugins.its.base.workflow.AddStandardComment;
 import com.googlesource.gerrit.plugins.its.base.workflow.Condition;
+import com.googlesource.gerrit.plugins.its.base.workflow.LogEvent;
 import com.googlesource.gerrit.plugins.its.base.workflow.Property;
 import com.googlesource.gerrit.plugins.its.base.workflow.Rule;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.AddComment;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.AddSoyComment;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.AddStandardComment;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.LogEvent;
 import java.nio.file.Path;
 
 public class ItsHookModule extends FactoryModule {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
index cf0c66d..7ce2083 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
@@ -27,7 +27,7 @@
 import org.apache.commons.lang.StringEscapeUtils;
 
 /** Extractor to translate the various {@code *Attribute}s to {@link Property Properties}. */
-public class PropertyAttributeExtractor {
+class PropertyAttributeExtractor {
   private Property.Factory propertyFactory;
   private ItsFacade its;
 
@@ -37,7 +37,7 @@
     this.propertyFactory = propertyFactory;
   }
 
-  public Set<Property> extractFrom(AccountAttribute accountAttribute, String prefix) {
+  Set<Property> extractFrom(AccountAttribute accountAttribute, String prefix) {
     Set<Property> properties = Sets.newHashSet();
     if (accountAttribute != null) {
       properties.add(propertyFactory.create(prefix + "Email", accountAttribute.email));
@@ -47,7 +47,7 @@
     return properties;
   }
 
-  public Set<Property> extractFrom(ChangeAttribute changeAttribute) {
+  Set<Property> extractFrom(ChangeAttribute changeAttribute) {
     Set<Property> properties = Sets.newHashSet();
     properties.add(propertyFactory.create("branch", changeAttribute.branch));
     properties.add(propertyFactory.create("topic", changeAttribute.topic));
@@ -74,7 +74,7 @@
     return properties;
   }
 
-  public Set<Property> extractFrom(PatchSetAttribute patchSetAttribute) {
+  Set<Property> extractFrom(PatchSetAttribute patchSetAttribute) {
     Set<Property> properties = Sets.newHashSet();
     properties.add(propertyFactory.create("revision", patchSetAttribute.revision));
     properties.add(
@@ -92,7 +92,7 @@
     return properties;
   }
 
-  public Set<Property> extractFrom(RefUpdateAttribute refUpdateAttribute) {
+  Set<Property> extractFrom(RefUpdateAttribute refUpdateAttribute) {
     Set<Property> properties = Sets.newHashSet();
     properties.add(propertyFactory.create("revision", refUpdateAttribute.newRev));
     properties.add(propertyFactory.create("revisionOld", refUpdateAttribute.oldRev));
@@ -100,7 +100,7 @@
     return properties;
   }
 
-  public Set<Property> extractFrom(ApprovalAttribute approvalAttribute) {
+  Set<Property> extractFrom(ApprovalAttribute approvalAttribute) {
     Set<Property> properties = Sets.newHashSet();
     properties.add(
         propertyFactory.create(
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/Action.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/Action.java
similarity index 74%
rename from src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/Action.java
rename to src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/Action.java
index b8b2102..7f73195 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/Action.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/Action.java
@@ -12,15 +12,13 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package com.googlesource.gerrit.plugins.its.base.workflow.action;
+package com.googlesource.gerrit.plugins.its.base.workflow;
 
-import com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest;
-import com.googlesource.gerrit.plugins.its.base.workflow.Property;
 import java.io.IOException;
 import java.util.Set;
 
 /** Interface for actions on an issue tracking system */
-public interface Action {
+interface Action {
 
   /**
    * Execute this action.
@@ -29,6 +27,6 @@
    * @param actionRequest The request to execute.
    * @param properties The properties for the execution.
    */
-  public void execute(String issue, ActionRequest actionRequest, Set<Property> properties)
+  void execute(String issue, ActionRequest actionRequest, Set<Property> properties)
       throws IOException;
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutor.java
index fdf1e8e..3cc9afe 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutor.java
@@ -16,11 +16,6 @@
 
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.Action;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.AddComment;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.AddSoyComment;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.AddStandardComment;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.LogEvent;
 import java.io.IOException;
 import java.util.Set;
 import org.slf4j.Logger;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddComment.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddComment.java
similarity index 87%
rename from src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddComment.java
rename to src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddComment.java
index 51f976c..6a64db2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddComment.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddComment.java
@@ -12,13 +12,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package com.googlesource.gerrit.plugins.its.base.workflow.action;
+package com.googlesource.gerrit.plugins.its.base.workflow;
 
 import com.google.common.base.Strings;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
-import com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest;
-import com.googlesource.gerrit.plugins.its.base.workflow.Property;
 import java.io.IOException;
 import java.util.Set;
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddSoyComment.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddSoyComment.java
similarity index 94%
rename from src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddSoyComment.java
rename to src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddSoyComment.java
index 0ddefd5..1521092 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddSoyComment.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddSoyComment.java
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package com.googlesource.gerrit.plugins.its.base.workflow.action;
+package com.googlesource.gerrit.plugins.its.base.workflow;
 
 import com.google.common.base.Strings;
 import com.google.common.io.CharStreams;
@@ -23,8 +23,6 @@
 import com.google.template.soy.tofu.SoyTofu;
 import com.googlesource.gerrit.plugins.its.base.ItsPath;
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
-import com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest;
-import com.googlesource.gerrit.plugins.its.base.workflow.Property;
 import java.io.IOException;
 import java.io.Reader;
 import java.nio.charset.StandardCharsets;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardComment.java
similarity index 94%
rename from src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java
rename to src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardComment.java
index 2a3bbeb..52c1369 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardComment.java
@@ -12,14 +12,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package com.googlesource.gerrit.plugins.its.base.workflow.action;
+package com.googlesource.gerrit.plugins.its.base.workflow;
 
 import com.google.common.base.Strings;
 import com.google.common.collect.Maps;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
-import com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest;
-import com.googlesource.gerrit.plugins.its.base.workflow.Property;
 import java.io.IOException;
 import java.util.Map;
 import java.util.Set;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/Condition.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/Condition.java
index 6f8df84..7c06bb4 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/Condition.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/Condition.java
@@ -20,7 +20,6 @@
 import com.google.gerrit.common.Nullable;
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.Action;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/LogEvent.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEvent.java
similarity index 91%
rename from src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/LogEvent.java
rename to src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEvent.java
index 4abff71..baf64b2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/LogEvent.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEvent.java
@@ -12,11 +12,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package com.googlesource.gerrit.plugins.its.base.workflow.action;
+package com.googlesource.gerrit.plugins.its.base.workflow;
 
 import com.google.inject.Inject;
-import com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest;
-import com.googlesource.gerrit.plugins.its.base.workflow.Property;
 import java.io.IOException;
 import java.util.Set;
 import org.slf4j.Logger;
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java
index 4dbc779..85173ab 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java
@@ -22,10 +22,6 @@
 import com.google.inject.Injector;
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
 import com.googlesource.gerrit.plugins.its.base.testutil.LoggingMockingTestCase;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.AddComment;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.AddSoyComment;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.AddStandardComment;
-import com.googlesource.gerrit.plugins.its.base.workflow.action.LogEvent;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Set;
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddCommentTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddCommentTest.java
similarity index 93%
rename from src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddCommentTest.java
rename to src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddCommentTest.java
index d16bab2..1993406 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddCommentTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddCommentTest.java
@@ -11,7 +11,7 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-package com.googlesource.gerrit.plugins.its.base.workflow.action;
+package com.googlesource.gerrit.plugins.its.base.workflow;
 
 import static org.easymock.EasyMock.expect;
 
@@ -20,7 +20,6 @@
 import com.google.inject.Injector;
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
 import com.googlesource.gerrit.plugins.its.base.testutil.LoggingMockingTestCase;
-import com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest;
 import java.io.IOException;
 import java.util.HashSet;
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardCommentTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardCommentTest.java
similarity index 98%
rename from src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardCommentTest.java
rename to src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardCommentTest.java
index 6154133..c26ea73 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardCommentTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddStandardCommentTest.java
@@ -11,7 +11,7 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-package com.googlesource.gerrit.plugins.its.base.workflow.action;
+package com.googlesource.gerrit.plugins.its.base.workflow;
 
 import static org.easymock.EasyMock.expect;
 
@@ -21,8 +21,6 @@
 import com.google.inject.Injector;
 import com.googlesource.gerrit.plugins.its.base.its.ItsFacade;
 import com.googlesource.gerrit.plugins.its.base.testutil.LoggingMockingTestCase;
-import com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest;
-import com.googlesource.gerrit.plugins.its.base.workflow.Property;
 import java.io.IOException;
 import java.util.Set;
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/LogEventTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEventTest.java
similarity index 96%
rename from src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/LogEventTest.java
rename to src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEventTest.java
index 54b9942..e9a0872 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/LogEventTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/LogEventTest.java
@@ -11,7 +11,7 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-package com.googlesource.gerrit.plugins.its.base.workflow.action;
+package com.googlesource.gerrit.plugins.its.base.workflow;
 
 import static org.easymock.EasyMock.expect;
 
@@ -20,8 +20,6 @@
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.googlesource.gerrit.plugins.its.base.testutil.LoggingMockingTestCase;
-import com.googlesource.gerrit.plugins.its.base.workflow.ActionRequest;
-import com.googlesource.gerrit.plugins.its.base.workflow.Property;
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Set;