/* * Copyright 2012 Tallinn University Centre for Educational Technology * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ee.htk.dippler.app.entities; import ee.htk.dippler.app.R; import android.content.Context; import android.os.Parcel; import android.os.Parcelable; public class Assignment implements Parcelable { private String title; private String deadline; private String points; private String type; private String late_submission; private String target; //TODO not used private String visibility; private String content; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDeadline() { return deadline; } public void setDeadline(String deadline) { this.deadline = deadline; } public String getPoints() { return points; } public void setPoints(String points) { this.points = points; } public String getType() { return type; } public String getType(Context context) { if ( this.getType().equalsIgnoreCase("blogpost") ) { type = context.getString(R.string.assignment_blogpost); } else if ( this.getType().equalsIgnoreCase("reflection") ) { type = context.getString(R.string.assignment_reflection); } else if ( this.getType().equalsIgnoreCase("file") ) { type = context.getString(R.string.assignment_file); } else if ( this.getType().equalsIgnoreCase("exercise") ) { type = context.getString(R.string.assignment_exercise); } else if ( this.getType().equalsIgnoreCase("test") ) { type = context.getString(R.string.assignment_test); } else if ( this.getType().equalsIgnoreCase("offline") ) { type = context.getString(R.string.assignment_offline); } return type; } public void setType(String type) { this.type = type; } public String getLate_submission() { return late_submission; } public void setLate_submission(String late_submission) { this.late_submission = late_submission; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public String getVisibility() { return visibility; } public void setVisibility(String visibility) { this.visibility = visibility; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Assignment getInstance() { Assignment new_instance = new Assignment(); new_instance.setTitle(this.getTitle()); new_instance.setDeadline(this.getDeadline()); new_instance.setPoints(this.getPoints()); new_instance.setLate_submission(this.getLate_submission()); new_instance.setVisibility(this.getVisibility()); new_instance.setType(this.getType()); new_instance.setContent(this.getContent()); return new_instance; } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(title); dest.writeString(deadline); dest.writeString(points); dest.writeString(type); dest.writeString(late_submission); dest.writeString(target); dest.writeString(visibility); dest.writeString(content); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public Assignment createFromParcel(Parcel in) { return new Assignment(in); } public Assignment[] newArray(int size) { return new Assignment[size]; } }; private Assignment(Parcel in) { title = in.readString(); deadline = in.readString(); points = in.readString(); type = in.readString(); late_submission = in.readString(); target = in.readString(); visibility = in.readString(); content = in.readString(); } public Assignment() { } }