summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/wicket/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/gitblit/wicket/models')
-rw-r--r--src/com/gitblit/wicket/models/Metric.java32
-rw-r--r--src/com/gitblit/wicket/models/PathModel.java107
-rw-r--r--src/com/gitblit/wicket/models/RefModel.java83
-rw-r--r--src/com/gitblit/wicket/models/RepositoryModel.java59
-rw-r--r--src/com/gitblit/wicket/models/TicketModel.java117
-rw-r--r--src/com/gitblit/wicket/models/UserModel.java53
6 files changed, 0 insertions, 451 deletions
diff --git a/src/com/gitblit/wicket/models/Metric.java b/src/com/gitblit/wicket/models/Metric.java
deleted file mode 100644
index 3014cd0c..00000000
--- a/src/com/gitblit/wicket/models/Metric.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.gitblit.wicket.models;
-
-import java.io.Serializable;
-
-public class Metric implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- public String name;
- public double count;
- public double tag;
- public int duration;
-
- public Metric(String name) {
- this.name = name;
- }
-} \ No newline at end of file
diff --git a/src/com/gitblit/wicket/models/PathModel.java b/src/com/gitblit/wicket/models/PathModel.java
deleted file mode 100644
index 2edc96c9..00000000
--- a/src/com/gitblit/wicket/models/PathModel.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.gitblit.wicket.models;
-
-import java.io.Serializable;
-
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-
-import com.gitblit.utils.JGitUtils;
-
-public class PathModel implements Serializable, Comparable<PathModel> {
-
- private static final long serialVersionUID = 1L;
-
- public final String name;
- public final String path;
- public final long size;
- public final int mode;
- public final String commitId;
- public boolean isParentPath;
-
- public PathModel(String name, String path, long size, int mode, String commitId) {
- this.name = name;
- this.path = path;
- this.size = size;
- this.mode = mode;
- this.commitId = commitId;
- }
-
- public boolean isTree() {
- return JGitUtils.isTreeFromMode(mode);
- }
-
- public static PathModel getParentPath(String basePath, String commitId) {
- String parentPath = null;
- if (basePath.lastIndexOf('/') > -1) {
- parentPath = basePath.substring(0, basePath.lastIndexOf('/'));
- }
- PathModel model = new PathModel("..", parentPath, 0, 40000, commitId);
- model.isParentPath = true;
- return model;
- }
-
- @Override
- public int hashCode() {
- return commitId.hashCode() + path.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof PathModel) {
- PathModel other = (PathModel) o;
- return this.path.equals(other.path);
- }
- return super.equals(o);
- }
-
- @Override
- public int compareTo(PathModel o) {
- boolean isTree = isTree();
- boolean otherTree = o.isTree();
- if (isTree && otherTree) {
- return path.compareTo(o.path);
- } else if (!isTree && !otherTree) {
- return path.compareTo(o.path);
- } else if (isTree && !otherTree) {
- return -1;
- }
- return 1;
- }
-
- public static class PathChangeModel extends PathModel {
-
- private static final long serialVersionUID = 1L;
-
- public final ChangeType changeType;
-
- public PathChangeModel(String name, String path, long size, int mode, String commitId,
- ChangeType type) {
- super(name, path, size, mode, commitId);
- this.changeType = type;
- }
-
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- return super.equals(o);
- }
- }
-}
diff --git a/src/com/gitblit/wicket/models/RefModel.java b/src/com/gitblit/wicket/models/RefModel.java
deleted file mode 100644
index e0831f5a..00000000
--- a/src/com/gitblit/wicket/models/RefModel.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.gitblit.wicket.models;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.Ref;
-import org.eclipse.jgit.revwalk.RevCommit;
-
-import com.gitblit.utils.JGitUtils;
-
-public class RefModel implements Serializable, Comparable<RefModel> {
-
- private static final long serialVersionUID = 1L;
- public final String displayName;
- public final RevCommit commit;
- public transient Ref ref;
-
- public RefModel(String displayName, Ref ref, RevCommit commit) {
- this.displayName = displayName;
- this.ref = ref;
- this.commit = commit;
- }
-
- public Date getDate() {
- return JGitUtils.getCommitDate(commit);
- }
-
- public String getName() {
- return ref.getName();
- }
-
- public ObjectId getCommitId() {
- return commit.getId();
- }
-
- public String getShortLog() {
- return commit.getShortMessage();
- }
-
- public ObjectId getObjectId() {
- return ref.getObjectId();
- }
-
- public boolean isAnnotatedTag() {
- // ref.isPeeled() ??
- return !getCommitId().equals(getObjectId());
- }
-
- @Override
- public int hashCode() {
- return getCommitId().hashCode() + getName().hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof RefModel) {
- RefModel other = (RefModel) o;
- return getName().equals(other.getName());
- }
- return super.equals(o);
- }
-
- @Override
- public int compareTo(RefModel o) {
- return getDate().compareTo(o.getDate());
- }
-} \ No newline at end of file
diff --git a/src/com/gitblit/wicket/models/RepositoryModel.java b/src/com/gitblit/wicket/models/RepositoryModel.java
deleted file mode 100644
index 575e64a5..00000000
--- a/src/com/gitblit/wicket/models/RepositoryModel.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.gitblit.wicket.models;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import com.gitblit.Constants.AccessRestrictionType;
-
-public class RepositoryModel implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- // field names are reflectively mapped in EditRepository page
- public String name;
- public String description;
- public String owner;
- public Date lastChange;
- public boolean hasCommits;
- public boolean showRemoteBranches;
- public boolean useTickets;
- public boolean useDocs;
- public AccessRestrictionType accessRestriction;
- public boolean isFrozen;
-
- public RepositoryModel() {
- this.name = "";
- this.description = "";
- this.owner = "";
- this.lastChange = new Date(0);
- this.accessRestriction = AccessRestrictionType.NONE;
- }
-
- public RepositoryModel(String name, String description, String owner, Date lastchange) {
- this.name = name;
- this.description = description;
- this.owner = owner;
- this.lastChange = lastchange;
- this.accessRestriction = AccessRestrictionType.NONE;
- }
-
- @Override
- public String toString() {
- return name;
- }
-} \ No newline at end of file
diff --git a/src/com/gitblit/wicket/models/TicketModel.java b/src/com/gitblit/wicket/models/TicketModel.java
deleted file mode 100644
index b661c19a..00000000
--- a/src/com/gitblit/wicket/models/TicketModel.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.gitblit.wicket.models;
-
-import java.io.Serializable;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-public class TicketModel implements Serializable, Comparable<TicketModel> {
-
- private static final long serialVersionUID = 1L;
-
- public String id;
- public String name;
- public String title;
- public String state;
- public Date date;
- public String handler;
- public String milestone;
- public String email;
- public String author;
- public List<Comment> comments;
- public List<String> tags;
-
- public TicketModel() {
- state = "open";
- comments = new ArrayList<Comment>();
- tags = new ArrayList<String>();
- }
-
- public TicketModel(String ticketName) throws ParseException {
- state = "";
- name = ticketName;
- comments = new ArrayList<Comment>();
- tags = new ArrayList<String>();
-
- String[] chunks = name.split("_");
- if (chunks.length == 3) {
- date = new Date(Long.parseLong(chunks[0]) * 1000L);
- title = chunks[1].replace('-', ' ');
- }
- }
-
- public static class Comment implements Serializable, Comparable<Comment> {
-
- private static final long serialVersionUID = 1L;
-
- public String text;
- public String author;
- public Date date;
-
- public Comment(String text, Date date) {
- this.text = text;
- this.date = date;
- }
-
- public Comment(String filename, String content) throws ParseException {
- String[] chunks = filename.split("_", -1);
- this.date = new Date(Long.parseLong(chunks[1]) * 1000L);
- this.author = chunks[2];
- this.text = content;
- }
-
- @Override
- public int hashCode() {
- return text.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof Comment) {
- Comment other = (Comment) o;
- return text.equals(other.text);
- }
- return super.equals(o);
- }
-
- @Override
- public int compareTo(Comment o) {
- return date.compareTo(o.date);
- }
- }
-
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof TicketModel) {
- TicketModel other = (TicketModel) o;
- return id.equals(other.id);
- }
- return super.equals(o);
- }
-
- @Override
- public int compareTo(TicketModel o) {
- return date.compareTo(o.date);
- }
-}
diff --git a/src/com/gitblit/wicket/models/UserModel.java b/src/com/gitblit/wicket/models/UserModel.java
deleted file mode 100644
index 1181ee15..00000000
--- a/src/com/gitblit/wicket/models/UserModel.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.gitblit.wicket.models;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-public class UserModel implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- // field names are reflectively mapped in EditUser page
- public String username;
- public String password;
- public boolean canAdmin;
- public final List<String> repositories = new ArrayList<String>();
-
- public UserModel(String username) {
- this.username = username;
- }
-
- public boolean canAccessRepository(String repositoryName) {
- return canAdmin || repositories.contains(repositoryName);
- }
-
- public void setRepositories(List<String> repositories) {
- this.repositories.clear();
- this.repositories.addAll(repositories);
- }
-
- public void addRepository(String name) {
- repositories.add(name.toLowerCase());
- }
-
- @Override
- public String toString() {
- return username;
- }
-}