| | |
| | | import java.util.HashSet;
|
| | | import java.util.Set;
|
| | |
|
| | | import com.gitblit.utils.ModelUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | |
|
| | | /**
|
| | | * ProjectModel is a serializable model class.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public class ProjectModel implements Serializable, Comparable<ProjectModel> {
|
| | |
|
| | |
| | | public String title;
|
| | | public String description;
|
| | | public final Set<String> repositories = new HashSet<String>();
|
| | | |
| | |
|
| | | public String projectMarkdown;
|
| | | public String repositoriesMarkdown;
|
| | | public Date lastChange;
|
| | |
| | | public ProjectModel(String name) {
|
| | | this(name, false);
|
| | | }
|
| | | |
| | |
|
| | | public ProjectModel(String name, boolean isRoot) {
|
| | | this.name = name;
|
| | | this.isRoot = isRoot;
|
| | |
| | | this.title = "";
|
| | | this.description = "";
|
| | | }
|
| | | |
| | |
|
| | | public boolean isUserProject() {
|
| | | return name.charAt(0) == '~';
|
| | | return ModelUtils.isPersonalRepository(name);
|
| | | }
|
| | |
|
| | | public boolean hasRepository(String name) {
|
| | |
| | | for (String name:names) {
|
| | | repositories.add(name.toLowerCase());
|
| | | }
|
| | | } |
| | | }
|
| | |
|
| | | public void removeRepository(String name) {
|
| | | repositories.remove(name.toLowerCase());
|
| | | }
|
| | | |
| | |
|
| | | public String getDisplayName() {
|
| | | return StringUtils.isEmpty(title) ? name : title;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public String toString() {
|
| | | return name;
|