James Moger
2011-11-01 c25a1d65ed2c94b65741d81862a7612ae12bdf76
commit | author | age
f13c4c 1 /*
JM 2  * Copyright 2011 gitblit.com.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
1f9dae 16 package com.gitblit.models;
5fe7df 17
JM 18 import java.io.Serializable;
8f73a7 19 import java.util.ArrayList;
5fe7df 20 import java.util.Date;
8f73a7 21 import java.util.List;
5fe7df 22
dfb889 23 import com.gitblit.Constants.AccessRestrictionType;
831469 24 import com.gitblit.Constants.FederationStrategy;
94750e 25 import com.gitblit.utils.StringUtils;
dfb889 26
d9f687 27 /**
JM 28  * RepositoryModel is a serializable model class that represents a Gitblit
29  * repository including its configuration settings and access restriction.
30  * 
31  * @author James Moger
32  * 
33  */
831469 34 public class RepositoryModel implements Serializable, Comparable<RepositoryModel> {
5fe7df 35
JM 36     private static final long serialVersionUID = 1L;
1f9dae 37
2a7306 38     // field names are reflectively mapped in EditRepository page
f5d0ad 39     public String name;
JM 40     public String description;
41     public String owner;
42     public Date lastChange;
bc9d4a 43     public boolean hasCommits;
cf9550 44     public boolean showRemoteBranches;
f5d0ad 45     public boolean useTickets;
JM 46     public boolean useDocs;
dfb889 47     public AccessRestrictionType accessRestriction;
00afd7 48     public boolean isFrozen;
a1ea87 49     public boolean showReadme;
831469 50     public FederationStrategy federationStrategy;
8f73a7 51     public List<String> federationSets;
831469 52     public boolean isFederated;
3d293a 53     public boolean skipSizeCalculation;
fe3262 54     public boolean skipSummaryMetrics;
831469 55     public String frequency;
JM 56     public String origin;
57     public String size;
5fe7df 58
f97bf0 59     public RepositoryModel() {
28d6b2 60         this("", "", "", new Date(0));
f97bf0 61     }
dfb889 62
5fe7df 63     public RepositoryModel(String name, String description, String owner, Date lastchange) {
JM 64         this.name = name;
65         this.description = description;
66         this.owner = owner;
67         this.lastChange = lastchange;
00afd7 68         this.accessRestriction = AccessRestrictionType.NONE;
4838c5 69         this.federationSets = new ArrayList<String>();
JM 70         this.federationStrategy = FederationStrategy.FEDERATE_THIS;
8a2e9c 71     }
2a7306 72
8a2e9c 73     @Override
JM 74     public String toString() {
75         return name;
76     }
831469 77
JM 78     @Override
79     public int compareTo(RepositoryModel o) {
94750e 80         return StringUtils.compareRepositoryNames(name, o.name);
831469 81     }
5fe7df 82 }