当前位置: 首页>>代码示例>>Java>>正文


Java Select类代码示例

本文整理汇总了Java中com.orm.query.Select的典型用法代码示例。如果您正苦于以下问题:Java Select类的具体用法?Java Select怎么用?Java Select使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Select类属于com.orm.query包,在下文中一共展示了Select类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchUnusedQuotes

import com.orm.query.Select; //导入依赖的package包/类
@Override
public void fetchUnusedQuotes(final Category category, final Callback<List<Quote>> callback) {
    Condition [] conditions = new Condition[2];
    conditions[0] = Condition.prop(NamingHelper.toSQLNameDefault("used")).eq("0");
    conditions[1] = Condition.prop(NamingHelper.toSQLNameDefault("category")).eq(category.getId());
    final List<Quote> unusedQuotesFromCategory = Select.from(Quote.class).where(conditions).list();
    if (unusedQuotesFromCategory != null && !unusedQuotesFromCategory.isEmpty()) {
        callback.onSuccess(unusedQuotesFromCategory);
    } else if (category.source == Category.Source.BRAINY_QUOTE) {
        fetchNewQuotes(category, new Callback<List<Quote>>() {
            @Override
            public void onSuccess(List<Quote> quotes) {
                callback.onSuccess(quotes);
            }

            @Override
            public void onError(LWQError error) {
                callback.onError(error);
            }
        });
    } else {
        // It's not an error, just no return.
        callback.onSuccess(new ArrayList<Quote>());
    }
}
 
开发者ID:stanidesis,项目名称:quotograph,代码行数:26,代码来源:LWQQuoteControllerBrainyQuoteImpl.java

示例2: bindTo

import com.orm.query.Select; //导入依赖的package包/类
void bindTo(UserAlbum userAlbum) {
    boundTo = userAlbum;
    imageSourceName.setText(userAlbum.name);
    imageSourceName.setFocusable(true);
    imageSourceName.setFocusableInTouchMode(true);
    removeSource.setVisibility(View.VISIBLE);
    useImageSource.setChecked(userAlbum.active);
    imageSource.setImageBitmap(
            ImageLoader.getInstance().loadImageSync(
                    Select.from(UserPhoto.class)
                            .where (
                                Condition.prop(
                                        NamingHelper.toSQLNameDefault("album")
                                ).eq(userAlbum)
                            ).first().uri)
            );
}
 
开发者ID:stanidesis,项目名称:quotograph,代码行数:18,代码来源:ImageMultiSelectAdapter.java

示例3: getCategories

import com.orm.query.Select; //导入依赖的package包/类
public List<Category> getCategories()
{
    List<Category> categories = Select.from(Category.class).orderBy("name").list();

    List<Category> validCategories = new ArrayList<>();

    for (Category category : categories)
    {
        if (category.isValid())
        {
            validCategories.add(category);
        }
    }

    return validCategories;
}
 
开发者ID:mauriciotogneri,项目名称:shoppinglist,代码行数:17,代码来源:CategoryDao.java

示例4: deleteStory

import com.orm.query.Select; //导入依赖的package包/类
public Observable<Object> deleteStory(Story item) {
    return Observable.create(subscriber -> {
        SugarTransactionHelper.doInTansaction(() -> {
            Select.from(Story.class)
                  .where(Condition.prop(StringUtil.toSQLName("mStoryId"))
                                  .eq(item.getStoryId()))
                  .first()
                  .delete();

            StoryDetail storyDetail = Select.from(StoryDetail.class)
                                            .where(Condition.prop(StringUtil.toSQLName(StoryDetail.STORY_DETAIL_ID))
                                                            .eq(item.getStoryId()))
                                            .first();
            Select.from(Comment.class)
                  .where(Condition.prop(StringUtil.toSQLName("mStoryDetail"))
                                  .eq(storyDetail.getId()))
                  .first()
                  .delete();
            storyDetail.delete();
            if (!subscriber.isUnsubscribed()) {
                subscriber.onCompleted();
            }
        });
    });
}
 
开发者ID:dinosaurwithakatana,项目名称:hacker-news-android,代码行数:26,代码来源:StoryListViewModel.java

示例5: getLoggedInProfileItem

