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


Java Update类代码示例

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


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

示例1: updateStatusByComplexity

import com.activeandroid.query.Update; //导入依赖的package包/类
/**
 * Update counters after calling this.
 */
public void updateStatusByComplexity(String collectionId, int limit, SentenceStatus fromStatus, SentenceStatus toStatus, String complecityOrder) {
    List<Sentence> sentences = new Select()
            .from(Sentence.class)
            .where("collection_id=? and status=?", collectionId, fromStatus.getStatus())
            .orderBy("complexity " + complecityOrder)
            .limit(limit)
            .execute();

    String[] sentenceIds = new String[sentences.size()];
    for (int i = 0; i < sentences.size(); i++) {
        sentenceIds[i] = sentences.get(i).sentenceId;
    }
    
    new Update(Sentence.class)
            .set("status=?", toStatus.getStatus())
            .where("sentence_id in (" + StringUtils.repeat(",?", sentences.size()).substring(1) + ")", sentenceIds)
            .execute();
}
 
开发者ID:tkrajina,项目名称:10000sentences,代码行数:22,代码来源:SentenceCollectionsService.java

示例2: deleteWaypointAt

import com.activeandroid.query.Update; //导入依赖的package包/类
public void deleteWaypointAt(int order) {
    if (order == WaypointModel.START_WAYPOINT_ORDER || order == WaypointModel.END_WAYPOINT_ORDER) {
        // Do not allow deleting the start or end point
        throw new IllegalArgumentException("Not allowed to delete the start or end point");
    }

    new Delete().from(WaypointModel.class)
                .where(WaypointContract.Columns.ROUTE + " = ?", getId())
                .and(WaypointContract.Columns.ORDER + " = ?", order)
                .execute();

    new Update(WaypointModel.class)
            .set(WaypointContract.Columns.ORDER + " = " + WaypointContract.Columns.ORDER + " - 1")
            .where(String.format("%s = ? AND %s > ? AND %s <> ?",
                            WaypointContract.Columns.ROUTE, WaypointContract.Columns.ORDER, WaypointContract.Columns.ORDER),
                    getId(), order, WaypointModel.END_WAYPOINT_ORDER)
            .execute();
}
 
开发者ID:SenAndAaron,项目名称:voyager2-android,代码行数:19,代码来源:RouteModel.java

示例3: markAsStart

import com.activeandroid.query.Update; //导入依赖的package包/类
public void markAsStart(final Screen screen, Observer<Screen> observer) {
    Observable.create(new Observable.OnSubscribe<Screen>() {
        @Override
        public void call(Subscriber<? super Screen> subscriber) {
            Log.d(TAG, "saving...");
            new Update(Screen.class).set("IsStart = ?", 0)
                    .where("Utree = ?", screen.utree.getId())
                    .execute();
            screen.isStart = 1;
            screen.save();
            Log.d(TAG, "saved");
            subscriber.onNext(screen);
            subscriber.onCompleted();
        }
    }).subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(observer);
}
 
开发者ID:rockycamacho,项目名称:usbong-builder,代码行数:19,代码来源:ScreenListController.java

示例4: save

import com.activeandroid.query.Update; //导入依赖的package包/类
public void save(final Screen screen, Observer<Screen> observer) {
    Observable.create(new Observable.OnSubscribe<Screen>() {
        @Override
        public void call(Subscriber<? super Screen> subscriber) {
            if (screen.isStart == 1) {
                new Update(Screen.class).set("IsStart = ?", 0)
                        .where("Utree = ?", screen.utree.getId())
                        .execute();
                screen.isStart = 1;
                screen.save();
            } else if (Screen.getScreens(screen.utree.getId()).size() == 0) {
                screen.isStart = 1;
                screen.save();
            } else {
                screen.save();
            }
            subscriber.onNext(screen);
            subscriber.onCompleted();
        }
    }).subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(observer);
}
 
开发者ID:rockycamacho,项目名称:usbong-builder,代码行数:24,代码来源:ScreenController.java

示例5: addToFavorite

import com.activeandroid.query.Update; //导入依赖的package包/类
public void addToFavorite(final UpdateFinishCallback callback) {
    IsFav = true;
    new Thread() {
        @Override
        public void run() {
            super.run();
            boolean exist = new Select().from(Animation.class).where("AnimationId='" + AnimationId + "'").executeSingle() != null;
            if (!exist)
                save();
            else
                new com.activeandroid.query.Update(Animation.class).set("IsFavorite='1'").where("AnimationId='" + AnimationId + "'").execute();
            Message msg = Message.obtain();
            Looper.prepare();
            msg.setTarget(new FavoriteHandler(callback, Method.ADD_FAVORITE));
            msg.sendToTarget();
            Looper.loop();
        }
    }.start();
}
 
