Android Open Source - twitt4droid D A O Factory






From Project

Back to project page twitt4droid.

License

The source code is released under:

Apache License

If you think the Android project twitt4droid 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 2014 Daniel Pedraza-Arcega/*ww w.  j  a  v  a2s.c o  m*/
 *
 * 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 com.twitt4droid.data.dao.impl;

import android.content.Context;

import com.twitt4droid.data.dao.ListTimelineDAO;
import com.twitt4droid.data.dao.TimelineDAO;
import com.twitt4droid.data.dao.UserDAO;
import com.twitt4droid.data.dao.UserTimelineDAO;
import com.twitt4droid.data.dao.impl.sqlite.ListSQLiteDAO;
import com.twitt4droid.data.dao.impl.sqlite.TimelineSQLiteDAO;
import com.twitt4droid.data.dao.impl.sqlite.UserSQLiteDAO;
import com.twitt4droid.data.dao.impl.sqlite.UserTimelineSQLiteDAO;
import com.twitt4droid.data.source.Twitt4droidDatabaseHelper;

/**
 * Creates the current DAO objects from the implementations.
 * 
 * @author Daniel Pedraza-Arcega
 * @since version 1.0
 */
public class DAOFactory {

    private final Context context;

    /**
     * Creates a DAOFactory.
     * 
     * @param context the application context.
     */
    public DAOFactory(Context context) {
        this.context = context;
    }

    /** @return a new HomeTimelineDAO. */
    public TimelineDAO getHomeTimelineDAO() {
        TimelineSQLiteDAO dao = new TimelineSQLiteDAO(TimelineSQLiteDAO.Table.HOME);
        dao.setContext(context);
        dao.setSQLiteOpenHelper(new Twitt4droidDatabaseHelper(context));
        return dao;
    }

    /** @return a new MentionsTimelineDAO. */
    public TimelineDAO getMentionsTimelineDAO() {
        TimelineSQLiteDAO dao = new TimelineSQLiteDAO(TimelineSQLiteDAO.Table.MENTION);
        dao.setContext(context);
        dao.setSQLiteOpenHelper(new Twitt4droidDatabaseHelper(context));
        return dao;
    }

    /** @return a new UserTimelineDAO. */
    public UserTimelineDAO getUserTimelineDAO() {
        UserTimelineSQLiteDAO dao = new UserTimelineSQLiteDAO();
        dao.setContext(context);
        dao.setSQLiteOpenHelper(new Twitt4droidDatabaseHelper(context));
        return dao;
    }

    /** @return a new FixedQueryTimelineDAO. */
    public TimelineDAO getFixedQueryTimelineDAO() {
        TimelineSQLiteDAO dao = new TimelineSQLiteDAO(TimelineSQLiteDAO.Table.FIXED_QUERY);
        dao.setContext(context);
        dao.setSQLiteOpenHelper(new Twitt4droidDatabaseHelper(context));
        return dao;
    }

    /** @return a new QueryableTimelineDAO. */
    public TimelineDAO getQueryableTimelineDAO() {
        TimelineSQLiteDAO dao = new TimelineSQLiteDAO(TimelineSQLiteDAO.Table.QUERYABLE);
        dao.setContext(context);
        dao.setSQLiteOpenHelper(new Twitt4droidDatabaseHelper(context));
        return dao;
    }

    /** @return a new ListTimelineDAO. */
    public ListTimelineDAO getListTimelineDAO() {
        ListSQLiteDAO dao = new ListSQLiteDAO();
        dao.setContext(context);
        dao.setSQLiteOpenHelper(new Twitt4droidDatabaseHelper(context));
        return dao;
    }

    /** @return a new UserDAO. */
    public UserDAO getUserDAO() {
        UserSQLiteDAO dao = new UserSQLiteDAO();
        dao.setContext(context);
        dao.setSQLiteOpenHelper(new Twitt4droidDatabaseHelper(context));
        return dao;
    }
}




Java Source Code List

com.twitt4droid.Resources.java
com.twitt4droid.Twitt4droid.java
com.twitt4droid.activity.UserProfileActivity.java
com.twitt4droid.activity.WebLoginActivity.java
com.twitt4droid.app.activity.MainActivity.java
com.twitt4droid.app.activity.SettingsActivity.java
com.twitt4droid.app.activity.SignInActivity.java
com.twitt4droid.app.fragment.ListsFragment.java
com.twitt4droid.app.widget.DrawerItemAdapter.java
com.twitt4droid.app.widget.DrawerItem.java
com.twitt4droid.app.widget.ScrimInsetsFrameLayout.java
com.twitt4droid.data.dao.GenericDAO.java
com.twitt4droid.data.dao.ListTimelineDAO.java
com.twitt4droid.data.dao.TimelineDAO.java
com.twitt4droid.data.dao.UserDAO.java
com.twitt4droid.data.dao.UserTimelineDAO.java
com.twitt4droid.data.dao.impl.DAOFactory.java
com.twitt4droid.data.dao.impl.sqlite.ListSQLiteDAO.java
com.twitt4droid.data.dao.impl.sqlite.SQLiteTemplate.java
com.twitt4droid.data.dao.impl.sqlite.SQLiteUtils.java
com.twitt4droid.data.dao.impl.sqlite.StatusCursorImpl.java
com.twitt4droid.data.dao.impl.sqlite.TimelineSQLiteDAO.java
com.twitt4droid.data.dao.impl.sqlite.UserCursorImpl.java
com.twitt4droid.data.dao.impl.sqlite.UserSQLiteDAO.java
com.twitt4droid.data.dao.impl.sqlite.UserTimelineSQLiteDAO.java
com.twitt4droid.data.source.SQLFileParser.java
com.twitt4droid.data.source.Twitt4droidDatabaseHelper.java
com.twitt4droid.fragment.FixedQueryTimelineFragment.java
com.twitt4droid.fragment.HomeTimelineFragment.java
com.twitt4droid.fragment.ListTimelineFragment.java
com.twitt4droid.fragment.MentionsTimelineFragment.java
com.twitt4droid.fragment.QueryableTimelineFragment.java
com.twitt4droid.fragment.TimelineFragment.java
com.twitt4droid.fragment.UserTimelineFragment.java
com.twitt4droid.util.Files.java
com.twitt4droid.util.Images.java
com.twitt4droid.util.Objects.java
com.twitt4droid.util.Strings.java
com.twitt4droid.widget.LogInOutButton.java
com.twitt4droid.widget.TweetAdapter.java
com.twitt4droid.widget.TweetDialog.java