Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Licensed under the Apache License, Version 2.0

import java.util.ArrayList;
import java.util.HashMap;

import android.content.ContentValues;

public class Main {
    public static void shiftTableIdsExceptWhen(HashMap<String, ArrayList<ContentValues>> operationMap,
            String tableName, String idColumnName, long topTableId, String exceptionColumn, String exceptionValue) {
        ArrayList<ContentValues> restoreOperations = operationMap.get(tableName);
        if (null == restoreOperations || null == exceptionValue) {
            return;
        }
        for (ContentValues restoreCv : restoreOperations) {
            if (!exceptionValue.equals(restoreCv.getAsString(exceptionColumn))) {
                restoreCv.put(idColumnName, restoreCv.getAsLong(idColumnName) + topTableId);
            }
        }
    }
}