The Unified and Autonomous Development Platform
midwork
robin shinee693485c9a13
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.javaindex a35b8692c1..ea7c214ab2 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java@@ -30,6 +30,7 @@ import com.pmease.gitplex.core.manager.AccountManager;import com.pmease.gitplex.core.manager.TeamAuthorizationManager;import com.pmease.gitplex.core.manager.AuxiliaryManager;import com.pmease.gitplex.core.manager.BranchWatchManager;+import com.pmease.gitplex.core.manager.CodeCommentManager;import com.pmease.gitplex.core.manager.PullRequestCommentManager;import com.pmease.gitplex.core.manager.ConfigManager;import com.pmease.gitplex.core.manager.DataManager;@@ -53,6 +54,7 @@ import com.pmease.gitplex.core.manager.impl.DefaultAccountManager;import com.pmease.gitplex.core.manager.impl.DefaultTeamAuthorizationManager;import com.pmease.gitplex.core.manager.impl.DefaultAuxiliaryManager;import com.pmease.gitplex.core.manager.impl.DefaultBranchWatchManager;+import com.pmease.gitplex.core.manager.impl.DefaultCodeCommentManager;import com.pmease.gitplex.core.manager.impl.DefaultPullRequestCommentManager;import com.pmease.gitplex.core.manager.impl.DefaultConfigManager;import com.pmease.gitplex.core.manager.impl.DefaultDataManager;@@ -152,6 +154,7 @@ public class CoreModule extends AbstractPluginModule {bind(ConfigManager.class).to(DefaultConfigManager.class);bind(DataManager.class).to(DefaultDataManager.class);bind(PullRequestCommentManager.class).to(DefaultPullRequestCommentManager.class);+ bind(CodeCommentManager.class).to(DefaultCodeCommentManager.class);bind(PullRequestManager.class).to(DefaultPullRequestManager.class);bind(PullRequestUpdateManager.class).to(DefaultPullRequestUpdateManager.class);bind(DepotManager.class).to(DefaultDepotManager.class);diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeComment.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeComment.javaindex 5f71264b1a..c67ece7809 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeComment.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeComment.java@@ -3,10 +3,13 @@ package com.pmease.gitplex.core.entity;import java.util.Date;import javax.annotation.Nullable;+import javax.persistence.AttributeOverride;+import javax.persistence.AttributeOverrides;import javax.persistence.Column;import javax.persistence.Embedded;import javax.persistence.Entity;import javax.persistence.FetchType;+import javax.persistence.JoinColumn;import javax.persistence.Lob;import javax.persistence.ManyToOne;import javax.persistence.Version;@@ -14,12 +17,11 @@ import javax.persistence.Version;import org.hibernate.annotations.DynamicUpdate;import org.hibernate.annotations.OptimisticLock;-import com.google.common.base.Preconditions;import com.pmease.commons.git.BlobIdent;import com.pmease.commons.hibernate.AbstractEntity;import com.pmease.commons.hibernate.dao.Dao;import com.pmease.gitplex.core.GitPlex;-import com.pmease.gitplex.core.entity.component.CommentPosition;+import com.pmease.gitplex.core.entity.component.TokenRange;/** @DynamicUpdate annotation here along with various @OptimisticLock annotations@@ -38,6 +40,7 @@ public class CodeComment extends AbstractEntity {private long version;@ManyToOne(fetch=FetchType.LAZY)+ @JoinColumn(nullable=false)private Depot depot;@ManyToOne(fetch=FetchType.LAZY)@@ -52,7 +55,20 @@ public class CodeComment extends AbstractEntity {@OptimisticLock(excluded=true)@Embedded- private CommentPosition position;+ @AttributeOverrides({+ @AttributeOverride(name="revision", column=@Column(name="G_BLOB_REV")),+ @AttributeOverride(name="path", column=@Column(name="G_BLOB_PATH")),+ @AttributeOverride(name="mode", column=@Column(name="G_BLOB_MODE")),+ @AttributeOverride(name="id", column=@Column(name="G_BLOB_ID"))+ })+ private BlobIdent blobIdent;++ @OptimisticLock(excluded=true)+ @Embedded+ private TokenRange textRange;++ @OptimisticLock(excluded=true)+ private String compareCommit;/*** @return the depot@@ -97,52 +113,46 @@ public class CodeComment extends AbstractEntity {GitPlex.getInstance(Dao.class).remove(this);}- public CommentPosition getPosition() {- return position;- }-- public void setPosition(CommentPosition position) {- this.position = position;- }-+ /**+ * @return the blobIdent+ */public BlobIdent getBlobIdent() {- return Preconditions.checkNotNull(position).getBlobIdent();+ return blobIdent;}-++ /**+ * @param blobIdent the blobIdent to set+ */public void setBlobIdent(BlobIdent blobIdent) {- if (position == null)- position = new CommentPosition();- position.setBlobIdent(blobIdent);- }-- public BlobIdent getCompareWith() {- return Preconditions.checkNotNull(position).getCompareWith();- }-- public void setCompareWith(BlobIdent compareWith) {- if (position == null)- position = new CommentPosition();- position.setCompareWith(compareWith);+ this.blobIdent = blobIdent;}- public int getBeginLine() {- return Preconditions.checkNotNull(position).getBeginLine();+ /**+ * @return the textRange+ */+ public TokenRange getTextRange() {+ return textRange;}- public void setBeginLine(int beginLine) {- if (position == null)- position = new CommentPosition();- position.setBeginLine(beginLine);+ /**+ * @param textRange the textRange to set+ */+ public void setTextRange(TokenRange textRange) {+ this.textRange = textRange;}-- public int getEndLine() {- return Preconditions.checkNotNull(position).getEndLine();++ /**+ * @return the compareCommit+ */+ public String getCompareCommit() {+ return compareCommit;}- public void setEndLine(int endLine) {- if (position == null)- position = new CommentPosition();- position.setEndLine(endLine);+ /**+ * @param compareCommit the compareCommit to set+ */+ public void setCompareCommit(String compareCommit) {+ this.compareCommit = compareCommit;}-+}diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/CommentPosition.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/CommentPosition.javadeleted file mode 100644index 50d7c16132..0000000000--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/CommentPosition.java+++ /dev/null@@ -1,74 +0,0 @@-package com.pmease.gitplex.core.entity.component;--import java.io.Serializable;--import javax.persistence.AttributeOverride;-import javax.persistence.AttributeOverrides;-import javax.persistence.Column;-import javax.persistence.Embeddable;-import javax.persistence.Embedded;--import com.pmease.commons.git.BlobIdent;--@Embeddable-public class CommentPosition implements Serializable {-- private static final long serialVersionUID = 1L;-- @Embedded- @AttributeOverrides({- @AttributeOverride(name="revision", column=@Column(name="G_BLOB_REV")),- @AttributeOverride(name="path", column=@Column(name="G_BLOB_PATH")),- @AttributeOverride(name="mode", column=@Column(name="G_BLOB_MODE")),- @AttributeOverride(name="id", column=@Column(name="G_BLOB_ID"))- })- private BlobIdent blobIdent;-- @Embedded- @AttributeOverrides({- @AttributeOverride(name="revision", column=@Column(name="G_COMPARE_REV") ),- @AttributeOverride(name="path", column=@Column(name="G_COMPARE_PATH")),- @AttributeOverride(name="mode", column=@Column(name="G_COMPARE_MODE")),- @AttributeOverride(name="id", column=@Column(name="G_COMPARE_ID"))- })- private BlobIdent compareWith;-- // Use Integer instead of int here in order to allow this class to be- // embedded as nullable property of JPA entities- private Integer beginLine;-- private Integer endLine;-- public BlobIdent getBlobIdent() {- return blobIdent;- }-- public void setBlobIdent(BlobIdent blobIdent) {- this.blobIdent = blobIdent;- }-- public BlobIdent getCompareWith() {- return compareWith;- }-- public void setCompareWith(BlobIdent compareWith) {- this.compareWith = compareWith;- }-- public Integer getBeginLine() {- return beginLine;- }-- public void setBeginLine(Integer beginLine) {- this.beginLine = beginLine;- }-- public Integer getEndLine() {- return endLine;- }-- public void setEndLine(Integer endLine) {- this.endLine = endLine;- }--}diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/TokenRange.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/TokenRange.javanew file mode 100644index 0000000000..ff9b7b343e--- /dev/null+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/TokenRange.java@@ -0,0 +1,69 @@+package com.pmease.gitplex.core.entity.component;++public class TokenRange {++ private Integer beginLine;++ private Integer beginToken;++ private Integer endLine;++ private Integer endToken;++ /**+ * @return the beginLine+ */+ public Integer getBeginLine() {+ return beginLine;+ }++ /**+ * @param beginLine the beginLine to set+ */+ public void setBeginLine(Integer beginLine) {+ this.beginLine = beginLine;+ }++ /**+ * @return the beginToken+ */+ public Integer getBeginToken() {+ return beginToken;+ }++ /**+ * @param beginToken the beginToken to set+ */+ public void setBeginToken(Integer beginToken) {+ this.beginToken = beginToken;+ }++ /**+ * @return the endLine+ */+ public Integer getEndLine() {+ return endLine;+ }++ /**+ * @param endLine the endLine to set+ */+ public void setEndLine(Integer endLine) {+ this.endLine = endLine;+ }++ /**+ * @return the endToken+ */+ public Integer getEndToken() {+ return endToken;+ }++ /**+ * @param endToken the endToken to set+ */+ public void setEndToken(Integer endToken) {+ this.endToken = endToken;+ }++}diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CodeCommentManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CodeCommentManager.javanew file mode 100644index 0000000000..716d1eaf36--- /dev/null+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CodeCommentManager.java@@ -0,0 +1,8 @@+package com.pmease.gitplex.core.manager;++import com.pmease.commons.hibernate.dao.EntityDao;+import com.pmease.gitplex.core.entity.CodeComment;++public interface CodeCommentManager extends EntityDao<CodeComment> {++}diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentManager.javanew file mode 100644index 0000000000..82eb04d21c--- /dev/null+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentManager.java@@ -0,0 +1,20 @@+package com.pmease.gitplex.core.manager.impl;++import javax.inject.Inject;+import javax.inject.Singleton;++import com.pmease.commons.hibernate.dao.AbstractEntityDao;+import com.pmease.commons.hibernate.dao.Dao;+import com.pmease.gitplex.core.entity.CodeComment;+import com.pmease.gitplex.core.manager.CodeCommentManager;++@Singleton+public class DefaultCodeCommentManager extends AbstractEntityDao<CodeComment>+ implements CodeCommentManager {++ @Inject+ public DefaultCodeCommentManager(Dao dao) {+ super(dao);+ }++}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.jsindex 6a9117ef00..764f3b3c44 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.js+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.js@@ -21,4 +21,4 @@ gitplex.textdiff = {symbolTooltip.onMouseOverSymbol(revision, this);});}-}\ No newline at end of file+}