mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<fragment
|
||||
android:id="@+id/map"
|
||||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/latlongLocation"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="bottom"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="#ff058fff"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="#ffffffff"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp" />
|
||||
|
||||
</RelativeLayout>
|
Binary file not shown.
After Width: | Height: | Size: 556 KiB |
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/pullToRefresh">
|
||||
<ListView android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/timelineList"
|
||||
android:divider="@android:color/transparent"
|
||||
android:dividerHeight="5dp">
|
||||
</ListView>
|
||||
</uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:drawable="@color/gradient_start" />
|
||||
<item android:state_pressed="true" android:drawable="@color/gradient_start" />
|
||||
<item android:drawable="@color/gradient_end" />
|
||||
</selector>
|
|
@ -0,0 +1,81 @@
|
|||
package com.adins.mss.foundation.db.dataaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.dao.Contact;
|
||||
import com.adins.mss.dao.ContactDao;
|
||||
import com.adins.mss.dao.DaoSession;
|
||||
import com.adins.mss.foundation.db.DaoOpenHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
/**
|
||||
* Created by olivia.dg on 11/17/2017.
|
||||
*/
|
||||
|
||||
public class ContactDataAccess {
|
||||
protected static DaoSession getDaoSession(Context context){
|
||||
return DaoOpenHelper.getDaoSession(context);
|
||||
}
|
||||
|
||||
protected static ContactDao getAccountDao(Context context) {
|
||||
return getDaoSession(context).getContactDao();
|
||||
}
|
||||
|
||||
public static void add(Context context, Contact contact){
|
||||
getAccountDao(context).insert(contact);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void add(Context context, List<Contact> contactList){
|
||||
getAccountDao(context).insertInTx(contactList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void addOrReplace(Context context, Contact contact){
|
||||
getAccountDao(context).insertOrReplaceInTx(contact);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void addOrReplace(Context context, List<Contact> contactList){
|
||||
getAccountDao(context).insertOrReplaceInTx(contactList);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void clean(Context context){
|
||||
getAccountDao(context).deleteAll();
|
||||
}
|
||||
|
||||
public static void delete(Context context, Contact contact){
|
||||
getAccountDao(context).delete(contact);
|
||||
getDaoSession(context).clear();
|
||||
}
|
||||
|
||||
public static void update(Context context, Contact contact){
|
||||
getAccountDao(context).update(contact);
|
||||
}
|
||||
|
||||
public static List<Contact> getAll(Context context){
|
||||
QueryBuilder<Contact> qb = getAccountDao(context).queryBuilder();
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
|
||||
public static Contact getOne(Context context, String uuid){
|
||||
QueryBuilder<Contact> qb = getAccountDao(context).queryBuilder();
|
||||
qb.where(ContactDao.Properties.Uuid_contact.eq(uuid));
|
||||
qb.build();
|
||||
|
||||
if ((qb.list() == null) || qb.list().isEmpty()) return null;
|
||||
return qb.list().get(0);
|
||||
}
|
||||
|
||||
public static List<Contact> getAllByAccount(Context context, String uuidAccount){
|
||||
QueryBuilder<Contact> qb = getAccountDao(context).queryBuilder();
|
||||
qb.where(ContactDao.Properties.Uuid_account.eq(uuidAccount));
|
||||
qb.build();
|
||||
return qb.list();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.adins.mss.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.adins.mss.base.util.LocaleHelper;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by adityapurwa on 15/04/15.
|
||||
*/
|
||||
public class ChangePasswordActivity extends FragmentActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_change_password);
|
||||
Fragment fragment = new ChangePasswordFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ChangePasswordFragment.AS_ACTIVITY, true);
|
||||
fragment.setArguments(args);
|
||||
FragmentTransaction
|
||||
transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.replace(R.id.fragmentRoot, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
Context context = newBase;
|
||||
Locale locale;
|
||||
try{
|
||||
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} catch (Exception e) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} finally {
|
||||
super.attachBaseContext(context);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package com.adins.mss.foundation.http;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.StatusLine;
|
||||
|
||||
public class HttpConnectionResult {
|
||||
|
||||
|
||||
/**
|
||||
* Status Code in HTTP Connection, for example '200' for success, and '500' for server exception
|
||||
*/
|
||||
private int statusCode;
|
||||
|
||||
/**
|
||||
* The phrase used for each status code, for example the description of 500 error as server exception
|
||||
*/
|
||||
private String reasonPhrase;
|
||||
|
||||
/**
|
||||
* The result string sent from server as a reply
|
||||
*/
|
||||
private String result;
|
||||
|
||||
/**
|
||||
* Simple info which is true if statusCode is 200, and false if else
|
||||
*/
|
||||
private boolean OK;
|
||||
|
||||
public HttpConnectionResult(StatusLine statusline, String result) {
|
||||
if (statusline != null) {
|
||||
this.statusCode = statusline.getStatusCode();
|
||||
this.reasonPhrase = statusline.getReasonPhrase();
|
||||
setOK(statusCode);
|
||||
}
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public HttpConnectionResult(int code, String message, String result) {
|
||||
this.statusCode = code;
|
||||
this.reasonPhrase = message;
|
||||
setOK(statusCode);
|
||||
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public void printLog(String tag) {
|
||||
String msg;
|
||||
if (this.statusCode == HttpStatus.SC_OK) {
|
||||
msg = "Connection success";
|
||||
} else {
|
||||
msg = "Connection to server failed: " + this.statusCode + " " + this.reasonPhrase;
|
||||
}
|
||||
Log.i(tag, msg);
|
||||
}
|
||||
|
||||
//=== Getter Setter ===//
|
||||
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public void setStatusCode(int statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
setOK(statusCode);
|
||||
}
|
||||
|
||||
public String getReasonPhrase() {
|
||||
return reasonPhrase;
|
||||
}
|
||||
|
||||
public void setReasonPhrase(String reasonPhrase) {
|
||||
this.reasonPhrase = reasonPhrase;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public boolean isOK() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
private void setOK(int statusCode) {
|
||||
if (statusCode == HttpStatus.SC_OK) {
|
||||
OK = true;
|
||||
} else {
|
||||
OK = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.adins.mss.foundation.image;
|
||||
|
||||
/**
|
||||
* Created by gigin.ginanjar on 31/03/2016.
|
||||
*/
|
||||
public class ExifData {
|
||||
public int orientation;
|
||||
public int width;
|
||||
public int height;
|
||||
|
||||
public int getOrientation() {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public void setOrientation(int orientation) {
|
||||
this.orientation = orientation;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,315 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import android.database.Cursor;
|
||||
|
||||
import de.greenrobot.dao.AbstractDao;
|
||||
import de.greenrobot.dao.Property;
|
||||
import de.greenrobot.dao.internal.SqlUtils;
|
||||
import de.greenrobot.dao.internal.DaoConfig;
|
||||
import de.greenrobot.dao.database.Database;
|
||||
import de.greenrobot.dao.database.DatabaseStatement;
|
||||
import de.greenrobot.dao.query.Query;
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
import com.adins.mss.dao.ReceiptVoucher;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||
/**
|
||||
* DAO for table "TR_RECEIPTVOUCHER".
|
||||
*/
|
||||
public class ReceiptVoucherDao extends AbstractDao<ReceiptVoucher, String> {
|
||||
|
||||
public static final String TABLENAME = "TR_RECEIPTVOUCHER";
|
||||
|
||||
/**
|
||||
* Properties of entity ReceiptVoucher.<br/>
|
||||
* Can be used for QueryBuilder and for referencing column names.
|
||||
*/
|
||||
public static class Properties {
|
||||
public final static Property Uuid_receipt_voucher = new Property(0, String.class, "uuid_receipt_voucher", true, "UUID_RECEIPT_VOUCHER");
|
||||
public final static Property Rv_status = new Property(1, String.class, "rv_status", false, "RV_STATUS");
|
||||
public final static Property Rv_number = new Property(2, String.class, "rv_number", false, "RV_NUMBER");
|
||||
public final static Property Flag_sources = new Property(3, String.class, "flag_sources", false, "FLAG_SOURCES");
|
||||
public final static Property Usr_crt = new Property(4, String.class, "usr_crt", false, "USR_CRT");
|
||||
public final static Property Dtm_crt = new Property(5, java.util.Date.class, "dtm_crt", false, "DTM_CRT");
|
||||
public final static Property Dtm_use = new Property(6, java.util.Date.class, "dtm_use", false, "DTM_USE");
|
||||
public final static Property Uuid_user = new Property(7, String.class, "uuid_user", false, "UUID_USER");
|
||||
public final static Property Uuid_task_h = new Property(8, String.class, "uuid_task_h", false, "UUID_TASK_H");
|
||||
};
|
||||
|
||||
private DaoSession daoSession;
|
||||
|
||||
private Query<ReceiptVoucher> user_ReceiptVoucherListQuery;
|
||||
private Query<ReceiptVoucher> taskH_ReceiptVoucherListQuery;
|
||||
|
||||
public ReceiptVoucherDao(DaoConfig config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
public ReceiptVoucherDao(DaoConfig config, DaoSession daoSession) {
|
||||
super(config, daoSession);
|
||||
this.daoSession = daoSession;
|
||||
}
|
||||
|
||||
/** Creates the underlying database table. */
|
||||
public static void createTable(Database db, boolean ifNotExists) {
|
||||
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||
db.execSQL("CREATE TABLE " + constraint + "\"TR_RECEIPTVOUCHER\" (" + //
|
||||
"\"UUID_RECEIPT_VOUCHER\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_receipt_voucher
|
||||
"\"RV_STATUS\" TEXT," + // 1: rv_status
|
||||
"\"RV_NUMBER\" TEXT," + // 2: rv_number
|
||||
"\"FLAG_SOURCES\" TEXT," + // 3: flag_sources
|
||||
"\"USR_CRT\" TEXT," + // 4: usr_crt
|
||||
"\"DTM_CRT\" INTEGER," + // 5: dtm_crt
|
||||
"\"DTM_USE\" INTEGER," + // 6: dtm_use
|
||||
"\"UUID_USER\" TEXT," + // 7: uuid_user
|
||||
"\"UUID_TASK_H\" TEXT);"); // 8: uuid_task_h
|
||||
}
|
||||
|
||||
/** Drops the underlying database table. */
|
||||
public static void dropTable(Database db, boolean ifExists) {
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TR_RECEIPTVOUCHER\"";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected void bindValues(DatabaseStatement stmt, ReceiptVoucher entity) {
|
||||
stmt.clearBindings();
|
||||
stmt.bindString(1, entity.getUuid_receipt_voucher());
|
||||
|
||||
String rv_status = entity.getRv_status();
|
||||
if (rv_status != null) {
|
||||
stmt.bindString(2, rv_status);
|
||||
}
|
||||
|
||||
String rv_number = entity.getRv_number();
|
||||
if (rv_number != null) {
|
||||
stmt.bindString(3, rv_number);
|
||||
}
|
||||
|
||||
String flag_sources = entity.getFlag_sources();
|
||||
if (flag_sources != null) {
|
||||
stmt.bindString(4, flag_sources);
|
||||
}
|
||||
|
||||
String usr_crt = entity.getUsr_crt();
|
||||
if (usr_crt != null) {
|
||||
stmt.bindString(5, usr_crt);
|
||||
}
|
||||
|
||||
java.util.Date dtm_crt = entity.getDtm_crt();
|
||||
if (dtm_crt != null) {
|
||||
stmt.bindLong(6, dtm_crt.getTime());
|
||||
}
|
||||
|
||||
java.util.Date dtm_use = entity.getDtm_use();
|
||||
if (dtm_use != null) {
|
||||
stmt.bindLong(7, dtm_use.getTime());
|
||||
}
|
||||
|
||||
String uuid_user = entity.getUuid_user();
|
||||
if (uuid_user != null) {
|
||||
stmt.bindString(8, uuid_user);
|
||||
}
|
||||
|
||||
String uuid_task_h = entity.getUuid_task_h();
|
||||
if (uuid_task_h != null) {
|
||||
stmt.bindString(9, uuid_task_h);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachEntity(ReceiptVoucher entity) {
|
||||
super.attachEntity(entity);
|
||||
entity.__setDaoSession(daoSession);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String readKey(Cursor cursor, int offset) {
|
||||
return cursor.getString(offset + 0);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public ReceiptVoucher readEntity(Cursor cursor, int offset) {
|
||||
ReceiptVoucher entity = new ReceiptVoucher( //
|
||||
cursor.getString(offset + 0), // uuid_receipt_voucher
|
||||
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // rv_status
|
||||
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // rv_number
|
||||
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // flag_sources
|
||||
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // usr_crt
|
||||
cursor.isNull(offset + 5) ? null : new java.util.Date(cursor.getLong(offset + 5)), // dtm_crt
|
||||
cursor.isNull(offset + 6) ? null : new java.util.Date(cursor.getLong(offset + 6)), // dtm_use
|
||||
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // uuid_user
|
||||
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // uuid_task_h
|
||||
);
|
||||
return entity;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public void readEntity(Cursor cursor, ReceiptVoucher entity, int offset) {
|
||||
entity.setUuid_receipt_voucher(cursor.getString(offset + 0));
|
||||
entity.setRv_status(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||
entity.setRv_number(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||
entity.setFlag_sources(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||
entity.setUsr_crt(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||
entity.setDtm_crt(cursor.isNull(offset + 5) ? null : new java.util.Date(cursor.getLong(offset + 5)));
|
||||
entity.setDtm_use(cursor.isNull(offset + 6) ? null : new java.util.Date(cursor.getLong(offset + 6)));
|
||||
entity.setUuid_user(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
|
||||
entity.setUuid_task_h(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected String updateKeyAfterInsert(ReceiptVoucher entity, long rowId) {
|
||||
return entity.getUuid_receipt_voucher();
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String getKey(ReceiptVoucher entity) {
|
||||
if(entity != null) {
|
||||
return entity.getUuid_receipt_voucher();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected boolean isEntityUpdateable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Internal query to resolve the "receiptVoucherList" to-many relationship of User. */
|
||||
public List<ReceiptVoucher> _queryUser_ReceiptVoucherList(String uuid_user) {
|
||||
synchronized (this) {
|
||||
if (user_ReceiptVoucherListQuery == null) {
|
||||
QueryBuilder<ReceiptVoucher> queryBuilder = queryBuilder();
|
||||
queryBuilder.where(Properties.Uuid_user.eq(null));
|
||||
user_ReceiptVoucherListQuery = queryBuilder.build();
|
||||
}
|
||||
}
|
||||
Query<ReceiptVoucher> query = user_ReceiptVoucherListQuery.forCurrentThread();
|
||||
query.setParameter(0, uuid_user);
|
||||
return query.list();
|
||||
}
|
||||
|
||||
/** Internal query to resolve the "receiptVoucherList" to-many relationship of TaskH. */
|
||||
public List<ReceiptVoucher> _queryTaskH_ReceiptVoucherList(String uuid_task_h) {
|
||||
synchronized (this) {
|
||||
if (taskH_ReceiptVoucherListQuery == null) {
|
||||
QueryBuilder<ReceiptVoucher> queryBuilder = queryBuilder();
|
||||
queryBuilder.where(Properties.Uuid_task_h.eq(null));
|
||||
taskH_ReceiptVoucherListQuery = queryBuilder.build();
|
||||
}
|
||||
}
|
||||
Query<ReceiptVoucher> query = taskH_ReceiptVoucherListQuery.forCurrentThread();
|
||||
query.setParameter(0, uuid_task_h);
|
||||
return query.list();
|
||||
}
|
||||
|
||||
private String selectDeep;
|
||||
|
||||
protected String getSelectDeep() {
|
||||
if (selectDeep == null) {
|
||||
StringBuilder builder = new StringBuilder("SELECT ");
|
||||
SqlUtils.appendColumns(builder, "T", getAllColumns());
|
||||
builder.append(',');
|
||||
SqlUtils.appendColumns(builder, "T0", daoSession.getUserDao().getAllColumns());
|
||||
builder.append(',');
|
||||
SqlUtils.appendColumns(builder, "T1", daoSession.getTaskHDao().getAllColumns());
|
||||
builder.append(" FROM TR_RECEIPTVOUCHER T");
|
||||
builder.append(" LEFT JOIN MS_USER T0 ON T.\"UUID_USER\"=T0.\"UUID_USER\"");
|
||||
builder.append(" LEFT JOIN TR_TASK_H T1 ON T.\"UUID_TASK_H\"=T1.\"UUID_TASK_H\"");
|
||||
builder.append(' ');
|
||||
selectDeep = builder.toString();
|
||||
}
|
||||
return selectDeep;
|
||||
}
|
||||
|
||||
protected ReceiptVoucher loadCurrentDeep(Cursor cursor, boolean lock) {
|
||||
ReceiptVoucher entity = loadCurrent(cursor, 0, lock);
|
||||
int offset = getAllColumns().length;
|
||||
|
||||
User user = loadCurrentOther(daoSession.getUserDao(), cursor, offset);
|
||||
entity.setUser(user);
|
||||
offset += daoSession.getUserDao().getAllColumns().length;
|
||||
|
||||
TaskH taskH = loadCurrentOther(daoSession.getTaskHDao(), cursor, offset);
|
||||
entity.setTaskH(taskH);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public ReceiptVoucher loadDeep(Long key) {
|
||||
assertSinglePk();
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder(getSelectDeep());
|
||||
builder.append("WHERE ");
|
||||
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
|
||||
String sql = builder.toString();
|
||||
|
||||
String[] keyArray = new String[] { key.toString() };
|
||||
Cursor cursor = db.rawQuery(sql, keyArray);
|
||||
|
||||
try {
|
||||
boolean available = cursor.moveToFirst();
|
||||
if (!available) {
|
||||
return null;
|
||||
} else if (!cursor.isLast()) {
|
||||
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
|
||||
}
|
||||
return loadCurrentDeep(cursor, true);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
|
||||
public List<ReceiptVoucher> loadAllDeepFromCursor(Cursor cursor) {
|
||||
int count = cursor.getCount();
|
||||
List<ReceiptVoucher> list = new ArrayList<ReceiptVoucher>(count);
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
if (identityScope != null) {
|
||||
identityScope.lock();
|
||||
identityScope.reserveRoom(count);
|
||||
}
|
||||
try {
|
||||
do {
|
||||
list.add(loadCurrentDeep(cursor, false));
|
||||
} while (cursor.moveToNext());
|
||||
} finally {
|
||||
if (identityScope != null) {
|
||||
identityScope.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected List<ReceiptVoucher> loadDeepAllAndCloseCursor(Cursor cursor) {
|
||||
try {
|
||||
return loadAllDeepFromCursor(cursor);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** A raw-style query where you can pass any WHERE clause and arguments. */
|
||||
public List<ReceiptVoucher> queryDeep(String where, String... selectionArg) {
|
||||
Cursor cursor = db.rawQuery(getSelectDeep() + where, selectionArg);
|
||||
return loadDeepAllAndCloseCursor(cursor);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue