/*
 * Copyright (c) 2017, University of Oslo
 *
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 * Neither the name of the HISP project nor the names of its contributors may
 * be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.hisp.dhis.android.core.user;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import org.hisp.dhis.android.core.common.DeletableStore;

import java.util.Date;

interface UserRoleStore extends DeletableStore {
    long insert(
            @NonNull String uid,
            @Nullable String code,
            @Nullable String name,
            @Nullable String displayName,
            @Nullable Date created,
            @Nullable Date lastUpdated);

    int update(
            @NonNull String uid,
            @Nullable String code,
            @Nullable String name,
            @Nullable String displayName,
            @Nullable Date created,
            @Nullable Date lastUpdated,
            @NonNull String whereUid);

    int delete(@NonNull String uid);

}

@@ -1545,16 +1545,17 @@
 GE.%0A */%0A
+%0A
 package 
@@ -1588,16 +1588,96 @@
 .user;%0A%0A
+import android.database.Cursor;%0Aimport android.database.sqlite.SQLiteStatement;%0A
 import a
@@ -1715,268 +1715,588 @@
 ll;%0A
+%0A
 import 
-android.support.annotation.Nullable;%0A%0Aimport org.hisp.dhis.android.core.common.DeletableStore;%0A%0Aimport java.util.Date;%0A%0Ainterface UserRoleStore extends DeletableStore %7B%0A    long insert(%0A            @NonNull String uid,%0A            @Nullable String co
+org.hisp.dhis.android.core.arch.db.binders.IdentifiableStatementBinder;%0Aimport org.hisp.dhis.android.core.arch.db.binders.StatementBinder;%0Aimport org.hisp.dhis.android.core.common.CursorModelFactory;%0Aimport org.hisp.dhis.android.core.common.IdentifiableObjectStore;%0Aimport org.hisp.dhis.android.core.common.StoreFactory;%0Aimport org.hisp.dhis.android.core.data.database.DatabaseAdapter;%0A%0Apublic final class UserRoleStore %7B%0A%0A    private UserRoleStore() %7B%7D%0A%0A    private static StatementBinder%3CUserRole%3E BINDER = new IdentifiableStatementBinder%3CUserRole%3E() %7B%0A        @Overri
 de
-,
 %0A   
@@ -2304,273 +2304,388 @@
     
-    @Nullable String name,%0A            @Nullable String displayName,%0A            @Nullable Date created,%0A            @Nullable Date lastUpdated);%0A%0A    int update(%0A            @NonNull String uid,%0A            @Nullable String code,%0A            @Nullable String name,
+public void bindToStatement(@NonNull UserRole o, @NonNull SQLiteStatement sqLiteStatement) %7B%0A            super.bindToStatement(o, sqLiteStatement);%0A        %7D%0A    %7D;%0A%0A    private static final CursorModelFactory%3CUserRole%3E FACTORY = new CursorModelFactory%3CUserRole%3E() %7B%0A        @Override%0A        public UserRole fromCursor(Cursor cursor) %7B%0A            return UserRole.create(cursor);
 %0A   
@@ -2693,129 +2693,120 @@
     
+%7D%0A
     
-@Nullable String displayName,%0A            @Nullable Date created,%0A            @Nullable Date lastUp
+%7D;%0A%0A    public static IdentifiableObjectStore%3CUserRole%3E create(DatabaseAdapter databaseA
 da
+p
 te
-d,%0A   
+r) %7B%0A
         
  @No
@@ -2805,73 +2805,115 @@
     
- @NonNull String whereUid);%0A%0A    int delete(@NonNull String uid);%0A%0A
+return StoreFactory.objectWithUidStore(databaseAdapter, UserRoleTableInfo.TABLE_INFO, BINDER, FACTORY);%0A    
 %7D%0A
+%7D

Unify UserRoleStore