Example usage for android.database Cursor getInt

List of usage examples for android.database Cursor getInt

Introduction

In this page you can find the example usage for android.database Cursor getInt.

Prototype

int getInt(int columnIndex);

Source Link

Document

Returns the value of the requested column as an int.

Usage

From source file:com.ubuntuone.android.files.provider.MetaUtilities.java

public static ArrayList<U1Node> getPhotoNodesFromDirectory(String directoryResourcePath) {
    String[] projection = Nodes.getDefaultProjection();
    String selection = Nodes.NODE_PARENT_PATH + "=? AND " + Nodes.NODE_MIME + "=?";
    String[] selectionArgs = new String[] { directoryResourcePath, "image/jpeg" };

    Cursor c = sResolver.query(Nodes.CONTENT_URI, projection, selection, selectionArgs, null);

    ArrayList<U1Node> photoNodes = null;
    if (c != null) {
        photoNodes = new ArrayList<U1Node>();
        try {//from  ww  w .jav a2 s.c o m
            if (c.moveToFirst()) {
                do {
                    String resourcePath;
                    String key;
                    U1NodeKind kind;
                    Boolean isLive = true;
                    String path;
                    String parentPath;
                    String volumePath;
                    Date whenCreated;
                    Date whenChanged;
                    Long generation;
                    Long generationCreated;
                    String contentPath;

                    resourcePath = c.getString(c.getColumnIndex(Nodes.NODE_RESOURCE_PATH));
                    key = c.getString(c.getColumnIndex(Nodes.NODE_KEY));
                    kind = U1NodeKind
                            .valueOf(c.getString(c.getColumnIndex(Nodes.NODE_KIND)).toUpperCase(Locale.US));
                    isLive = c.getInt(c.getColumnIndex(Nodes.NODE_IS_LIVE)) != 0;
                    path = c.getString(c.getColumnIndex(Nodes.NODE_PATH));
                    parentPath = c.getString(c.getColumnIndex(Nodes.NODE_PARENT_PATH));
                    volumePath = c.getString(c.getColumnIndex(Nodes.NODE_VOLUME_PATH));
                    whenCreated = new Date(c.getLong(c.getColumnIndex(Nodes.NODE_WHEN_CREATED)));
                    whenChanged = new Date(c.getLong(c.getColumnIndex(Nodes.NODE_WHEN_CHANGED)));
                    generation = c.getLong(c.getColumnIndex(Nodes.NODE_GENERATION));
                    generationCreated = c.getLong(c.getColumnIndex(Nodes.NODE_GENERATION_CREATED));
                    contentPath = c.getString(c.getColumnIndex(Nodes.NODE_CONTENT_PATH));

                    U1Node node = new U1Node(resourcePath, kind, isLive, path, parentPath, volumePath, key,
                            whenCreated, whenChanged, generation, generationCreated, contentPath);
                    photoNodes.add(node);
                } while (c.moveToNext());
            }
        } finally {
            c.close();
        }
    }
    return photoNodes;
}

From source file:com.polyvi.xface.extension.XMessagingExt.java

/**
 * ?message?/*from   w  ww.j ava  2s .com*/
 */
private JSONObject getMessageFromCursor(Cursor cursor) throws JSONException {
    //??
    String msgId = cursor.getString(cursor.getColumnIndex("_id"));
    String subject = cursor.getString(cursor.getColumnIndex("subject"));
    String smsBody = cursor.getString(cursor.getColumnIndex("body"));
    long date = cursor.getLong(cursor.getColumnIndex("date"));
    boolean isRead = cursor.getInt(cursor.getColumnIndex("read")) == 0 ? false : true;
    String destAddress = cursor.getString(cursor.getColumnIndex("address"));
    JSONObject message = new JSONObject();
    message.put("messageId", msgId);
    message.put("subject", subject);
    message.put("body", smsBody);
    message.put("destinationAddresses", destAddress);
    message.put("messageType", MESSAGE_TYPE_SMS);
    message.put("date", date);
    message.put("isRead", isRead);
    return message;
}