import com.orm.query.Select; //导入依赖的package包/类
IProfile[] getLoggedInProfileItem() {
    if (mLoggedInProfiles == null) {
        mLoggedInProfiles = new IProfile[2];
        User currentUser = Select.from(User.class).first();
        ProfileDrawerItem profileDrawerItem = new ProfileDrawerItem().withIdentifier(LOGGED_IN_PROFILE_ITEM)
                                                                     .withIcon(TextDrawable.builder()
                                                                                           .buildRound(String.valueOf(currentUser.getUserName().charAt(0)),
                                                                                                       mResources.getColor(R.color.colorPrimaryDark)))
                                                                     .withName(currentUser.getUserName());
        ProfileSettingDrawerItem logoutDrawerItem = new ProfileSettingDrawerItem().withIdentifier(LOG_OUT_PROFILE_ITEM)
                                                                                  .withName("Logout")
                                                                                  .withDescription("Logout of current account")
                                                                                  .withIcon(mResources.getDrawable(R.drawable.ic_close));

        mLoggedInProfiles[0] = profileDrawerItem;
        mLoggedInProfiles[1] = logoutDrawerItem;
    }

    return mLoggedInProfiles;
}
 
开发者ID:dinosaurwithakatana,项目名称:hacker-news-android,代码行数:21,代码来源:MainViewModel.java

示例6: getByName

import com.orm.query.Select; //导入依赖的package包/类
/**
 * Finds transport mode by name.
 * @param name name of the transport mode to be searched
 * @return transport mode with the given name
 */
public static TransportMode getByName(String name) {
    List<TransportMode> modes = Select.from(TransportMode.class)
            .where(Condition.prop("name").eq(name))
            .limit("1")
            .list();

    return modes.get(0);
}
 
开发者ID:mobility-profile,项目名称:Mobility-Profile,代码行数:14,代码来源:TransportModeDao.java

示例7: getLatestRouteSearch

import com.orm.query.Select; //导入依赖的package包/类
/**
 * Returns the latest routesearch from the database based on custom query,
 * or null if there is none.
 * @param query custom query
 * @return result of the query
 */
private static RouteSearch getLatestRouteSearch(Select<RouteSearch> query) {
    List<RouteSearch> routesearches = query.list();

    assert routesearches.size() <= 1 : "Invalid SQL query: only one or zero entities should have been returned!";

    if (routesearches.size() == 0) {
        return null;
    }

    return routesearches.get(0);
}
 
开发者ID:mobility-profile,项目名称:Mobility-Profile,代码行数:18,代码来源:RouteSearchDao.java

示例8: getRouteSearchesByStartlocation

import com.orm.query.Select; //导入依赖的package包/类
/**
 * Returns a list of routesearches where the nearestKnownLocation matches the given one.
 *
 * @param startLocation StartLocation of the routesearches
 * @return List of routesearches
 */
public static List<RouteSearch> getRouteSearchesByStartlocation(String startLocation) {
    return Select.from(RouteSearch.class)
            .where(Condition.prop("startlocation").eq(startLocation))
            .orderBy("timestamp DESC")
            .list();
}
 
开发者ID:mobility-profile,项目名称:Mobility-Profile,代码行数:13,代码来源:RouteSearchDao.java

示例9: getRouteSearchesByDestination

import com.orm.query.Select; //导入依赖的package包/类
/**
 * Returns a list of routesearches where the destination matches the given one.
 *
 * @param destination destination of the routesearches
 * @return List of routesearches
 */
public static List<RouteSearch> getRouteSearchesByDestination(String destination) {
    return Select.from(RouteSearch.class)
            .where(Condition.prop("destination").eq(destination))
            .orderBy("timestamp DESC")
            .list();
}
 
开发者ID:mobility-profile,项目名称:Mobility-Profile,代码行数:13,代码来源:RouteSearchDao.java

示例10: getRouteSearchesByStartlocationAndDestination

import com.orm.query.Select; //导入依赖的package包/类
/**
 * Returns a list of routesearches where the startlocation and destination matches the given ones.
 *
 * @param startLocation Start location of the routesearch
 * @param destination Destination of the routesearch
 * @return List of routesearches
 */
