Android Open Source - GradeCalculator-Android Storable






From Project

Back to project page GradeCalculator-Android.

License

The source code is released under:

Copyright (C) 2012 Jimmy Theis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in ...

If you think the Android project GradeCalculator-Android 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

/*
 * Copyright (C) 2012 Jimmy Theis. Licensed under the MIT License:
 * /*  w  w  w  .j av  a  2  s  .c om*/
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.jetheis.android.grades.storage;

import android.content.Context;

/**
 * An abstract class containing shared attributes of objects that will be stored
 * in the database.
 */
public abstract class Storable {

    private long mId;

    public Storable() {
        mId = 0;
    }

    /**
     * Get the unique identifier (within the object's type) for this object.
     * 
     * @return This object's unique identifier (0 if unsaved, -1 if saving has
     *         failed with an error in the past).
     */
    public long getId() {
        return mId;
    }

    /**
     * Set the unique identifier for this object. This should really only be
     * done by the class that creates the object after retrieving it from the
     * database.
     * 
     * @param id
     *            This object's new unique identifier.
     */
    public void setId(long id) {
        mId = id;
    }

    /**
     * Load (or prepare to load) any connected objects from the database. This
     * method should only be called by {@link StorageAdapter}s that are
     * populating "full" versions of the object.
     */
    public abstract void loadConnectedObjects();

    /**
     * Save this object to the database. If this is a new object that is not yet
     * reflected in the database, a new entry should be created. Otherwise, the
     * existing entry for this object should be updated with the most recent
     * values of this object. This save should also recurse to save any
     * contained objects.
     * 
     * @param context
     *            The {@link Context} to save this object within.
     */
    public abstract void save();

    /**
     * Remove this object from the database. If this object is not reflected in
     * the database, nothing should happen. This destruction should also recurse
     * to destroy any contained objects.
     */
    public abstract void destroy();
}




Java Source Code List

com.jetheis.android.grades.Constants.java
com.jetheis.android.grades.activity.AboutActivity.java
com.jetheis.android.grades.activity.CourseActivity.java
com.jetheis.android.grades.activity.CourseListActivity.java
com.jetheis.android.grades.billing.BillingWrapper.java
com.jetheis.android.grades.billing.FreeBillingWrapper.java
com.jetheis.android.grades.billing.Security.java
com.jetheis.android.grades.billing.googleplay.GooglePlayBillingConstants.java
com.jetheis.android.grades.billing.googleplay.GooglePlayBillingReceiver.java
com.jetheis.android.grades.billing.googleplay.GooglePlayBillingService.java
com.jetheis.android.grades.billing.googleplay.GooglePlayBillingWrapper.java
com.jetheis.android.grades.fragment.AboutFragment.java
com.jetheis.android.grades.fragment.AddCourseDialogFragment.java
com.jetheis.android.grades.fragment.AddGradeComponentDialogFragment.java
com.jetheis.android.grades.fragment.BuyFullVersionFragment.java
com.jetheis.android.grades.fragment.CourseListFragment.java
com.jetheis.android.grades.fragment.CourseOverviewFragment.java
com.jetheis.android.grades.fragment.EditCourseDialogFragment.java
com.jetheis.android.grades.fragment.EditGradeComponentDialogFragment.java
com.jetheis.android.grades.fragment.GradeComponentListFragment.java
com.jetheis.android.grades.listadapter.CourseArrayAdapter.java
com.jetheis.android.grades.model.Course.java
com.jetheis.android.grades.model.GradeComponent.java
com.jetheis.android.grades.model.PercentageGradeComponent.java
com.jetheis.android.grades.model.PointTotalGradeComponent.java
com.jetheis.android.grades.storage.CourseStorageAdapter.java
com.jetheis.android.grades.storage.DatabaseHelper.java
com.jetheis.android.grades.storage.GradeComponentStorageAdapter.java
com.jetheis.android.grades.storage.Storable.java
com.jetheis.android.grades.storage.StorageAdapter.java
com.jetheis.android.grades.storage.StorageIterator.java