1 /*******************************************************************************
2  * This file is part of BOINC.
3  * http://boinc.berkeley.edu
4  * Copyright (C) 2012 University of California
5  *
6  * BOINC is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation,
9  * either version 3 of the License, or (at your option) any later version.
10  *
11  * BOINC is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18  ******************************************************************************/
19 
20 package edu.berkeley.boinc.rpc;
21 
22 import android.os.Parcel;
23 import android.os.Parcelable;
24 
25 public class Notice implements Parcelable {
26 	public int seqno = -1;
27     public String title = "";
28     public String description = "";
29     public double create_time;
30     public double arrival_time;
31     public boolean is_private;
32     public String category = "";
33         // assigned by RSS source.  Reserved values:
34         // "client": generated by client
35         // "server": scheduler RPC message
36     public String link = "";
37         // URL where original message can be seen, if any
38     public String project_name;
39         // if notice is associated with a project
40 
41     public boolean isServerNotice;
42     public boolean isClientNotice;
43 
44 	@Override
describeContents()45 	public int describeContents() {
46 		// TODO Auto-generated method stub
47 		return 0;
48 	}
49 	@Override
writeToParcel(Parcel dest, int flags)50 	public void writeToParcel(Parcel dest, int flags) {
51 		// TODO Auto-generated method stub
52 		dest.writeInt(seqno);
53 		dest.writeString(title);
54 		dest.writeString(description);
55 		dest.writeDouble(create_time);
56 		dest.writeDouble(arrival_time);
57 		dest.writeString(category);
58 		dest.writeString(link);
59 		dest.writeString(project_name);
60 
61 		dest.writeBooleanArray(new boolean[] {
62 				is_private,
63 				isServerNotice,
64 				isClientNotice});
65 	}
66 
Notice()67 	public Notice() {}
68 
Notice(Parcel in)69 	private Notice(Parcel in) {
70 		seqno = in.readInt();
71 		title = in.readString();
72 		description = in.readString();
73 		create_time = in.readDouble();
74 		arrival_time = in.readDouble();
75 		category = in.readString();
76 		link = in.readString();
77 		project_name = in.readString();
78 
79 		boolean[] bArray = in.createBooleanArray();
80 		is_private = bArray[0];
81 		isServerNotice = bArray[1];
82 		isClientNotice = bArray[2];
83 
84 	}
85 
86 	public static final Parcelable.Creator<Notice> CREATOR = new Parcelable.Creator<Notice>() {
87 		public Notice createFromParcel(Parcel in) {
88 		    return new Notice(in);
89 		}
90 		public Notice[] newArray(int size) {
91 		    return new Notice[size];
92 		}
93 	};
94 }
95