开发者ID:daimajia,项目名称:AnimeTaste,代码行数:20,代码来源:Animation.java

示例6: saveScreen

import com.activeandroid.query.Update; //导入依赖的package包/类
public void saveScreen(final Screen screen, final OnScreenDetailsSave event, final View screenContainer, Observer<Screen> observer) {
    Observable.create(new Observable.OnSubscribe<Screen>() {
        @Override
        public void call(Subscriber<? super Screen> subscriber) {
            Log.d(TAG, "saving...");
            if (screen.isStart == 1) {
                Log.d(TAG, "screen.isStart == 1");
                new Update(Screen.class).set("IsStart = ?", 0)
                        .where("Utree = ?", screen.utree.getId())
                        .execute();
                screen.isStart = 1;
                screen.save();
            } else if (Screen.getScreens(screen.utree.getId()).size() == 0) {
                Log.d(TAG, "Screen.getScreens(screen.utree.getId()).size() == 0");
                screen.isStart = 1;
                screen.save();
            } else {
                //WTF?!? need to re-set the values of screen name and details if isStart == 0
                screen.name = event.getName();
                screen.details = event.getContent();
                Log.d(TAG, "screen.save() " + screen.name + " " + screen.details);
                screen.save();
            }

            Log.d(TAG, "saved");
            File screenshotFile = screenContainer.getContext().getFileStreamPath(screen.getScreenshotPath());
            ScreenUtils.saveScreenshot(screenshotFile, screenContainer);
            subscriber.onNext(screen);
            subscriber.onCompleted();
        }
    }).subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(observer);
}
 
开发者ID:rockycamacho,项目名称:usbong-builder,代码行数:35,代码来源:ScreenDetailController.java

示例7: removeFromFavorite

import com.activeandroid.query.Update; //导入依赖的package包/类
public void removeFromFavorite(final UpdateFinishCallback callback) {
    IsFav = false;
    new Thread() {
        @Override
        public void run() {
            super.run();
            new Update(Animation.class).set("IsFavorite='0'").where("AnimationId='" + AnimationId + "'").execute();
            Message msg = Message.obtain();
            Looper.prepare();
            msg.setTarget(new FavoriteHandler(callback, Method.REMOVE_FAVORITE));
            msg.sendToTarget();
            Looper.loop();
        }
    }.start();
}
 
开发者ID:daimajia,项目名称:AnimeTaste,代码行数:16,代码来源:Animation.java

示例8: update

import com.activeandroid.query.Update; //导入依赖的package包/类
private Update update() {
	return new Update(MockModel.class);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:UpdateTest.java

示例9: save

import com.activeandroid.query.Update; //导入依赖的package包/类
public static void save(Animation animation,M3U8Mission mission){
    DownloadRecord record = new Select()
            .from(DownloadRecord.class)
            .where("AnimationId = ?" , animation.AnimationId)
            .executeSingle();
    if(record == null){
        new DownloadRecord(animation,mission).save();
    }else{
        int status;
        if(mission.isDone()){
            status = mission.isSuccess() ? STATUS.SUCCESS : STATUS.ERROR;
            status = mission.isCanceled() ? STATUS.CANCELED : status;
        }else{
            status = STATUS.DOWNLOADING;
        }
        new Update(DownloadRecord.class)
                        .set("Size = ?," +
                                "DownloadedSize = ?," +
                                "Duration = ?," +
                                "DownloadedDuration = ?," +
                                "Segments = ?," +
                                "DownloadedSegments = ?," +
                                "DownloadedPercentage = ?," +
                                "RangeStart = ?,"+
                                "Status = ?," +
                                "Extra = ?," +
                                "SaveDir = ?," +
                                "SaveFileName = ? ," +
                                "UsingDownloadUrl = ? ",
                        mission.getFilesize(),
                        mission.getDownloaded(),
                        mission.getVideoDuration(),
                        mission.getDownloadedDuration(),
                        mission.getSegmentsCount(),
                        mission.getDownloadedSegmentCount(),
                        mission.getPercentage(),
                        mission.getCurrentSegmentDownloaded(),
                        status,
                        "",
                        mission.getSaveDir(),
                        mission.getSaveName(),
                        mission.getUri())
                .where("AnimationId = ?",animation.AnimationId)
                .execute();
    }
}
 
开发者ID:daimajia,项目名称:AnimeTaste,代码行数:47,代码来源:DownloadRecord.java


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