Android Open Source - Joetz-Android-V2 Person






From Project

Back to project page Joetz-Android-V2.

License

The source code is released under:

GNU General Public License

If you think the Android project Joetz-Android-V2 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 com.example.jens.myapplication.domain;
//from www .ja  v  a  2  s  . co m
import android.os.Parcel;
import android.os.Parcelable;

import com.example.jens.myapplication.domain.converter.UnixDateTimeConverter;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.joda.time.DateTime;

/**
 * Created by Sam on 21/10/2014.
 */

/**
 * JsonIgnoreProperties(ignoreUnknown = true) indicates that while converting the JSON string from
 * the server to a User object, fields not defined here will be ignored instead of
 * throwing an error.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class Person implements Parcelable {
    public static final String JSON_ID = "Id";
    public static final String JSON_FIRST_NAME = "Firstname";
    public static final String JSON_LAST_NAME = "Lastname";
    public static final String JSON_EMAIL = "Email";
    public static final String JSON_DATE_OF_BIRTH = "DateOfBirth";
    public static final String JSON_STREET = "Street";
    public static final String JSON_HOUSE_NUMBER = "HouseNumber";
    public static final String JSON_BUS = "Bus";
    public static final String JSON_POSTAL_CODE = "PostalCode";
    public static final String JSON_CITY = "City";
    public static final String JSON_TELEPHONE = "Telephone";
    public static final String JSON_RIJKSREGISTERNUMMER = "RijksregisterNummer";
    public static final String JSON_BOND_AANSLUITINGSNUMMER = "AansluitingsNummer";
    public static final String JSON_BOND_CODE_GERECHTIGDE = "CodeGerechtigde";
    public static final String JSON_SUBSCRIBED_TO_NEWSLETTER = "SubscribedToNewsletter";

    @JsonProperty(JSON_ID)
    private long id = -1;

    @JsonProperty(JSON_FIRST_NAME)
    private String firstName;

    @JsonProperty(JSON_LAST_NAME)
    private String lastName;

    @JsonProperty(JSON_EMAIL)
    private String email;

    //Separate getter/setter for unix conversion.
    @JsonIgnore
    private DateTime dateOfBirth;

    @JsonProperty(JSON_STREET)
    private String street;

    @JsonProperty(JSON_HOUSE_NUMBER)
    private int houseNumber;

    @JsonProperty(JSON_BUS)
    private String bus;

    @JsonProperty(JSON_POSTAL_CODE)
    private int postalCode;

    @JsonProperty(JSON_CITY)
    private String city;

    @JsonProperty(JSON_TELEPHONE)
    private String phone;

    @JsonProperty(JSON_RIJKSREGISTERNUMMER)
    private String rijksRegisterNummer;

    @JsonProperty(JSON_BOND_AANSLUITINGSNUMMER)
    private String bondAansluitingsNr;

    @JsonProperty(JSON_BOND_CODE_GERECHTIGDE)
    private String bondCodeGerechtigde;

    public Person(){

    }

    public boolean hasBondInformation(){
        return this.getBondAansluitingsNr() != null &&
                !this.getBondAansluitingsNr().isEmpty() &&
                this.getBondCodeGerechtigde() != null &&
                !this.getBondCodeGerechtigde().isEmpty();
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public DateTime getDateOfBirth() {
        return dateOfBirth;
    }

    public void setDateOfBirth(DateTime dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    @JsonProperty(JSON_DATE_OF_BIRTH)
    public long getUnixDateOfBirth(){
        return UnixDateTimeConverter.getUnix(dateOfBirth);
    }

    @JsonProperty(JSON_DATE_OF_BIRTH)
    public void setUnixDateOfBirth(long unixTime){
        setDateOfBirth(UnixDateTimeConverter.getDate(unixTime));
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public int getPostalCode() {
        return postalCode;
    }

    public void setPostalCode(int postalCode) {
        this.postalCode = postalCode;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getRijksRegisterNummer() {
        return rijksRegisterNummer;
    }

    public void setRijksRegisterNummer(String rijksRegisterNummer) {
        this.rijksRegisterNummer = rijksRegisterNummer;
    }

    public String getBondCodeGerechtigde() {
        return bondCodeGerechtigde;
    }

    public void setBondCodeGerechtigde(String bondCodeGerechtigde) {
        this.bondCodeGerechtigde = bondCodeGerechtigde;
    }

    public String getBondAansluitingsNr() {
        return bondAansluitingsNr;
    }

    public void setBondAansluitingsNr(String bondAansluitingsNr) {
        this.bondAansluitingsNr = bondAansluitingsNr;
    }

    public int getHouseNumber() {
        return houseNumber;
    }

    public void setHouseNumber(int houseNumber) {
        this.houseNumber = houseNumber;
    }

    public String getBus() {
        return bus;
    }

    public void setBus(String bus) {
        this.bus = bus;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    /**
     * Creates a clone of this person, returns a new person with the same data
     * @return
     */
    public Person clone(){
        Person p = new Person();
        p.setId(getId());
        p.setFirstName(getFirstName());
        p.setLastName(getLastName());
        p.setEmail(getEmail());
        p.setDateOfBirth(getDateOfBirth());
        p.setStreet(getStreet());
        p.setHouseNumber(getHouseNumber());
        p.setBus(getBus());
        p.setPostalCode(getPostalCode());
        p.setCity(getCity());
        p.setPhone(getPhone());
        p.setRijksRegisterNummer(getRijksRegisterNummer());
        p.setBondAansluitingsNr(getBondAansluitingsNr());
        p.setBondCodeGerechtigde(getBondCodeGerechtigde());
        return p;
    }

    @Override
    public String toString() {
        return "Person[Name: " + firstName + " " + lastName + " || Email: " + email + "]";
    }

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

    @Override
    public void writeToParcel(Parcel pc, int flags) {
        pc.writeLong(id);
        pc.writeString(firstName);
        pc.writeString(lastName);
        pc.writeString(email);
        pc.writeLong(getUnixDateOfBirth());
        pc.writeString(street);
        pc.writeInt(houseNumber);
        pc.writeString(bus);
        pc.writeInt(postalCode);
        pc.writeString(city);
        pc.writeString(phone);
        pc.writeString(rijksRegisterNummer);
        pc.writeString(bondAansluitingsNr);
        pc.writeString(bondCodeGerechtigde);
    }

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

        @Override
        public Person[] newArray(int size) {
            return new Person[size];
        }
    };

    public Person(Parcel pc){
        id = pc.readLong();
        firstName = pc.readString();
        lastName = pc.readString();
        email = pc.readString();
        setUnixDateOfBirth(pc.readLong());
        street = pc.readString();
        houseNumber = pc.readInt();
        bus = pc.readString();
        postalCode = pc.readInt();
        city = pc.readString();
        phone = pc.readString();
        rijksRegisterNummer = pc.readString();
        bondAansluitingsNr = pc.readString();
        bondCodeGerechtigde = pc.readString();
    }
}




