Android Open Source - PrincePolo Commit






From Project

Back to project page PrincePolo.

License

The source code is released under:

GNU General Public License

If you think the Android project PrincePolo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package se.agile.githubdata;
//  ww  w.  ja v  a 2s. c o  m
import java.util.ArrayList;
import java.util.Date;

import android.util.Log;

public class Commit implements GitHubDataInterface{
  private final String logTag = "PrincePolo";
  private String message, sha, url, branchName;
  private ArrayList<Commit> parentList;
  private User committer;
  private Date date;
  private ArrayList<File> changedFiles;
  private boolean isComplete;
  
  public Commit(String url){
    this.url = url;
    this.changedFiles = new ArrayList<File>();
    this.parentList = new ArrayList<Commit>();
    this.date = new Date();
  }
  
  public String getMessage() {
    return message;
  }

  public void setMessage(String message) {
    this.message = message;
     
  }

  public String getSha() {
    return sha;
  }

  public void setSha(String sha) {
    this.sha = sha;
  }

  public String getUrl() {
    return url;
  }

  public void setUrl(String url) {
    this.url = url;
  }

  public User getCommitter() {
    return committer;
  }

  public void setCommitter(User committer) {
    this.committer = committer;
  }

  public Date getDate() {
    return date;
  }

  public void setDate(Date date) {
    this.date = date;
  }

  public ArrayList<File> getChangedFiles() {
    if(!isComplete){
      Log.e(logTag, "All the information about the commit haven't been downloaded. Check isComplete in order to know if all information exist.");
    }
    return changedFiles;
  }

  public void setChangedFiles(ArrayList<File> changedFiles) {
    this.changedFiles = changedFiles;
  }
  
  @Override
  public String getName() {
    return "Committer: " + committer.getName() + "\nMessage: " + message;
  }
  
  

  public String getBranchName() {
    return branchName;
  }

  public void setBranchName(String branchName) {
    this.branchName = branchName;
  }

  @Override
  public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append("Commit [ ");
    builder.append("Committer: " + committer.getName());
    builder.append(", Date: " + date);
    builder.append(", messsage: " + message);
    builder.append(", sha: " + sha);
    builder.append(", ChangedFiles: ");
    if(isComplete){
      for(File file : changedFiles){
        builder.append(file.toString() + ", ");
      }
    }else{
      builder.append("IsComplete: " + isComplete);
    }
    
    
    builder.append("]");
    
    
    return builder.toString();
  }

  public ArrayList<Commit> getParentList() {
    return parentList;
  }

  public void setParentList(ArrayList<Commit> parentList) {
    this.parentList = parentList;
  }
  
  
  public void setIsComplete(boolean isComplete) {
    this.isComplete = isComplete;
  }
  /**
   * When using the GitHub Api a branch has for example a connected commit. 
   * But when we're reading a branch and also create a commit for that branch, 
   * that commit doesn't get all information.
   * For example you cannot see changedFiles.
   * 
   * @return
   */
  public boolean isComplete() {
    return isComplete;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((sha == null) ? 0 : sha.hashCode());
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    Commit other = (Commit) obj;
    if (sha == null) {
      if (other.sha != null)
        return false;
    } else if (!sha.equals(other.sha))
      return false;
    return true;
  }
  
  

}




Java Source Code List

se.agile.activities.AboutFragment.java
se.agile.activities.BranchFragment.java
se.agile.activities.BranchesFragment.java
se.agile.activities.CardFragment.java
se.agile.activities.CollaboratorsFragment.java
se.agile.activities.CommitFragment.java
se.agile.activities.ConflictFragment.java
se.agile.activities.ConnectToGitHubFragment.java
se.agile.activities.LoginActivity.java
se.agile.activities.MainActivity.java
se.agile.activities.NotificationFragmentSwitcher.java
se.agile.activities.NotificationsFragment.java
se.agile.activities.PersonalNotesFragment.java
se.agile.activities.PokerFragment.java
se.agile.activities.RepositoryOverviewFragment.java
se.agile.activities.SelectRepositoryFragment.java
se.agile.activities.SelectWorkingFilesActivity.java
se.agile.activities.SelectWorkingFilesFragment.java
se.agile.activities.SelectWorkingFilesOverviewFragment.java
se.agile.activities.SettingsFragment.java
se.agile.activities.SignOutFragment.java
se.agile.asynctasks.RequestAccessToken.java
se.agile.asynctasks.RequestAllCommitsForBranch.java
se.agile.asynctasks.RequestAllFilesForBranch.java
se.agile.asynctasks.RequestBranch.java
se.agile.asynctasks.RequestBranches.java
se.agile.asynctasks.RequestFiles.java
se.agile.asynctasks.RequestFullCommit.java
se.agile.asynctasks.RequestListenerAdapter.java
se.agile.asynctasks.RequestListener.java
se.agile.asynctasks.RequestRepositories.java
se.agile.asynctasks.RequestShortCommit.java
se.agile.asynctasks.RequestTask.java
se.agile.asynctasks.RequestUser.java
se.agile.controller.MainActivityController.java
se.agile.controller.settingsFragmentController.java
se.agile.githubdata.Branch.java
se.agile.githubdata.Commit.java
se.agile.githubdata.Directory.java
se.agile.githubdata.File.java
se.agile.githubdata.Folder.java
se.agile.githubdata.GitHubDataInterface.java
se.agile.githubdata.Repository.java
se.agile.githubdata.User.java
se.agile.model.BranchNotification.java
se.agile.model.BranchSelectionModel.java
se.agile.model.CommitNotification.java
se.agile.model.ConflictNotification.java
se.agile.model.CreateNotificationActivity.java
se.agile.model.DirectoryListArrayAdapter.java
se.agile.model.InteractiveArrayAdapter.java
se.agile.model.JSONParser.java
se.agile.model.NotificationDialog.java
se.agile.model.NotificationHandler.java
se.agile.model.NotificationListArrayAdapter.java
se.agile.model.NotificationListener.java
se.agile.model.Notification.java
se.agile.model.PreferenceListener.java
se.agile.model.Preferences.java
se.agile.model.TemporaryStorage.java
se.agile.model.Tuple.java
se.agile.model.WorkingFileListArrayAdapter.java
se.agile.navigator.NavDrawerItem.java
se.agile.navigator.NavDrawerListAdapter.java