Android Open Source - openpomo Clean Database






From Project

Back to project page openpomo.

License

The source code is released under:

GNU General Public License

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

/**
 * This file is part of Pomodroid.// w w  w  . ja  v  a2 s.c o  m
 *
 *   Pomodroid is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Pomodroid is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with Pomodroid.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.unibz.pomodroid;

import it.unibz.pomodroid.exceptions.PomodroidException;
import it.unibz.pomodroid.models.*;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

/**
 * This class allows us to manipulate the content of the object oriented database db4o.
 *
 * @author Daniel Graziotin <d AT danielgraziotin DOT it>
 * @author Thomas Schievenin <thomas.schievenin@stud-inf.unibz.it>
 * @see it.unibz.pomodroid.SharedActivity
 * @see android.view.View.OnClickListener
 * @see http://www.db4o.com
 */
public class CleanDatabase extends SharedActivity implements OnClickListener {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.cleandatabase);
        Button abDeleteActivitiesEvents = (Button) findViewById(R.id.abDeleteActivitiesEvents);
        abDeleteActivitiesEvents.setOnClickListener((OnClickListener) this);
        Button abDeleteDatabase = (Button) findViewById(R.id.abDeleteDatabase);
        abDeleteDatabase.setOnClickListener((OnClickListener) this);
        Button abDefragmentDatabase = (Button) findViewById(R.id.abDefragmentDatabase);
        abDefragmentDatabase.setOnClickListener((OnClickListener) this);
    }

    /**
     * Default listener for clicks.
     * Regarding to the button that has been clicked, the related action is
     * called.
     *
     * @see android.view.View.OnClickListener#onClick(android.view.View)
     */
    @Override
    public void onClick(View v) {
        try {
            switch (v.getId()) {
                case R.id.abDeleteActivitiesEvents:
                    Activity.deleteAll(super.getDbHelper());
                    Event.deleteAll(super.getDbHelper());
                    throw new PomodroidException(
                            "All activities and events deleted!", "INFO");
                case R.id.abDefragmentDatabase:
                    super.getDbHelper().defragment();
                    throw new PomodroidException("Database defragmented.", "INFO");
                case R.id.abDeleteDatabase:
                    super.getDbHelper().deleteDatabase();
                    throw new PomodroidException(
                            "Database destroyed. Please restart Pomodroid.", "INFO");
            }
        } catch (PomodroidException e) {
            e.alertUser(context);
        } finally {
            super.getDbHelper().commit();
        }

    }
}




Java Source Code List

it.unibz.pomodroid.About.java
it.unibz.pomodroid.ActivityInventorySheet.java
it.unibz.pomodroid.CleanDatabase.java
it.unibz.pomodroid.EditActivity.java
it.unibz.pomodroid.EditService.java
it.unibz.pomodroid.ListServices.java
it.unibz.pomodroid.PomodoroService.java
it.unibz.pomodroid.Pomodoro.java
it.unibz.pomodroid.Pomodroid.java
it.unibz.pomodroid.Preferences.java
it.unibz.pomodroid.Services.java
it.unibz.pomodroid.SharedActivity.java
it.unibz.pomodroid.SharedListActivity.java
it.unibz.pomodroid.Statistics.java
it.unibz.pomodroid.TabPomodroid.java
it.unibz.pomodroid.TabPreferences.java
it.unibz.pomodroid.TodoTodaySheet.java
it.unibz.pomodroid.TrashSheet.java
it.unibz.pomodroid.exceptions.PomodroidException.java
it.unibz.pomodroid.factories.ActivityFactory.java
it.unibz.pomodroid.models.Activity.java
it.unibz.pomodroid.models.DBHelper.java
it.unibz.pomodroid.models.Event.java
it.unibz.pomodroid.models.Service.java
it.unibz.pomodroid.models.User.java
it.unibz.pomodroid.services.TracTicketFetcher.java
it.unibz.pomodroid.services.XmlRpcClient.java
org.xmlrpc.Test.java
org.xmlrpc.android.Base64Coder.java
org.xmlrpc.android.XMLRPCClient.java
org.xmlrpc.android.XMLRPCException.java
org.xmlrpc.android.XMLRPCFault.java
org.xmlrpc.android.XMLRPCSerializer.java