Java Source Code List

com.example.jens.myapplication.ApplicationTest.java
com.example.jens.myapplication.account.FragmentAccount.java
com.example.jens.myapplication.account.LoginDialogActivity.java
com.example.jens.myapplication.account.LoginFragment.java
com.example.jens.myapplication.account.PersonsFragment.java
com.example.jens.myapplication.account.ProfileFragment.java
com.example.jens.myapplication.account.RegisterDialogActivity.java
com.example.jens.myapplication.account.RegisterFragment.java
com.example.jens.myapplication.account.TabsPagerAdapter.java
com.example.jens.myapplication.activities.ActivityDetailActivity.java
com.example.jens.myapplication.activities.ActivityDetailFragment.java
com.example.jens.myapplication.activities.FragmentListActivities.java
com.example.jens.myapplication.activities.JoetzActivitiesAdapter.java
com.example.jens.myapplication.activities.JoetzActivity.java
com.example.jens.myapplication.activities.StartActivity.java
com.example.jens.myapplication.apimanager.ApiConnection.java
com.example.jens.myapplication.apimanager.CancellableTask.java
com.example.jens.myapplication.apimanager.JSONParsingTask.java
com.example.jens.myapplication.apimanager.PostRequestTask.java
com.example.jens.myapplication.apimanager.RequestParams.java
com.example.jens.myapplication.apimanager.SimpleRequestTask.java
com.example.jens.myapplication.apimanager.filter.PersonFilter.java
com.example.jens.myapplication.apimanager.manager.ActivityManager.java
com.example.jens.myapplication.apimanager.manager.AuthToken.java
com.example.jens.myapplication.apimanager.manager.BookingManager.java
com.example.jens.myapplication.apimanager.manager.CampManager.java
com.example.jens.myapplication.apimanager.manager.ImageManager.java
com.example.jens.myapplication.apimanager.manager.LoginManager.java
com.example.jens.myapplication.apimanager.manager.ProfileManager.java
com.example.jens.myapplication.apimanager.manager.RegisterManager.java
com.example.jens.myapplication.booking.AddPersonActivity.java
com.example.jens.myapplication.booking.BookingActivity.java
com.example.jens.myapplication.booking.BookingBondFragment.java
com.example.jens.myapplication.booking.BookingContactFragment.java
com.example.jens.myapplication.booking.BookingExtraFragment.java
com.example.jens.myapplication.booking.BookingParticipantsFragment.java
com.example.jens.myapplication.bookingHistory.BookingHistoryDetailActivity.java
com.example.jens.myapplication.bookingHistory.BookingHistoryDetailFragment.java
com.example.jens.myapplication.bookingHistory.BookingHistoryOverviewFragment.java
com.example.jens.myapplication.bookingHistory.BookingsAdapter.java
com.example.jens.myapplication.calendar.FragmentCalendar.java
com.example.jens.myapplication.calendar.KalenderAdapter.java
com.example.jens.myapplication.calendar.KalenderItem.java
com.example.jens.myapplication.camps.CampAdapter.java
com.example.jens.myapplication.camps.CampDetailActivity.java
com.example.jens.myapplication.camps.CampFilterActivity.java
com.example.jens.myapplication.camps.FilterFragment.java
com.example.jens.myapplication.camps.FragmentListCamps.java
com.example.jens.myapplication.camps.ImageActivity.java
com.example.jens.myapplication.camps.ImagePagerFragment.java
com.example.jens.myapplication.camps.InfoFragment.java
com.example.jens.myapplication.camps.PhotoFragment.java
com.example.jens.myapplication.camps.RecyclerItemClickListener.java
com.example.jens.myapplication.camps.SquareImageView.java
com.example.jens.myapplication.camps.TabsPagerAdapter.java
com.example.jens.myapplication.domain.BookingStatus.java
com.example.jens.myapplication.domain.Booking.java
com.example.jens.myapplication.domain.Camp.java
com.example.jens.myapplication.domain.PeriodCategory.java
com.example.jens.myapplication.domain.Person.java
com.example.jens.myapplication.domain.UserRole.java
com.example.jens.myapplication.domain.User.java
com.example.jens.myapplication.domain.binding.PersonValidatorBinding.java
com.example.jens.myapplication.domain.binding.UserValidatorBinding.java
com.example.jens.myapplication.domain.binding.ValidatorBinding.java
com.example.jens.myapplication.domain.converter.ErrorConverter.java
com.example.jens.myapplication.domain.converter.MyStringParser.java
com.example.jens.myapplication.domain.converter.UnixDateTimeConverter.java
com.example.jens.myapplication.domain.validator.PersonValidator.java
com.example.jens.myapplication.domain.validator.UserValidator.java
com.example.jens.myapplication.domain.validator.Validator.java
com.example.jens.myapplication.home.AanbevolenAdapter.java
com.example.jens.myapplication.home.HomeFragment.java
com.example.jens.myapplication.home.ImageSlideAdapter.java
com.example.jens.myapplication.home.Reclame.java
com.example.jens.myapplication.lib.RangeSeekBar.java
com.example.jens.myapplication.main.MainActivity.java
com.example.jens.myapplication.main.NavDrawerAdapter.java
com.example.jens.myapplication.main.NavDrawerItem.java
com.example.jens.myapplication.main.NavMenuItem.java
com.example.jens.myapplication.main.NavMenuSection.java
com.example.jens.myapplication.sam.JoetzApplication.java
com.example.jens.myapplication.sam.MyFragment.java
com.example.jens.myapplication.sam.MySaveableFragment.java
com.example.jens.myapplication.util.AESEncryption.java
com.example.jens.myapplication.util.ActivityUtils.java
com.example.jens.myapplication.util.BindingUtils.java
com.example.jens.myapplication.util.DateTimeStringConverter.java
com.example.jens.myapplication.util.JsonUtils.java
com.example.jens.myapplication.util.MyMonths.java
com.example.jens.myapplication.util.StringUtils.java
com.example.jens.myapplication.view.MyLinearLayout.java