You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RepositoryModel.java 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  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. */
  16. package com.gitblit.models;
  17. import java.io.Serializable;
  18. import java.util.ArrayList;
  19. import java.util.Date;
  20. import java.util.List;
  21. import com.gitblit.Constants.AccessRestrictionType;
  22. import com.gitblit.Constants.FederationStrategy;
  23. import com.gitblit.utils.StringUtils;
  24. /**
  25. * RepositoryModel is a serializable model class that represents a Gitblit
  26. * repository including its configuration settings and access restriction.
  27. *
  28. * @author James Moger
  29. *
  30. */
  31. public class RepositoryModel implements Serializable, Comparable<RepositoryModel> {
  32. private static final long serialVersionUID = 1L;
  33. // field names are reflectively mapped in EditRepository page
  34. public String name;
  35. public String description;
  36. public String owner;
  37. public Date lastChange;
  38. public boolean hasCommits;
  39. public boolean showRemoteBranches;
  40. public boolean useTickets;
  41. public boolean useDocs;
  42. public AccessRestrictionType accessRestriction;
  43. public boolean isFrozen;
  44. public boolean showReadme;
  45. public FederationStrategy federationStrategy;
  46. public List<String> federationSets;
  47. public boolean isFederated;
  48. public boolean skipSizeCalculation;
  49. public boolean skipSummaryMetrics;
  50. public String frequency;
  51. public String origin;
  52. public String size;
  53. public List<String> preReceiveScripts;
  54. public List<String> postReceiveScripts;
  55. public RepositoryModel() {
  56. this("", "", "", new Date(0));
  57. }
  58. public RepositoryModel(String name, String description, String owner, Date lastchange) {
  59. this.name = name;
  60. this.description = description;
  61. this.owner = owner;
  62. this.lastChange = lastchange;
  63. this.accessRestriction = AccessRestrictionType.NONE;
  64. this.federationSets = new ArrayList<String>();
  65. this.federationStrategy = FederationStrategy.FEDERATE_THIS;
  66. }
  67. @Override
  68. public String toString() {
  69. return name;
  70. }
  71. @Override
  72. public int compareTo(RepositoryModel o) {
  73. return StringUtils.compareRepositoryNames(name, o.name);
  74. }
  75. }