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.

DailyLogEntry.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2013 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.Date;
  19. import org.eclipse.jgit.lib.PersonIdent;
  20. /**
  21. * Model class to simulate a push for presentation in the push log news feed
  22. * for a repository that does not have a Gitblit push log. Commits are grouped
  23. * by date and may be additionally split by ref.
  24. *
  25. * @author James Moger
  26. */
  27. public class DailyLogEntry extends PushLogEntry implements Serializable {
  28. private static final long serialVersionUID = 1L;
  29. public DailyLogEntry(String repository, Date date) {
  30. super(repository, date, new UserModel("digest"));
  31. }
  32. public DailyLogEntry(String repository, Date date, UserModel user) {
  33. super(repository, date, user);
  34. }
  35. @Override
  36. public PersonIdent getCommitterIdent() {
  37. if (getAuthorCount() == 1) {
  38. return getCommits().get(0).getCommitterIdent();
  39. }
  40. return super.getCommitterIdent();
  41. }
  42. @Override
  43. public PersonIdent getAuthorIdent() {
  44. if (getAuthorCount() == 1) {
  45. return getCommits().get(0).getAuthorIdent();
  46. }
  47. return super.getAuthorIdent();
  48. }
  49. }