Skip to content

The Unified and Autonomous Development Platform

Add more comments.

robin shine22e1a1303e87
diff --git a/gitop.core/src/main/java/com/pmease/gitop/core/model/BranchOperation.java b/gitop.core/src/main/java/com/pmease/gitop/core/model/BranchOperation.java
index 96fbfbd8ff..315cb571d7 100644
--- a/gitop.core/src/main/java/com/pmease/gitop/core/model/BranchOperation.java
+++ b/gitop.core/src/main/java/com/pmease/gitop/core/model/BranchOperation.java
@@ -1,5 +1,25 @@
package com.pmease.gitop.core.model;
+/**
+ * This class represents operation against a certain repository branch. Typical
+ * branch operations include pull and push.
+ *
+ * @author robin
+ *
+ */
public interface BranchOperation {
+ /**
+ * Checks whether or not passed operation is a subset of current operation
+ * as parameter.
+ * <p>
+ * This will be used to check if a certain operation instance should match a permission entry.
+ * For instance, push operation with file path <code>src/com/example/Core.java</code> is a
+ * subset of push operation with file path <code>src/&#42;&#42;/&#42;.java</code>
+ *
+ * @param branchOperation
+ * the operation to be checked if it is a subset of current operation
+ * @return
+ * true if passed operation is a subset of current operation; false otherwise
+ */
boolean implies(BranchOperation branchOperation);
}
diff --git a/gitop.core/src/main/java/com/pmease/gitop/core/model/BranchPermission.java b/gitop.core/src/main/java/com/pmease/gitop/core/model/BranchPermission.java
index a5347b9f1a..aaec1b646c 100644
--- a/gitop.core/src/main/java/com/pmease/gitop/core/model/BranchPermission.java
+++ b/gitop.core/src/main/java/com/pmease/gitop/core/model/BranchPermission.java
@@ -45,7 +45,7 @@ public class BranchPermission {
this.allow = allow;
}
- public Boolean permits(String repositoryName, String branchName, BranchOperation branchOperation) {
+ Boolean permits(String repositoryName, String branchName, BranchOperation branchOperation) {
if (StringUtils.wildcardMatch(getRepositoryNamePattern(), repositoryName)
&& PathUtils.match(getBranchNamePattern(), branchName)
&& getBranchOperation().implies(branchOperation)) {
diff --git a/gitop.core/src/main/java/com/pmease/gitop/core/model/Team.java b/gitop.core/src/main/java/com/pmease/gitop/core/model/Team.java
index 1bd2723326..a7bfe179a2 100644
--- a/gitop.core/src/main/java/com/pmease/gitop/core/model/Team.java
+++ b/gitop.core/src/main/java/com/pmease/gitop/core/model/Team.java
@@ -80,7 +80,7 @@ public class Team extends AbstractEntity {
* Check whether or not a specified branch operation is permitted.
* <p>
* Supplied repository name, branch name and the operation will be matched against permission list
- * to find the first matching entry. If found, the <i>allow</i> flag of that entry will be returned
+ * to find the first matching entry. If found, the <code>allow</code> flag of that entry will be returned
* to indicate whether or not the operation is permitted. If no permission entry matches supplied
* parameters, a null value will be returned to indicate that this team can not determine whether
* or not the operation should be permitted.