Android Open Source - jogjakota-perizinan Permit






From Project

Back to project page jogjakota-perizinan.

License

The source code is released under:

MIT License

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

Java Source Code

package id.go.jogjakota.perizinan.domain;
/*from www .  j a  v a  2s  . com*/
import android.os.Parcel;
import android.os.Parcelable;

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;

import java.util.HashMap;
import java.util.LinkedHashMap;

public class Permit implements Parcelable {

    private User user;
    private DateTime requestTime;
    private DateTime responseTime;
    private PermitType type;
    private LinkedHashMap<String, String> fieldValues;
    private boolean approved;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public HashMap<String, String> getFieldValues() {
        return fieldValues;
    }

    public void addFieldValue(String key, String value) {
        if (fieldValues == null)
            fieldValues = new LinkedHashMap<>();

        fieldValues.put(key, value);
    }

    public DateTime getRequestTime() {
        return requestTime;
    }

    public String getRequestTimeString() {
        return requestTime.toString(DateTimeFormat.longDate());
    }

    public void setRequestTime(DateTime requestTime) {
        this.requestTime = requestTime;
    }

    public DateTime getResponseTime() {
        return responseTime;
    }

    public void setResponseTime(DateTime responseTime) {
        this.responseTime = responseTime;
    }

    public PermitType getType() {
        return type;
    }

    public void setType(PermitType type) {
        this.type = type;
    }

    public boolean isApproved() {
        return approved;
    }

    public void setApproved(boolean approved) {
        this.approved = approved;
    }

    public String getStatusString() {
        return approved
                ? "Pengajuan anda telah disetujui dan dapat dicetak di kantor Dinas Perizinan."
                : "Maaf, pengajuan anda belum selesai diproses. ";
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(user);
        dest.writeValue(requestTime);
        dest.writeValue(responseTime);
        dest.writeValue(type);
        dest.writeByte((byte) (approved ? 0x01 : 0x00));

        dest.writeInt(fieldValues.size());
        for (String key : fieldValues.keySet()) {
            dest.writeString(key);
            dest.writeString(fieldValues.get(key));
        }
    }

    public Permit() {
    }

    private Permit(Parcel in) {
        user = (User) in.readValue(User.class.getClassLoader());
        requestTime = (DateTime) in.readValue(DateTime.class.getClassLoader());
        responseTime = (DateTime) in.readValue(DateTime.class.getClassLoader());
        type = (PermitType) in.readValue(PermitType.class.getClassLoader());
        approved = in.readByte() != 0x00;

        int fieldCount = in.readInt();
        fieldValues = new LinkedHashMap<>();
        for (int i = 0; i < fieldCount; i++)
            fieldValues.put(in.readString(), in.readString());
    }

    public static final Parcelable.Creator<Permit> CREATOR = new Parcelable.Creator<Permit>() {
        public Permit createFromParcel(Parcel source) {
            return new Permit(source);
        }

        public Permit[] newArray(int size) {
            return new Permit[size];
        }
    };
}




Java Source Code List

id.go.jogjakota.perizinan.ApplicationTest.java
id.go.jogjakota.perizinan.BaseActivity.java
id.go.jogjakota.perizinan.BaseApp.java
id.go.jogjakota.perizinan.LoginActivity.java
id.go.jogjakota.perizinan.MainActivity.java
id.go.jogjakota.perizinan.PermitDetailActivity.java
id.go.jogjakota.perizinan.PermitFormActivity.java
id.go.jogjakota.perizinan.PermitListActivity.java
id.go.jogjakota.perizinan.PermitTypeListActivity.java
id.go.jogjakota.perizinan.RegisterActivity.java
id.go.jogjakota.perizinan.SplashActivity.java
id.go.jogjakota.perizinan.StatusView.java
id.go.jogjakota.perizinan.Tag.java
id.go.jogjakota.perizinan.Transition.java
id.go.jogjakota.perizinan.TwoLineViewHolder.java
id.go.jogjakota.perizinan.data.Dummies.java
id.go.jogjakota.perizinan.data.PermitDB.java
id.go.jogjakota.perizinan.data.PermitTypes.java
id.go.jogjakota.perizinan.data.Session.java
id.go.jogjakota.perizinan.data.UserDB.java
id.go.jogjakota.perizinan.domain.PermitType.java
id.go.jogjakota.perizinan.domain.Permit.java
id.go.jogjakota.perizinan.domain.User.java