Create/Update entities

This commit is contained in:
tom79 2019-06-18 14:54:32 +02:00
parent b5d0290b8b
commit 287d3b5fbe
3 changed files with 386 additions and 0 deletions

View File

@ -120,6 +120,11 @@ public class Account implements Parcelable {
private String privacy = "public";
private boolean sensitive = false;
private String locale;
private String invite_request;
private String created_by_application_id;
private String invited_by_account_id;
@ -176,6 +181,10 @@ public class Account implements Parcelable {
dest.writeByte(this.isAdmin ? (byte) 1 : (byte) 0);
dest.writeString(this.privacy);
dest.writeByte(this.sensitive ? (byte) 1 : (byte) 0);
dest.writeString(this.locale);
dest.writeString(this.invite_request);
dest.writeString(this.created_by_application_id);
dest.writeString(this.invited_by_account_id);
}
public Account() {
@ -231,6 +240,10 @@ public class Account implements Parcelable {
this.isAdmin = in.readByte() != 0;
this.privacy = in.readString();
this.sensitive =in.readByte() != 0;
this.locale = in.readString();
this.invite_request = in.readString();
this.created_by_application_id = in.readString();
this.invited_by_account_id = in.readString();
}
public static final Creator<Account> CREATOR = new Creator<Account>() {
@ -406,6 +419,38 @@ public class Account implements Parcelable {
this.sensitive = sensitive;
}
public String getLocale() {
return locale;
}
public void setLocale(String locale) {
this.locale = locale;
}
public String getInvite_request() {
return invite_request;
}
public void setInvite_request(String invite_request) {
this.invite_request = invite_request;
}
public String getCreated_by_application_id() {
return created_by_application_id;
}
public void setCreated_by_application_id(String created_by_application_id) {
this.created_by_application_id = created_by_application_id;
}
public String getInvited_by_account_id() {
return invited_by_account_id;
}
public void setInvited_by_account_id(String invited_by_account_id) {
this.invited_by_account_id = invited_by_account_id;
}
public enum followAction{
FOLLOW,

View File

@ -0,0 +1,174 @@
package app.fedilab.android.client.Entities;
/* Copyright 2019 Thomas Schneider
*
* This file is a part of Fedilab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Date;
public class AccountAdmin implements Parcelable {
private String id;
private String username;
private Date created_at;
private String email;
private String role;
private String ip;
private boolean confirmed;
private boolean suspended;
private boolean silenced;
private boolean disabled;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Date getCreated_at() {
return created_at;
}
public void setCreated_at(Date created_at) {
this.created_at = created_at;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public boolean isConfirmed() {
return confirmed;
}
public void setConfirmed(boolean confirmed) {
this.confirmed = confirmed;
}
public boolean isSuspended() {
return suspended;
}
public void setSuspended(boolean suspended) {
this.suspended = suspended;
}
public boolean isSilenced() {
return silenced;
}
public void setSilenced(boolean silenced) {
this.silenced = silenced;
}
public boolean isDisabled() {
return disabled;
}
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
private Account account;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.id);
dest.writeString(this.username);
dest.writeLong(this.created_at != null ? this.created_at.getTime() : -1);
dest.writeString(this.email);
dest.writeString(this.role);
dest.writeString(this.ip);
dest.writeByte(this.confirmed ? (byte) 1 : (byte) 0);
dest.writeByte(this.suspended ? (byte) 1 : (byte) 0);
dest.writeByte(this.silenced ? (byte) 1 : (byte) 0);
dest.writeByte(this.disabled ? (byte) 1 : (byte) 0);
dest.writeParcelable(this.account, flags);
}
public AccountAdmin() {
}
protected AccountAdmin(Parcel in) {
this.id = in.readString();
this.username = in.readString();
long tmpCreated_at = in.readLong();
this.created_at = tmpCreated_at == -1 ? null : new Date(tmpCreated_at);
this.email = in.readString();
this.role = in.readString();
this.ip = in.readString();
this.confirmed = in.readByte() != 0;
this.suspended = in.readByte() != 0;
this.silenced = in.readByte() != 0;
this.disabled = in.readByte() != 0;
this.account = in.readParcelable(Account.class.getClassLoader());
}
public static final Parcelable.Creator<AccountAdmin> CREATOR = new Parcelable.Creator<AccountAdmin>() {
@Override
public AccountAdmin createFromParcel(Parcel source) {
return new AccountAdmin(source);
}
@Override
public AccountAdmin[] newArray(int size) {
return new AccountAdmin[size];
}
};
}

View File

@ -0,0 +1,167 @@
package app.fedilab.android.client.Entities;
/* Copyright 2019 Thomas Schneider
*
* This file is a part of Fedilab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Date;
import java.util.List;
public class Report implements Parcelable {
private String id;
private String action_taken;
private String comment;
private Date created_at;
private Date updated_at;
private String account_id;
private String target_account_id;
private String assigned_account_id;
private String action_taken_by_account_id;
private List<Status> statuses;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAction_taken() {
return action_taken;
}
public void setAction_taken(String action_taken) {
this.action_taken = action_taken;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Date getCreated_at() {
return created_at;
}
public void setCreated_at(Date created_at) {
this.created_at = created_at;
}
public Date getUpdated_at() {
return updated_at;
}
public void setUpdated_at(Date updated_at) {
this.updated_at = updated_at;
}
public String getAccount_id() {
return account_id;
}
public void setAccount_id(String account_id) {
this.account_id = account_id;
}
public String getTarget_account_id() {
return target_account_id;
}
public void setTarget_account_id(String target_account_id) {
this.target_account_id = target_account_id;
}
public String getAssigned_account_id() {
return assigned_account_id;
}
public void setAssigned_account_id(String assigned_account_id) {
this.assigned_account_id = assigned_account_id;
}
public String getAction_taken_by_account_id() {
return action_taken_by_account_id;
}
public void setAction_taken_by_account_id(String action_taken_by_account_id) {
this.action_taken_by_account_id = action_taken_by_account_id;
}
public List<Status> getStatuses() {
return statuses;
}
public void setStatuses(List<Status> statuses) {
this.statuses = statuses;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.id);
dest.writeString(this.action_taken);
dest.writeString(this.comment);
dest.writeLong(this.created_at != null ? this.created_at.getTime() : -1);
dest.writeLong(this.updated_at != null ? this.updated_at.getTime() : -1);
dest.writeString(this.account_id);
dest.writeString(this.target_account_id);
dest.writeString(this.assigned_account_id);
dest.writeString(this.action_taken_by_account_id);
dest.writeTypedList(this.statuses);
}
public Report() {
}
protected Report(Parcel in) {
this.id = in.readString();
this.action_taken = in.readString();
this.comment = in.readString();
long tmpCreated_at = in.readLong();
this.created_at = tmpCreated_at == -1 ? null : new Date(tmpCreated_at);
long tmpUpdated_at = in.readLong();
this.updated_at = tmpUpdated_at == -1 ? null : new Date(tmpUpdated_at);
this.account_id = in.readString();
this.target_account_id = in.readString();
this.assigned_account_id = in.readString();
this.action_taken_by_account_id = in.readString();
this.statuses = in.createTypedArrayList(Status.CREATOR);
}
public static final Parcelable.Creator<Report> CREATOR = new Parcelable.Creator<Report>() {
@Override
public Report createFromParcel(Parcel source) {
return new Report(source);
}
@Override
public Report[] newArray(int size) {
return new Report[size];
}
};
}