public static List<RouteSearch> getRouteSearchesByStartlocationAndDestination(String startLocation, String destination) {
    return Select.from(RouteSearch.class)
            .where(Condition.prop("startlocation").eq(startLocation))
            .where(Condition.prop("destination").eq(destination))
            .orderBy("timestamp DESC")
            .list();
}
 
开发者ID:mobility-profile,项目名称:Mobility-Profile,代码行数:15,代码来源:RouteSearchDao.java

示例11: getAll

import com.orm.query.Select; //导入依赖的package包/类
/**
 * Retrieves all RouteSearches with the given mode
 * @param mode 0 for intracity, 1 for intercity
 * @return list of routeSearches
 */
public static List<RouteSearch> getAll(int mode) {
    return Select.from(RouteSearch.class)
            .where(Condition.prop("mode").eq(mode))
            .orderBy("timestamp DESC")
            .list();
}
 
开发者ID:mobility-profile,项目名称:Mobility-Profile,代码行数:12,代码来源:RouteSearchDao.java

示例12: incrementAppCount

import com.orm.query.Select; //导入依赖的package包/类
public static void incrementAppCount(String packageName, String name) {
    String identifier = AppPersistent.generateIdentifier(packageName, name);
    AppPersistent appPersistent = Select.from(AppPersistent.class).where(Condition.prop(NamingHelper.toSQLNameDefault("mIdentifier")).eq(identifier)).first();
    if (appPersistent != null) {
        appPersistent.setOpenCount(appPersistent.getOpenCount() + 1);
        appPersistent.save();
    } else {
        AppPersistent newAppPersistent = new AppPersistent(packageName, name, DEFAULT_OPEN_COUNT, DEFAULT_ORDER_NUMBER, DEFAULT_APP_VISIBILITY);
        newAppPersistent.save();
    }
}
 
开发者ID:nicholasrout,项目名称:lens-launcher,代码行数:12,代码来源:AppPersistent.java

示例13: setAppOrderNumber

import com.orm.query.Select; //导入依赖的package包/类
public static void setAppOrderNumber(String packageName, String name, int orderNumber) {
    String identifier = AppPersistent.generateIdentifier(packageName, name);
    AppPersistent appPersistent = Select.from(AppPersistent.class).where(Condition.prop(NamingHelper.toSQLNameDefault("mIdentifier")).eq(identifier)).first();
    if (appPersistent != null) {
        appPersistent.setOrderNumber(orderNumber);
        appPersistent.save();
    } else {
        AppPersistent newAppPersistent = new AppPersistent(packageName, name, DEFAULT_OPEN_COUNT, DEFAULT_ORDER_NUMBER, DEFAULT_APP_VISIBILITY);
        newAppPersistent.save();
    }
}
 
开发者ID:nicholasrout,项目名称:lens-launcher,代码行数:12,代码来源:AppPersistent.java

示例14: getAppVisibility

import com.orm.query.Select; //导入依赖的package包/类
public static boolean getAppVisibility(String packageName, String name) {
    String identifier = AppPersistent.generateIdentifier(packageName, name);
    AppPersistent appPersistent = Select.from(AppPersistent.class).where(Condition.prop(NamingHelper.toSQLNameDefault("mIdentifier")).eq(identifier)).first();
    if (appPersistent != null) {
        return appPersistent.isAppVisible();
    } else {
        return true;
    }
}
 
开发者ID:nicholasrout,项目名称:lens-launcher,代码行数:10,代码来源:AppPersistent.java

示例15: setAppVisibility

import com.orm.query.Select; //导入依赖的package包/类
public static void setAppVisibility(String packageName, String name, boolean mHideApp) {
    String identifier = AppPersistent.generateIdentifier(packageName, name);
    AppPersistent appPersistent = Select.from(AppPersistent.class).where(Condition.prop(NamingHelper.toSQLNameDefault("mIdentifier")).eq(identifier)).first();
    if (appPersistent != null) {
        appPersistent.setAppVisible(mHideApp);
        appPersistent.save();
    } else {
        AppPersistent newAppPersistent = new AppPersistent(packageName, name, DEFAULT_OPEN_COUNT, DEFAULT_ORDER_NUMBER, mHideApp);
        newAppPersistent.save();
    }
}
 
开发者ID:nicholasrout,项目名称:lens-launcher,代码行数:12,代码来源:AppPersistent.java


注:本文中的com.orm.query.Select类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。