James Moger
2011-12-22 e6935876b97a63bae2ec087b4fc390c832aef155
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;
fa54be 58     public List<String> preReceiveScripts;
JM 59     public List<String> postReceiveScripts;
eb96ea 60     public List<String> mailingLists;
5fe7df 61
f97bf0 62     public RepositoryModel() {
28d6b2 63         this("", "", "", new Date(0));
f97bf0 64     }
dfb889 65
5fe7df 66     public RepositoryModel(String name, String description, String owner, Date lastchange) {
JM 67         this.name = name;
68         this.description = description;
69         this.owner = owner;
70         this.lastChange = lastchange;
00afd7 71         this.accessRestriction = AccessRestrictionType.NONE;
4838c5 72         this.federationSets = new ArrayList<String>();
JM 73         this.federationStrategy = FederationStrategy.FEDERATE_THIS;
8a2e9c 74     }
2a7306 75
8a2e9c 76     @Override
JM 77     public String toString() {
78         return name;
79     }
831469 80
JM 81     @Override
82     public int compareTo(RepositoryModel o) {
94750e 83         return StringUtils.compareRepositoryNames(name, o.name);
831469 84     }
5fe7df 85 }