From source file:org.mythtv.service.dvr.v26.RecordedHelperV26.java

private int load(final Context context, final LocationProfile locationProfile, final Program[] programs)
        throws RemoteException, OperationApplicationException {
    Log.d(TAG, "load : enter");

    if (null == context)
        throw new RuntimeException("ProgramGuideHelperV26 is not initialized");

    processProgramGroups(context, locationProfile, programs);

    String tag = UUID.randomUUID().toString();
    int processed = -1;
    int count = 0;

    ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();

    boolean inError;

    List<Integer> channelsChecked = new ArrayList<Integer>();

    for (Program program : programs) {

        if (null != program.getRecording() && "livetv".equalsIgnoreCase(program.getRecording().getRecGroup())
                && !"deleted".equalsIgnoreCase(program.getRecording().getRecGroup())) {
            Log.w(TAG,// www .  jav a 2 s  .c  o  m
                    "load : program has no recording or program is in livetv or deleted recording groups:"
                            + program.getTitle() + ":" + program.getSubTitle() + ":"
                            + program.getChannel().getChanId() + ":" + program.getStartTime() + ":"
                            + program.getHostName() + " ("
                            + (null == program.getRecording() ? "No Recording"
                                    : ("livetv".equalsIgnoreCase(program.getRecording().getRecGroup())
                                            ? "LiveTv"
                                            : "Deleted"))
                            + ")");

            continue;
        }

        if (null == program.getStartTime() || null == program.getEndTime()) {
            Log.w(TAG, "load : null starttime and or endtime");

            inError = true;
        } else {
            inError = false;
        }

        ProgramHelperV26.getInstance().processProgram(context, locationProfile,
                ProgramConstants.CONTENT_URI_RECORDED, ProgramConstants.TABLE_NAME_RECORDED, ops, program, tag);
        count++;

        if (null != program.getChannel()) {

            if (!channelsChecked.contains(program.getChannel().getChanId())) {

                if (null == mChannelDaoHelper.findByChannelId(context, locationProfile,
                        Long.parseLong(String.valueOf(program.getChannel().getChanId())))) {

                    ChannelHelperV26.getInstance().processChannel(context, locationProfile, ops,
                            program.getChannel());
                    count++;

                }

                channelsChecked.add(program.getChannel().getChanId());

            }

        }

        if (!inError && null != program.getRecording()) {

            if (program.getRecording().getRecordId() > 0) {

                RecordingHelperV26.getInstance().processRecording(context, locationProfile, ops,
                        RecordingConstants.ContentDetails.RECORDED, program, tag);
                count++;

            }

        }

        if (count > BATCH_COUNT_LIMIT) {
            Log.i(TAG, "load : applying batch for '" + count + "' transactions");

            processBatch(context, ops, processed, count);

            count = 0;

        }

    }

    if (!ops.isEmpty()) {
        Log.i(TAG, "load : applying batch for '" + count + "' transactions");

        processBatch(context, ops, processed, count);
    }

    ProgramHelperV26.getInstance().findAllPrograms(context, locationProfile,
            ProgramConstants.CONTENT_URI_RECORDED, ProgramConstants.TABLE_NAME_RECORDED);

    Log.v(TAG, "load : remove deleted recording live streams");
    String[] deletedProjection = new String[] { ProgramConstants.FIELD_CHANNEL_ID,
            ProgramConstants.FIELD_START_TIME, ProgramConstants.FIELD_TITLE, ProgramConstants.FIELD_SUB_TITLE,
            ProgramConstants.FIELD_LAST_MODIFIED_DATE };
    String deletedSelection = "not " + ProgramConstants.TABLE_NAME_RECORDED + "."
            + ProgramConstants.FIELD_LAST_MODIFIED_TAG + " = ?";
    String[] deletedSelectionArgs = new String[] { tag };

    deletedSelection = appendLocationHostname(context, locationProfile, deletedSelection,
            ProgramConstants.TABLE_NAME_RECORDED);

    int deleteCount = 0;
    Cursor deletedCursor = context.getContentResolver().query(ProgramConstants.CONTENT_URI_RECORDED,
            deletedProjection, deletedSelection, deletedSelectionArgs, null);
    while (deletedCursor.moveToNext()) {

        long channelId = deletedCursor.getLong(deletedCursor.getColumnIndex(ProgramConstants.FIELD_CHANNEL_ID));
        long startTime = deletedCursor.getLong(deletedCursor.getColumnIndex(ProgramConstants.FIELD_START_TIME));

        // Delete any live stream details
        String liveStreamSelection = LiveStreamConstants.FIELD_CHAN_ID + " = ? AND "
                + LiveStreamConstants.FIELD_START_TIME + " = ?";
        String[] liveStreamSelectionArgs = new String[] { String.valueOf(channelId),
                String.valueOf(startTime) };

        liveStreamSelection = appendLocationHostname(context, locationProfile, liveStreamSelection,
                LiveStreamConstants.TABLE_NAME);

        Cursor liveStreamCursor = context.getContentResolver().query(LiveStreamConstants.CONTENT_URI, null,
                liveStreamSelection, liveStreamSelectionArgs, null);
        if (liveStreamCursor.moveToFirst()) {
            Log.v(TAG, "load : remove live stream");

            int liveStreamId = liveStreamCursor.getInt(liveStreamCursor
                    .getColumnIndex(LiveStreamConstants.TABLE_NAME + "." + LiveStreamConstants.FIELD_ID));

            RemoveStreamTask removeStreamTask = new RemoveStreamTask(context, locationProfile);
            removeStreamTask.execute(liveStreamId);
        }
        liveStreamCursor.close();

        deleteCount++;
    }
    deletedCursor.close();
    Log.v(TAG, "load : queued deleted programs - " + deleteCount);

    ProgramHelperV26.getInstance().deletePrograms(context, locationProfile,
            ProgramConstants.CONTENT_URI_RECORDED, ProgramConstants.TABLE_NAME_RECORDED, tag);
    //      RecordingHelperV26.getInstance().deleteRecordings( context, locationProfile, ops, RecordingConstants.ContentDetails.RECORDED, lastModified );

    if (!ops.isEmpty()) {
        Log.i(TAG, "load : applying delete batch for transactions");

        processBatch(context, ops, processed, count);
    }

    //      Log.v( TAG, "load : exit" );
    return processed;
}

