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


Java Condition类代码示例

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


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

示例1: fetchUnusedQuotes

import com.orm.query.Condition; //导入依赖的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.Condition; //导入依赖的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: deleteStory

import com.orm.query.Condition; //导入依赖的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

示例4: getByName

import com.orm.query.Condition; //导入依赖的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

示例5: getRouteSearchesByStartlocation

import com.orm.query.Condition; //导入依赖的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

示例6: getRouteSearchesByDestination

import com.orm.query.Condition; //导入依赖的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

示例7: getRouteSearchesByStartlocationAndDestination

import com.orm.query.Condition; //导入依赖的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

示例8: getAll

import com.orm.query.Condition; //导入依赖的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

示例9: incrementAppCount

import com.orm.query.Condition; //导入依赖的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

示例10: setAppOrderNumber

import com.orm.query.Condition; //导入依赖的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

示例11: getAppVisibility

import com.orm.query.Condition; //导入依赖的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

示例12: setAppVisibility

import com.orm.query.Condition; //导入依赖的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

示例13: getAppOpenCount

import com.orm.query.Condition; //导入依赖的package包/类
public static long getAppOpenCount(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.getOpenCount();
    } else {
        return 0;
    }
}
 
开发者ID:nicholasrout,项目名称:lens-launcher,代码行数:10,代码来源:AppPersistent.java

示例14: exists

import com.orm.query.Condition; //导入依赖的package包/类
public static boolean exists(@NonNull String activityInfoName, @NonNull String packageName) {
    return Select.from(AppsModel.class)
            .where(Condition.prop(NamingHelper.toSQLNameDefault("activityInfoName")).eq(activityInfoName))
            .and(Condition.prop(NamingHelper.toSQLNameDefault("packageName")).eq(packageName))
            .and(Condition.prop(NamingHelper.toSQLNameDefault("folderId")).eq(0))
            .first() != null;
}
 
开发者ID:k0shk0sh,项目名称:FastAccess,代码行数:8,代码来源:AppsModel.java

示例15: getHours

import com.orm.query.Condition; //导入依赖的package包/类
public static List<String> getHours(Integer day) {
    List<String> hours = new ArrayList<>();
    List<Lesson> lessons = Select.from(Lesson.class)
            .where(Condition.prop("day").eq(day), Condition.prop("hidden").eq("0"))
            .list();

    for (Lesson lesson : lessons) {
        if (hours.indexOf(lesson.getTime()) == -1) {
            hours.add(lesson.getTime());
        }
    }

    return hours;
}
 
开发者ID:luk1337,项目名称:TimeTable2,代码行数:15,代码来源:Utils.java


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