file_name
stringlengths 6
86
| file_path
stringlengths 45
249
| content
stringlengths 47
6.26M
| file_size
int64 47
6.26M
| language
stringclasses 1
value | extension
stringclasses 1
value | repo_name
stringclasses 767
values | repo_stars
int64 8
14.4k
| repo_forks
int64 0
1.17k
| repo_open_issues
int64 0
788
| repo_created_at
stringclasses 767
values | repo_pushed_at
stringclasses 767
values |
---|---|---|---|---|---|---|---|---|---|---|---|
ReviewCommentModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/ReviewCommentModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.model.User;
import java.util.Date;
/**
* Created by Kosh on 04 May 2017, 7:10 PM
*/
public class ReviewCommentModel implements Parcelable {
private long id;
private String url;
private long pullRequestReviewId;
private String diffHunk;
private String path;
private int position;
private int originalPosition;
private String commitId;
private String originalCommitId;
private User user;
private String bodyHtml;
private String body;
private Date createdAt;
private Date updatedAt;
private String htmlUrl;
private String pullRequestUrl;
private ReactionsModel reactions;
private String authorAssociation;
public ReviewCommentModel() {}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public long getPullRequestReviewId() {
return pullRequestReviewId;
}
public void setPullRequestReviewId(long pullRequestReviewId) {
this.pullRequestReviewId = pullRequestReviewId;
}
public String getDiffHunk() {
return diffHunk;
}
public void setDiffHunk(String diffHunk) {
this.diffHunk = diffHunk;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
public int getOriginalPosition() {
return originalPosition;
}
public void setOriginalPosition(int originalPosition) {
this.originalPosition = originalPosition;
}
public String getCommitId() {
return commitId;
}
public void setCommitId(String commitId) {
this.commitId = commitId;
}
public String getOriginalCommitId() {
return originalCommitId;
}
public void setOriginalCommitId(String originalCommitId) {
this.originalCommitId = originalCommitId;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getBodyHtml() {
return bodyHtml;
}
public void setBodyHtml(String bodyHtml) {
this.bodyHtml = bodyHtml;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public String getHtmlUrl() {
return htmlUrl;
}
public void setHtmlUrl(String htmlUrl) {
this.htmlUrl = htmlUrl;
}
public String getPullRequestUrl() {
return pullRequestUrl;
}
public void setPullRequestUrl(String pullRequestUrl) {
this.pullRequestUrl = pullRequestUrl;
}
public ReactionsModel getReactions() {
return reactions;
}
public void setReactions(ReactionsModel reactions) {
this.reactions = reactions;
}
public String getAuthorAssociation() {
return authorAssociation;
}
public void setAuthorAssociation(String authorAssociation) {
this.authorAssociation = authorAssociation;
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReviewCommentModel that = (ReviewCommentModel) o;
return id == that.id;
}
@Override public int hashCode() {
return (int) (id ^ (id >>> 32));
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeLong(this.pullRequestReviewId);
dest.writeString(this.diffHunk);
dest.writeString(this.path);
dest.writeInt(this.position);
dest.writeInt(this.originalPosition);
dest.writeString(this.commitId);
dest.writeString(this.originalCommitId);
dest.writeParcelable(this.user, flags);
dest.writeString(this.bodyHtml);
dest.writeString(this.body);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeString(this.htmlUrl);
dest.writeString(this.pullRequestUrl);
dest.writeParcelable(this.reactions, flags);
dest.writeString(this.authorAssociation);
}
protected ReviewCommentModel(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
this.pullRequestReviewId = in.readLong();
this.diffHunk = in.readString();
this.path = in.readString();
this.position = in.readInt();
this.originalPosition = in.readInt();
this.commitId = in.readString();
this.originalCommitId = in.readString();
this.user = in.readParcelable(User.class.getClassLoader());
this.bodyHtml = in.readString();
this.body = in.readString();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.htmlUrl = in.readString();
this.pullRequestUrl = in.readString();
this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader());
this.authorAssociation = in.readString();
}
public static final Creator<ReviewCommentModel> CREATOR = new Creator<ReviewCommentModel>() {
@Override public ReviewCommentModel createFromParcel(Parcel source) {return new ReviewCommentModel(source);}
@Override public ReviewCommentModel[] newArray(int size) {return new ReviewCommentModel[size];}
};
}
| 6,395 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
GitCommitModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/GitCommitModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.model.User;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 08 Dec 2016, 8:59 PM
*/
@Getter @Setter @NoArgsConstructor
public class GitCommitModel implements Parcelable {
public String sha;
public String url;
public String message;
public User author;
public User committer;
public User tree;
public @SerializedName("distinct") boolean distincted;
public GitCommitListModel parents;
public int commentCount;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.sha);
dest.writeString(this.url);
dest.writeString(this.message);
dest.writeParcelable(this.author, flags);
dest.writeParcelable(this.committer, flags);
dest.writeParcelable(this.tree, flags);
dest.writeByte(this.distincted ? (byte) 1 : (byte) 0);
dest.writeList(this.parents);
dest.writeInt(this.commentCount);
}
protected GitCommitModel(Parcel in) {
this.sha = in.readString();
this.url = in.readString();
this.message = in.readString();
this.author = in.readParcelable(User.class.getClassLoader());
this.committer = in.readParcelable(User.class.getClassLoader());
this.tree = in.readParcelable(User.class.getClassLoader());
this.distincted = in.readByte() != 0;
this.parents = new GitCommitListModel();
in.readList(this.parents, this.parents.getClass().getClassLoader());
this.commentCount = in.readInt();
}
public static final Creator<GitCommitModel> CREATOR = new Creator<GitCommitModel>() {
@Override public GitCommitModel createFromParcel(Parcel source) {return new GitCommitModel(source);}
@Override public GitCommitModel[] newArray(int size) {return new GitCommitModel[size];}
};
@Override public String toString() {
if (message != null) {
return (sha != null && sha.length() > 7 ? sha.substring(0, 7) + " - " : "") + message.split(System.lineSeparator())[0];
} else if (sha != null && sha.length() > 10) {
return sha.substring(0, 10);
}
return "N/A";
}
}
| 2,439 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
TeamsModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/TeamsModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 03 Apr 2017, 7:40 PM
*/
@Getter @Setter @NoArgsConstructor public class TeamsModel implements Parcelable {
private long id;
private String url;
private String name;
private String slug;
private String description;
private String privacy;
private String permission;
private String membersUrl;
private String repositoriesUrl;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeString(this.name);
dest.writeString(this.slug);
dest.writeString(this.description);
dest.writeString(this.privacy);
dest.writeString(this.permission);
dest.writeString(this.membersUrl);
dest.writeString(this.repositoriesUrl);
}
protected TeamsModel(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
this.name = in.readString();
this.slug = in.readString();
this.description = in.readString();
this.privacy = in.readString();
this.permission = in.readString();
this.membersUrl = in.readString();
this.repositoriesUrl = in.readString();
}
public static final Creator<TeamsModel> CREATOR = new Creator<TeamsModel>() {
@Override public TeamsModel createFromParcel(Parcel source) {return new TeamsModel(source);}
@Override public TeamsModel[] newArray(int size) {return new TeamsModel[size];}
};
}
| 1,738 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
MergeRequestModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/MergeRequestModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 16 Dec 2016, 11:42 PM
*/
@Getter @Setter @NoArgsConstructor
public class MergeRequestModel implements Parcelable {
private String commitMessage;
private String sha;
private String base;
private String head;
private String mergeMethod = "merge";
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.commitMessage);
dest.writeString(this.sha);
dest.writeString(this.base);
dest.writeString(this.head);
}
@SuppressWarnings("WeakerAccess") protected MergeRequestModel(Parcel in) {
this.commitMessage = in.readString();
this.sha = in.readString();
this.base = in.readString();
this.head = in.readString();
}
public static final Creator<MergeRequestModel> CREATOR = new Creator<MergeRequestModel>() {
@Override public MergeRequestModel createFromParcel(Parcel source) {return new MergeRequestModel(source);}
@Override public MergeRequestModel[] newArray(int size) {return new MergeRequestModel[size];}
};
}
| 1,317 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
TimelineModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/TimelineModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.Nullable;
import com.fastaccess.data.dao.model.Comment;
import com.fastaccess.data.dao.model.Issue;
import com.fastaccess.data.dao.model.PullRequest;
import com.fastaccess.data.dao.timeline.GenericEvent;
import com.fastaccess.data.dao.timeline.PullRequestCommitModel;
import com.fastaccess.data.dao.types.IssueEventType;
import java.util.List;
import io.reactivex.Observable;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
/**
* Created by Kosh on 30 Mar 2017, 9:03 PM
*/
@Getter @Setter public class TimelineModel implements Parcelable {
public static final int HEADER = 1;
public static final int EVENT = 2;
public static final int COMMENT = 3;
public static final int REVIEW = 4;
public static final int GROUP = 5;
public static final int COMMIT_COMMENTS = 6;
public static final int STATUS = 7;
private IssueEventType event;
private Comment comment;
private GenericEvent genericEvent;
private PullRequestStatusModel status;
private Issue issue;
private PullRequest pullRequest;
private ReviewModel review;
private GroupedReviewModel groupedReviewModel;
private PullRequestCommitModel commit;
private int position;
public TimelineModel(Issue issue) {
this.issue = issue;
}
public TimelineModel(PullRequest pullRequest) {
this.pullRequest = pullRequest;
}
public TimelineModel(Comment comment) {
this.comment = comment;
this.event = IssueEventType.commented;
}
public TimelineModel(PullRequestStatusModel statusModel) {
this.status = statusModel;
}
public TimelineModel() {}
public int getType() {
if (getEvent() != null) {
switch (getEvent()) {
case commented:
return COMMENT;
case reviewed:
case changes_requested:
return REVIEW;
case GROUPED:
return GROUP;
case commit_commented:
return COMMIT_COMMENTS;
default:
return EVENT;
}
} else {
if (issue != null || pullRequest != null) return HEADER;
else if (status != null) return STATUS;
return 0;
}
}
public static TimelineModel constructHeader(Issue issue) {
return new TimelineModel(issue);
}
public static TimelineModel constructHeader(PullRequest pullRequest) {
return new TimelineModel(pullRequest);
}
public static TimelineModel constructComment(Comment comment) {
return new TimelineModel(comment);
}
@NonNull public static Observable<List<TimelineModel>> construct(@Nullable List<Comment> comments) {
if (comments == null || comments.isEmpty()) return Observable.empty();
return Observable.fromIterable(comments)
.map(TimelineModel::new)
.toList()
.toObservable();
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TimelineModel model = (TimelineModel) o;
return (comment != null && model.getComment() != null) && (comment.getId() == model.comment.getId());
}
@Override public int hashCode() {
return comment != null ? (int) comment.getId() : 0;
}
public IssueEventType getEvent() {
return event;
}
public void setEvent(IssueEventType event) {
this.event = event;
}
public Comment getComment() {
return comment;
}
public void setComment(Comment comment) {
this.comment = comment;
}
public GenericEvent getGenericEvent() {
return genericEvent;
}
public void setGenericEvent(GenericEvent genericEvent) {
this.genericEvent = genericEvent;
}
public PullRequestStatusModel getStatus() {
return status;
}
public void setStatus(PullRequestStatusModel status) {
this.status = status;
}
public Issue getIssue() {
return issue;
}
public void setIssue(Issue issue) {
this.issue = issue;
}
public PullRequest getPullRequest() {
return pullRequest;
}
public void setPullRequest(PullRequest pullRequest) {
this.pullRequest = pullRequest;
}
public ReviewModel getReview() {
return review;
}
public void setReview(ReviewModel review) {
this.review = review;
}
public GroupedReviewModel getGroupedReviewModel() {
return groupedReviewModel;
}
public void setGroupedReviewModel(GroupedReviewModel groupedReviewModel) {
this.groupedReviewModel = groupedReviewModel;
}
public PullRequestCommitModel getCommit() {
return commit;
}
public void setCommit(PullRequestCommitModel commit) {
this.commit = commit;
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.event == null ? -1 : this.event.ordinal());
dest.writeParcelable(this.comment, flags);
dest.writeParcelable(this.genericEvent, flags);
dest.writeParcelable(this.status, flags);
dest.writeParcelable(this.issue, flags);
dest.writeParcelable(this.pullRequest, flags);
dest.writeParcelable(this.review, flags);
dest.writeParcelable(this.groupedReviewModel, flags);
dest.writeParcelable(this.commit, flags);
dest.writeInt(this.position);
}
protected TimelineModel(Parcel in) {
int tmpEvent = in.readInt();
this.event = tmpEvent == -1 ? null : IssueEventType.values()[tmpEvent];
this.comment = in.readParcelable(Comment.class.getClassLoader());
this.genericEvent = in.readParcelable(GenericEvent.class.getClassLoader());
this.status = in.readParcelable(PullRequestStatusModel.class.getClassLoader());
this.issue = in.readParcelable(Issue.class.getClassLoader());
this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader());
this.review = in.readParcelable(ReviewModel.class.getClassLoader());
this.groupedReviewModel = in.readParcelable(GroupedReviewModel.class.getClassLoader());
this.commit = in.readParcelable(PullRequestCommitModel.class.getClassLoader());
this.position = in.readInt();
}
public static final Creator<TimelineModel> CREATOR = new Creator<TimelineModel>() {
@Override public TimelineModel createFromParcel(Parcel source) {return new TimelineModel(source);}
@Override public TimelineModel[] newArray(int size) {return new TimelineModel[size];}
};
}
| 6,929 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
LicenseModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/LicenseModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 01 Jan 2017, 1:15 PM
*/
@Getter @Setter @NoArgsConstructor
public class LicenseModel implements Parcelable {
String key;
String name;
String spdxId;
String url;
boolean featured;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.key);
dest.writeString(this.name);
dest.writeString(this.spdxId);
dest.writeString(this.url);
dest.writeByte(this.featured ? (byte) 1 : (byte) 0);
}
protected LicenseModel(Parcel in) {
this.key = in.readString();
this.name = in.readString();
this.spdxId = in.readString();
this.url = in.readString();
this.featured = in.readByte() != 0;
}
public static final Creator<LicenseModel> CREATOR = new Creator<LicenseModel>() {
@Override public LicenseModel createFromParcel(Parcel source) {return new LicenseModel(source);}
@Override public LicenseModel[] newArray(int size) {return new LicenseModel[size];}
};
}
| 1,270 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
IssueEventAdapterModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/IssueEventAdapterModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import com.fastaccess.data.dao.model.Issue;
import com.fastaccess.data.dao.model.IssueEvent;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
/**
* Created by Kosh on 10 Dec 2016, 3:34 PM
*/
@Getter @Setter
public class IssueEventAdapterModel implements Parcelable {
public static final int HEADER = 1;
public static final int ROW = 2;
private int type;
private IssueEvent issueEvent;
private Issue issueModel;
private IssueEventAdapterModel(int type, IssueEvent model) {
this.type = type;
this.issueEvent = model;
}
public IssueEventAdapterModel(int type, Issue issueModel) {
this.type = type;
this.issueModel = issueModel;
}
public static ArrayList<IssueEventAdapterModel> addEvents(@Nullable List<IssueEvent> modelList) {
ArrayList<IssueEventAdapterModel> models = new ArrayList<>();
if (modelList == null || modelList.isEmpty()) return models;
Stream.of(modelList).forEach(issueEventModel -> models.add(new IssueEventAdapterModel(ROW, issueEventModel)));
return models;
}
public IssueEventAdapterModel() {}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.type);
dest.writeParcelable(this.issueEvent, flags);
dest.writeParcelable(this.issueModel, flags);
}
private IssueEventAdapterModel(Parcel in) {
this.type = in.readInt();
this.issueEvent = in.readParcelable(IssueEvent.class.getClassLoader());
this.issueModel = in.readParcelable(Issue.class.getClassLoader());
}
public static final Creator<IssueEventAdapterModel> CREATOR = new Creator<IssueEventAdapterModel>() {
@Override public IssueEventAdapterModel createFromParcel(Parcel source) {return new IssueEventAdapterModel(source);}
@Override public IssueEventAdapterModel[] newArray(int size) {return new IssueEventAdapterModel[size];}
};
}
| 2,215 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
CreateIssueModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/CreateIssueModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 19 Feb 2017, 12:13 PM
*/
@Getter @Setter @NoArgsConstructor
public class CreateIssueModel implements Parcelable {
private String title;
private String body;
private ArrayList<String> labels;
private ArrayList<String> assignees;
private Long milestone;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.title);
dest.writeString(this.body);
dest.writeStringList(this.labels);
dest.writeStringList(this.assignees);
dest.writeValue(this.milestone);
}
protected CreateIssueModel(Parcel in) {
this.title = in.readString();
this.body = in.readString();
this.labels = in.createStringArrayList();
this.assignees = in.createStringArrayList();
this.milestone = (Long) in.readValue(Long.class.getClassLoader());
}
public static final Creator<CreateIssueModel> CREATOR = new Creator<CreateIssueModel>() {
@Override public CreateIssueModel createFromParcel(Parcel source) {return new CreateIssueModel(source);}
@Override public CreateIssueModel[] newArray(int size) {return new CreateIssueModel[size];}
};
}
| 1,457 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AppLanguageModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/AppLanguageModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* Created by kosh on 20/07/2017.
*/
@Getter @Setter @AllArgsConstructor public class AppLanguageModel implements Parcelable {
private String value;
private String label;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.value);
dest.writeString(this.label);
}
private AppLanguageModel(Parcel in) {
this.value = in.readString();
this.label = in.readString();
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AppLanguageModel that = (AppLanguageModel) o;
return label != null ? label.equals(that.label) : that.label == null;
}
@Override public int hashCode() {
return label != null ? label.hashCode() : 0;
}
public static final Parcelable.Creator<AppLanguageModel> CREATOR = new Parcelable.Creator<AppLanguageModel>() {
@Override public AppLanguageModel createFromParcel(Parcel source) {return new AppLanguageModel(source);}
@Override public AppLanguageModel[] newArray(int size) {return new AppLanguageModel[size];}
};
}
| 1,418 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ReviewRequestModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/ReviewRequestModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
/**
* Created by Kosh on 24 Jun 2017, 4:15 PM
*/
@Getter @Setter public class ReviewRequestModel implements Parcelable {
public String commitId;
public String body;
public String event;
public List<CommentRequestModel> comments;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.commitId);
dest.writeString(this.body);
dest.writeString(this.event);
dest.writeTypedList(this.comments);
}
private ReviewRequestModel(Parcel in) {
this.commitId = in.readString();
this.body = in.readString();
this.event = in.readString();
this.comments = in.createTypedArrayList(CommentRequestModel.CREATOR);
}
public ReviewRequestModel() {
}
public static final Parcelable.Creator<ReviewRequestModel> CREATOR = new Parcelable.Creator<ReviewRequestModel>() {
@Override public ReviewRequestModel createFromParcel(Parcel source) {return new ReviewRequestModel(source);}
@Override public ReviewRequestModel[] newArray(int size) {return new ReviewRequestModel[size];}
};
}
| 1,338 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
TabsCountStateModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/TabsCountStateModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.DrawableRes;
import java.io.Serializable;
/**
* Created by Kosh on 27 Apr 2017, 6:10 PM
*/
public class TabsCountStateModel implements Parcelable, Serializable {
private int count;
private int tabIndex;
@DrawableRes private int drawableId;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public int getTabIndex() {
return tabIndex;
}
public void setTabIndex(int tabIndex) {
this.tabIndex = tabIndex;
}
public int getDrawableId() {
return drawableId;
}
public void setDrawableId(int drawableId) {
this.drawableId = drawableId;
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TabsCountStateModel model = (TabsCountStateModel) o;
return tabIndex == model.tabIndex;
}
@Override public int hashCode() {
return tabIndex;
}
public TabsCountStateModel() {}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.count);
dest.writeInt(this.tabIndex);
dest.writeInt(this.drawableId);
}
protected TabsCountStateModel(Parcel in) {
this.count = in.readInt();
this.tabIndex = in.readInt();
this.drawableId = in.readInt();
}
public static final Creator<TabsCountStateModel> CREATOR = new Creator<TabsCountStateModel>() {
@Override public TabsCountStateModel createFromParcel(Parcel source) {return new TabsCountStateModel(source);}
@Override public TabsCountStateModel[] newArray(int size) {return new TabsCountStateModel[size];}
};
}
| 1,931 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
GithubState.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/GithubState.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 08 Dec 2016, 8:57 PM
*/
@Getter @Setter @NoArgsConstructor
public class GithubState implements Parcelable {
private int additions;
private int deletions;
private int total;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.additions);
dest.writeInt(this.deletions);
dest.writeInt(this.total);
}
protected GithubState(Parcel in) {
this.additions = in.readInt();
this.deletions = in.readInt();
this.total = in.readInt();
}
public static final Creator<GithubState> CREATOR = new Creator<GithubState>() {
@Override public GithubState createFromParcel(Parcel source) {return new GithubState(source);}
@Override public GithubState[] newArray(int size) {return new GithubState[size];}
};
}
| 1,074 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
TopicsModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/TopicsModel.java | package com.fastaccess.data.dao;
import java.util.ArrayList;
/**
* Created by Kosh on 09 May 2017, 7:52 PM
*/
public class TopicsModel extends ArrayList<String> {}
| 169 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ReleasesAssetsListModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/ReleasesAssetsListModel.java | package com.fastaccess.data.dao;
import java.util.ArrayList;
/**
* Created by Kosh on 31 Dec 2016, 1:28 PM
*/
public class ReleasesAssetsListModel extends ArrayList<ReleasesAssetsModel> {}
| 194 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
Pageable.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/Pageable.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 15 Nov 2016, 7:04 PM
*/
@Getter @Setter @NoArgsConstructor
public class Pageable<M extends Parcelable> implements Parcelable {
public int first;
public int next;
public int prev;
public int last;
public int totalCount;
public boolean incompleteResults;
public List<M> items;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.first);
dest.writeInt(this.next);
dest.writeInt(this.prev);
dest.writeInt(this.last);
dest.writeInt(this.totalCount);
dest.writeByte(this.incompleteResults ? (byte) 1 : (byte) 0);
dest.writeTypedList(this.items);
}
@SuppressWarnings("WeakerAccess") protected Pageable(Parcel in) {
this.first = in.readInt();
this.next = in.readInt();
this.prev = in.readInt();
this.last = in.readInt();
this.totalCount = in.readInt();
this.incompleteResults = in.readByte() != 0;
in.readList(this.items, this.items.getClass().getClassLoader());
}
public static final Creator<Pageable> CREATOR = new Creator<Pageable>() {
@Override public Pageable createFromParcel(Parcel source) {return new Pageable(source);}
@Override public Pageable[] newArray(int size) {return new Pageable[size];}
};
}
| 1,596 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
RepoPermissionsModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/RepoPermissionsModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 03 Dec 2016, 11:12 AM
*/
@Getter @Setter @NoArgsConstructor
public class RepoPermissionsModel implements Parcelable {
boolean admin;
boolean push;
boolean pull;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeByte(this.admin ? (byte) 1 : (byte) 0);
dest.writeByte(this.push ? (byte) 1 : (byte) 0);
dest.writeByte(this.pull ? (byte) 1 : (byte) 0);
}
protected RepoPermissionsModel(Parcel in) {
this.admin = in.readByte() != 0;
this.push = in.readByte() != 0;
this.pull = in.readByte() != 0;
}
public static final Creator<RepoPermissionsModel> CREATOR = new Creator<RepoPermissionsModel>() {
@Override public RepoPermissionsModel createFromParcel(Parcel source) {return new RepoPermissionsModel(source);}
@Override public RepoPermissionsModel[] newArray(int size) {return new RepoPermissionsModel[size];}
};
}
| 1,193 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ReleasesAssetsModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/ReleasesAssetsModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.model.User;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
/**
* Created by Kosh on 31 Dec 2016, 1:28 PM
*/
@Getter @Setter public class ReleasesAssetsModel implements Parcelable {
private String url;
private String browserDownloadUrl;
private long id;
private String name;
private String label;
private String state;
private String contentType;
private int size;
private int downloadCount;
private Date createdAt;
private Date updatedAt;
private User uploader;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.url);
dest.writeString(this.browserDownloadUrl);
dest.writeLong(this.id);
dest.writeString(this.name);
dest.writeString(this.label);
dest.writeString(this.state);
dest.writeString(this.contentType);
dest.writeInt(this.size);
dest.writeInt(this.downloadCount);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeParcelable(this.uploader, flags);
}
public ReleasesAssetsModel() {}
@SuppressWarnings("WeakerAccess") protected ReleasesAssetsModel(Parcel in) {
this.url = in.readString();
this.browserDownloadUrl = in.readString();
this.id = in.readLong();
this.name = in.readString();
this.label = in.readString();
this.state = in.readString();
this.contentType = in.readString();
this.size = in.readInt();
this.downloadCount = in.readInt();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.uploader = in.readParcelable(User.class.getClassLoader());
}
public static final Creator<ReleasesAssetsModel> CREATOR = new Creator<ReleasesAssetsModel>() {
@Override public ReleasesAssetsModel createFromParcel(Parcel source) {return new ReleasesAssetsModel(source);}
@Override public ReleasesAssetsModel[] newArray(int size) {return new ReleasesAssetsModel[size];}
};
}
| 2,483 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
MilestoneModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/MilestoneModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.model.User;
import java.util.Date;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 08 Dec 2016, 8:47 PM
*/
@Getter @Setter @NoArgsConstructor
public class MilestoneModel implements Parcelable {
long id;
String url;
String title;
String state;
String description;
int number;
User creator;
String htmlUr;
int openIssues;
int closedIssues;
Date createdAt;
Date updatedAt;
Date closedAt;
Date dueOn;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeString(this.title);
dest.writeString(this.state);
dest.writeString(this.description);
dest.writeInt(this.number);
dest.writeParcelable(this.creator, flags);
dest.writeString(this.htmlUr);
dest.writeInt(this.openIssues);
dest.writeInt(this.closedIssues);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeLong(this.closedAt != null ? this.closedAt.getTime() : -1);
dest.writeLong(this.dueOn != null ? this.dueOn.getTime() : -1);
}
protected MilestoneModel(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
this.title = in.readString();
this.state = in.readString();
this.description = in.readString();
this.number = in.readInt();
this.creator = in.readParcelable(User.class.getClassLoader());
this.htmlUr = in.readString();
this.openIssues = in.readInt();
this.closedIssues = in.readInt();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
long tmpClosedAt = in.readLong();
this.closedAt = tmpClosedAt == -1 ? null : new Date(tmpClosedAt);
long tmpDueOn = in.readLong();
this.dueOn = tmpDueOn == -1 ? null : new Date(tmpDueOn);
}
public static final Creator<MilestoneModel> CREATOR = new Creator<MilestoneModel>() {
@Override public MilestoneModel createFromParcel(Parcel source) {return new MilestoneModel(source);}
@Override public MilestoneModel[] newArray(int size) {return new MilestoneModel[size];}
};
}
| 2,707 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
UsersListModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/UsersListModel.java | package com.fastaccess.data.dao;
import com.fastaccess.data.dao.model.User;
import java.util.ArrayList;
/**
* Created by Kosh on 12 Feb 2017, 1:33 PM
*/
public class UsersListModel extends ArrayList<User> {}
| 214 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
LabelListModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/LabelListModel.java | package com.fastaccess.data.dao;
import java.util.ArrayList;
/**
* Created by Kosh on 12 Feb 2017, 1:32 PM
*/
public class LabelListModel extends ArrayList<LabelModel> {}
| 176 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
CommitFileModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/CommitFileModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by Kosh on 01 Jan 2017, 9:00 PM
*/
public class CommitFileModel implements Parcelable {
private String sha;
private String filename;
private String status;
private int additions;
private int deletions;
private int changes;
private String blobUrl;
private String rawUrl;
private String contentsUrl;
private String patch;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.sha);
dest.writeString(this.filename);
dest.writeString(this.status);
dest.writeInt(this.additions);
dest.writeInt(this.deletions);
dest.writeInt(this.changes);
dest.writeString(this.blobUrl);
dest.writeString(this.rawUrl);
dest.writeString(this.contentsUrl);
dest.writeString(this.patch);
}
@SuppressWarnings("WeakerAccess") protected CommitFileModel(Parcel in) {
this.sha = in.readString();
this.filename = in.readString();
this.status = in.readString();
this.additions = in.readInt();
this.deletions = in.readInt();
this.changes = in.readInt();
this.blobUrl = in.readString();
this.rawUrl = in.readString();
this.contentsUrl = in.readString();
this.patch = in.readString();
}
public static final Creator<CommitFileModel> CREATOR = new Creator<CommitFileModel>() {
@Override public CommitFileModel createFromParcel(Parcel source) {return new CommitFileModel(source);}
@Override public CommitFileModel[] newArray(int size) {return new CommitFileModel[size];}
};
@Override public String toString() {
return "CommitFileModel{" +
"sha='" + sha + '\'' +
", filename='" + filename + '\'' +
", status='" + status + '\'' +
", additions=" + additions +
", deletions=" + deletions +
", changes=" + changes +
", blobUrl='" + blobUrl + '\'' +
", rawUrl='" + rawUrl + '\'' +
", contentsUrl='" + contentsUrl + '\'' +
", patch='" + patch + '\'' +
'}';
}
public String getSha() {
return sha;
}
public void setSha(String sha) {
this.sha = sha;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getAdditions() {
return additions;
}
public void setAdditions(int additions) {
this.additions = additions;
}
public int getDeletions() {
return deletions;
}
public void setDeletions(int deletions) {
this.deletions = deletions;
}
public int getChanges() {
return changes;
}
public void setChanges(int changes) {
this.changes = changes;
}
public String getBlobUrl() {
return blobUrl;
}
public void setBlobUrl(String blobUrl) {
this.blobUrl = blobUrl;
}
public String getRawUrl() {
return rawUrl;
}
public void setRawUrl(String rawUrl) {
this.rawUrl = rawUrl;
}
public String getContentsUrl() {
return contentsUrl;
}
public void setContentsUrl(String contentsUrl) {
this.contentsUrl = contentsUrl;
}
public String getPatch() {
return patch;
}
public void setPatch(String patch) {
this.patch = patch;
}
}
| 3,819 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
PayloadModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/PayloadModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.model.Comment;
import com.fastaccess.data.dao.model.Commit;
import com.fastaccess.data.dao.model.Gist;
import com.fastaccess.data.dao.model.Issue;
import com.fastaccess.data.dao.model.PullRequest;
import com.fastaccess.data.dao.model.Release;
import com.fastaccess.data.dao.model.Repo;
import com.fastaccess.data.dao.model.User;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 08 Feb 2017, 10:03 PM
*/
@Getter @Setter @NoArgsConstructor
public class PayloadModel implements Parcelable {
public String action;
public Repo forkee;
public Issue issue;
public PullRequest pullRequest;
public String refType;
public Comment comment;
public User target;
public User member;
public TeamsModel team;
public Comment commitComment;
public String description;
public ReleasesAssetsModel download;
public Gist gist;
public List<WikiModel> pages;
public String before;
public String head;
public String ref;
public int size;
public List<GitCommitModel> commits;
public User user;
public Release release;
public User blockedUser;
public User organization;
public User invitation;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.action);
dest.writeParcelable(this.forkee, flags);
dest.writeParcelable(this.issue, flags);
dest.writeParcelable(this.pullRequest, flags);
dest.writeString(this.refType);
dest.writeParcelable(this.comment, flags);
dest.writeParcelable(this.target, flags);
dest.writeParcelable(this.member, flags);
dest.writeParcelable(this.team, flags);
dest.writeParcelable(this.commitComment, flags);
dest.writeString(this.description);
dest.writeParcelable(this.download, flags);
dest.writeParcelable(this.gist, flags);
dest.writeTypedList(this.pages);
dest.writeString(this.before);
dest.writeString(this.head);
dest.writeString(this.ref);
dest.writeInt(this.size);
dest.writeTypedList(this.commits);
dest.writeParcelable(this.user, flags);
dest.writeParcelable(this.release, flags);
dest.writeParcelable(this.blockedUser, flags);
dest.writeParcelable(this.organization, flags);
dest.writeParcelable(this.invitation, flags);
}
protected PayloadModel(Parcel in) {
this.action = in.readString();
this.forkee = in.readParcelable(Repo.class.getClassLoader());
this.issue = in.readParcelable(Issue.class.getClassLoader());
this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader());
this.refType = in.readString();
this.comment = in.readParcelable(Comment.class.getClassLoader());
this.target = in.readParcelable(User.class.getClassLoader());
this.member = in.readParcelable(User.class.getClassLoader());
this.team = in.readParcelable(TeamsModel.class.getClassLoader());
this.commitComment = in.readParcelable(Comment.class.getClassLoader());
this.description = in.readString();
this.download = in.readParcelable(ReleasesAssetsModel.class.getClassLoader());
this.gist = in.readParcelable(Gist.class.getClassLoader());
this.pages = in.createTypedArrayList(WikiModel.CREATOR);
this.before = in.readString();
this.head = in.readString();
this.ref = in.readString();
this.size = in.readInt();
this.commits = in.createTypedArrayList(GitCommitModel.CREATOR);
this.user = in.readParcelable(User.class.getClassLoader());
this.release = in.readParcelable(Release.class.getClassLoader());
this.blockedUser = in.readParcelable(User.class.getClassLoader());
this.organization = in.readParcelable(User.class.getClassLoader());
this.invitation = in.readParcelable(User.class.getClassLoader());
}
public static final Creator<PayloadModel> CREATOR = new Creator<PayloadModel>() {
@Override public PayloadModel createFromParcel(Parcel source) {return new PayloadModel(source);}
@Override public PayloadModel[] newArray(int size) {return new PayloadModel[size];}
};
}
| 4,488 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
PostReactionModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/PostReactionModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 29 Mar 2017, 9:50 PM
*/
@Getter @Setter @NoArgsConstructor @AllArgsConstructor public class PostReactionModel implements Parcelable {
private String content;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {dest.writeString(this.content);}
private PostReactionModel(Parcel in) {this.content = in.readString();}
public static final Parcelable.Creator<PostReactionModel> CREATOR = new Parcelable.Creator<PostReactionModel>() {
@Override public PostReactionModel createFromParcel(Parcel source) {return new PostReactionModel(source);}
@Override public PostReactionModel[] newArray(int size) {return new PostReactionModel[size];}
};
}
| 974 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AuthModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/AuthModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 12 Mar 2017, 3:16 AM
*/
@Getter @Setter @NoArgsConstructor
public class AuthModel implements Parcelable {
private String clientId;
private String clientSecret;
private String redirectUri;
private List<String> scopes;
private String state;
private String note;
private String noteUrl;
@SerializedName("X-GitHub-OTP") private String otpCode;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.clientId);
dest.writeString(this.clientSecret);
dest.writeString(this.redirectUri);
dest.writeStringList(this.scopes);
dest.writeString(this.state);
dest.writeString(this.note);
dest.writeString(this.noteUrl);
dest.writeString(this.otpCode);
}
private AuthModel(Parcel in) {
this.clientId = in.readString();
this.clientSecret = in.readString();
this.redirectUri = in.readString();
this.scopes = in.createStringArrayList();
this.state = in.readString();
this.note = in.readString();
this.noteUrl = in.readString();
this.otpCode = in.readString();
}
public static final Creator<AuthModel> CREATOR = new Creator<AuthModel>() {
@Override public AuthModel createFromParcel(Parcel source) {return new AuthModel(source);}
@Override public AuthModel[] newArray(int size) {return new AuthModel[size];}
};
}
| 1,759 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
WikiModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/WikiModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.Getter;
import lombok.Setter;
/**
* Created by Kosh on 11 Jun 2017, 7:13 PM
*/
@Getter @Setter public class WikiModel implements Parcelable {
public String pageName;
public String title;
public String summary;
public String action;
public String sha;
public String htmlUrl;
public WikiModel() {}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.pageName);
dest.writeString(this.title);
dest.writeString(this.summary);
dest.writeString(this.action);
dest.writeString(this.sha);
dest.writeString(this.htmlUrl);
}
private WikiModel(Parcel in) {
this.pageName = in.readString();
this.title = in.readString();
this.summary = in.readString();
this.action = in.readString();
this.sha = in.readString();
this.htmlUrl = in.readString();
}
public static final Creator<WikiModel> CREATOR = new Creator<WikiModel>() {
@Override public WikiModel createFromParcel(Parcel source) {return new WikiModel(source);}
@Override public WikiModel[] newArray(int size) {return new WikiModel[size];}
};
}
| 1,353 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
SettingsModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/SettingsModel.java | package com.fastaccess.data.dao;
import androidx.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* Created by JediB on 5/12/2017.
*/
@Getter @Setter @AllArgsConstructor public class SettingsModel {
public static final int THEME = 0;
public static final int NOTIFICATION = 1;
public static final int BEHAVIOR = 2;
public static final int CUSTOMIZATION = 3;
public static final int BACKUP = 4;
public static final int LANGUAGE = 5;
public static final int CODE_THEME = 6;
@IntDef({
THEME,
NOTIFICATION,
CUSTOMIZATION,
BEHAVIOR,
BACKUP,
LANGUAGE,
CODE_THEME
})
@Retention(RetentionPolicy.SOURCE) public @interface SettingsType {}
private int image;
private String title;
@SettingsType private int settingsType;
}
| 994 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
GitCommitListModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/GitCommitListModel.java | package com.fastaccess.data.dao;
import java.util.ArrayList;
/**
* Created by Kosh on 12 Feb 2017, 12:14 AM
*/
public class GitCommitListModel extends ArrayList<GitCommitModel> {}
| 185 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
MarkdownModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/MarkdownModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 18 Feb 2017, 7:20 PM
*/
@Getter @Setter @NoArgsConstructor
public class MarkdownModel implements Parcelable {
private String text;
private String mode = "gfm";
private String context;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.text);
dest.writeString(this.mode);
dest.writeString(this.context);
}
@SuppressWarnings("WeakerAccess") protected MarkdownModel(Parcel in) {
this.text = in.readString();
this.mode = in.readString();
this.context = in.readString();
}
public static final Parcelable.Creator<MarkdownModel> CREATOR = new Parcelable.Creator<MarkdownModel>() {
@Override public MarkdownModel createFromParcel(Parcel source) {return new MarkdownModel(source);}
@Override public MarkdownModel[] newArray(int size) {return new MarkdownModel[size];}
};
}
| 1,157 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
CommitListModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/CommitListModel.java | package com.fastaccess.data.dao;
import com.fastaccess.data.dao.model.Commit;
import java.util.ArrayList;
/**
* Created by Kosh on 12 Feb 2017, 12:10 AM
*/
public class CommitListModel extends ArrayList<Commit> {}
| 220 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
NotificationSubscriptionBodyModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/NotificationSubscriptionBodyModel.java | package com.fastaccess.data.dao;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* Created by Hashemsergani on 14.10.17.
*/
@AllArgsConstructor @Getter @Setter public class NotificationSubscriptionBodyModel {
private Boolean subscribed;
private Boolean ignored;
}
| 311 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ProjectColumnModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/ProjectColumnModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Date;
/**
* Created by Hashemsergani on 11.09.17.
*/
public class ProjectColumnModel implements Parcelable {
private Long id;
private String name;
private String url;
private String projectUrl;
private String cardsUrl;
private Date createdAt;
private Date updatedAt;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getProjectUrl() {
return projectUrl;
}
public void setProjectUrl(String projectUrl) {
this.projectUrl = projectUrl;
}
public String getCardsUrl() {
return cardsUrl;
}
public void setCardsUrl(String cardsUrl) {
this.cardsUrl = cardsUrl;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public ProjectColumnModel() {}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeValue(this.id);
dest.writeString(this.name);
dest.writeString(this.url);
dest.writeString(this.projectUrl);
dest.writeString(this.cardsUrl);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
}
protected ProjectColumnModel(Parcel in) {
this.id = (Long) in.readValue(Long.class.getClassLoader());
this.name = in.readString();
this.url = in.readString();
this.projectUrl = in.readString();
this.cardsUrl = in.readString();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
}
public static final Creator<ProjectColumnModel> CREATOR = new Creator<ProjectColumnModel>() {
@Override public ProjectColumnModel createFromParcel(Parcel source) {return new ProjectColumnModel(source);}
@Override public ProjectColumnModel[] newArray(int size) {return new ProjectColumnModel[size];}
};
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProjectColumnModel that = (ProjectColumnModel) o;
return id != null ? id.equals(that.id) : that.id == null;
}
@Override public int hashCode() {
return id != null ? id.hashCode() : 0;
}
}
| 3,151 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
BranchesModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/BranchesModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.model.Commit;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 03 Mar 2017, 9:08 PM
*/
@Getter @Setter @NoArgsConstructor
public class BranchesModel implements Parcelable {
public String name;
public Commit commit;
@SerializedName("protected") public boolean protectedBranch;
public String protectionUrl;
public boolean isTag;
@Override public String toString() {
return name;
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.name);
dest.writeParcelable(this.commit, flags);
dest.writeByte(this.protectedBranch ? (byte) 1 : (byte) 0);
dest.writeString(this.protectionUrl);
dest.writeByte(this.isTag ? (byte) 1 : (byte) 0);
}
private BranchesModel(Parcel in) {
this.name = in.readString();
this.commit = in.readParcelable(Commit.class.getClassLoader());
this.protectedBranch = in.readByte() != 0;
this.protectionUrl = in.readString();
this.isTag = in.readByte() != 0;
}
public static final Creator<BranchesModel> CREATOR = new Creator<BranchesModel>() {
@Override public BranchesModel createFromParcel(Parcel source) {return new BranchesModel(source);}
@Override public BranchesModel[] newArray(int size) {return new BranchesModel[size];}
};
}
| 1,632 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
LabelModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/LabelModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 08 Dec 2016, 9:05 PM
*/
@Getter @Setter @NoArgsConstructor
public class LabelModel implements Parcelable {
String url;
String name;
String color;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.url);
dest.writeString(this.name);
dest.writeString(this.color);
}
protected LabelModel(Parcel in) {
this.url = in.readString();
this.name = in.readString();
this.color = in.readString();
}
public static final Creator<LabelModel> CREATOR = new Creator<LabelModel>() {
@Override public LabelModel createFromParcel(Parcel source) {return new LabelModel(source);}
@Override public LabelModel[] newArray(int size) {return new LabelModel[size];}
};
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LabelModel that = (LabelModel) o;
return name != null ? name.equals(that.name) : that.name == null;
}
@Override public int hashCode() {
return name != null ? name.hashCode() : 0;
}
@Override public String toString() {
return "LabelModel{" +
"url='" + url + '\'' +
", name='" + name + '\'' +
", color='" + color + '\'' +
'}';
}
}
| 1,635 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
CommentRequestModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/CommentRequestModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;
/**
* Created by Kosh on 20 Nov 2016, 10:40 AM
*/
@Getter @Setter public class CommentRequestModel implements Parcelable {
public String body;
@SerializedName("in_reply_to") public Long inReplyTo;
public String path;
public Integer position;
public Integer line;
public CommentRequestModel() {}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CommentRequestModel that = (CommentRequestModel) o;
return (path != null ? path.equals(that.path) : that.path == null) &&
(position != null ? position.equals(that.position) : that.position == null);
}
@Override public int hashCode() {
int result = path != null ? path.hashCode() : 0;
result = 31 * result + (position != null ? position.hashCode() : 0);
return result;
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.body);
dest.writeValue(this.inReplyTo);
dest.writeString(this.path);
dest.writeValue(this.position);
dest.writeValue(this.line);
}
@Override public String toString() {
return "CommentRequestModel{" +
"body='" + body + '\'' +
", inReplyTo=" + inReplyTo +
", path='" + path + '\'' +
", position=" + position +
", line=" + line +
'}';
}
private CommentRequestModel(Parcel in) {
this.body = in.readString();
this.inReplyTo = (Long) in.readValue(Long.class.getClassLoader());
this.path = in.readString();
this.position = (Integer) in.readValue(Integer.class.getClassLoader());
this.line = (Integer) in.readValue(Integer.class.getClassLoader());
}
public static final Creator<CommentRequestModel> CREATOR = new Creator<CommentRequestModel>() {
@Override public CommentRequestModel createFromParcel(Parcel source) {return new CommentRequestModel(source);}
@Override public CommentRequestModel[] newArray(int size) {return new CommentRequestModel[size];}
};
}
| 2,435 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ProjectCardModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/ProjectCardModel.java | package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.model.User;
import java.util.Date;
/**
* Created by Hashemsergani on 11.09.17.
*/
public class ProjectCardModel implements Parcelable {
private String url;
private String columnUrl;
private String contentUrl;
private Integer id;
private String note;
private User creator;
private Date createdAt;
private Date updatedAt;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getColumnUrl() {
return columnUrl;
}
public void setColumnUrl(String columnUrl) {
this.columnUrl = columnUrl;
}
public String getContentUrl() {
return contentUrl;
}
public void setContentUrl(String contentUrl) {
this.contentUrl = contentUrl;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public User getCreator() {
return creator;
}
public void setCreator(User creator) {
this.creator = creator;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public ProjectCardModel() {}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.url);
dest.writeString(this.columnUrl);
dest.writeString(this.contentUrl);
dest.writeValue(this.id);
dest.writeString(this.note);
dest.writeParcelable(this.creator, flags);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
}
protected ProjectCardModel(Parcel in) {
this.url = in.readString();
this.columnUrl = in.readString();
this.contentUrl = in.readString();
this.id = (Integer) in.readValue(Integer.class.getClassLoader());
this.note = in.readString();
this.creator = in.readParcelable(User.class.getClassLoader());
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
}
public static final Creator<ProjectCardModel> CREATOR = new Creator<ProjectCardModel>() {
@Override public ProjectCardModel createFromParcel(Parcel source) {return new ProjectCardModel(source);}
@Override public ProjectCardModel[] newArray(int size) {return new ProjectCardModel[size];}
};
}
| 3,108 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AssigneesRequestModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/AssigneesRequestModel.java | package com.fastaccess.data.dao;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 05 Mar 2017, 12:01 PM
*/
@Getter @Setter @NoArgsConstructor
public class AssigneesRequestModel {
private List<String> assignees;
private List<String> reviewers;
}
| 335 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
LicenseConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/LicenseConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.LicenseModel;
/**
* Created by Kosh on 15 Mar 2017, 8:33 PM
*/
public class LicenseConverter extends BaseConverter<LicenseModel> {
@Override protected Class<? extends LicenseModel> getTypeClass() {
return LicenseModel.class;
}
}
| 325 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
TeamConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/TeamConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.TeamsModel;
import com.fastaccess.data.dao.model.User;
/**
* Created by Kosh on 15 Mar 2017, 7:58 PM
*/
public class TeamConverter extends BaseConverter<TeamsModel> {
@Override protected Class<? extends TeamsModel> getTypeClass() {
return TeamsModel.class;
}
}
| 358 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
RepoConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/RepoConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.model.Repo;
/**
* Created by Kosh on 15 Mar 2017, 7:58 PM
*/
public class RepoConverter extends BaseConverter<Repo> {
@Override protected Class<? extends Repo> getTypeClass() {
return Repo.class;
}
}
| 297 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
CommitConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/CommitConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.model.Commit;
/**
* Created by Kosh on 15 Mar 2017, 7:58 PM
*/
public class CommitConverter extends BaseConverter<Commit> {
@Override protected Class<? extends Commit> getTypeClass() {
return Commit.class;
}
}
| 307 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
UserConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/UserConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.model.User;
/**
* Created by Kosh on 15 Mar 2017, 7:58 PM
*/
public class UserConverter extends BaseConverter<User> {
@Override protected Class<? extends User> getTypeClass() {
return User.class;
}
}
| 297 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
RenameConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/RenameConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.RenameModel;
/**
* Created by Kosh on 15 Mar 2017, 8:29 PM
*/
public class RenameConverter extends BaseConverter<RenameModel> {
@Override protected Class<? extends RenameModel> getTypeClass() {
return RenameModel.class;
}
}
| 320 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
NotificationSubjectConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/NotificationSubjectConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.NotificationSubjectModel;
/**
* Created by Kosh on 15 Mar 2017, 7:58 PM
*/
public class NotificationSubjectConverter extends BaseConverter<NotificationSubjectModel> {
@Override protected Class<? extends NotificationSubjectModel> getTypeClass() {
return NotificationSubjectModel.class;
}
}
| 386 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ReactionsConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/ReactionsConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.ReactionsModel;
/**
* Created by Kosh on 06 May 2017, 4:53 PM
*/
public class ReactionsConverter extends BaseConverter<ReactionsModel> {
@Override protected Class<? extends ReactionsModel> getTypeClass() {
return ReactionsModel.class;
}
}
| 335 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
TopicsConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/TopicsConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.TopicsModel;
/**
* Created by Kosh on 09 May 2017, 7:54 PM
*/
public class TopicsConverter extends BaseConverter<TopicsModel> {
@Override protected Class<? extends TopicsModel> getTypeClass() {
return TopicsModel.class;
}
}
| 320 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
GistConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/GistConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.model.Gist;
/**
* Created by Kosh on 15 Mar 2017, 8:30 PM
*/
public class GistConverter extends BaseConverter<Gist> {
@Override protected Class<? extends Gist> getTypeClass() {
return Gist.class;
}
}
| 296 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
CommitFilesConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/CommitFilesConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.CommitFileListModel;
/**
* Created by Kosh on 15 Mar 2017, 8:37 PM
*/
public class CommitFilesConverter extends BaseConverter<CommitFileListModel> {
@Override protected Class<? extends CommitFileListModel> getTypeClass() {
return CommitFileListModel.class;
}
}
| 357 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
PayloadConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/PayloadConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.PayloadModel;
/**
* Created by Kosh on 15 Mar 2017, 8:39 PM
*/
public class PayloadConverter extends BaseConverter<PayloadModel> {
@Override protected Class<? extends PayloadModel> getTypeClass() {
return PayloadModel.class;
}
}
| 325 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
CommitsConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/CommitsConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.CommitListModel;
/**
* Created by Kosh on 15 Mar 2017, 8:37 PM
*/
public class CommitsConverter extends BaseConverter<CommitListModel> {
@Override protected Class<? extends CommitListModel> getTypeClass() {
return CommitListModel.class;
}
}
| 337 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
RepoPermissionConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/RepoPermissionConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.RepoPermissionsModel;
/**
* Created by Kosh on 15 Mar 2017, 8:33 PM
*/
public class RepoPermissionConverter extends BaseConverter<RepoPermissionsModel> {
@Override protected Class<? extends RepoPermissionsModel> getTypeClass() {
return RepoPermissionsModel.class;
}
}
| 364 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
IssueConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/IssueConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.model.Issue;
/**
* Created by Kosh on 15 Mar 2017, 8:30 PM
*/
public class IssueConverter extends BaseConverter<Issue> {
@Override protected Class<? extends Issue> getTypeClass() {
return Issue.class;
}
}
| 301 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
GitHubFilesConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/GitHubFilesConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.GithubFileModel;
/**
* Created by Kosh on 15 Mar 2017, 8:21 PM
*/
public class GitHubFilesConverter extends BaseConverter<GithubFileModel> {
@Override protected Class<? extends GithubFileModel> getTypeClass() {
return GithubFileModel.class;
}
}
| 341 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
MilestoneConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/MilestoneConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.MilestoneModel;
/**
* Created by Kosh on 11 Feb 2017, 11:43 PM
*/
public class MilestoneConverter extends BaseConverter<MilestoneModel> {
@Override protected Class<? extends MilestoneModel> getTypeClass() {
return MilestoneModel.class;
}
}
| 337 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
UsersConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/UsersConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.UsersListModel;
/**
* Created by Kosh on 15 Mar 2017, 8:26 PM
*/
public class UsersConverter extends BaseConverter<UsersListModel> {
@Override protected Class<? extends UsersListModel> getTypeClass() {
return UsersListModel.class;
}
}
| 331 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
GitHubStateConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/GitHubStateConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.GithubState;
/**
* Created by Kosh on 15 Mar 2017, 8:41 PM
*/
public class GitHubStateConverter extends BaseConverter<GithubState> {
@Override protected Class<? extends GithubState> getTypeClass() {
return GithubState.class;
}
}
| 325 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
PullRequestConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/PullRequestConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.model.PullRequest;
/**
* Created by Kosh on 15 Mar 2017, 7:58 PM
*/
public class PullRequestConverter extends BaseConverter<PullRequest> {
@Override protected Class<? extends PullRequest> getTypeClass() {
return PullRequest.class;
}
}
| 332 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
LabelConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/LabelConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.LabelModel;
/**
* Created by Kosh on 15 Mar 2017, 8:30 PM
*/
public class LabelConverter extends BaseConverter<LabelModel> {
@Override protected Class<? extends LabelModel> getTypeClass() {
return LabelModel.class;
}
}
| 315 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ReleasesAssetsConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/ReleasesAssetsConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.ReleasesAssetsListModel;
/**
* Created by Kosh on 11 Feb 2017, 11:43 PM
*/
public class ReleasesAssetsConverter extends BaseConverter<ReleasesAssetsListModel> {
@Override protected Class<? extends ReleasesAssetsListModel> getTypeClass() {
return ReleasesAssetsListModel.class;
}
}
| 378 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
GitCommitConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/GitCommitConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.GitCommitModel;
/**
* Created by Kosh on 15 Mar 2017, 8:42 PM
*/
public class GitCommitConverter extends BaseConverter<GitCommitModel> {
@Override protected Class<? extends GitCommitModel> getTypeClass() {
return GitCommitModel.class;
}
}
| 335 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
BaseConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/BaseConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.provider.rest.RestProvider;
import io.requery.Converter;
/**
* Created by Kosh on 15 Mar 2017, 8:02 PM
*/
public abstract class BaseConverter<C> implements Converter<C, String> {
protected abstract Class<? extends C> getTypeClass();
@SuppressWarnings("unchecked") @Override public Class<C> getMappedType() {
return (Class<C>) getTypeClass();
}
@Override public Class<String> getPersistedType() {
return String.class;
}
@Override public Integer getPersistedSize() {
return null;
}
@Override public String convertToPersisted(C value) {
return RestProvider.gson.toJson(value);
}
@Override public C convertToMapped(Class<? extends C> type, String value) {
return RestProvider.gson.fromJson(value, type);
}
}
| 866 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
LabelsListConverter.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/converters/LabelsListConverter.java | package com.fastaccess.data.dao.converters;
import com.fastaccess.data.dao.LabelListModel;
/**
* Created by Kosh on 11 Feb 2017, 11:43 PM
*/
public class LabelsListConverter extends BaseConverter<LabelListModel> {
@Override protected Class<? extends LabelListModel> getTypeClass() {
return LabelListModel.class;
}
}
| 338 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
EventsType.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/EventsType.java | package com.fastaccess.data.dao.types;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import com.fastaccess.R;
public enum EventsType {
WatchEvent(R.string.starred, R.drawable.ic_star_filled),
CreateEvent(R.string.created_repo, R.drawable.ic_repo),
CommitCommentEvent(R.string.commented_on_commit, R.drawable.ic_comment),
DownloadEvent(R.string.downloaded, R.drawable.ic_download),
FollowEvent(R.string.followed, R.drawable.ic_add),
ForkEvent(R.string.forked, R.drawable.ic_fork),
GistEvent(R.string.created_gist, R.drawable.ic_gists),
GollumEvent(R.string.gollum, R.drawable.ic_info_outline),
IssueCommentEvent(R.string.commented_on_issue, R.drawable.ic_comment),
IssuesEvent(R.string.created_issue, R.drawable.ic_issues),
MemberEvent(R.string.member, R.drawable.ic_add),
PublicEvent(R.string.public_event, R.drawable.ic_repo),
PullRequestEvent(R.string.pull_request, R.drawable.ic_pull_requests),
PullRequestReviewCommentEvent(R.string.pr_comment_review, R.drawable.ic_comment),
PullRequestReviewEvent(R.string.pr_review_event, R.drawable.ic_eye),
RepositoryEvent(R.string.repo_event, R.drawable.ic_repo),
PushEvent(R.string.pushed, R.drawable.ic_push),
TeamAddEvent(R.string.team_event, R.drawable.ic_profile),
DeleteEvent(R.string.deleted, R.drawable.ic_trash),
ReleaseEvent(R.string.released, R.drawable.ic_download),
ForkApplyEvent(R.string.forked, R.drawable.ic_fork),
OrgBlockEvent(R.string.organization_event, R.drawable.ic_profile),
ProjectCardEvent(R.string.card_event, R.drawable.ic_info_outline),
ProjectColumnEvent(R.string.project_event, R.drawable.ic_info_outline),
OrganizationEvent(R.string.organization_event, R.drawable.ic_profile),
ProjectEvent(R.string.project_event, R.drawable.ic_info_outline);
@StringRes int type;
@DrawableRes int drawableRes;
EventsType(@StringRes int type, @DrawableRes int drawableRes) {
this.type = type;
this.drawableRes = drawableRes;
}
@DrawableRes public int getDrawableRes() {
return drawableRes > 0 ? drawableRes : R.drawable.ic_info_outline;
}
@StringRes public int getType() {
return type > 0 ? type : R.string.unknown;
}
} | 2,285 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ReviewStateType.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/ReviewStateType.java | package com.fastaccess.data.dao.types;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import com.annimon.stream.Stream;
import com.fastaccess.R;
/**
* Created by Kosh on 10 Apr 2017, 4:27 PM
*/
public enum ReviewStateType {
COMMENTED(R.string.reviewed, R.drawable.ic_eye),
CHANGES_REQUESTED(R.string.request_changes, R.drawable.ic_clear),
REQUEST_CHANGES(R.string.reviewed, R.drawable.ic_eye),
DISMISSED(R.string.dismissed_review, R.drawable.ic_clear),
APPROVED(R.string.approved_these_changes, R.drawable.ic_done),
APPROVE(R.string.approved_these_changes, R.drawable.ic_done);
private int stringRes;
private int drawableRes;
ReviewStateType(@StringRes int stringRes, @DrawableRes int drawableRes) {
this.stringRes = stringRes;
this.drawableRes = drawableRes;
}
@StringRes public int getStringRes() {
return stringRes > 0 ? stringRes : R.string.reviewed;
}
@DrawableRes public int getDrawableRes() {
return drawableRes > 0 ? drawableRes : R.drawable.ic_eye;
}
@Nullable public static ReviewStateType getType(@NonNull String state) {
return Stream.of(values())
.filter(value -> value.name().toLowerCase().equalsIgnoreCase(state.toLowerCase()))
.findFirst()
.orElse(null);
}
}
| 1,442 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
NotificationType.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/NotificationType.java | package com.fastaccess.data.dao.types;
import com.fastaccess.R;
/**
* Created by Kosh on 19 Apr 2017, 7:57 PM
*/
public enum NotificationType {
PullRequest(R.drawable.ic_pull_requests),
Issue(R.drawable.ic_issues),
Commit(R.drawable.ic_push);
int drawableRes;
NotificationType(int drawableRes) {
this.drawableRes = drawableRes;
}
public int getDrawableRes() {
return drawableRes > 0 ? drawableRes : R.drawable.ic_issues;
}
}
| 481 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
IssueState.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/IssueState.java | package com.fastaccess.data.dao.types;
import androidx.annotation.StringRes;
import com.fastaccess.R;
public enum IssueState {
open(R.string.opened),
closed(R.string.closed),
all(R.string.all);
int status;
IssueState(@StringRes int status) {
this.status = status;
}
@StringRes public int getStatus() {
return status;
}
} | 374 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ReactionTypes.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/ReactionTypes.java | package com.fastaccess.data.dao.types;
import androidx.annotation.IdRes;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import com.fastaccess.R;
/**
* Created by Kosh on 29 Mar 2017, 10:11 PM
*/
public enum ReactionTypes {
HEART("heart", R.id.heart, R.id.heartReaction),
HOORAY("hooray", R.id.hurray, R.id.hurrayReaction),
PLUS_ONE("thumbs_up", R.id.thumbsUp, R.id.thumbsUpReaction),
MINUS_ONE("thumbs_down", R.id.thumbsDown, R.id.thumbsDownReaction),
CONFUSED("confused", R.id.sad, R.id.sadReaction),
LAUGH("laugh", R.id.laugh, R.id.laughReaction),
ROCKET("rocket", R.id.rocket, R.id.rocketReaction),
EYES("eyes", R.id.eyes, R.id.eyeReaction);
private String content;
private int vId;
private int secondaryViewId;
ReactionTypes(String content, int vId, int secondaryViewId) {
this.content = content;
this.vId = vId;
this.secondaryViewId = secondaryViewId;
}
public String getContent() {
return content;
}
public String getPostContent() {
if (this == PLUS_ONE) {
return "+1";
} else if (this == MINUS_ONE) {
return "-1";
} else {
return getContent();
}
}
@IdRes public int getvId() {
return vId;
}
@Nullable public static ReactionTypes get(@IdRes int vId) {
return Stream.of(values())
.filter(value -> value.getvId() == vId || value.secondaryViewId == vId)
.findFirst()
.orElse(null);
}
}
| 1,574 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
MyIssuesType.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/MyIssuesType.java | package com.fastaccess.data.dao.types;
/**
* Created by Kosh on 30 Apr 2017, 1:03 PM
*/
public enum MyIssuesType {
CREATED,
ASSIGNED,
MENTIONED,
REVIEW,
PARTICIPATED
}
| 192 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
GitEntryType.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/GitEntryType.java | package com.fastaccess.data.dao.types;
public enum GitEntryType {
commit,
tree,
blob
} | 99 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
IssueEventType.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/IssueEventType.java | package com.fastaccess.data.dao.types;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import com.fastaccess.R;
import com.google.gson.annotations.SerializedName;
public enum IssueEventType {
assigned(R.drawable.ic_profile),
closed(R.drawable.ic_issue_closed),
commented(R.drawable.ic_comment),
committed(R.drawable.ic_push),
demilestoned(R.drawable.ic_milestone),
head_ref_deleted(R.drawable.ic_trash),
head_ref_restored(R.drawable.ic_redo),
labeled(R.drawable.ic_label),
locked(R.drawable.ic_lock),
mentioned(R.drawable.ic_at),
merged(R.drawable.ic_fork),
milestoned(R.drawable.ic_milestone),
referenced(R.drawable.ic_format_quote),
renamed(R.drawable.ic_edit),
reopened(R.drawable.ic_issue_opened),
subscribed(R.drawable.ic_subscribe),
unassigned(R.drawable.ic_profile),
unlabeled(R.drawable.ic_label),
unlocked(R.drawable.ic_unlock),
unsubscribed(R.drawable.ic_eye_off),
review_requested(R.drawable.ic_eye),
review_dismissed(R.drawable.ic_eye_off),
review_request_removed(R.drawable.ic_eye_off),
@SerializedName("cross-referenced")cross_referenced(R.drawable.ic_format_quote),
@SerializedName("line-commented")line_commented(R.drawable.ic_comment),
@SerializedName("commit-commented")commit_commented(R.drawable.ic_comment),
reviewed(R.drawable.ic_eye),
changes_requested(R.drawable.ic_eye),
added_to_project(R.drawable.ic_add),
GROUPED(R.drawable.ic_eye),
deployed(R.drawable.ic_rocket);
int iconResId;
IssueEventType(int iconResId) {this.iconResId = iconResId;}
public int getIconResId() {
return iconResId == 0 ? R.drawable.ic_label : iconResId;
}
@Nullable public static IssueEventType getType(@NonNull String type) {
return Stream.of(values())
.filter(value -> value.name().toLowerCase().equalsIgnoreCase(type.toLowerCase()
.replaceAll("-", "_")))
.findFirst()
.orElse(null);
}
} | 2,090 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
NotificationReason.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/NotificationReason.java | package com.fastaccess.data.dao.types;
public enum NotificationReason {
subscribed,
manual,
author,
comment,
mention,
team_mention,
state_change,
assign,
} | 188 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
StatusStateType.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/StatusStateType.java | package com.fastaccess.data.dao.types;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import com.fastaccess.R;
/**
* Created by Kosh on 10 Apr 2017, 3:41 AM
*/
public enum StatusStateType {
failure(R.drawable.ic_issues_small),
pending(R.drawable.ic_time_small),
success(R.drawable.ic_check_small),
error(R.drawable.ic_issues_small);
@DrawableRes private int drawableRes;
StatusStateType(@DrawableRes int drawableRes) {
this.drawableRes = drawableRes;
}
@DrawableRes public int getDrawableRes() {
return drawableRes;
}
@NonNull public static StatusStateType getState(@Nullable String status) {
return Stream.of(values())
.filter(value -> value.name().toLowerCase().equalsIgnoreCase(status))
.findFirst()
.orElse(pending);
}
}
| 951 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
FilesType.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/types/FilesType.java | package com.fastaccess.data.dao.types;
import androidx.annotation.DrawableRes;
import com.fastaccess.R;
/**
* Created by Kosh on 17 Feb 2017, 7:45 PM
*/
public enum FilesType {
file(R.drawable.ic_file_document),
dir(R.drawable.ic_folder),
blob(R.drawable.ic_file_document),
tree(R.drawable.ic_folder),
symlink(R.drawable.ic_submodule);
int icon;
FilesType(int icon) {
this.icon = icon;
}
@DrawableRes public int getIcon() {
return icon > 0 ? icon : R.drawable.ic_file_document;
}
}
| 547 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
ParentsModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/timeline/ParentsModel.java | package com.fastaccess.data.dao.timeline;
import android.os.Parcel;
import android.os.Parcelable;
import lombok.Getter;
import lombok.Setter;
@Getter @Setter public class ParentsModel implements Parcelable {
private String sha;
private String url;
private String htmlUrl;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.sha);
dest.writeString(this.url);
dest.writeString(this.htmlUrl);
}
public ParentsModel() {}
private ParentsModel(Parcel in) {
this.sha = in.readString();
this.url = in.readString();
this.htmlUrl = in.readString();
}
public static final Parcelable.Creator<ParentsModel> CREATOR = new Parcelable.Creator<ParentsModel>() {
@Override public ParentsModel createFromParcel(Parcel source) {return new ParentsModel(source);}
@Override public ParentsModel[] newArray(int size) {return new ParentsModel[size];}
};
} | 1,033 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
GenericEvent.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/timeline/GenericEvent.java | package com.fastaccess.data.dao.timeline;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.LabelModel;
import com.fastaccess.data.dao.MilestoneModel;
import com.fastaccess.data.dao.RenameModel;
import com.fastaccess.data.dao.TeamsModel;
import com.fastaccess.data.dao.model.Issue;
import com.fastaccess.data.dao.model.PullRequest;
import com.fastaccess.data.dao.model.User;
import com.fastaccess.data.dao.types.IssueEventType;
import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by kosh on 25/07/2017.
*/
@NoArgsConstructor @Getter @Setter public class GenericEvent implements Parcelable {
private long id;
private String url;
private String commitId;
private String commitUrl;
private String message;
private String sha;
private String htmlUrl;
private Date createdAt;
private User actor;
private User requestedReviewer;
private User reviewRequester;
private User assigner;
private User assignee;
private User author;
private User committer;
private LabelModel label;
private TeamsModel requestedTeam;
private MilestoneModel milestone;
private RenameModel rename;
private SourceModel source;
private Issue issue;
private PullRequest pullRequest;
private ParentsModel tree;
private List<ParentsModel> parents;
private IssueEventType event;
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeString(this.commitId);
dest.writeString(this.commitUrl);
dest.writeString(this.message);
dest.writeString(this.sha);
dest.writeString(this.htmlUrl);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeParcelable(this.actor, flags);
dest.writeParcelable(this.requestedReviewer, flags);
dest.writeParcelable(this.reviewRequester, flags);
dest.writeParcelable(this.assigner, flags);
dest.writeParcelable(this.assignee, flags);
dest.writeParcelable(this.author, flags);
dest.writeParcelable(this.committer, flags);
dest.writeParcelable(this.label, flags);
dest.writeParcelable(this.requestedTeam, flags);
dest.writeParcelable(this.milestone, flags);
dest.writeParcelable(this.rename, flags);
dest.writeParcelable(this.source, flags);
dest.writeParcelable(this.issue, flags);
dest.writeParcelable(this.pullRequest, flags);
dest.writeParcelable(this.tree, flags);
dest.writeTypedList(this.parents);
dest.writeInt(this.event == null ? -1 : this.event.ordinal());
}
private GenericEvent(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
this.commitId = in.readString();
this.commitUrl = in.readString();
this.message = in.readString();
this.sha = in.readString();
this.htmlUrl = in.readString();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
this.actor = in.readParcelable(User.class.getClassLoader());
this.requestedReviewer = in.readParcelable(User.class.getClassLoader());
this.reviewRequester = in.readParcelable(User.class.getClassLoader());
this.assigner = in.readParcelable(User.class.getClassLoader());
this.assignee = in.readParcelable(User.class.getClassLoader());
this.author = in.readParcelable(User.class.getClassLoader());
this.committer = in.readParcelable(User.class.getClassLoader());
this.label = in.readParcelable(LabelModel.class.getClassLoader());
this.requestedTeam = in.readParcelable(TeamsModel.class.getClassLoader());
this.milestone = in.readParcelable(MilestoneModel.class.getClassLoader());
this.rename = in.readParcelable(RenameModel.class.getClassLoader());
this.source = in.readParcelable(SourceModel.class.getClassLoader());
this.issue = in.readParcelable(Issue.class.getClassLoader());
this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader());
this.tree = in.readParcelable(ParentsModel.class.getClassLoader());
this.parents = in.createTypedArrayList(ParentsModel.CREATOR);
int tmpEvent = in.readInt();
this.event = tmpEvent == -1 ? null : IssueEventType.values()[tmpEvent];
}
public static final Creator<GenericEvent> CREATOR = new Creator<GenericEvent>() {
@Override public GenericEvent createFromParcel(Parcel source) {return new GenericEvent(source);}
@Override public GenericEvent[] newArray(int size) {return new GenericEvent[size];}
};
}
| 4,906 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
CommentEvent.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/timeline/CommentEvent.java | package com.fastaccess.data.dao.timeline;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.ReactionsModel;
import com.fastaccess.data.dao.model.Comment;
import com.fastaccess.data.dao.model.User;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
/**
* Created by Kosh on 16 Mar 2017, 7:24 PM
*/
@Getter @Setter public class CommentEvent implements Parcelable {
private long id;
private User user;
private String url;
private String body;
private String bodyHtml;
private String htmlUrl;
private Date createdAt;
private Date updatedAt;
private int position;
private int line;
private String path;
private String commitId;
private String repoId;
private String login;
private String gistId;
private String issueId;
private String pullRequestId;
private ReactionsModel reactions;
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Comment that = (Comment) o;
return id == that.getId();
}
@Override public int hashCode() {
return (int) (id ^ (id >>> 32));
}
public CommentEvent() {}
@Override public String toString() {
return "CommentEvent{" +
"id=" + id +
", user=" + user +
", url='" + url + '\'' +
", body='" + body + '\'' +
", bodyHtml='" + bodyHtml + '\'' +
", htmlUrl='" + htmlUrl + '\'' +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
", position=" + position +
", line=" + line +
", path='" + path + '\'' +
", commitId='" + commitId + '\'' +
", repoId='" + repoId + '\'' +
", login='" + login + '\'' +
", gistId='" + gistId + '\'' +
", issueId='" + issueId + '\'' +
", pullRequestId='" + pullRequestId + '\'' +
", reactions=" + reactions +
'}';
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeParcelable(this.user, flags);
dest.writeString(this.url);
dest.writeString(this.body);
dest.writeString(this.bodyHtml);
dest.writeString(this.htmlUrl);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeInt(this.position);
dest.writeInt(this.line);
dest.writeString(this.path);
dest.writeString(this.commitId);
dest.writeString(this.repoId);
dest.writeString(this.login);
dest.writeString(this.gistId);
dest.writeString(this.issueId);
dest.writeString(this.pullRequestId);
dest.writeParcelable(this.reactions, flags);
}
private CommentEvent(Parcel in) {
this.id = in.readLong();
this.user = in.readParcelable(User.class.getClassLoader());
this.url = in.readString();
this.body = in.readString();
this.bodyHtml = in.readString();
this.htmlUrl = in.readString();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.position = in.readInt();
this.line = in.readInt();
this.path = in.readString();
this.commitId = in.readString();
this.repoId = in.readString();
this.login = in.readString();
this.gistId = in.readString();
this.issueId = in.readString();
this.pullRequestId = in.readString();
this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader());
}
public static final Creator<CommentEvent> CREATOR = new Creator<CommentEvent>() {
@Override public CommentEvent createFromParcel(Parcel source) {return new CommentEvent(source);}
@Override public CommentEvent[] newArray(int size) {return new CommentEvent[size];}
};
}
| 4,364 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
PullRequestCommitModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/timeline/PullRequestCommitModel.java | package com.fastaccess.data.dao.timeline;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.model.Comment;
import java.util.List;
/**
* Created by kosh on 15/08/2017.
*/
public class PullRequestCommitModel implements Parcelable {
private String login;
private String path;
private int position;
private String commitId;
private List<Comment> comments;
private int line;
public int getLine() {
return line;
}
public void setLine(int line) {
this.line = line;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
public String getCommitId() {
return commitId;
}
public void setCommitId(String commitId) {
this.commitId = commitId;
}
public List<Comment> getComments() {
return comments;
}
public void setComments(List<Comment> comments) {
this.comments = comments;
}
public PullRequestCommitModel() {}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.login);
dest.writeString(this.path);
dest.writeInt(this.position);
dest.writeString(this.commitId);
dest.writeTypedList(this.comments);
dest.writeInt(this.line);
}
protected PullRequestCommitModel(Parcel in) {
this.login = in.readString();
this.path = in.readString();
this.position = in.readInt();
this.commitId = in.readString();
this.comments = in.createTypedArrayList(Comment.CREATOR);
this.line = in.readInt();
}
public static final Creator<PullRequestCommitModel> CREATOR = new Creator<PullRequestCommitModel>() {
@Override public PullRequestCommitModel createFromParcel(Parcel source) {return new PullRequestCommitModel(source);}
@Override public PullRequestCommitModel[] newArray(int size) {return new PullRequestCommitModel[size];}
};
}
| 2,368 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
SourceModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/timeline/SourceModel.java | package com.fastaccess.data.dao.timeline;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.data.dao.model.Commit;
import com.fastaccess.data.dao.model.Issue;
import com.fastaccess.data.dao.model.PullRequest;
import com.fastaccess.data.dao.model.Repo;
import lombok.Getter;
import lombok.Setter;
/**
* Created by kosh on 26/07/2017.
*/
@Getter @Setter public class SourceModel implements Parcelable {
private String type;
private Issue issue;
private PullRequest pullRequest;
private Commit commit;
private Repo repository;
public SourceModel() {}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.type);
dest.writeParcelable(this.issue, flags);
dest.writeParcelable(this.pullRequest, flags);
dest.writeParcelable(this.commit, flags);
dest.writeParcelable(this.repository, flags);
}
private SourceModel(Parcel in) {
this.type = in.readString();
this.issue = in.readParcelable(Issue.class.getClassLoader());
this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader());
this.commit = in.readParcelable(Commit.class.getClassLoader());
this.repository = in.readParcelable(Repo.class.getClassLoader());
}
public static final Creator<SourceModel> CREATOR = new Creator<SourceModel>() {
@Override public SourceModel createFromParcel(Parcel source) {return new SourceModel(source);}
@Override public SourceModel[] newArray(int size) {return new SourceModel[size];}
};
}
| 1,653 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AuthorModel.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/timeline/AuthorModel.java | package com.fastaccess.data.dao.timeline;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
@Getter @Setter public class AuthorModel implements Parcelable {
private String name;
private String email;
private Date date;
public AuthorModel() {}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.name);
dest.writeString(this.email);
dest.writeLong(this.date != null ? this.date.getTime() : -1);
}
private AuthorModel(Parcel in) {
this.name = in.readString();
this.email = in.readString();
long tmpDate = in.readLong();
this.date = tmpDate == -1 ? null : new Date(tmpDate);
}
public static final Creator<AuthorModel> CREATOR = new Creator<AuthorModel>() {
@Override public AuthorModel createFromParcel(Parcel source) {return new AuthorModel(source);}
@Override public AuthorModel[] newArray(int size) {return new AuthorModel[size];}
};
} | 1,120 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractViewerFile.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractViewerFile.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.helper.RxHelper;
import io.requery.Column;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import lombok.NoArgsConstructor;
import io.reactivex.Observable;import io.reactivex.Single;
/**
* Created by Kosh on 06 Dec 2016, 10:42 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractViewerFile implements Parcelable {
@Key @Generated long id;
boolean markdown;
String content;
@Column(unique = true) String fullUrl;
boolean repo;
public Single<ViewerFile> save(ViewerFile modelEntity) {
return RxHelper.getSingle(App.getInstance().getDataStore()
.delete(ViewerFile.class)
.where(ViewerFile.FULL_URL.eq(modelEntity.getFullUrl()))
.get()
.single()
.flatMap(i -> App.getInstance().getDataStore().insert(modelEntity)));
}
public static Observable<ViewerFile> get(@NonNull String url) {
return App.getInstance()
.getDataStore()
.select(ViewerFile.class)
.where(ViewerFile.FULL_URL.equal(url))
.get()
.observable();
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeByte(this.markdown ? (byte) 1 : (byte) 0);
dest.writeString(this.content);
dest.writeString(this.fullUrl);
dest.writeByte(this.repo ? (byte) 1 : (byte) 0);
}
protected AbstractViewerFile(Parcel in) {
this.id = in.readLong();
this.markdown = in.readByte() != 0;
this.content = in.readString();
this.fullUrl = in.readString();
this.repo = in.readByte() != 0;
}
public static final Creator<ViewerFile> CREATOR = new Creator<ViewerFile>() {
@Override public ViewerFile createFromParcel(Parcel source) {return new ViewerFile(source);}
@Override public ViewerFile[] newArray(int size) {return new ViewerFile[size];}
};
}
| 2,245 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractPinnedRepos.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedRepos.java | package com.fastaccess.data.dao.model;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.data.dao.converters.RepoConverter;
import com.fastaccess.helper.Logger;
import com.fastaccess.helper.RxHelper;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Column;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import io.requery.Persistable;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.PinnedRepos.ENTRY_COUNT;
import static com.fastaccess.data.dao.model.PinnedRepos.ID;
import static com.fastaccess.data.dao.model.PinnedRepos.LOGIN;
import static com.fastaccess.data.dao.model.PinnedRepos.REPO_FULL_NAME;
/**
* Created by Kosh on 25 Mar 2017, 7:29 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractPinnedRepos implements Parcelable {
@Key @Generated long id;
@Column(unique = false) String repoFullName;
@Convert(RepoConverter.class) Repo pinnedRepo;
@io.requery.Nullable int entryCount;
@io.requery.Nullable String login;
public static Single<PinnedRepos> update(@NonNull PinnedRepos entity) {
return RxHelper.getSingle(App.getInstance().getDataStore().update(entity));
}
public static boolean pinUpin(@NonNull Repo repo) {
PinnedRepos pinnedRepos = get(repo.getFullName());
if (pinnedRepos == null) {
PinnedRepos pinned = new PinnedRepos();
pinned.setRepoFullName(repo.getFullName());
pinned.setLogin(Login.getUser().getLogin());
pinned.setPinnedRepo(repo);
try {
App.getInstance().getDataStore().toBlocking().insert(pinned);
return true;
} catch (Exception ignored) {}
return false;
} else {
delete(pinnedRepos.getId());
return false;
}
}
@Nullable public static PinnedRepos get(long id) {
return App.getInstance().getDataStore().select(PinnedRepos.class)
.where(ID.eq(id))
.get()
.firstOrNull();
}
@Nullable public static PinnedRepos get(@NonNull String repoFullName) {
return App.getInstance().getDataStore().toBlocking().select(PinnedRepos.class)
.where(REPO_FULL_NAME.eq(repoFullName).and(LOGIN.eq(Login.getUser().getLogin()))
.or(REPO_FULL_NAME.eq(repoFullName)))
.get()
.firstOrNull();
}
public static boolean isPinned(@NonNull String repoFullName) {
return get(repoFullName) != null;
}
@NonNull public static Disposable updateEntry(@NonNull String repoFullName) {
return RxHelper.getObservable(Observable.fromPublisher(e -> {
PinnedRepos pinned = get(repoFullName);
if (pinned != null) {
pinned.setEntryCount(pinned.getEntryCount() + 1);
App.getInstance().getDataStore().toBlocking().update(pinned);
e.onNext("");
}
e.onComplete();
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
@NonNull public static Single<List<PinnedRepos>> getMyPinnedRepos() {
return App.getInstance().getDataStore().select(PinnedRepos.class)
.where(LOGIN.eq(Login.getUser().getLogin())
.or(LOGIN.isNull()))
.orderBy(ENTRY_COUNT.desc(), ID.desc())
.get()
.observable()
.toList();
}
@NonNull public static Observable<List<PinnedRepos>> getMenuRepos() {
return App.getInstance().getDataStore().select(PinnedRepos.class)
.where(LOGIN.eq(Login.getUser().getLogin()))
.orderBy(ENTRY_COUNT.desc(), ID.desc())
.limit(5)
.get()
.observable()
.toList()
.toObservable();
}
public static void migrateToVersion4() {
RxHelper.getObservable(Observable.fromPublisher(e -> {
try {
Login login = Login.getUser();
if (login == null) {
e.onComplete();
return;
}
BlockingEntityStore<Persistable> reactiveEntityStore = App.getInstance().getDataStore().toBlocking();
List<PinnedRepos> pinnedRepos = reactiveEntityStore.select(PinnedRepos.class)
.where(LOGIN.isNull())
.get()
.toList();
if (pinnedRepos != null) {
for (PinnedRepos pinnedRepo : pinnedRepos) {
pinnedRepo.setRepoFullName(login.getLogin());
reactiveEntityStore.update(pinnedRepo);
}
}
Logger.e("Hello");
} catch (Exception ignored) {
e.onError(ignored);
}
e.onComplete();
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
public static void delete(long id) {
App.getInstance().getDataStore().delete(PinnedRepos.class)
.where(ID.eq(id))
.get()
.value();
}
}
| 5,506 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractPullRequest.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractPullRequest.java | package com.fastaccess.data.dao.model;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.R;
import com.fastaccess.data.dao.LabelListModel;
import com.fastaccess.data.dao.MilestoneModel;
import com.fastaccess.data.dao.PullsIssuesParser;
import com.fastaccess.data.dao.ReactionsModel;
import com.fastaccess.data.dao.UsersListModel;
import com.fastaccess.data.dao.converters.CommitConverter;
import com.fastaccess.data.dao.converters.LabelsListConverter;
import com.fastaccess.data.dao.converters.MilestoneConverter;
import com.fastaccess.data.dao.converters.PullRequestConverter;
import com.fastaccess.data.dao.converters.ReactionsConverter;
import com.fastaccess.data.dao.converters.UserConverter;
import com.fastaccess.data.dao.converters.UsersConverter;
import com.fastaccess.data.dao.types.IssueState;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.helper.ParseDateFormat;
import com.fastaccess.helper.RxHelper;
import com.fastaccess.ui.widgets.SpannableBuilder;
import java.util.Date;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Column;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Persistable;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.PullRequest.ID;
import static com.fastaccess.data.dao.model.PullRequest.LOGIN;
import static com.fastaccess.data.dao.model.PullRequest.NUMBER;
import static com.fastaccess.data.dao.model.PullRequest.REPO_ID;
import static com.fastaccess.data.dao.model.PullRequest.STATE;
import static com.fastaccess.data.dao.model.PullRequest.UPDATED_AT;
/**
* Created by Kosh on 16 Mar 2017, 7:39 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractPullRequest implements Parcelable {
@Key long id;
String url;
String body;
String title;
int comments;
int number;
boolean locked;
boolean mergable;
boolean merged;
boolean mergeable;
int commits;
int additions;
int deletions;
IssueState state;
String bodyHtml;
String htmlUrl;
Date closedAt;
Date createdAt;
Date updatedAt;
int changedFiles;
String diffUrl;
String patchUrl;
String mergeCommitSha;
Date mergedAt;
String mergeState;
int reviewComments;
String repoId;
String login;
String mergeableState;
@Convert(UsersConverter.class) UsersListModel assignees;
@Convert(UserConverter.class) User mergedBy;
@Convert(UserConverter.class) User closedBy;
@Column(name = "user_column") @Convert(UserConverter.class) User user;
@Convert(UserConverter.class) User assignee;
@Convert(LabelsListConverter.class) LabelListModel labels;
@Convert(MilestoneConverter.class) MilestoneModel milestone;
@Convert(CommitConverter.class) Commit base;
@Convert(CommitConverter.class) Commit head;
@Convert(PullRequestConverter.class) PullRequest pullRequest;
@Convert(ReactionsConverter.class) ReactionsModel reactions;
public Single<PullRequest> save(PullRequest entity) {
return RxHelper.getSingle(App.getInstance().getDataStore()
.delete(PullRequest.class)
.where(PullRequest.ID.eq(entity.getId()))
.get()
.single()
.flatMap(observer -> App.getInstance().getDataStore().insert(entity)));
}
public static Disposable save(@NonNull List<PullRequest> models, @NonNull String repoId, @NonNull String login) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(PullRequest.class)
.where(REPO_ID.equal(repoId)
.and(LOGIN.equal(login)))
.get()
.value();
if (!models.isEmpty()) {
for (PullRequest pullRequest : models) {
dataSource.delete(PullRequest.class).where(PullRequest.ID.eq(pullRequest.getId())).get().value();
pullRequest.setRepoId(repoId);
pullRequest.setLogin(login);
dataSource.insert(pullRequest);
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Single<List<PullRequest>> getPullRequests(@NonNull String repoId, @NonNull String login,
@NonNull IssueState issueState) {
return App.getInstance().getDataStore()
.select(PullRequest.class)
.where(REPO_ID.equal(repoId)
.and(LOGIN.equal(login))
.and(STATE.equal(issueState)))
.orderBy(UPDATED_AT.desc())
.get()
.observable()
.toList();
}
public static Observable<PullRequest> getPullRequestById(long id) {
return App.getInstance().getDataStore()
.select(PullRequest.class)
.where(ID.eq(id))
.get()
.observable();
}
public static Observable<PullRequest> getPullRequestByNumber(int number, @NonNull String repoId, @NonNull String login) {
return App.getInstance().getDataStore()
.select(PullRequest.class)
.where(REPO_ID.equal(repoId)
.and(LOGIN.equal(login))
.and(NUMBER.equal(number)))
.get()
.observable();
}
@NonNull public static SpannableBuilder getMergeBy(@NonNull PullRequest pullRequest, @NonNull Context context, boolean showRepoName) {
boolean isMerge = pullRequest.isMerged() || !InputHelper.isEmpty(pullRequest.mergedAt);
if (isMerge) {
User merger = pullRequest.getMergedBy();
SpannableBuilder builder = SpannableBuilder.builder();
if (showRepoName) {
PullsIssuesParser parser = PullsIssuesParser.getForPullRequest(pullRequest.getHtmlUrl());
if (parser != null)
builder.bold(parser.getLogin())
.append("/")
.bold(parser.getRepoId())
.append(" ")
.bold("#").bold(String.valueOf(pullRequest.getNumber()))
.append(" ");
} else {
builder.bold("#" + pullRequest.getNumber())
.append(" ")
.append(merger != null ? merger.getLogin() + " " : "");
}
builder.append(context.getString(R.string.merged).toLowerCase())
.append(" ");
if (pullRequest.getHead() != null) {
builder.bold(pullRequest.getHead().getRef())
.append(" ")
.append(context.getString(R.string.to))
.append(" ")
.bold(pullRequest.getBase().getRef())
.append(" ");
}
builder.append(ParseDateFormat.getTimeAgo(pullRequest.getMergedAt()));
return builder;
} else {
User user = pullRequest.getUser();
String status = context.getString(pullRequest.getState().getStatus());
SpannableBuilder builder = SpannableBuilder.builder();
if (showRepoName) {
PullsIssuesParser parser = PullsIssuesParser.getForPullRequest(pullRequest.getHtmlUrl());
if (parser != null) {
builder.bold(parser.getLogin())
.append("/")
.bold(parser.getRepoId())
.append(" ")
.bold("#").bold(String.valueOf(pullRequest.getNumber()))
.append(" ");
}
} else {
builder.bold("#" + pullRequest.getNumber())
.append(" ")
.append(user.getLogin())
.append(" ");
}
if (pullRequest.getState() == IssueState.open && pullRequest.getHead() != null && pullRequest.getBase() != null) {
return builder
.append(context.getString(R.string.want_to_merge))
.append(" ")
.bold(pullRequest.getHead().getRef())
.append(" ")
.append(context.getString(R.string.to))
.append(" ")
.bold(pullRequest.getBase().getRef())
.append(" ")
.append(ParseDateFormat.getTimeAgo(pullRequest.getState() == IssueState.closed
? pullRequest.getClosedAt() : pullRequest.getCreatedAt()));
} else {
return builder
.bold(status.toLowerCase())
.append(" ")
.bold(pullRequest.getHead() != null ? pullRequest.getHead().getRef() : "")
.append(" ")
.append(ParseDateFormat.getTimeAgo(pullRequest.getState() == IssueState.closed
? pullRequest.getClosedAt() : pullRequest.getCreatedAt()));
}
}
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeString(this.body);
dest.writeString(this.title);
dest.writeInt(this.comments);
dest.writeInt(this.number);
dest.writeByte(this.locked ? (byte) 1 : (byte) 0);
dest.writeByte(this.mergable ? (byte) 1 : (byte) 0);
dest.writeByte(this.merged ? (byte) 1 : (byte) 0);
dest.writeByte(this.mergeable ? (byte) 1 : (byte) 0);
dest.writeInt(this.commits);
dest.writeInt(this.additions);
dest.writeInt(this.deletions);
dest.writeInt(this.state == null ? -1 : this.state.ordinal());
dest.writeString(this.bodyHtml);
dest.writeString(this.htmlUrl);
dest.writeLong(this.closedAt != null ? this.closedAt.getTime() : -1);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeInt(this.changedFiles);
dest.writeString(this.diffUrl);
dest.writeString(this.patchUrl);
dest.writeString(this.mergeCommitSha);
dest.writeLong(this.mergedAt != null ? this.mergedAt.getTime() : -1);
dest.writeString(this.mergeState);
dest.writeInt(this.reviewComments);
dest.writeString(this.repoId);
dest.writeString(this.login);
dest.writeString(this.mergeableState);
dest.writeList(this.assignees);
dest.writeParcelable(this.mergedBy, flags);
dest.writeParcelable(this.closedBy, flags);
dest.writeParcelable(this.user, flags);
dest.writeParcelable(this.assignee, flags);
dest.writeList(this.labels);
dest.writeParcelable(this.milestone, flags);
dest.writeParcelable(this.base, flags);
dest.writeParcelable(this.head, flags);
dest.writeParcelable(this.pullRequest, flags);
dest.writeParcelable(this.reactions, flags);
}
protected AbstractPullRequest(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
this.body = in.readString();
this.title = in.readString();
this.comments = in.readInt();
this.number = in.readInt();
this.locked = in.readByte() != 0;
this.mergable = in.readByte() != 0;
this.merged = in.readByte() != 0;
this.mergeable = in.readByte() != 0;
this.commits = in.readInt();
this.additions = in.readInt();
this.deletions = in.readInt();
int tmpState = in.readInt();
this.state = tmpState == -1 ? null : IssueState.values()[tmpState];
this.bodyHtml = in.readString();
this.htmlUrl = in.readString();
long tmpClosedAt = in.readLong();
this.closedAt = tmpClosedAt == -1 ? null : new Date(tmpClosedAt);
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.changedFiles = in.readInt();
this.diffUrl = in.readString();
this.patchUrl = in.readString();
this.mergeCommitSha = in.readString();
long tmpMergedAt = in.readLong();
this.mergedAt = tmpMergedAt == -1 ? null : new Date(tmpMergedAt);
this.mergeState = in.readString();
this.reviewComments = in.readInt();
this.repoId = in.readString();
this.login = in.readString();
this.mergeableState = in.readString();
this.assignees = new UsersListModel();
in.readList(this.assignees, this.assignees.getClass().getClassLoader());
this.mergedBy = in.readParcelable(User.class.getClassLoader());
this.closedBy = in.readParcelable(User.class.getClassLoader());
this.user = in.readParcelable(User.class.getClassLoader());
this.assignee = in.readParcelable(User.class.getClassLoader());
this.labels = new LabelListModel();
in.readList(this.labels, this.labels.getClass().getClassLoader());
this.milestone = in.readParcelable(MilestoneModel.class.getClassLoader());
this.base = in.readParcelable(Commit.class.getClassLoader());
this.head = in.readParcelable(Commit.class.getClassLoader());
this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader());
this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader());
}
public static final Creator<PullRequest> CREATOR = new Creator<PullRequest>() {
@Override public PullRequest createFromParcel(Parcel source) {return new PullRequest(source);}
@Override public PullRequest[] newArray(int size) {return new PullRequest[size];}
};
}
| 14,858 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractNotificationQueue.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotificationQueue.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.helper.RxHelper;
import java.util.Date;
import java.util.List;
import io.reactivex.Observable;
import io.requery.BlockingEntityStore;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Persistable;
import lombok.NoArgsConstructor;
/**
* Created by Kosh on 03.11.17.
*/
@Entity @NoArgsConstructor public abstract class AbstractNotificationQueue implements Parcelable {
@Key long notificationId;
Date date;
public static boolean exists(long notificationId) {
return App.getInstance().getDataStore().toBlocking().select(NotificationQueue.class)
.where(NotificationQueue.NOTIFICATION_ID.eq(notificationId))
.get().firstOrNull() != null;
}
public static Observable<Boolean> put(@Nullable List<Notification> models) {
if (models == null || models.isEmpty()) {
return Observable.empty();
}
return RxHelper.getObservable(Observable.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataStore = App.getInstance().getDataStore().toBlocking();
dataStore.delete(NotificationQueue.class).get().value();
for (Notification entity : models) {
NotificationQueue notificationQueue = new NotificationQueue();
notificationQueue.setNotificationId(entity.getId());
notificationQueue.setDate(entity.getUpdatedAt());
dataStore.insert(notificationQueue);
}
s.onNext(true);
} catch (Exception e) {
e.printStackTrace();
s.onError(e);
}
s.onComplete();
}));
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.notificationId);
dest.writeLong(this.date != null ? this.date.getTime() : -1);
}
protected AbstractNotificationQueue(Parcel in) {
this.notificationId = in.readLong();
long tmpDate = in.readLong();
this.date = tmpDate == -1 ? null : new Date(tmpDate);
}
public static final Parcelable.Creator<NotificationQueue> CREATOR = new Parcelable.Creator<NotificationQueue>() {
@Override public NotificationQueue createFromParcel(Parcel source) {return new NotificationQueue(source);}
@Override public NotificationQueue[] newArray(int size) {return new NotificationQueue[size];}
};
}
| 2,696 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractGist.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractGist.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.annimon.stream.Collectors;
import com.annimon.stream.LongStream;
import com.annimon.stream.Stream;
import com.fastaccess.App;
import com.fastaccess.data.dao.FilesListModel;
import com.fastaccess.data.dao.GithubFileModel;
import com.fastaccess.data.dao.converters.GitHubFilesConverter;
import com.fastaccess.data.dao.converters.UserConverter;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.helper.RxHelper;
import com.fastaccess.ui.widgets.SpannableBuilder;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Column;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Persistable;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.Gist.ID;
import static com.fastaccess.data.dao.model.Gist.OWNER_NAME;
/**
* Created by Kosh on 16 Mar 2017, 7:32 PM
*/
@Entity() @NoArgsConstructor public abstract class AbstractGist implements Parcelable {
@SerializedName("nooope") @Key long id;
String url;
String forksUrl;
String commitsUrl;
String gitPullUrl;
String gitPushUrl;
String htmlUrl;
boolean publicX;
Date createdAt;
Date updatedAt;
String description;
int comments;
String commentsUrl;
boolean truncated;
String ownerName;
@SerializedName("id") String gistId;
@Convert(GitHubFilesConverter.class) GithubFileModel files;
@Column(name = "user_column") @Convert(UserConverter.class) User user;
@Convert(UserConverter.class) User owner;
public static Disposable save(@NonNull List<Gist> models, @NonNull String ownerName) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
Login login = Login.getUser();
if (login != null) {
if (login.getLogin().equalsIgnoreCase(ownerName)) {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(Gist.class)
.where(Gist.OWNER_NAME.equal(ownerName))
.get()
.value();
if (!models.isEmpty()) {
for (Gist gistModel : models) {
dataSource.delete(Gist.class).where(ID.eq(gistModel.getId())).get().value();
gistModel.setOwnerName(ownerName);
dataSource.insert(gistModel);
}
}
} else {
App.getInstance().getDataStore().toBlocking()
.delete(Gist.class)
.where(Gist.OWNER_NAME.notEqual(ownerName)
.or(OWNER_NAME.isNull()))
.get()
.value();
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
@NonNull public static Single<List<Gist>> getMyGists(@NonNull String ownerName) {
return App.getInstance()
.getDataStore()
.select(Gist.class)
.where(Gist.OWNER_NAME.equal(ownerName))
.get()
.observable()
.toList();
}
@NonNull public static Single<List<Gist>> getGists() {
return App.getInstance()
.getDataStore()
.select(Gist.class)
.where(Gist.OWNER_NAME.isNull())
.get()
.observable()
.toList();
}
public static Observable<Gist> getGist(@NonNull String gistId) {
return App.getInstance()
.getDataStore()
.select(Gist.class)
.where(Gist.GIST_ID.eq(gistId))
.get()
.observable();
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AbstractGist that = (AbstractGist) o;
return url != null ? url.equals(that.url) : that.url == null;
}
@Override public int hashCode() {
return url != null ? url.hashCode() : 0;
}
@NonNull public ArrayList<FilesListModel> getFilesAsList() {
if (files != null) {
return Stream.of(files)
.map(Map.Entry::getValue)
.collect(Collectors.toCollection(ArrayList::new));
}
return new ArrayList<>();
}
@NonNull public SpannableBuilder getDisplayTitle(boolean isFromProfile) {
return getDisplayTitle(isFromProfile, false);
}
@NonNull public SpannableBuilder getDisplayTitle(boolean isFromProfile, boolean gistView) {
SpannableBuilder spannableBuilder = SpannableBuilder.builder();
boolean addDescription = true;
if (!isFromProfile) {
if (owner != null) {
spannableBuilder.bold(owner.getLogin());
} else if (user != null) {
spannableBuilder.bold(user.getLogin());
} else {
spannableBuilder.bold("Anonymous");
}
if (!gistView) {
List<FilesListModel> files = getFilesAsList();
if (!files.isEmpty()) {
FilesListModel filesListModel = files.get(0);
if (!InputHelper.isEmpty(filesListModel.getFilename()) && filesListModel.getFilename().trim().length() > 2) {
spannableBuilder.append(" ").append("/").append(" ")
.append(filesListModel.getFilename());
addDescription = false;
}
}
}
}
if (!InputHelper.isEmpty(description) && addDescription) {
if (!InputHelper.isEmpty(spannableBuilder.toString())) {
spannableBuilder.append(" ").append("/").append(" ");
}
spannableBuilder.append(description);
}
if (InputHelper.isEmpty(spannableBuilder.toString())) {
if (isFromProfile) {
List<FilesListModel> files = getFilesAsList();
if (!files.isEmpty()) {
FilesListModel filesListModel = files.get(0);
if (!InputHelper.isEmpty(filesListModel.getFilename()) && filesListModel.getFilename().trim().length() > 2) {
spannableBuilder.append(" ")
.append(filesListModel.getFilename());
}
}
}
}
return spannableBuilder;
}
public long getSize() {
List<FilesListModel> models = getFilesAsList();
if (!models.isEmpty()) {
return Stream.of(models).flatMapToLong(filesListModel -> LongStream.of(filesListModel.getSize())).sum();
}
return 0;
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeString(this.forksUrl);
dest.writeString(this.commitsUrl);
dest.writeString(this.gitPullUrl);
dest.writeString(this.gitPushUrl);
dest.writeString(this.htmlUrl);
dest.writeByte(this.publicX ? (byte) 1 : (byte) 0);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeString(this.description);
dest.writeInt(this.comments);
dest.writeString(this.commentsUrl);
dest.writeByte(this.truncated ? (byte) 1 : (byte) 0);
dest.writeString(this.ownerName);
dest.writeString(this.gistId);
dest.writeSerializable(this.files);
dest.writeParcelable(this.user, flags);
dest.writeParcelable(this.owner, flags);
}
protected AbstractGist(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
this.forksUrl = in.readString();
this.commitsUrl = in.readString();
this.gitPullUrl = in.readString();
this.gitPushUrl = in.readString();
this.htmlUrl = in.readString();
this.publicX = in.readByte() != 0;
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.description = in.readString();
this.comments = in.readInt();
this.commentsUrl = in.readString();
this.truncated = in.readByte() != 0;
this.ownerName = in.readString();
this.gistId = in.readString();
this.files = (GithubFileModel) in.readSerializable();
this.user = in.readParcelable(User.class.getClassLoader());
this.owner = in.readParcelable(User.class.getClassLoader());
}
public static final Creator<Gist> CREATOR = new Creator<Gist>() {
@Override public Gist createFromParcel(Parcel source) {return new Gist(source);}
@Override public Gist[] newArray(int size) {return new Gist[size];}
};
}
| 9,914 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractComment.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractComment.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.ReactionsModel;
import com.fastaccess.data.dao.converters.ReactionsConverter;
import com.fastaccess.data.dao.converters.UserConverter;
import com.fastaccess.helper.RxHelper;
import java.util.Date;
import java.util.List;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Column;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Persistable;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.Comment.COMMIT_ID;
import static com.fastaccess.data.dao.model.Comment.GIST_ID;
import static com.fastaccess.data.dao.model.Comment.ID;
import static com.fastaccess.data.dao.model.Comment.ISSUE_ID;
import static com.fastaccess.data.dao.model.Comment.LOGIN;
import static com.fastaccess.data.dao.model.Comment.PULL_REQUEST_ID;
import static com.fastaccess.data.dao.model.Comment.REPO_ID;
import static com.fastaccess.data.dao.model.Comment.UPDATED_AT;
/**
* Created by Kosh on 16 Mar 2017, 7:24 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractComment implements Parcelable {
@Key long id;
@Column(name = "user_column") @Convert(UserConverter.class) User user;
String url;
String body;
String bodyHtml;
String htmlUrl;
Date createdAt;
Date updatedAt;
int position;
int line;
String path;
String commitId;
String repoId;
String login;
String gistId;
String issueId;
String pullRequestId;
@Convert(ReactionsConverter.class) ReactionsModel reactions;
String authorAssociation;
public static Disposable saveForGist(@NonNull List<Comment> models, @NonNull String gistId) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(Comment.class)
.where(GIST_ID.equal(gistId))
.get()
.value();
if (!models.isEmpty()) {
for (Comment model : models) {
dataSource.delete(Comment.class).where(ID.eq(model.getId())).get().value();
model.setGistId(gistId);
dataSource.insert(model);
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Disposable saveForCommits(@NonNull List<Comment> models, @NonNull String repoId,
@NonNull String login, @NonNull String commitId) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(Comment.class)
.where(COMMIT_ID.equal(commitId)
.and(REPO_ID.equal(repoId))
.and(LOGIN.equal(login)))
.get()
.value();
if (!models.isEmpty()) {
for (Comment model : models) {
dataSource.delete(Comment.class).where(ID.eq(model.getId())).get().value();
model.setLogin(login);
model.setRepoId(repoId);
model.setCommitId(commitId);
dataSource.insert(model);
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Single<List<Comment>> getGistComments(@NonNull String gistId) {
return App.getInstance().getDataStore()
.select(Comment.class)
.where(GIST_ID.equal(gistId))
.orderBy(UPDATED_AT.desc())
.get()
.observable()
.toList();
}
public static Single<List<Comment>> getCommitComments(@NonNull String repoId, @NonNull String login,
@NonNull String commitId) {
return App.getInstance().getDataStore()
.select(Comment.class)
.where(REPO_ID.equal(repoId)
.and(LOGIN.equal(login))
.and(COMMIT_ID.equal(commitId)))
.orderBy(UPDATED_AT.desc())
.get()
.observable()
.toList();
}
public static Single<List<Comment>> getIssueComments(@NonNull String repoId, @NonNull String login, @NonNull String issueId) {
return App.getInstance().getDataStore()
.select(Comment.class)
.where(REPO_ID.equal(repoId)
.and(LOGIN.equal(login))
.and(ISSUE_ID.equal(issueId)))
.orderBy(UPDATED_AT.desc())
.get()
.observable()
.toList();
}
public static Single<List<Comment>> getPullRequestComments(@NonNull String repoId, @NonNull String login,
@NonNull String pullRequestId) {
return App.getInstance().getDataStore()
.select(Comment.class)
.where(REPO_ID.equal(repoId)
.and(LOGIN.equal(login))
.and(PULL_REQUEST_ID.equal(pullRequestId)))
.orderBy(UPDATED_AT.desc())
.get()
.observable()
.toList();
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Comment that = (Comment) o;
return id == that.id;
}
@Override public int hashCode() {
return (int) (id ^ (id >>> 32));
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeParcelable(this.user, flags);
dest.writeString(this.url);
dest.writeString(this.body);
dest.writeString(this.bodyHtml);
dest.writeString(this.htmlUrl);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeInt(this.position);
dest.writeInt(this.line);
dest.writeString(this.path);
dest.writeString(this.commitId);
dest.writeString(this.repoId);
dest.writeString(this.login);
dest.writeString(this.gistId);
dest.writeString(this.issueId);
dest.writeString(this.pullRequestId);
dest.writeParcelable(this.reactions, flags);
dest.writeString(this.authorAssociation);
}
protected AbstractComment(Parcel in) {
this.id = in.readLong();
this.user = in.readParcelable(User.class.getClassLoader());
this.url = in.readString();
this.body = in.readString();
this.bodyHtml = in.readString();
this.htmlUrl = in.readString();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.position = in.readInt();
this.line = in.readInt();
this.path = in.readString();
this.commitId = in.readString();
this.repoId = in.readString();
this.login = in.readString();
this.gistId = in.readString();
this.issueId = in.readString();
this.pullRequestId = in.readString();
this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader());
this.authorAssociation = in.readString();
}
public static final Creator<Comment> CREATOR = new Creator<Comment>() {
@Override public Comment createFromParcel(Parcel source) {return new Comment(source);}
@Override public Comment[] newArray(int size) {return new Comment[size];}
};
}
| 8,704 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractNotification.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotification.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.App;
import com.fastaccess.data.dao.NotificationSubjectModel;
import com.fastaccess.data.dao.converters.NotificationSubjectConverter;
import com.fastaccess.data.dao.converters.RepoConverter;
import com.fastaccess.data.dao.types.NotificationReason;
import com.fastaccess.helper.RxHelper;
import java.util.Date;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Nullable;
import io.requery.Persistable;
import lombok.NoArgsConstructor;
/**
* Created by Kosh on 16 Mar 2017, 7:37 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractNotification implements Parcelable {
@Key long id;
@Convert(RepoConverter.class) Repo repository;
@Convert(NotificationSubjectConverter.class) NotificationSubjectModel subject;
NotificationReason reason;
String url;
boolean unread;
Date updatedAt;
Date lastReadAt;
@Nullable boolean isSubscribed;
public Disposable save(Notification entity) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataStore = App.getInstance().getDataStore().toBlocking();
dataStore.delete(Notification.class).where(Notification.ID.eq(entity.getId())).get().value();
dataStore.insert(entity);
s.onNext(true);
} catch (Exception e) {
e.printStackTrace();
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
public static Disposable markAsRead(long id) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataStore = App.getInstance().getDataStore().toBlocking();
Notification current = dataStore.select(Notification.class).where(Notification.ID.eq(id)).get().firstOrNull();
if (current != null) {
current.setUnread(false);
dataStore.update(current);
}
s.onNext(true);
} catch (Exception e) {
e.printStackTrace();
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
public static Disposable save(@androidx.annotation.Nullable List<Notification> models) {
if (models == null || models.isEmpty()) {
return Observable.empty().subscribe();
}
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataStore = App.getInstance().getDataStore().toBlocking();
for (Notification entity : models) {
dataStore.delete(Notification.class).where(Notification.ID.eq(entity.getId())).get().value();
}
dataStore.insert(models);
s.onNext(true);
} catch (Exception e) {
e.printStackTrace();
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
public static Single<Boolean> saveAsSingle(@androidx.annotation.Nullable List<Notification> models) {
if (models == null || models.isEmpty()) {
return Single.just(true);
}
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataStore = App.getInstance().getDataStore().toBlocking();
for (Notification entity : models) {
dataStore.delete(Notification.class).where(Notification.ID.eq(entity.getId())).get().value();
}
dataStore.insert(models);
s.onNext(true);
} catch (Exception e) {
e.printStackTrace();
s.onError(e);
}
s.onComplete();
}));
}
public static Single<List<Notification>> getUnreadNotifications() {
return App.getInstance()
.getDataStore()
.select(Notification.class)
.where(Notification.UNREAD.eq(true))
.orderBy(Notification.UPDATED_AT.desc())
.get()
.observable()
.toList();
}
public static Single<List<Notification>> getAllNotifications() {
return App.getInstance()
.getDataStore()
.select(Notification.class)
.orderBy(Notification.UPDATED_AT.desc(), Notification.UNREAD.eq(false).getLeftOperand())
.get()
.observable()
.toList();
}
public static boolean hasUnreadNotifications() {
return App.getInstance()
.getDataStore()
.toBlocking()
.count(Notification.class)
.where(Notification.UNREAD.equal(true))
.get()
.value() > 0;
}
public static void deleteAll() {
App.getInstance().getDataStore().toBlocking().delete(Notification.class).get().value();
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Notification that = (Notification) o;
return repository != null && that.repository != null && repository.getId() == that.repository.getId();
}
@Override public int hashCode() {
return repository != null ? (int) repository.getId() : 0;
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeParcelable(this.repository, flags);
dest.writeParcelable(this.subject, flags);
dest.writeInt(this.reason == null ? -1 : this.reason.ordinal());
dest.writeString(this.url);
dest.writeByte(this.unread ? (byte) 1 : (byte) 0);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeLong(this.lastReadAt != null ? this.lastReadAt.getTime() : -1);
dest.writeByte(this.isSubscribed ? (byte) 1 : (byte) 0);
}
protected AbstractNotification(Parcel in) {
this.id = in.readLong();
this.repository = in.readParcelable(Repo.class.getClassLoader());
this.subject = in.readParcelable(NotificationSubjectModel.class.getClassLoader());
int tmpReason = in.readInt();
this.reason = tmpReason == -1 ? null : NotificationReason.values()[tmpReason];
this.url = in.readString();
this.unread = in.readByte() != 0;
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
long tmpLastReadAt = in.readLong();
this.lastReadAt = tmpLastReadAt == -1 ? null : new Date(tmpLastReadAt);
this.isSubscribed = in.readByte() != 0;
}
public static final Creator<Notification> CREATOR = new Creator<Notification>() {
@Override public Notification createFromParcel(Parcel source) {return new Notification(source);}
@Override public Notification[] newArray(int size) {return new Notification[size];}
};
}
| 7,651 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractRepoFile.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractRepoFile.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.types.FilesType;
import com.fastaccess.helper.RxHelper;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import io.requery.Persistable;
import io.requery.reactivex.ReactiveEntityStore;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.RepoFile.LOGIN;
import static com.fastaccess.data.dao.model.RepoFile.REPO_ID;
import static com.fastaccess.data.dao.model.RepoFile.SHA;
import static com.fastaccess.data.dao.model.RepoFile.TYPE;
/**
* Created by Kosh on 16 Mar 2017, 7:53 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractRepoFile implements Parcelable {
@Key @Generated long id;
String name;
String path;
String sha;
long size;
String url;
String htmlUrl;
String gitUrl;
String downloadUrl;
FilesType type;
String repoId;
String login;
public Single<RepoFile> save(RepoFile entity) {
return RxHelper.getSingle(App.getInstance().getDataStore().insert(entity));
}
public static Observable<RepoFile> save(@NonNull List<RepoFile> models, @NonNull String login, @NonNull String repoId) {
ReactiveEntityStore<Persistable> singleEntityStore = App.getInstance().getDataStore();
return RxHelper.safeObservable(singleEntityStore.delete(RepoFile.class)
.where(REPO_ID.eq(repoId)
.and(LOGIN.eq(login)))
.get()
.single()
.toObservable()
.flatMap(integer -> Observable.fromIterable(models))
.flatMap(filesModel -> {
filesModel.setRepoId(repoId);
filesModel.setLogin(login);
return filesModel.save(filesModel).toObservable();
}));
}
public static Single<List<RepoFile>> getFiles(@NonNull String login, @NonNull String repoId) {
return App.getInstance().getDataStore()
.select(RepoFile.class)
.where(REPO_ID.eq(repoId)
.and(LOGIN.eq(login)))
.orderBy(TYPE.asc())
.get()
.observable()
.toList();
}
public static Observable<RepoFile> getFile(@NonNull String login, @NonNull String repoId, @NonNull String sha) {
return App.getInstance().getDataStore()
.select(RepoFile.class)
.where(REPO_ID.eq(repoId)
.and(LOGIN.eq(login))
.and(SHA.eq(sha)))
.orderBy(TYPE.asc())
.get()
.observable();
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.name);
dest.writeString(this.path);
dest.writeString(this.sha);
dest.writeLong(this.size);
dest.writeString(this.url);
dest.writeString(this.htmlUrl);
dest.writeString(this.gitUrl);
dest.writeString(this.downloadUrl);
dest.writeInt(this.type == null ? -1 : this.type.ordinal());
dest.writeString(this.repoId);
dest.writeString(this.login);
}
protected AbstractRepoFile(Parcel in) {
this.id = in.readLong();
this.name = in.readString();
this.path = in.readString();
this.sha = in.readString();
this.size = in.readLong();
this.url = in.readString();
this.htmlUrl = in.readString();
this.gitUrl = in.readString();
this.downloadUrl = in.readString();
int tmpType = in.readInt();
this.type = tmpType == -1 ? null : FilesType.values()[tmpType];
this.repoId = in.readString();
this.login = in.readString();
}
public static final Creator<RepoFile> CREATOR = new Creator<RepoFile>() {
@Override public RepoFile createFromParcel(Parcel source) {return new RepoFile(source);}
@Override public RepoFile[] newArray(int size) {return new RepoFile[size];}
};
}
| 4,349 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractSearchHistory.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractSearchHistory.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.fastaccess.App;
import com.fastaccess.helper.RxHelper;
import java.util.List;
import io.reactivex.Single;
import io.requery.Column;
import io.requery.Entity;
/**
* Created by Kosh on 01 Jan 2017, 11:20 PM
*/
@Entity
public abstract class AbstractSearchHistory implements Parcelable {
@Column(unique = true) String text;
public Single<SearchHistory> save(SearchHistory entity) {
return RxHelper.getSingle(
App.getInstance().getDataStore()
.delete(SearchHistory.class)
.where(SearchHistory.TEXT.eq(entity.getText()))
.get()
.single()
.flatMap(integer -> App.getInstance().getDataStore().insert(entity)));
}
public static Single<List<SearchHistory>> getHistory() {
return App.getInstance().getDataStore()
.select(SearchHistory.class)
.groupBy(SearchHistory.TEXT.asc())
.get()
.observable()
.toList();
}
@Override public String toString() {
return text;
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AbstractSearchHistory that = (AbstractSearchHistory) o;
return text != null ? text.equals(that.text) : that.text == null;
}
@Override public int hashCode() {
return text != null ? text.hashCode() : 0;
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {dest.writeString(this.text);}
public AbstractSearchHistory() {}
public AbstractSearchHistory(String text) {
this.text = text;
}
protected AbstractSearchHistory(Parcel in) {this.text = in.readString();}
public static final Creator<SearchHistory> CREATOR = new Creator<SearchHistory>() {
@Override public SearchHistory createFromParcel(Parcel source) {return new SearchHistory(source);}
@Override public SearchHistory[] newArray(int size) {return new SearchHistory[size];}
};
public static void deleteAll() {
App.getInstance().getDataStore()
.delete(SearchHistory.class)
.get()
.value();
}
}
| 2,466 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractRelease.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractRelease.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.ReleasesAssetsListModel;
import com.fastaccess.data.dao.converters.ReleasesAssetsConverter;
import com.fastaccess.data.dao.converters.UserConverter;
import com.fastaccess.helper.RxHelper;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
import java.util.List;
import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Persistable;
import io.requery.Table;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.Release.CREATED_AT;
import static com.fastaccess.data.dao.model.Release.ID;
import static com.fastaccess.data.dao.model.Release.LOGIN;
import static com.fastaccess.data.dao.model.Release.REPO_ID;
/**
* Created by Kosh on 16 Mar 2017, 7:40 PM
*/
@Entity @NoArgsConstructor @Table(name = "release_table")
public abstract class AbstractRelease implements Parcelable {
@Key long id;
String url;
String htmlUrl;
String assetsUrl;
String uploadUrl;
String tagName;
String targetCommitish;
String name;
boolean draft;
boolean preRelease;
Date createdAt;
Date publishedAt;
String repoId;
String login;
@SerializedName("tarball_url") String tarballUrl;
@SerializedName("body_html") String body;
@SerializedName("zipball_url") String zipBallUrl;
@Convert(UserConverter.class) User author;
@Convert(ReleasesAssetsConverter.class) ReleasesAssetsListModel assets;
public static Disposable save(@NonNull List<Release> models, @NonNull String repoId, @NonNull String login) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(Release.class)
.where(Release.REPO_ID.equal(repoId)
.and(Release.LOGIN.equal(login)))
.get()
.value();
if (!models.isEmpty()) {
for (Release releasesModel : models) {
dataSource.delete(Release.class).where(Release.ID.eq(releasesModel.getId())).get().value();
releasesModel.setRepoId(repoId);
releasesModel.setLogin(login);
dataSource.insert(releasesModel);
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Completable delete(@NonNull String repoId, @NonNull String login) {
return App.getInstance().getDataStore()
.delete(Release.class)
.where(REPO_ID.eq(repoId)
.and(LOGIN.eq(login)))
.get()
.single()
.toCompletable();
}
public static Observable<Release> get(long id) {
return App.getInstance().getDataStore()
.select(Release.class)
.where(ID.eq(id))
.get()
.observable();
}
public static Single<List<Release>> get(@NonNull String repoId, @NonNull String login) {
return App.getInstance().getDataStore()
.select(Release.class)
.where(REPO_ID.eq(repoId)
.and(LOGIN.eq(login)))
.orderBy(CREATED_AT.desc())
.get()
.observable()
.toList();
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeString(this.htmlUrl);
dest.writeString(this.assetsUrl);
dest.writeString(this.uploadUrl);
dest.writeString(this.tagName);
dest.writeString(this.targetCommitish);
dest.writeString(this.name);
dest.writeByte(this.draft ? (byte) 1 : (byte) 0);
dest.writeByte(this.preRelease ? (byte) 1 : (byte) 0);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.publishedAt != null ? this.publishedAt.getTime() : -1);
dest.writeString(this.repoId);
dest.writeString(this.login);
dest.writeString(this.tarballUrl);
dest.writeString(this.body);
dest.writeString(this.zipBallUrl);
dest.writeParcelable(this.author, flags);
dest.writeList(this.assets);
}
protected AbstractRelease(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
this.htmlUrl = in.readString();
this.assetsUrl = in.readString();
this.uploadUrl = in.readString();
this.tagName = in.readString();
this.targetCommitish = in.readString();
this.name = in.readString();
this.draft = in.readByte() != 0;
this.preRelease = in.readByte() != 0;
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpPublishedAt = in.readLong();
this.publishedAt = tmpPublishedAt == -1 ? null : new Date(tmpPublishedAt);
this.repoId = in.readString();
this.login = in.readString();
this.tarballUrl = in.readString();
this.body = in.readString();
this.zipBallUrl = in.readString();
this.author = in.readParcelable(User.class.getClassLoader());
this.assets = new ReleasesAssetsListModel();
in.readList(this.assets, this.assets.getClass().getClassLoader());
}
public static final Creator<Release> CREATOR = new Creator<Release>() {
@Override public Release createFromParcel(Parcel source) {return new Release(source);}
@Override public Release[] newArray(int size) {return new Release[size];}
};
}
| 6,357 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractUser.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractUser.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.helper.RxHelper;
import java.util.Date;
import java.util.List;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Column;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Persistable;
import io.requery.Table;
import io.requery.Transient;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.User.FOLLOWER_NAME;
import static com.fastaccess.data.dao.model.User.FOLLOWING_NAME;
import static com.fastaccess.data.dao.model.User.ID;
import static com.fastaccess.data.dao.model.User.LOGIN;
/**
* Created by Kosh on 16 Mar 2017, 7:55 PM
*/
@Entity @NoArgsConstructor @Table(name = "user_table")
public abstract class AbstractUser implements Parcelable {
@Key long id;
String login;
String avatarUrl;
String gravatarId;
String url;
String htmlUrl;
String followersUrl;
String followingUrl;
String gistsUrl;
String starredUrl;
String subscriptionsUrl;
String organizationsUrl;
String reposUrl;
String eventsUrl;
String receivedEventsUrl;
String type;
boolean siteAdmin;
String name;
String company;
String blog;
String location;
String email;
boolean hireable;
String bio;
long publicRepos;
long publicGists;
long followers;
long following;
Date createdAt;
Date updatedAt;
int contributions;
String followingName;
String followerName;
@Column(name = "date_column") Date date;
String repoId;
String description;
@Transient boolean hasOrganizationProjects;
public void save(User entity) {
if (getUser(entity.getId()) != null) {
App.getInstance().getDataStore().toBlocking().update(entity);
} else {
App.getInstance().getDataStore().toBlocking().insert(entity);
}
}
@Nullable public static User getUser(String login) {
return App.getInstance().getDataStore()
.select(User.class)
.where(LOGIN.eq(login))
.get()
.firstOrNull();
}
@Nullable public static User getUser(long id) {
return App.getInstance().getDataStore()
.select(User.class)
.where(ID.eq(id))
.get()
.firstOrNull();
}
public static Disposable saveUserFollowerList(@NonNull List<User> models, @NonNull String followingName) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
Login login = Login.getUser();
if (login != null) {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
if (login.getLogin().equalsIgnoreCase(followingName)) {
dataSource.delete(User.class)
.where(FOLLOWING_NAME.eq(followingName))
.get()
.value();
if (!models.isEmpty()) {
for (User user : models) {
dataSource.delete(User.class).where(User.ID.eq(user.getId())).get().value();
user.setFollowingName(followingName);
dataSource.insert(user);
}
}
} else {
dataSource.delete(User.class)
.where(User.FOLLOWING_NAME.notEqual(login.getLogin()))
.get()
.value();
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Disposable saveUserFollowingList(@NonNull List<User> models, @NonNull String followerName) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
Login login = Login.getUser();
if (login != null) {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
if (login.getLogin().equalsIgnoreCase(followerName)) {
dataSource.delete(User.class)
.where(FOLLOWER_NAME.eq(followerName))
.get()
.value();
if (!models.isEmpty()) {
for (User user : models) {
dataSource.delete(User.class).where(User.ID.eq(user.getId())).get().value();
user.setFollowerName(followerName);
dataSource.insert(user);
}
}
} else {
dataSource.delete(User.class)
.where(User.FOLLOWER_NAME.notEqual(login.getLogin()))
.get()
.value();
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
@NonNull public static Single<List<User>> getUserFollowerList(@NonNull String following) {
return App.getInstance().getDataStore()
.select(User.class)
.where(FOLLOWING_NAME.eq(following))
.get()
.observable()
.toList();
}
@NonNull public static Single<List<User>> getUserFollowingList(@NonNull String follower) {
return App.getInstance().getDataStore()
.select(User.class)
.where(FOLLOWER_NAME.eq(follower))
.get()
.observable()
.toList();
}
public boolean isOrganizationType() {
return type != null && type.equalsIgnoreCase("Organization");
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.login);
dest.writeString(this.avatarUrl);
dest.writeString(this.gravatarId);
dest.writeString(this.url);
dest.writeString(this.htmlUrl);
dest.writeString(this.followersUrl);
dest.writeString(this.followingUrl);
dest.writeString(this.gistsUrl);
dest.writeString(this.starredUrl);
dest.writeString(this.subscriptionsUrl);
dest.writeString(this.organizationsUrl);
dest.writeString(this.reposUrl);
dest.writeString(this.eventsUrl);
dest.writeString(this.receivedEventsUrl);
dest.writeString(this.type);
dest.writeByte(this.siteAdmin ? (byte) 1 : (byte) 0);
dest.writeString(this.name);
dest.writeString(this.company);
dest.writeString(this.blog);
dest.writeString(this.location);
dest.writeString(this.email);
dest.writeByte(this.hireable ? (byte) 1 : (byte) 0);
dest.writeString(this.bio);
dest.writeLong(this.publicRepos);
dest.writeLong(this.publicGists);
dest.writeLong(this.followers);
dest.writeLong(this.following);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeInt(this.contributions);
dest.writeString(this.followingName);
dest.writeString(this.followerName);
dest.writeLong(this.date != null ? this.date.getTime() : -1);
dest.writeString(this.repoId);
dest.writeString(this.description);
}
protected AbstractUser(Parcel in) {
this.id = in.readLong();
this.login = in.readString();
this.avatarUrl = in.readString();
this.gravatarId = in.readString();
this.url = in.readString();
this.htmlUrl = in.readString();
this.followersUrl = in.readString();
this.followingUrl = in.readString();
this.gistsUrl = in.readString();
this.starredUrl = in.readString();
this.subscriptionsUrl = in.readString();
this.organizationsUrl = in.readString();
this.reposUrl = in.readString();
this.eventsUrl = in.readString();
this.receivedEventsUrl = in.readString();
this.type = in.readString();
this.siteAdmin = in.readByte() != 0;
this.name = in.readString();
this.company = in.readString();
this.blog = in.readString();
this.location = in.readString();
this.email = in.readString();
this.hireable = in.readByte() != 0;
this.bio = in.readString();
this.publicRepos = in.readLong();
this.publicGists = in.readLong();
this.followers = in.readLong();
this.following = in.readLong();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.contributions = in.readInt();
this.followingName = in.readString();
this.followerName = in.readString();
long tmpDate = in.readLong();
this.date = tmpDate == -1 ? null : new Date(tmpDate);
this.repoId = in.readString();
this.description = in.readString();
}
public static final Creator<User> CREATOR = new Creator<User>() {
@Override public User createFromParcel(Parcel source) {return new User(source);}
@Override public User[] newArray(int size) {return new User[size];}
};
}
| 10,259 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractCommit.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractCommit.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.CommitFileListModel;
import com.fastaccess.data.dao.CommitListModel;
import com.fastaccess.data.dao.GitCommitModel;
import com.fastaccess.data.dao.GithubState;
import com.fastaccess.data.dao.converters.CommitFilesConverter;
import com.fastaccess.data.dao.converters.CommitsConverter;
import com.fastaccess.data.dao.converters.GitCommitConverter;
import com.fastaccess.data.dao.converters.GitHubStateConverter;
import com.fastaccess.data.dao.converters.RepoConverter;
import com.fastaccess.data.dao.converters.UserConverter;
import com.fastaccess.helper.RxHelper;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Column;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import io.requery.Nullable;
import io.requery.Persistable;
import io.requery.Table;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.Commit.ID;
import static com.fastaccess.data.dao.model.Commit.LOGIN;
import static com.fastaccess.data.dao.model.Commit.PULL_REQUEST_NUMBER;
import static com.fastaccess.data.dao.model.Commit.REPO_ID;
import static com.fastaccess.data.dao.model.Commit.SHA;
@Entity @NoArgsConstructor @Table(name = "commit_table")
public abstract class AbstractCommit implements Parcelable {
@Key @Generated long id;
String url;
String sha;
String htmlUrl;
String login;
String repoId;
long pullRequestNumber;
@Convert(GitHubStateConverter.class) GithubState stats;
@Convert(CommitFilesConverter.class) CommitFileListModel files;
@Convert(CommitsConverter.class) CommitListModel parents;
@Column(name = "ref_column") String ref;
@SerializedName("distincted") boolean distincted;
@SerializedName("commit") @Convert(GitCommitConverter.class) GitCommitModel gitCommit;
@Convert(UserConverter.class) User author;
@Convert(UserConverter.class) User committer;
@Convert(RepoConverter.class) Repo repo;
@Column(name = "user_column") @Convert(UserConverter.class) User user;
@Nullable int commentCount;
public Single<Commit> save(Commit entity) {
return RxHelper.getSingle(App.getInstance().getDataStore().upsert(entity));
}
public static Disposable save(@NonNull List<Commit> models, @NonNull String repoId, @NonNull String login) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(Commit.class)
.where(REPO_ID.eq(repoId).and(LOGIN.eq(login)))
.get()
.value();
if (!models.isEmpty()) {
for (Commit commitModel : models) {
dataSource.delete(Commit.class).where(ID.eq(commitModel.getId())).get().value();
commitModel.setRepoId(repoId);
commitModel.setLogin(login);
dataSource.insert(commitModel);
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Disposable save(@NonNull List<Commit> models, @NonNull String repoId, @NonNull String login, long number) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(Commit.class)
.where(REPO_ID.eq(repoId)
.and(LOGIN.eq(login))
.and(PULL_REQUEST_NUMBER.eq(number)))
.get()
.value();
if (!models.isEmpty()) {
for (Commit commitModel : models) {
dataSource.delete(Commit.class).where(ID.eq(commitModel.getId())).get().value();
commitModel.setRepoId(repoId);
commitModel.setLogin(login);
commitModel.setPullRequestNumber(number);
dataSource.insert(commitModel);
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Single<List<Commit>> getCommits(@NonNull String repoId, @NonNull String login) {
return App.getInstance().getDataStore()
.select(Commit.class)
.where(REPO_ID.eq(repoId)
.and(LOGIN.eq(login))
.and(PULL_REQUEST_NUMBER.eq(0L)))
.get()
.observable()
.toList();
}
public static Single<List<Commit>> getCommits(@NonNull String repoId, @NonNull String login, long pullRequestNumber) {
return App.getInstance().getDataStore()
.select(Commit.class)
.where(REPO_ID.eq(repoId)
.and(LOGIN.eq(login))
.and(PULL_REQUEST_NUMBER.eq(pullRequestNumber)))
.get()
.observable()
.toList();
}
public static Observable<Commit> getCommit(@NonNull String sha, @NonNull String repoId, @NonNull String login) {
return App.getInstance().getDataStore()
.select(Commit.class)
.where(REPO_ID.eq(repoId)
.and(LOGIN.eq(login))
.and(SHA.eq(sha)))
.limit(1)
.get()
.observable();
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeString(this.sha);
dest.writeString(this.htmlUrl);
dest.writeString(this.login);
dest.writeString(this.repoId);
dest.writeLong(this.pullRequestNumber);
dest.writeParcelable(this.stats, flags);
dest.writeList(this.files);
dest.writeList(this.parents);
dest.writeString(this.ref);
dest.writeByte(this.distincted ? (byte) 1 : (byte) 0);
dest.writeParcelable(this.gitCommit, flags);
dest.writeParcelable(this.author, flags);
dest.writeParcelable(this.committer, flags);
dest.writeParcelable(this.repo, flags);
dest.writeParcelable(this.user, flags);
dest.writeInt(this.commentCount);
}
protected AbstractCommit(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
this.sha = in.readString();
this.htmlUrl = in.readString();
this.login = in.readString();
this.repoId = in.readString();
this.pullRequestNumber = in.readLong();
this.stats = in.readParcelable(GithubState.class.getClassLoader());
this.files = new CommitFileListModel();
in.readList(this.files, this.files.getClass().getClassLoader());
this.parents = new CommitListModel();
in.readList(this.parents, this.parents.getClass().getClassLoader());
this.ref = in.readString();
this.distincted = in.readByte() != 0;
this.gitCommit = in.readParcelable(GitCommitModel.class.getClassLoader());
this.author = in.readParcelable(User.class.getClassLoader());
this.committer = in.readParcelable(User.class.getClassLoader());
this.repo = in.readParcelable(Repo.class.getClassLoader());
this.user = in.readParcelable(User.class.getClassLoader());
this.commentCount = in.readInt();
}
public static final Creator<Commit> CREATOR = new Creator<Commit>() {
@Override public Commit createFromParcel(Parcel source) {return new Commit(source);}
@Override public Commit[] newArray(int size) {return new Commit[size];}
};
}
| 8,556 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractPinnedGists.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedGists.java | package com.fastaccess.data.dao.model;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.data.dao.converters.GistConverter;
import java.util.List;
import io.reactivex.Single;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.PinnedGists.ENTRY_COUNT;
import static com.fastaccess.data.dao.model.PinnedGists.ID;
import static com.fastaccess.data.dao.model.PinnedGists.LOGIN;
/**
* Created by Hashemsergani on 14.10.17.
*/
@Entity @NoArgsConstructor public class AbstractPinnedGists {
@Key @Generated long id;
@io.requery.Nullable int entryCount;
@io.requery.Nullable String login;
@io.requery.Nullable @Convert(GistConverter.class) Gist gist;
@io.requery.Nullable long gistId;
public static void pinUpin(@NonNull Gist gist) {
PinnedGists pinnedIssues = get(gist.getGistId().hashCode());
if (pinnedIssues == null) {
PinnedGists pinned = new PinnedGists();
pinned.setLogin(Login.getUser().getLogin());
pinned.setGist(gist);
pinned.setGistId(gist.getGistId().hashCode());
try {
App.getInstance().getDataStore().toBlocking().insert(pinned);
} catch (Exception ignored) {}
} else {
delete(gist.getGistId().hashCode());
}
}
@Nullable public static PinnedGists get(long gistId) {
return App.getInstance().getDataStore().select(PinnedGists.class)
.where(PinnedGists.GIST_ID.eq(gistId))
.get()
.firstOrNull();
}
public static void delete(long gistId) {
App.getInstance().getDataStore().delete(PinnedGists.class)
.where(PinnedGists.GIST_ID.eq(gistId))
.get()
.value();
}
@NonNull public static Single<List<Gist>> getMyPinnedGists() {
return App.getInstance().getDataStore().select(PinnedGists.class)
.where(LOGIN.eq(Login.getUser().getLogin()).or(LOGIN.isNull()))
.orderBy(ENTRY_COUNT.desc(), ID.desc())
.get()
.observable()
.map(PinnedGists::getGist)
.toList();
}
public static boolean isPinned(long gistId) {
return get(gistId) != null;
}
}
| 2,466 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractIssueEvent.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractIssueEvent.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.LabelModel;
import com.fastaccess.data.dao.MilestoneModel;
import com.fastaccess.data.dao.RenameModel;
import com.fastaccess.data.dao.TeamsModel;
import com.fastaccess.data.dao.converters.IssueConverter;
import com.fastaccess.data.dao.converters.LabelConverter;
import com.fastaccess.data.dao.converters.MilestoneConverter;
import com.fastaccess.data.dao.converters.RenameConverter;
import com.fastaccess.data.dao.converters.TeamConverter;
import com.fastaccess.data.dao.converters.UserConverter;
import com.fastaccess.data.dao.types.IssueEventType;
import com.fastaccess.helper.RxHelper;
import java.util.Date;
import java.util.List;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Persistable;
import io.requery.Transient;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.IssueEvent.CREATED_AT;
import static com.fastaccess.data.dao.model.IssueEvent.ISSUE_ID;
import static com.fastaccess.data.dao.model.IssueEvent.LOGIN;
import static com.fastaccess.data.dao.model.IssueEvent.REPO_ID;
/**
* Created by Kosh on 16 Mar 2017, 7:33 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractIssueEvent implements Parcelable {
@Key long id;
String url;
IssueEventType event;
@Convert(UserConverter.class) User actor;
@Convert(UserConverter.class) User assigner;
@Convert(UserConverter.class) User assignee;
@Convert(UserConverter.class) User requestedReviewer;
@Convert(TeamConverter.class) TeamsModel requestedTeam;
@Convert(MilestoneConverter.class) MilestoneModel milestone;
@Convert(RenameConverter.class) RenameModel rename;
@Convert(IssueConverter.class) Issue source;
@Convert(LabelConverter.class) LabelModel label;
String commitId;
String commitUrl;
Date createdAt;
String issueId;
String repoId;
String login;
@Transient List<LabelModel> labels;
@Transient Issue issue;
public static Disposable save(@NonNull List<IssueEvent> models, @NonNull String repoId,
@NonNull String login, @NonNull String issueId) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(IssueEvent.class)
.where(LOGIN.equal(login)
.and(REPO_ID.equal(repoId))
.and(ISSUE_ID.equal(issueId)))
.get()
.value();
if (!models.isEmpty()) {
for (IssueEvent issueEventModel : models) {
dataSource.delete(IssueEvent.class).where(IssueEvent.ID.eq(issueEventModel.getId())).get().value();
issueEventModel.setIssueId(issueId);
issueEventModel.setLogin(login);
issueEventModel.setRepoId(repoId);
dataSource.insert(issueEventModel);
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Single<List<IssueEvent>> get(@NonNull String repoId, @NonNull String login,
@NonNull String issueId) {
return App.getInstance().getDataStore()
.select(IssueEvent.class)
.where(LOGIN.equal(login)
.and(REPO_ID.equal(repoId))
.and(ISSUE_ID.equal(issueId)))
.orderBy(CREATED_AT.desc())
.get()
.observable()
.toList();
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeInt(this.event == null ? -1 : this.event.ordinal());
dest.writeParcelable(this.actor, flags);
dest.writeParcelable(this.assigner, flags);
dest.writeParcelable(this.assignee, flags);
dest.writeParcelable(this.requestedReviewer, flags);
dest.writeParcelable(this.requestedTeam, flags);
dest.writeParcelable(this.milestone, flags);
dest.writeParcelable(this.rename, flags);
dest.writeParcelable(this.source, flags);
dest.writeParcelable(this.label, flags);
dest.writeString(this.commitId);
dest.writeString(this.commitUrl);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeString(this.issueId);
dest.writeString(this.repoId);
dest.writeString(this.login);
dest.writeTypedList(this.labels);
dest.writeParcelable(this.issue, flags);
}
protected AbstractIssueEvent(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
int tmpEvent = in.readInt();
this.event = tmpEvent == -1 ? null : IssueEventType.values()[tmpEvent];
this.actor = in.readParcelable(User.class.getClassLoader());
this.assigner = in.readParcelable(User.class.getClassLoader());
this.assignee = in.readParcelable(User.class.getClassLoader());
this.requestedReviewer = in.readParcelable(User.class.getClassLoader());
this.requestedTeam = in.readParcelable(TeamsModel.class.getClassLoader());
this.milestone = in.readParcelable(MilestoneModel.class.getClassLoader());
this.rename = in.readParcelable(RenameModel.class.getClassLoader());
this.source = in.readParcelable(Issue.class.getClassLoader());
this.label = in.readParcelable(LabelModel.class.getClassLoader());
this.commitId = in.readString();
this.commitUrl = in.readString();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
this.issueId = in.readString();
this.repoId = in.readString();
this.login = in.readString();
this.labels = in.createTypedArrayList(LabelModel.CREATOR);
this.issue = in.readParcelable(Issue.class.getClassLoader());
}
public static final Creator<IssueEvent> CREATOR = new Creator<IssueEvent>() {
@Override public IssueEvent createFromParcel(Parcel source) {return new IssueEvent(source);}
@Override public IssueEvent[] newArray(int size) {return new IssueEvent[size];}
};
}
| 6,940 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractPinnedIssues.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedIssues.java | package com.fastaccess.data.dao.model;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.data.dao.converters.IssueConverter;
import com.fastaccess.helper.RxHelper;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.PinnedIssues.ENTRY_COUNT;
import static com.fastaccess.data.dao.model.PinnedIssues.ID;
import static com.fastaccess.data.dao.model.PinnedIssues.LOGIN;
/**
* Created by Hashemsergani on 14.10.17.
*/
@Entity @NoArgsConstructor public class AbstractPinnedIssues {
@Key @Generated long id;
@io.requery.Nullable int entryCount;
@io.requery.Nullable String login;
@io.requery.Nullable @Convert(IssueConverter.class) Issue issue;
@io.requery.Nullable long issueId;
public static void pinUpin(@NonNull Issue issue) {
PinnedIssues pinnedIssues = get(issue.getId());
if (pinnedIssues == null) {
PinnedIssues pinned = new PinnedIssues();
pinned.setLogin(Login.getUser().getLogin());
pinned.setIssue(issue);
pinned.setIssueId(issue.getId());
try {
App.getInstance().getDataStore().toBlocking().insert(pinned);
} catch (Exception ignored) {}
} else {
delete(issue.getId());
}
}
@Nullable public static PinnedIssues get(long issueId) {
return App.getInstance().getDataStore().select(PinnedIssues.class)
.where(PinnedIssues.ISSUE_ID.eq(issueId))
.get()
.firstOrNull();
}
public static void delete(long issueId) {
App.getInstance().getDataStore().delete(PinnedIssues.class)
.where(PinnedIssues.ISSUE_ID.eq(issueId))
.get()
.value();
}
@NonNull public static Disposable updateEntry(long issueId) {
return RxHelper.getObservable(Observable.fromPublisher(e -> {
PinnedIssues pinned = get(issueId);
if (pinned != null) {
pinned.setEntryCount(pinned.getEntryCount() + 1);
App.getInstance().getDataStore().toBlocking().update(pinned);
e.onNext("");
}
e.onComplete();
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
@NonNull public static Single<List<Issue>> getMyPinnedIssues() {
return App.getInstance().getDataStore().select(PinnedIssues.class)
.where(LOGIN.eq(Login.getUser().getLogin()).or(LOGIN.isNull()))
.orderBy(ENTRY_COUNT.desc(), ID.desc())
.get()
.observable()
.map(PinnedIssues::getIssue)
.toList();
}
public static boolean isPinned(long issueId) {
return get(issueId) != null;
}
}
| 3,090 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractLogin.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractLogin.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.helper.RxHelper;
import java.util.Date;
import io.reactivex.Observable;
import io.requery.Column;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Nullable;
import lombok.NoArgsConstructor;
/**
* Created by Kosh on 16 Mar 2017, 7:36 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractLogin implements Parcelable {
@Key long id;
@Column String login;
String avatarUrl;
String gravatarId;
String url;
String htmlUrl;
String followersUrl;
String followingUrl;
String gistsUrl;
String starredUrl;
String subscriptionsUrl;
String organizationsUrl;
String reposUrl;
String eventsUrl;
String receivedEventsUrl;
String type;
boolean siteAdmin;
String name;
String company;
String blog;
String location;
String email;
boolean hireable;
String bio;
long publicRepos;
long publicGists;
long followers;
long following;
Date createdAt;
Date updatedAt;
String token;
int contributions;
@Nullable boolean isLoggedIn;
@Nullable boolean isEnterprise;
@Nullable String otpCode;
@Nullable String enterpriseUrl;
public Observable<Login> update(Login login) {
return RxHelper.safeObservable(App.getInstance().getDataStore().update(login)
.toObservable());
}
public void save(Login entity) {
App.getInstance().getDataStore()
.delete(Login.class)
.where(Login.LOGIN.eq(entity.getLogin()))
.get()
.single()
.flatMap(integer -> App.getInstance().getDataStore().insert(entity))
.blockingGet();
}
public static Login getUser() {
return App.getInstance().getDataStore()
.select(Login.class)
.where(Login.LOGIN.notNull()
.and(Login.TOKEN.notNull())
.and(Login.IS_LOGGED_IN.eq(true)))
.get()
.firstOrNull();
}
public static Login getUser(@NonNull String login) {
return App.getInstance().getDataStore()
.select(Login.class)
.where(Login.LOGIN.eq(login)
.and(Login.TOKEN.notNull()))
.get()
.firstOrNull();
}
public static Observable<Login> getAccounts() {
return App.getInstance().getDataStore()
.select(Login.class)
.where(Login.IS_LOGGED_IN.eq(false))
.orderBy(Login.LOGIN.desc())
.get()
.observable();
}
public static void logout() {
Login login = getUser();
if (login == null) return;
App.getInstance().getDataStore().toBlocking().delete(PinnedRepos.class)
.where(PinnedRepos.LOGIN.eq(login.getLogin())).get().value();
App.getInstance().getDataStore().toBlocking().delete(login);
}
public static boolean hasNormalLogin() {
return App.getInstance().getDataStore()
.count(Login.class)
.where(Login.IS_ENTERPRISE.eq(false)
.or(Login.IS_ENTERPRISE.isNull()))
.get()
.value() > 0;
}
public static Observable<Boolean> onMultipleLogin(@NonNull Login userModel, boolean isEnterprise, boolean isNew) {
return Observable.fromPublisher(s -> {
Login currentUser = Login.getUser();
if (currentUser != null) {
currentUser.setIsLoggedIn(false);
App.getInstance().getDataStore()
.toBlocking()
.update(currentUser);
}
if (!isEnterprise) {
PrefGetter.resetEnterprise();
}
userModel.setIsLoggedIn(true);
if (isNew) {
userModel.setIsEnterprise(isEnterprise);
userModel.setToken(isEnterprise ? PrefGetter.getEnterpriseToken() : PrefGetter.getToken());
userModel.setOtpCode(isEnterprise ? PrefGetter.getEnterpriseOtpCode() : PrefGetter.getOtpCode());
userModel.setEnterpriseUrl(isEnterprise ? PrefGetter.getEnterpriseUrl() : null);
App.getInstance().getDataStore()
.toBlocking()
.delete(Login.class)
.where(Login.ID.eq(userModel.getId()))
.get()
.value();
App.getInstance().getDataStore()
.toBlocking()
.insert(userModel);
} else {
if (isEnterprise) {
PrefGetter.setTokenEnterprise(userModel.token);
PrefGetter.setEnterpriseOtpCode(userModel.otpCode);
PrefGetter.setEnterpriseUrl(userModel.enterpriseUrl);
} else {
PrefGetter.resetEnterprise();
PrefGetter.setToken(userModel.token);
PrefGetter.setOtpCode(userModel.otpCode);
}
App.getInstance().getDataStore()
.toBlocking()
.update(userModel);
}
s.onNext(true);
s.onComplete();
});
}
@Override public int describeContents() {
return 0;
}
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.login);
dest.writeString(this.avatarUrl);
dest.writeString(this.gravatarId);
dest.writeString(this.url);
dest.writeString(this.htmlUrl);
dest.writeString(this.followersUrl);
dest.writeString(this.followingUrl);
dest.writeString(this.gistsUrl);
dest.writeString(this.starredUrl);
dest.writeString(this.subscriptionsUrl);
dest.writeString(this.organizationsUrl);
dest.writeString(this.reposUrl);
dest.writeString(this.eventsUrl);
dest.writeString(this.receivedEventsUrl);
dest.writeString(this.type);
dest.writeByte(this.siteAdmin ? (byte) 1 : (byte) 0);
dest.writeString(this.name);
dest.writeString(this.company);
dest.writeString(this.blog);
dest.writeString(this.location);
dest.writeString(this.email);
dest.writeByte(this.hireable ? (byte) 1 : (byte) 0);
dest.writeString(this.bio);
dest.writeLong(this.publicRepos);
dest.writeLong(this.publicGists);
dest.writeLong(this.followers);
dest.writeLong(this.following);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeString(this.token);
dest.writeInt(this.contributions);
dest.writeByte(this.isLoggedIn ? (byte) 1 : (byte) 0);
dest.writeByte(this.isEnterprise ? (byte) 1 : (byte) 0);
dest.writeString(this.otpCode);
dest.writeString(this.enterpriseUrl);
}
protected AbstractLogin(Parcel in) {
this.id = in.readLong();
this.login = in.readString();
this.avatarUrl = in.readString();
this.gravatarId = in.readString();
this.url = in.readString();
this.htmlUrl = in.readString();
this.followersUrl = in.readString();
this.followingUrl = in.readString();
this.gistsUrl = in.readString();
this.starredUrl = in.readString();
this.subscriptionsUrl = in.readString();
this.organizationsUrl = in.readString();
this.reposUrl = in.readString();
this.eventsUrl = in.readString();
this.receivedEventsUrl = in.readString();
this.type = in.readString();
this.siteAdmin = in.readByte() != 0;
this.name = in.readString();
this.company = in.readString();
this.blog = in.readString();
this.location = in.readString();
this.email = in.readString();
this.hireable = in.readByte() != 0;
this.bio = in.readString();
this.publicRepos = in.readLong();
this.publicGists = in.readLong();
this.followers = in.readLong();
this.following = in.readLong();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.token = in.readString();
this.contributions = in.readInt();
this.isLoggedIn = in.readByte() != 0;
this.isEnterprise = in.readByte() != 0;
this.otpCode = in.readString();
this.enterpriseUrl = in.readString();
}
public static final Creator<Login> CREATOR = new Creator<Login>() {
@Override
public Login createFromParcel(Parcel source) {
return new Login(source);
}
@Override
public Login[] newArray(int size) {
return new Login[size];
}
};
}
| 9,382 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractFastHubNotification.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractFastHubNotification.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import java.util.Date;
import io.reactivex.Observable;
import io.requery.Column;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import lombok.NoArgsConstructor;
/**
* Created by Kosh on 11.11.17.
*/
@Entity @NoArgsConstructor public class AbstractFastHubNotification implements Parcelable {
public enum NotificationType {
UPDATE, GUIDE, PURCHASE, REPORT_ISSUE, PROMOTION, STAR_REPO
}
@Generated @Key long id;
@io.requery.Nullable @Column(name = "notification_date") Date date;
@io.requery.Nullable boolean read;
@io.requery.Nullable String body;
@io.requery.Nullable String title;
@io.requery.Nullable NotificationType type;
public static void update(@NonNull FastHubNotification notification) {
App.getInstance().getDataStore().toBlocking().update(notification);
}
public static void save(@NonNull FastHubNotification notification) {
App.getInstance().getDataStore().toBlocking().insert(notification);
}
@Nullable public static FastHubNotification getLatest() {
return App.getInstance().getDataStore().toBlocking()
.select(FastHubNotification.class)
.where(FastHubNotification.READ.eq(false))
.orderBy(FastHubNotification.DATE.desc())
.limit(1)
.get()
.firstOrNull();
}
@NonNull public static Observable<FastHubNotification> getNotifications() {
return App.getInstance().getDataStore()
.select(FastHubNotification.class)
.orderBy(FastHubNotification.DATE.desc())
.get()
.observable();
}
public static boolean hasNotifications() {
return App.getInstance().getDataStore()
.count(FastHubNotification.class)
.get()
.value() > 0;
}
@Override public String toString() {
return "AbstractFastHubNotification{" +
"date=" + date +
", isRead=" + read +
", body='" + body + '\'' +
", title='" + title + '\'' +
", type=" + type +
'}';
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeLong(this.date != null ? this.date.getTime() : -1);
dest.writeByte(this.read ? (byte) 1 : (byte) 0);
dest.writeString(this.body);
dest.writeString(this.title);
dest.writeInt(this.type == null ? -1 : this.type.ordinal());
}
protected AbstractFastHubNotification(Parcel in) {
this.id = in.readLong();
long tmpDate = in.readLong();
this.date = tmpDate == -1 ? null : new Date(tmpDate);
this.read = in.readByte() != 0;
this.body = in.readString();
this.title = in.readString();
int tmpType = in.readInt();
this.type = tmpType == -1 ? null : NotificationType.values()[tmpType];
}
public static final Creator<FastHubNotification> CREATOR = new Creator<FastHubNotification>() {
@Override public FastHubNotification createFromParcel(Parcel source) {return new FastHubNotification(source);}
@Override public FastHubNotification[] newArray(int size) {return new FastHubNotification[size];}
};
}
| 3,603 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractRepo.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractRepo.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.LicenseModel;
import com.fastaccess.data.dao.RepoPermissionsModel;
import com.fastaccess.data.dao.TopicsModel;
import com.fastaccess.data.dao.converters.LicenseConverter;
import com.fastaccess.data.dao.converters.RepoConverter;
import com.fastaccess.data.dao.converters.RepoPermissionConverter;
import com.fastaccess.data.dao.converters.TopicsConverter;
import com.fastaccess.data.dao.converters.UserConverter;
import com.fastaccess.helper.RxHelper;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
import java.util.List;
import io.reactivex.Maybe;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Column;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Nullable;
import io.requery.Persistable;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.Repo.FULL_NAME;
import static com.fastaccess.data.dao.model.Repo.ID;
import static com.fastaccess.data.dao.model.Repo.REPOS_OWNER;
import static com.fastaccess.data.dao.model.Repo.STARRED_USER;
import static com.fastaccess.data.dao.model.Repo.STATUSES_URL;
import static com.fastaccess.data.dao.model.Repo.UPDATED_AT;
/**
* Created by Kosh on 16 Mar 2017, 7:54 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractRepo implements Parcelable {
@Key long id;
String name;
String fullName;
@SerializedName("private") boolean privateX;
String htmlUrl;
String description;
boolean fork;
String url;
String forksUrl;
String keysUrl;
String collaboratorsUrl;
String teamsUrl;
String hooksUrl;
String issueEventsUrl;
String eventsUrl;
String assigneesUrl;
String branchesUrl;
String tagsUrl;
String blobsUrl;
String gitTagsUrl;
String gitRefsUrl;
String treesUrl;
String statusesUrl;
String languagesUrl;
String stargazersUrl;
String contributorsUrl;
String subscribersUrl;
String subscriptionUrl;
String commitsUrl;
String gitCommitsUrl;
String commentsUrl;
String issueCommentUrl;
String contentsUrl;
String compareUrl;
String mergesUrl;
String archiveUrl;
String downloadsUrl;
String issuesUrl;
String pullsUrl;
String milestonesUrl;
String notificationsUrl;
String labelsUrl;
String releasesUrl;
Date createdAt;
Date updatedAt;
Date pushedAt;
String gitUrl;
String sshUrl;
String cloneUrl;
String svnUrl;
String homepage;
long size;
long stargazersCount;
long watchersCount;
@Column(name = "language_column") String language;
boolean hasIssues;
boolean hasDownloads;
boolean hasWiki;
boolean hasPages;
long forksCount;
String mirrorUrl;
long openIssuesCount;
long forks;
long openIssues;
long watchers;
String defaultBranch;
@Nullable @Convert(TopicsConverter.class) TopicsModel topics;
@Convert(UserConverter.class) User owner;
@Convert(RepoPermissionConverter.class) RepoPermissionsModel permissions;
@Convert(UserConverter.class) User organization;
@Convert(RepoConverter.class) Repo parent;
@Convert(RepoConverter.class) Repo source;
@Convert(LicenseConverter.class) LicenseModel license;
@SerializedName("subscribers_count") int subsCount;
int networkCount;
String starredUser;
String reposOwner;
@Nullable boolean hasProjects;
public Disposable save(Repo entity) {
return Single.create(e -> {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(Repo.class).where(Repo.ID.eq(entity.getId())).get().value();
dataSource.insert(entity);
}).subscribe(o -> {/**/}, Throwable::printStackTrace);
}
public static Maybe<Repo> getRepo(@NonNull String name, @NonNull String login) {
return App.getInstance().getDataStore()
.select(Repo.class)
.where(FULL_NAME.eq(login + "/" + name))
.get()
.maybe();
}
public static Repo getRepo(long id) {
return App.getInstance().getDataStore()
.select(Repo.class)
.where(ID.eq(id))
.get()
.firstOrNull();
}
public static Disposable saveStarred(@NonNull List<Repo> models, @NonNull String starredUser) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
Login login = Login.getUser();
if (login != null) {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
if (login.getLogin().equalsIgnoreCase(starredUser)) {
dataSource.delete(Repo.class)
.where(STARRED_USER.eq(starredUser))
.get()
.value();
if (!models.isEmpty()) {
for (Repo repo : models) {
dataSource.delete(Repo.class).where(Repo.ID.eq(repo.getId())).get().value();
repo.setStarredUser(starredUser);
dataSource.insert(repo);
}
}
} else {
dataSource.delete(Repo.class)
.where(STARRED_USER.notEqual(login.getLogin())
.or(STATUSES_URL.isNull()))
.get()
.value();
}
}
s.onNext("");
} catch (Exception ignored) {}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Disposable saveMyRepos(@NonNull List<Repo> models, @NonNull String reposOwner) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
Login login = Login.getUser();
if (login != null) {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
if (login.getLogin().equalsIgnoreCase(reposOwner)) {
dataSource.delete(Repo.class)
.where(REPOS_OWNER.eq(reposOwner))
.get()
.value();
if (!models.isEmpty()) {
for (Repo repo : models) {
dataSource.delete(Repo.class).where(Repo.ID.eq(repo.getId())).get().value();
repo.setReposOwner(reposOwner);
dataSource.insert(repo);
}
}
} else {
dataSource.delete(Repo.class)
.where(REPOS_OWNER.notEqual(login.getLogin())
.or(REPOS_OWNER.isNull()))
.get()
.value();
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Single<List<Repo>> getStarred(@NonNull String starredUser) {
return App.getInstance().getDataStore()
.select(Repo.class)
.where(STARRED_USER.eq(starredUser))
.orderBy(UPDATED_AT.desc())
.get()
.observable()
.toList();
}
public static Single<List<Repo>> getMyRepos(@NonNull String reposOwner) {
return App.getInstance().getDataStore()
.select(Repo.class)
.where(REPOS_OWNER.eq(reposOwner))
.orderBy(UPDATED_AT.desc())
.get()
.observable()
.toList();
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AbstractRepo that = (AbstractRepo) o;
return id == that.id;
}
@Override public int hashCode() {
return (int) (id ^ (id >>> 32));
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.name);
dest.writeString(this.fullName);
dest.writeByte(this.privateX ? (byte) 1 : (byte) 0);
dest.writeString(this.htmlUrl);
dest.writeString(this.description);
dest.writeByte(this.fork ? (byte) 1 : (byte) 0);
dest.writeString(this.url);
dest.writeString(this.forksUrl);
dest.writeString(this.keysUrl);
dest.writeString(this.collaboratorsUrl);
dest.writeString(this.teamsUrl);
dest.writeString(this.hooksUrl);
dest.writeString(this.issueEventsUrl);
dest.writeString(this.eventsUrl);
dest.writeString(this.assigneesUrl);
dest.writeString(this.branchesUrl);
dest.writeString(this.tagsUrl);
dest.writeString(this.blobsUrl);
dest.writeString(this.gitTagsUrl);
dest.writeString(this.gitRefsUrl);
dest.writeString(this.treesUrl);
dest.writeString(this.statusesUrl);
dest.writeString(this.languagesUrl);
dest.writeString(this.stargazersUrl);
dest.writeString(this.contributorsUrl);
dest.writeString(this.subscribersUrl);
dest.writeString(this.subscriptionUrl);
dest.writeString(this.commitsUrl);
dest.writeString(this.gitCommitsUrl);
dest.writeString(this.commentsUrl);
dest.writeString(this.issueCommentUrl);
dest.writeString(this.contentsUrl);
dest.writeString(this.compareUrl);
dest.writeString(this.mergesUrl);
dest.writeString(this.archiveUrl);
dest.writeString(this.downloadsUrl);
dest.writeString(this.issuesUrl);
dest.writeString(this.pullsUrl);
dest.writeString(this.milestonesUrl);
dest.writeString(this.notificationsUrl);
dest.writeString(this.labelsUrl);
dest.writeString(this.releasesUrl);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeLong(this.pushedAt != null ? this.pushedAt.getTime() : -1);
dest.writeString(this.gitUrl);
dest.writeString(this.sshUrl);
dest.writeString(this.cloneUrl);
dest.writeString(this.svnUrl);
dest.writeString(this.homepage);
dest.writeLong(this.size);
dest.writeLong(this.stargazersCount);
dest.writeLong(this.watchersCount);
dest.writeString(this.language);
dest.writeByte(this.hasIssues ? (byte) 1 : (byte) 0);
dest.writeByte(this.hasDownloads ? (byte) 1 : (byte) 0);
dest.writeByte(this.hasWiki ? (byte) 1 : (byte) 0);
dest.writeByte(this.hasPages ? (byte) 1 : (byte) 0);
dest.writeLong(this.forksCount);
dest.writeString(this.mirrorUrl);
dest.writeLong(this.openIssuesCount);
dest.writeLong(this.forks);
dest.writeLong(this.openIssues);
dest.writeLong(this.watchers);
dest.writeString(this.defaultBranch);
dest.writeList(this.topics);
dest.writeParcelable(this.owner, flags);
dest.writeParcelable(this.permissions, flags);
dest.writeParcelable(this.organization, flags);
dest.writeParcelable(this.parent, flags);
dest.writeParcelable(this.source, flags);
dest.writeParcelable(this.license, flags);
dest.writeInt(this.subsCount);
dest.writeInt(this.networkCount);
dest.writeString(this.starredUser);
dest.writeString(this.reposOwner);
dest.writeByte(this.hasProjects ? (byte) 1 : (byte) 0);
}
protected AbstractRepo(Parcel in) {
this.id = in.readLong();
this.name = in.readString();
this.fullName = in.readString();
this.privateX = in.readByte() != 0;
this.htmlUrl = in.readString();
this.description = in.readString();
this.fork = in.readByte() != 0;
this.url = in.readString();
this.forksUrl = in.readString();
this.keysUrl = in.readString();
this.collaboratorsUrl = in.readString();
this.teamsUrl = in.readString();
this.hooksUrl = in.readString();
this.issueEventsUrl = in.readString();
this.eventsUrl = in.readString();
this.assigneesUrl = in.readString();
this.branchesUrl = in.readString();
this.tagsUrl = in.readString();
this.blobsUrl = in.readString();
this.gitTagsUrl = in.readString();
this.gitRefsUrl = in.readString();
this.treesUrl = in.readString();
this.statusesUrl = in.readString();
this.languagesUrl = in.readString();
this.stargazersUrl = in.readString();
this.contributorsUrl = in.readString();
this.subscribersUrl = in.readString();
this.subscriptionUrl = in.readString();
this.commitsUrl = in.readString();
this.gitCommitsUrl = in.readString();
this.commentsUrl = in.readString();
this.issueCommentUrl = in.readString();
this.contentsUrl = in.readString();
this.compareUrl = in.readString();
this.mergesUrl = in.readString();
this.archiveUrl = in.readString();
this.downloadsUrl = in.readString();
this.issuesUrl = in.readString();
this.pullsUrl = in.readString();
this.milestonesUrl = in.readString();
this.notificationsUrl = in.readString();
this.labelsUrl = in.readString();
this.releasesUrl = in.readString();
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
long tmpPushedAt = in.readLong();
this.pushedAt = tmpPushedAt == -1 ? null : new Date(tmpPushedAt);
this.gitUrl = in.readString();
this.sshUrl = in.readString();
this.cloneUrl = in.readString();
this.svnUrl = in.readString();
this.homepage = in.readString();
this.size = in.readLong();
this.stargazersCount = in.readLong();
this.watchersCount = in.readLong();
this.language = in.readString();
this.hasIssues = in.readByte() != 0;
this.hasDownloads = in.readByte() != 0;
this.hasWiki = in.readByte() != 0;
this.hasPages = in.readByte() != 0;
this.forksCount = in.readLong();
this.mirrorUrl = in.readString();
this.openIssuesCount = in.readLong();
this.forks = in.readLong();
this.openIssues = in.readLong();
this.watchers = in.readLong();
this.defaultBranch = in.readString();
this.topics = new TopicsModel();
in.readList(this.topics, this.topics.getClass().getClassLoader());
this.owner = in.readParcelable(User.class.getClassLoader());
this.permissions = in.readParcelable(RepoPermissionsModel.class.getClassLoader());
this.organization = in.readParcelable(User.class.getClassLoader());
this.parent = in.readParcelable(Repo.class.getClassLoader());
this.source = in.readParcelable(Repo.class.getClassLoader());
this.license = in.readParcelable(LicenseModel.class.getClassLoader());
this.subsCount = in.readInt();
this.networkCount = in.readInt();
this.starredUser = in.readString();
this.reposOwner = in.readString();
this.hasProjects = in.readByte() != 0;
}
public static final Creator<Repo> CREATOR = new Creator<Repo>() {
@Override public Repo createFromParcel(Parcel source) {return new Repo(source);}
@Override public Repo[] newArray(int size) {return new Repo[size];}
};
}
| 16,622 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractIssue.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractIssue.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.LabelListModel;
import com.fastaccess.data.dao.MilestoneModel;
import com.fastaccess.data.dao.ReactionsModel;
import com.fastaccess.data.dao.UsersListModel;
import com.fastaccess.data.dao.converters.LabelsListConverter;
import com.fastaccess.data.dao.converters.MilestoneConverter;
import com.fastaccess.data.dao.converters.PullRequestConverter;
import com.fastaccess.data.dao.converters.ReactionsConverter;
import com.fastaccess.data.dao.converters.RepoConverter;
import com.fastaccess.data.dao.converters.UserConverter;
import com.fastaccess.data.dao.converters.UsersConverter;
import com.fastaccess.data.dao.types.IssueState;
import com.fastaccess.helper.RxHelper;
import java.util.Date;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Column;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Persistable;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.Issue.ID;
import static com.fastaccess.data.dao.model.Issue.LOGIN;
import static com.fastaccess.data.dao.model.Issue.NUMBER;
import static com.fastaccess.data.dao.model.Issue.REPO_ID;
import static com.fastaccess.data.dao.model.Issue.STATE;
import static com.fastaccess.data.dao.model.Issue.UPDATED_AT;
/**
* Created by Kosh on 16 Mar 2017, 7:34 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractIssue implements Parcelable {
@Key long id;
String url;
String body;
String title;
int comments;
int number;
boolean locked;
IssueState state;
String repoUrl;
String bodyHtml;
String htmlUrl;
Date closedAt;
Date createdAt;
Date updatedAt;
String repoId;
String login;
@Column(name = "user_column") @Convert(UserConverter.class) User user;
@Convert(UserConverter.class) User assignee;
@Convert(UsersConverter.class) UsersListModel assignees;
@Convert(LabelsListConverter.class) LabelListModel labels;
@Convert(MilestoneConverter.class) MilestoneModel milestone;
@Convert(RepoConverter.class) Repo repository;
@Convert(PullRequestConverter.class) PullRequest pullRequest;
@Convert(UserConverter.class) User closedBy;
@Convert(ReactionsConverter.class) ReactionsModel reactions;
public Single<Issue> save(Issue entity) {
return RxHelper.getSingle(App.getInstance().getDataStore()
.delete(Issue.class)
.where(Issue.ID.eq(entity.getId()))
.get()
.single()
.flatMap(observer -> App.getInstance().getDataStore().insert(entity)));
}
public static Disposable save(@NonNull List<Issue> models, @NonNull String repoId, @NonNull String login) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(Issue.class)
.where(REPO_ID.equal(repoId).and(LOGIN.equal(login)))
.get()
.value();
if (!models.isEmpty()) {
for (Issue issueModel : models) {
dataSource.delete(Issue.class).where(Issue.ID.eq(issueModel.getId())).get().value();
issueModel.setRepoId(repoId);
issueModel.setLogin(login);
dataSource.insert(issueModel);
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
public static Single<List<Issue>> getIssues(@NonNull String repoId, @NonNull String login, @NonNull IssueState issueState) {
return App.getInstance().getDataStore().select(Issue.class)
.where(REPO_ID.equal(repoId)
.and(LOGIN.equal(login))
.and(STATE.equal(issueState)))
.orderBy(UPDATED_AT.desc())
.get()
.observable()
.toList();
}
public static Observable<Issue> getIssue(long id) {
return App.getInstance().getDataStore()
.select(Issue.class)
.where(ID.equal(id))
.get()
.observable();
}
public static Observable<Issue> getIssueByNumber(int number, String repoId, String login) {
return App.getInstance().getDataStore()
.select(Issue.class)
.where(NUMBER.equal(number)
.and(REPO_ID.eq(repoId))
.and(LOGIN.eq(login)))
.get()
.observable();
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeString(this.body);
dest.writeString(this.title);
dest.writeInt(this.comments);
dest.writeInt(this.number);
dest.writeByte(this.locked ? (byte) 1 : (byte) 0);
dest.writeInt(this.state == null ? -1 : this.state.ordinal());
dest.writeString(this.repoUrl);
dest.writeString(this.bodyHtml);
dest.writeString(this.htmlUrl);
dest.writeLong(this.closedAt != null ? this.closedAt.getTime() : -1);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeString(this.repoId);
dest.writeString(this.login);
dest.writeParcelable(this.user, flags);
dest.writeParcelable(this.assignee, flags);
dest.writeList(this.assignees);
dest.writeList(this.labels);
dest.writeParcelable(this.milestone, flags);
dest.writeParcelable(this.repository, flags);
dest.writeParcelable(this.pullRequest, flags);
dest.writeParcelable(this.closedBy, flags);
dest.writeParcelable(this.reactions, flags);
}
protected AbstractIssue(Parcel in) {
this.id = in.readLong();
this.url = in.readString();
this.body = in.readString();
this.title = in.readString();
this.comments = in.readInt();
this.number = in.readInt();
this.locked = in.readByte() != 0;
int tmpState = in.readInt();
this.state = tmpState == -1 ? null : IssueState.values()[tmpState];
this.repoUrl = in.readString();
this.bodyHtml = in.readString();
this.htmlUrl = in.readString();
long tmpClosedAt = in.readLong();
this.closedAt = tmpClosedAt == -1 ? null : new Date(tmpClosedAt);
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.repoId = in.readString();
this.login = in.readString();
this.user = in.readParcelable(User.class.getClassLoader());
this.assignee = in.readParcelable(User.class.getClassLoader());
this.assignees = new UsersListModel();
in.readList(this.assignees, this.assignees.getClass().getClassLoader());
this.labels = new LabelListModel();
in.readList(this.labels, this.labels.getClass().getClassLoader());
this.milestone = in.readParcelable(MilestoneModel.class.getClassLoader());
this.repository = in.readParcelable(Repo.class.getClassLoader());
this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader());
this.closedBy = in.readParcelable(User.class.getClassLoader());
this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader());
}
public static final Creator<Issue> CREATOR = new Creator<Issue>() {
@Override public Issue createFromParcel(Parcel source) {return new Issue(source);}
@Override public Issue[] newArray(int size) {return new Issue[size];}
};
}
| 8,476 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractEvent.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractEvent.java | package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import android.text.TextUtils;
import com.fastaccess.App;
import com.fastaccess.data.dao.PayloadModel;
import com.fastaccess.data.dao.converters.PayloadConverter;
import com.fastaccess.data.dao.converters.RepoConverter;
import com.fastaccess.data.dao.converters.UserConverter;
import com.fastaccess.data.dao.types.EventsType;
import com.fastaccess.helper.RxHelper;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
import java.util.List;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.BlockingEntityStore;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Nullable;
import io.requery.Persistable;
import lombok.NoArgsConstructor;
/**
* Created by Kosh on 16 Mar 2017, 7:29 PM
*/
@Entity @NoArgsConstructor public abstract class AbstractEvent implements Parcelable {
@Key long id;
EventsType type;
Date createdAt;
@Convert(UserConverter.class) User actor;
@Convert(RepoConverter.class) Repo repo;
@Convert(PayloadConverter.class) PayloadModel payload;
@SerializedName("public") boolean publicEvent;
@Nullable String login;
@NonNull
public static Disposable save(@androidx.annotation.Nullable List<Event> events, @androidx.annotation.Nullable String user) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
Login login = Login.getUser();
if (login == null) {
s.onNext("");
s.onComplete();
return;
}
BlockingEntityStore<Persistable> dataSource = App.getInstance().getDataStore().toBlocking();
dataSource.delete(Event.class)
.where(Event.LOGIN.isNull()
.or(Event.LOGIN.eq(login.getLogin())))
.get()
.value();
if (events != null && !events.isEmpty() && TextUtils.equals(login.getLogin(), user)) {
for (Event event : events) {
dataSource.delete(Event.class).where(Event.ID.eq(event.getId())).get().value();
event.setLogin(login.getLogin());
dataSource.insert(event);
}
}
s.onNext("");
} catch (Exception e) {
s.onError(e);
}
s.onComplete();
})).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace);
}
@NonNull public static Single<List<Event>> getEvents(@NonNull String login) {
return RxHelper.getSingle(
App.getInstance().getDataStore()
.select(Event.class)
.where(Event.LOGIN.eq(login))
.orderBy(Event.CREATED_AT.desc())
.get()
.observable()
.toList());
}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeInt(this.type == null ? -1 : this.type.ordinal());
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeParcelable(this.actor, flags);
dest.writeParcelable(this.repo, flags);
dest.writeParcelable(this.payload, flags);
dest.writeByte(this.publicEvent ? (byte) 1 : (byte) 0);
}
protected AbstractEvent(Parcel in) {
this.id = in.readLong();
int tmpType = in.readInt();
this.type = tmpType == -1 ? null : EventsType.values()[tmpType];
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
this.actor = in.readParcelable(User.class.getClassLoader());
this.repo = in.readParcelable(Repo.class.getClassLoader());
this.payload = in.readParcelable(PayloadModel.class.getClassLoader());
this.publicEvent = in.readByte() != 0;
}
public static final Creator<Event> CREATOR = new Creator<Event>() {
@Override public Event createFromParcel(Parcel source) {return new Event(source);}
@Override public Event[] newArray(int size) {return new Event[size];}
};
}
| 4,478 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
AbstractPinnedPullRequests.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedPullRequests.java | package com.fastaccess.data.dao.model;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.data.dao.converters.PullRequestConverter;
import com.fastaccess.helper.RxHelper;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import lombok.NoArgsConstructor;
import static com.fastaccess.data.dao.model.PinnedPullRequests.ENTRY_COUNT;
import static com.fastaccess.data.dao.model.PinnedPullRequests.ID;
import static com.fastaccess.data.dao.model.PinnedPullRequests.LOGIN;
/**
* Created by Hashemsergani on 14.10.17.
*/
@Entity @NoArgsConstructor public class AbstractPinnedPullRequests {
@Key @Generated long id;
@io.requery.Nullable int entryCount;
@io.requery.Nullable String login;
@io.requery.Nullable @Convert(PullRequestConverter.class) PullRequest pullRequest;
@io.requery.Nullable long pullRequestId;
public static void pinUpin(@NonNull PullRequest pullRequest) {
PinnedPullRequests pinnedPullRequests = get(pullRequest.getId());
if (pinnedPullRequests == null) {
PinnedPullRequests pinned = new PinnedPullRequests();
pinned.setLogin(Login.getUser().getLogin());
pinned.setPullRequest(pullRequest);
pinned.setPullRequestId(pullRequest.getId());
try {
App.getInstance().getDataStore().toBlocking().insert(pinned);
} catch (Exception ignored) {}
} else {
delete(pullRequest.getId());
}
}
@Nullable public static PinnedPullRequests get(long pullRequestId) {
return App.getInstance().getDataStore().select(PinnedPullRequests.class)
.where(PinnedPullRequests.PULL_REQUEST_ID.eq(pullRequestId))
.get()
.firstOrNull();
}
public static void delete(long pullRequestId) {
App.getInstance().getDataStore().delete(PinnedPullRequests.class)
.where(PinnedPullRequests.PULL_REQUEST_ID.eq(pullRequestId))
.get()
.value();
}
@NonNull public static Disposable updateEntry(@NonNull long pullRequestId) {
return RxHelper.getObservable(Observable.fromPublisher(e -> {
PinnedPullRequests pinned = get(pullRequestId);
if (pinned != null) {
pinned.setEntryCount(pinned.getEntryCount() + 1);
App.getInstance().getDataStore().toBlocking().update(pinned);
e.onNext("");
}
e.onComplete();
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
@NonNull public static Single<List<PullRequest>> getMyPinnedPullRequests() {
return App.getInstance().getDataStore().select(PinnedPullRequests.class)
.where(LOGIN.eq(Login.getUser().getLogin()).or(LOGIN.isNull()))
.orderBy(ENTRY_COUNT.desc(), ID.desc())
.get()
.observable()
.map(PinnedPullRequests::getPullRequest)
.toList();
}
public static boolean isPinned(long pullRequestId) {
return get(pullRequestId) != null;
}
}
| 3,359 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
SearchService.java | /FileExtraction/Java_unseen/k0shk0sh_FastHub/app/src/main/java/com/fastaccess/data/service/SearchService.java | package com.fastaccess.data.service;
import com.fastaccess.data.dao.Pageable;
import com.fastaccess.data.dao.SearchCodeModel;
import com.fastaccess.data.dao.model.Issue;
import com.fastaccess.data.dao.model.Repo;
import com.fastaccess.data.dao.model.User;
import retrofit2.http.GET;
import retrofit2.http.Query;
import io.reactivex.Observable;
/**
* Created by Kosh on 08 Dec 2016, 9:07 PM
*/
public interface SearchService {
@GET("search/repositories")
Observable<Pageable<Repo>> searchRepositories(@Query(value = "q", encoded = true) String query, @Query("page") long page);
@GET("search/code")
Observable<Pageable<SearchCodeModel>> searchCode(@Query(value = "q", encoded = true) String query, @Query("page") long page);
@GET("search/issues")
Observable<Pageable<Issue>> searchIssues(@Query(value = "q", encoded = true) String query, @Query("page") long page);
@GET("search/users")
Observable<Pageable<User>> searchUsers(@Query(value = "q", encoded = true) String query, @Query("page") long page);
}
| 1,044 | Java | .java | k0shk0sh/FastHub | 5,696 | 930 | 343 | 2017-02-18T17:53:16Z | 2022-09-12T13:15:21Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.