From source file:org.mythtv.service.dvr.v25.RecordedHelperV25.java

private int load(final Context context, final LocationProfile locationProfile, final Program[] programs)
        throws RemoteException, OperationApplicationException {
    Log.d(TAG, "load : enter");

    if (null == context)
        throw new RuntimeException("RecordedHelperV25 is not initialized");

    processProgramGroups(context, locationProfile, programs);

    String tag = UUID.randomUUID().toString();
    int processed = -1;
    int count = 0;

    ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();

    boolean inError;

    List<Integer> channelsChecked = new ArrayList<Integer>();

    for (Program program : programs) {

        if (null != program.getRecording() && "livetv".equalsIgnoreCase(program.getRecording().getRecGroup())
                && !"deleted".equalsIgnoreCase(program.getRecording().getRecGroup())) {
            Log.w(TAG,//from  www  . j  ava 2s .  c  om
                    "load : program has no recording or program is in livetv or deleted recording groups:"
                            + program.getTitle() + ":" + program.getSubTitle() + ":"
                            + program.getChannel().getChanId() + ":" + program.getStartTime() + ":"
                            + program.getHostName() + " ("
                            + (null == program.getRecording() ? "No Recording"
                                    : ("livetv".equalsIgnoreCase(program.getRecording().getRecGroup())
                                            ? "LiveTv"
                                            : "Deleted"))
                            + ")");

            continue;
        }

        if (null == program.getStartTime() || null == program.getEndTime()) {
            Log.w(TAG, "load : null starttime and or endtime");

            inError = true;
        } else {
            inError = false;
        }

        ProgramHelperV25.getInstance().processProgram(context, locationProfile,
                ProgramConstants.CONTENT_URI_RECORDED, ProgramConstants.TABLE_NAME_RECORDED, ops, program, tag);
        count++;

        if (null != program.getChannel()) {

            if (!channelsChecked.contains(program.getChannel().getChanId())) {

                if (null == mChannelDaoHelper.findByChannelId(context, locationProfile,
                        Long.parseLong(String.valueOf(program.getChannel().getChanId())))) {

                    ChannelHelperV25.getInstance().processChannel(context, locationProfile, ops,
                            program.getChannel());
                    count++;

                }

                channelsChecked.add(program.getChannel().getChanId());

            }

        }

        if (!inError && null != program.getRecording()) {

            if (program.getRecording().getRecordId() > 0) {

                RecordingHelperV25.getInstance().processRecording(context, locationProfile, ops,
                        RecordingConstants.ContentDetails.RECORDED, program, tag);
                count++;

            }

        }

        if (count > BATCH_COUNT_LIMIT) {
            Log.i(TAG, "load : applying batch for '" + count + "' transactions");

            processBatch(context, ops, processed, count);

            count = 0;

        }

    }

    if (!ops.isEmpty()) {
        Log.i(TAG, "load : applying final batch for '" + count + "' transactions");

        processBatch(context, ops, processed, count);
    }

    ProgramHelperV25.getInstance().findAllPrograms(context, locationProfile,
            ProgramConstants.CONTENT_URI_RECORDED, ProgramConstants.TABLE_NAME_RECORDED);

    Log.v(TAG, "load : remove deleted recording live streams");
    String[] deletedProjection = new String[] { ProgramConstants.FIELD_CHANNEL_ID,
            ProgramConstants.FIELD_START_TIME, ProgramConstants.FIELD_TITLE, ProgramConstants.FIELD_SUB_TITLE,
            ProgramConstants.FIELD_LAST_MODIFIED_DATE };
    String deletedSelection = "not " + ProgramConstants.TABLE_NAME_RECORDED + "."
            + ProgramConstants.FIELD_LAST_MODIFIED_TAG + " = ?";
    String[] deletedSelectionArgs = new String[] { tag };

    deletedSelection = appendLocationHostname(context, locationProfile, deletedSelection,
            ProgramConstants.TABLE_NAME_RECORDED);

    int deleteCount = 0;
    Cursor deletedCursor = context.getContentResolver().query(ProgramConstants.CONTENT_URI_RECORDED,
            deletedProjection, deletedSelection, deletedSelectionArgs, null);
    while (deletedCursor.moveToNext()) {

        long channelId = deletedCursor.getLong(deletedCursor.getColumnIndex(ProgramConstants.FIELD_CHANNEL_ID));
        long startTime = deletedCursor.getLong(deletedCursor.getColumnIndex(ProgramConstants.FIELD_START_TIME));

        // Delete any live stream details
        String liveStreamSelection = LiveStreamConstants.FIELD_CHAN_ID + " = ? AND "
                + LiveStreamConstants.FIELD_START_TIME + " = ?";
        String[] liveStreamSelectionArgs = new String[] { String.valueOf(channelId),
                String.valueOf(startTime) };

        liveStreamSelection = appendLocationHostname(context, locationProfile, liveStreamSelection,
                LiveStreamConstants.TABLE_NAME);

        Cursor liveStreamCursor = context.getContentResolver().query(LiveStreamConstants.CONTENT_URI, null,
                liveStreamSelection, liveStreamSelectionArgs, null);
        if (liveStreamCursor.moveToFirst()) {
            Log.v(TAG, "load : remove live stream");

            int liveStreamId = liveStreamCursor.getInt(liveStreamCursor
                    .getColumnIndex(LiveStreamConstants.TABLE_NAME + "." + LiveStreamConstants.FIELD_ID));

            RemoveStreamTask removeStreamTask = new RemoveStreamTask(context, locationProfile);
            removeStreamTask.execute(liveStreamId);
        }
        liveStreamCursor.close();

        deleteCount++;
    }
    deletedCursor.close();
    Log.v(TAG, "load : queued deleted programs - " + deleteCount);

    ProgramHelperV25.getInstance().deletePrograms(context, locationProfile,
            ProgramConstants.CONTENT_URI_RECORDED, ProgramConstants.TABLE_NAME_RECORDED, tag);
    //      RecordingHelperV25.getInstance().deleteRecordings( context, locationProfile, ops, RecordingConstants.ContentDetails.RECORDED, lastModified );

    if (!ops.isEmpty()) {
        Log.i(TAG, "load : applying delete batch for transactions");

        processBatch(context, ops, processed, count);
    }

    //      Log.v( TAG, "load : exit" );
    return processed;
}

From source file:com.android.contacts.list.ContactEntryListAdapter.java

/**
 * Checks whether the contact entry at the given position represents the user's profile.
 *//*from   w w w.j av  a  2  s .c  o  m*/
protected boolean isUserProfile(int position) {
    // The profile only ever appears in the first position if it is present.  So if the position
    // is anything beyond 0, it can't be the profile.
    boolean isUserProfile = false;
    if (position == 0) {
        int partition = getPartitionForPosition(position);
        if (partition >= 0) {
            // Save the old cursor position - the call to getItem() may modify the cursor
            // position.
            int offset = getCursor(partition).getPosition();
            Cursor cursor = (Cursor) getItem(position);
            if (cursor != null) {
                int profileColumnIndex = cursor.getColumnIndex(Contacts.IS_USER_PROFILE);
                if (profileColumnIndex != -1) {
                    isUserProfile = cursor.getInt(profileColumnIndex) == 1;
                }
                // Restore the old cursor position.
                cursor.moveToPosition(offset);
            }
        }
    }
    return isUserProfile;
}

From source file:com.ichi2.libanki.Card.java

public void load() {
    Cursor cursor = null;
    try {//from   ww  w.j  a  v a2  s. c o  m
        cursor = mCol.getDb().getDatabase().rawQuery("SELECT * FROM cards WHERE id = " + mId, null);
        if (!cursor.moveToFirst()) {
            throw new RuntimeException(" No card with id " + mId);
        }
        mId = cursor.getLong(0);
        mNid = cursor.getLong(1);
        mDid = cursor.getLong(2);
        mOrd = cursor.getInt(3);
        mMod = cursor.getLong(4);
        mUsn = cursor.getInt(5);
        mType = cursor.getInt(6);
        mQueue = cursor.getInt(7);
        mDue = cursor.getInt(8);
        mIvl = cursor.getInt(9);
        mFactor = cursor.getInt(10);
        mReps = cursor.getInt(11);
        mLapses = cursor.getInt(12);
        mLeft = cursor.getInt(13);
        mODue = cursor.getLong(14);
        mODid = cursor.getLong(15);
        mFlags = cursor.getInt(16);
        mData = cursor.getString(17);
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }
    mQA = null;
    mNote = null;
}

From source file:com.hichinaschool.flashcards.libanki.Stats.java

/**
 * Due and cumulative due//from   ww w . j a  v  a  2  s .  com
 * ***********************************************************************************************
 */
public boolean calculateDue(int type) {
    mType = type;
    mBackwards = false;
    mTitle = R.string.stats_forecast;
    mValueLabels = new int[] { R.string.statistics_young, R.string.statistics_mature };
    mColors = new int[] { R.color.stats_young, R.color.stats_mature };
    mAxisTitles = new int[] { type, R.string.stats_cards };
    int end = 0;
    int chunk = 0;
    switch (type) {
    case TYPE_MONTH:
        end = 31;
        chunk = 1;
        break;
    case TYPE_YEAR:
        end = 52;
        chunk = 7;
        break;
    case TYPE_LIFE:
        end = -1;
        chunk = 30;
        break;
    }
    String lim = "";// AND due - " + mCol.getSched().getToday() + " >= " + start; // leave this out in order to show
                    // card too which were due the days before
    if (end != -1) {
        lim += " AND day <= " + end;
    }

    ArrayList<int[]> dues = new ArrayList<int[]>();
    Cursor cur = null;
    try {
        cur = mCol.getDb().getDatabase()
                .rawQuery("SELECT (due - " + mCol.getSched().getToday() + ")/" + chunk + " AS day, " // day
                        + "count(), " // all cards
                        + "sum(CASE WHEN ivl >= 21 THEN 1 ELSE 0 END) " // mature cards
                        + "FROM cards WHERE did IN " + _limit() + " AND queue IN (2,3)" + lim
                        + " GROUP BY day ORDER BY day", null);
        while (cur.moveToNext()) {
            dues.add(new int[] { cur.getInt(0), cur.getInt(1), cur.getInt(2) });
        }
    } finally {
        if (cur != null && !cur.isClosed()) {
            cur.close();
        }
    }
    // small adjustment for a proper chartbuilding with achartengine
    if (dues.size() == 0 || dues.get(0)[0] > 0) {
        dues.add(0, new int[] { 0, 0, 0 });
    }
    if (end == -1 && dues.size() < 2) {
        end = 31;
    }
    if (type != TYPE_LIFE && dues.get(dues.size() - 1)[0] < end) {
        dues.add(new int[] { end, 0, 0 });
    } else if (type == TYPE_LIFE && dues.size() < 2) {
        dues.add(new int[] { Math.max(12, dues.get(dues.size() - 1)[0] + 1), 0, 0 });
    }

    mSeriesList = new double[3][dues.size()];
    for (int i = 0; i < dues.size(); i++) {
        int[] data = dues.get(i);
        mSeriesList[0][i] = data[0];
        mSeriesList[1][i] = data[1];
        mSeriesList[2][i] = data[2];
    }
    return dues.size() > 0;
}

From source file:fr.openbike.android.database.OpenBikeDBAdapter.java

public int getStationCount() throws SQLException {
    Cursor cursor = mDb.rawQuery(
            "SELECT COUNT(*) AS count FROM " + STATIONS_TABLE + " WHERE " + KEY_NETWORK + " = ?",
            new String[] { String.valueOf(mPreferences.getInt(AbstractPreferencesActivity.NETWORK_PREFERENCE,
                    AbstractPreferencesActivity.NO_NETWORK)) });
    cursor.moveToNext();/*  w w  w .j  av  a  2 s .c o m*/
    int count = cursor.getInt(0);
    cursor.close();
    return count;
}

From source file:org.noorganization.instalistsynch.controller.synch.impl.IngredientSynch.java

@Override
public void indexLocal(int _groupId, Date _lastIndexTime) {
    String lastIndexTime = ISO8601Utils.format(_lastIndexTime, false, TimeZone.getTimeZone("GMT+0000"));//.concat("+0000");
    boolean isLocal = false;
    GroupAuth groupAuth = mGroupAuthDbController.getLocalGroup();
    if (groupAuth != null) {
        isLocal = groupAuth.getGroupId() == _groupId;
    }/*from  w  w w . jav a2  s  .c o m*/
    Cursor logCursor = mClientLogDbController.getLogsSince(lastIndexTime, mModelType);
    if (logCursor.getCount() == 0) {
        logCursor.close();
        return;
    }

    try {
        while (logCursor.moveToNext()) {
            // fetch the action type
            int actionId = logCursor.getInt(logCursor.getColumnIndex(LogInfo.COLUMN.ACTION));
            eActionType actionType = eActionType.getTypeById(actionId);

            List<ModelMapping> modelMappingList = mIngredientModelMapping.get(
                    ModelMapping.COLUMN.GROUP_ID + " = ? AND " + ModelMapping.COLUMN.CLIENT_SIDE_UUID
                            + " LIKE ?",
                    new String[] { String.valueOf(_groupId),
                            logCursor.getString(logCursor.getColumnIndex(LogInfo.COLUMN.ITEM_UUID)) });
            ModelMapping modelMapping = modelMappingList.size() == 0 ? null : modelMappingList.get(0);

            switch (actionType) {
            case INSERT:
                // skip insertion because this should be decided by the user if the non local groups should have access to the category
                // and also skip if a mapping for this case already exists!
                if (!isLocal || modelMapping != null) {
                    continue;
                }

                String clientUuid = logCursor.getString(logCursor.getColumnIndex(LogInfo.COLUMN.ITEM_UUID));
                Date clientDate = ISO8601Utils.parse(
                        logCursor.getString(logCursor.getColumnIndex(LogInfo.COLUMN.ACTION_DATE)),
                        new ParsePosition(0));
                modelMapping = new ModelMapping(null, groupAuth.getGroupId(), null, clientUuid,
                        new Date(Constants.INITIAL_DATE), clientDate, false);
                mIngredientModelMapping.insert(modelMapping);
                break;
            case UPDATE:
                if (modelMapping == null) {
                    Log.i(TAG, "indexLocal: the model is null but shouldn't be");
                    continue;
                }
                String timeString = logCursor.getString(logCursor.getColumnIndex(LogInfo.COLUMN.ACTION_DATE));
                clientDate = ISO8601Utils.parse(timeString, new ParsePosition(0));
                modelMapping.setLastClientChange(clientDate);
                mIngredientModelMapping.update(modelMapping);
                break;
            case DELETE:
                if (modelMapping == null) {
                    Log.i(TAG, "indexLocal: the model is null but shouldn't be");
                    continue;
                }
                modelMapping.setDeleted(true);
                timeString = logCursor.getString(logCursor.getColumnIndex(LogInfo.COLUMN.ACTION_DATE));
                clientDate = ISO8601Utils.parse(timeString, new ParsePosition(0));
                modelMapping.setLastClientChange(clientDate);
                mIngredientModelMapping.update(modelMapping);
                break;
            default:
            }

        }
    } catch (Exception e) {
        logCursor.close();
    }
}

From source file:com.amazonaws.mobileconnectors.s3.transferutility.TransferDBUtil.java

/**
 * Queries all the PartETags of completed parts from the multipart upload
 * specified by the mainUploadId. The list of PartETags is used to complete
 * a multiart upload, so it's usually called after all partUpload tasks are
 * finished.// ww w .  j  a  v a  2s  . c  o m
 *
 * @param mainUploadId The mainUploadId of a multipart upload task
 * @return A list of PartEtag of completed parts
 */
public List<PartETag> queryPartETagsOfUpload(int mainUploadId) {
    final List<PartETag> partETags = new ArrayList<PartETag>();
    Cursor c = null;
    int partNum = 0;
    String eTag = null;
    try {
        c = transferDBBase.query(getPartUri(mainUploadId), null, null, null, null);
        while (c.moveToNext()) {
            partNum = c.getInt(c.getColumnIndexOrThrow(TransferTable.COLUMN_PART_NUM));
            eTag = c.getString(c.getColumnIndexOrThrow(TransferTable.COLUMN_ETAG));
            partETags.add(new PartETag(partNum, eTag));
        }
    } finally {
        if (c != null) {
            c.close();
        }
    }
    return partETags;
}