Ejemplo n.º 1
0
 /** @inheritdoc */
 @Override
 public void readEntity(Cursor cursor, MunkaKep entity, int offset) {
   entity.setMunkaKepID(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setMunkaKepPath(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
   entity.setMunkaKepDate(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
   entity.setMunkaKepIsUploaded(
       cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3) != 0);
   entity.setMunkaKepIsActive(cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0);
   entity.setMunkaID(cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5));
 }
Ejemplo n.º 2
0
  public ArrayList<MParamInfo> selectMacroParamList(String mlibname) {

    if (null == mlibname) {
      Log.e("MParamBiz", "selectMacroParam: macro library name is null!");
      return null;
    }

    mDB = SkGlobalData.getProjectDatabase();
    if (null == mDB) { // 获得数据库失败
      Log.e("MParamBiz", "selectMacroParam: Get database failed!");
      return null;
    }

    Cursor tmpCursor = null;

    tmpCursor = mDB.getDatabaseBySql(mQueryStr, new String[] {mlibname});
    if (null == tmpCursor) { // 获取游标失败
      Log.e("MParamBiz", "selectMacroParam: Get cursor failed!");
      return null;
    }

    ArrayList<MParamInfo> dstList = new ArrayList<MParamInfo>();

    AddrProp mTmpAddr = null;

    while (tmpCursor.moveToNext()) {
      MParamInfo tmpMPI = new MParamInfo();
      tmpMPI.setName(tmpCursor.getString(tmpCursor.getColumnIndex("sName")));
      tmpMPI.setMacroLibName(tmpCursor.getString(tmpCursor.getColumnIndex("sMacroLibName")));
      tmpMPI.setDataType(tmpCursor.getShort(tmpCursor.getColumnIndex("nDatatype")));
      tmpMPI.setCodeType(tmpCursor.getShort(tmpCursor.getColumnIndex("nCodetype")));
      tmpMPI.setRWPerm(tmpCursor.getShort(tmpCursor.getColumnIndex("nRWPerm")));
      int tmpAddrValue = tmpCursor.getInt(tmpCursor.getColumnIndex("nAddrValue"));
      mTmpAddr = SkGlobalData.getProjectDatabase().getAddrById(tmpAddrValue);
      tmpMPI.setAddrProp(mTmpAddr);
      if (null != tmpCursor.getString(tmpCursor.getColumnIndex("bOffset"))) {
        boolean boo =
            tmpCursor.getString(tmpCursor.getColumnIndex("bOffset")).equals("true") ? true : false;
        tmpMPI.setbOffset(boo);
        if (boo) {
          tmpMPI.setnOffsetAddr(
              SkGlobalData.getProjectDatabase()
                  .getAddrById(tmpCursor.getInt(tmpCursor.getColumnIndex("nOffsetAddr"))));
        }
      }

      dstList.add(tmpMPI);
      mTmpAddr = null;
    }
    close(tmpCursor);

    return dstList;
  }
Ejemplo n.º 3
0
 /** @inheritdoc */
 @Override
 public MunkaKep readEntity(Cursor cursor, int offset) {
   MunkaKep entity =
       new MunkaKep( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // munkaKepID
           cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // munkaKepPath
           cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // munkaKepDate
           cursor.isNull(offset + 3)
               ? null
               : cursor.getShort(offset + 3) != 0, // munkaKepIsUploaded
           cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0, // munkaKepIsActive
           cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5) // munkaID
           );
   return entity;
 }
 @Override
 public Object getData(Cursor cursor, int columnIndex) {
   if (cursor.isNull(columnIndex)) {
     return null;
   }
   try {
     return cursor.getShort(columnIndex);
   } catch (Exception e) {
   }
   try {
     return cursor.getInt(columnIndex);
   } catch (Exception e) {
   }
   try {
     return cursor.getLong(columnIndex);
   } catch (Exception e) {
   }
   try {
     return cursor.getFloat(columnIndex);
   } catch (Exception e) {
   }
   try {
     return cursor.getDouble(columnIndex);
   } catch (Exception e) {
   }
   try {
     return cursor.getString(columnIndex);
   } catch (Exception e) {
   }
   // Not returning blobs to contain size of bundles and prevent FAILED BINDER TRANSACTION
   // try { return cursor.getBlob(columnIndex); } catch (Exception e) {}
   return null;
 }
Ejemplo n.º 5
0
  public int searchCustomerName(String customerName) {
    SQLiteDatabase DB;
    DB = GETSQLOBJ();
    String Query = "";
    Order order;
    Customer customer;
    LinkedList<Customer> LCustomers = new LinkedList<Customer>();

    String customername;
    Query = "SELECT ROWID, customer.Name FROM Customer WHERE customer.Name=" + "customerName";
    Cursor OBJCursor = DB.rawQuery(Query, null);
    if (OBJCursor != null) {
      if (OBJCursor.moveToFirst()) {
        do {
          Customer OBJCustomer =
              new Customer(
                  OBJCursor.getString(OBJCursor.getColumnIndex("Name")),
                  OBJCursor.getString(OBJCursor.getColumnIndex("Phone")),
                  OBJCursor.getString(OBJCursor.getColumnIndex("Address")));
          OBJCustomer.SetCustomerID(OBJCursor.getShort(0));
          LCustomers.addFirst(OBJCustomer);
        } while (OBJCursor.moveToNext());
      }
    }

    DB.close();
    OBJCursor.close();

    if (Query == null) return 0;
    else return 1;
  }
Ejemplo n.º 6
0
 /** @inheritdoc */
 @Override
 public void readEntity(Cursor cursor, Firsatlarim entity, int offset) {
   entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setFirsat_id(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1));
   entity.setSure(cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2));
   entity.setYararlanildi_mi(cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3) != 0);
 }
Ejemplo n.º 7
0
 /** @inheritdoc */
 @Override
 protected PicItem readEntity(Cursor cursor, int offset) {
   PicItem entity =
       new PicItem( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
           cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // picId
           cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // author
           cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // authorEmail
           cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // authorUrl
           cursor.isNull(offset + 5)
               ? null
               : dateConverter.convertToEntityProperty(
                   Timestamp.class, cursor.getLong(offset + 5)), // date
           cursor.isNull(offset + 6) ? null : cursor.getLong(offset + 6), // votePositive
           cursor.isNull(offset + 7) ? null : cursor.getLong(offset + 7), // voteNegative
           cursor.isNull(offset + 8) ? null : cursor.getLong(offset + 8), // commentCount
           cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // threadId
           cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // content
           cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // textContent
           cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // pics
           cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // picFirst
           cursor.isNull(offset + 14) ? null : cursor.getLong(offset + 14), // picCount
           cursor.isNull(offset + 15) ? null : cursor.getShort(offset + 15) != 0 // hasGif
           );
   return entity;
 }
Ejemplo n.º 8
0
 public void readEntity(Cursor cursor, FoodLocale foodlocale, int i) {
   boolean flag2 = true;
   Object obj1 = null;
   Object obj;
   if (cursor.isNull(i + 0)) {
     obj = null;
   } else {
     obj = Long.valueOf(cursor.getLong(i + 0));
   }
   foodlocale.setId(((Long) (obj)));
   if (cursor.isNull(i + 1)) {
     obj = null;
   } else {
     obj = cursor.getString(i + 1);
   }
   foodlocale.setValue(((String) (obj)));
   if (cursor.isNull(i + 2)) {
     obj = null;
   } else {
     obj = cursor.getString(i + 2);
   }
   foodlocale.setLabel(((String) (obj)));
   if (cursor.isNull(i + 3)) {
     obj = null;
   } else {
     boolean flag;
     if (cursor.getShort(i + 3) != 0) {
       flag = true;
     } else {
       flag = false;
     }
     obj = Boolean.valueOf(flag);
   }
   foodlocale.setSupportsLookupByBarCode(((Boolean) (obj)));
   if (cursor.isNull(i + 4)) {
     cursor = obj1;
   } else {
     boolean flag1;
     if (cursor.getShort(i + 4) != 0) {
       flag1 = flag2;
     } else {
       flag1 = false;
     }
     cursor = Boolean.valueOf(flag1);
   }
   foodlocale.setImageUpload(cursor);
 }
Ejemplo n.º 9
0
 public FoodLocale readEntity(Cursor cursor, int i) {
   boolean flag2 = true;
   Object obj = null;
   Long long1;
   String s;
   String s1;
   Boolean boolean1;
   if (cursor.isNull(i + 0)) {
     long1 = null;
   } else {
     long1 = Long.valueOf(cursor.getLong(i + 0));
   }
   if (cursor.isNull(i + 1)) {
     s = null;
   } else {
     s = cursor.getString(i + 1);
   }
   if (cursor.isNull(i + 2)) {
     s1 = null;
   } else {
     s1 = cursor.getString(i + 2);
   }
   if (cursor.isNull(i + 3)) {
     boolean1 = null;
   } else {
     boolean flag;
     if (cursor.getShort(i + 3) != 0) {
       flag = true;
     } else {
       flag = false;
     }
     boolean1 = Boolean.valueOf(flag);
   }
   if (cursor.isNull(i + 4)) {
     cursor = obj;
   } else {
     boolean flag1;
     if (cursor.getShort(i + 4) != 0) {
       flag1 = flag2;
     } else {
       flag1 = false;
     }
     cursor = Boolean.valueOf(flag1);
   }
   return new FoodLocale(long1, s, s1, boolean1, cursor);
 }
Ejemplo n.º 10
0
  /**
   * * Get cookies in the format of CookieManager.Cookie inside an ArrayList for a given domain
   *
   * @return ArrayList<Cookie> If nothing is found, return an empty list.
   */
  ArrayList<Cookie> getCookiesForDomain(String domain) {
    ArrayList<Cookie> list = new ArrayList<Cookie>();
    if (domain == null || !checkInitialized()) {
      return list;
    }

    synchronized (mCookieLock) {
      final String[] columns =
          new String[] {
            ID_COL, COOKIES_DOMAIN_COL, COOKIES_PATH_COL,
            COOKIES_NAME_COL, COOKIES_VALUE_COL, COOKIES_EXPIRES_COL,
            COOKIES_SECURE_COL
          };
      final String selection = "(" + COOKIES_DOMAIN_COL + " GLOB '*' || ?)";
      Cursor cursor = null;
      try {
        cursor =
            mDatabase.query(
                mTableNames[TABLE_COOKIES_ID],
                columns,
                selection,
                new String[] {domain},
                null,
                null,
                null);
        if (cursor.moveToFirst()) {
          int domainCol = cursor.getColumnIndex(COOKIES_DOMAIN_COL);
          int pathCol = cursor.getColumnIndex(COOKIES_PATH_COL);
          int nameCol = cursor.getColumnIndex(COOKIES_NAME_COL);
          int valueCol = cursor.getColumnIndex(COOKIES_VALUE_COL);
          int expiresCol = cursor.getColumnIndex(COOKIES_EXPIRES_COL);
          int secureCol = cursor.getColumnIndex(COOKIES_SECURE_COL);
          do {
            Cookie cookie = new Cookie();
            cookie.domain = cursor.getString(domainCol);
            cookie.path = cursor.getString(pathCol);
            cookie.name = cursor.getString(nameCol);
            cookie.value = cursor.getString(valueCol);
            if (cursor.isNull(expiresCol)) {
              cookie.expires = -1;
            } else {
              cookie.expires = cursor.getLong(expiresCol);
            }
            cookie.secure = cursor.getShort(secureCol) != 0;
            cookie.mode = Cookie.MODE_NORMAL;
            list.add(cookie);
          } while (cursor.moveToNext());
        }
      } catch (IllegalStateException e) {
        Log.e(LOGTAG, "getCookiesForDomain", e);
      } finally {
        if (cursor != null) cursor.close();
      }
      return list;
    }
  }
 /** @inheritdoc */
 @Override
 public ConquestMoveDisplacements readEntity(Cursor cursor, int offset) {
   ConquestMoveDisplacements entity =
       new ConquestMoveDisplacements( //
           cursor.getLong(offset + 0), // Id
           cursor.getString(offset + 1), // Identifier
           cursor.getShort(offset + 2) != 0 // AffectsTarget
           );
   return entity;
 }
 @Override
 public void readEntity(Cursor cursor, TestData entity, int offset) {
   entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setTestString(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
   entity.setTestLong(cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2));
   entity.setTestDate(
       cursor.isNull(offset + 3) ? null : new java.util.Date(cursor.getLong(offset + 3)));
   entity.setTestInt(cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4));
   entity.setTestBoolean(cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0);
 }
Ejemplo n.º 13
0
 /** @inheritdoc */
 @Override
 public void readEntity(Cursor cursor, Address entity, int offset) {
   entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setUsername(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
   entity.setMobileNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
   entity.setArea(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
   entity.setStreet(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
   entity.setDetail(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
   entity.setIsDefault(cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0);
 }
Ejemplo n.º 14
0
 /** @inheritdoc */
 @Override
 public void readEntity(Cursor cursor, PasswordType entity, int offset) {
   entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setIcon(cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1));
   entity.setName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
   entity.setStatus(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3));
   entity.setRemark(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
   entity.setTheme(cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5));
   entity.setExcludeFromQuery(cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0);
 }
Ejemplo n.º 15
0
  /** Insert all new local files in Google Drive. */
  private void insertNewLocalFiles() {
    Uri uri = getNotesUri(mAccount.name);
    try {
      Cursor cursor =
          mProvider.query(
              uri, PROJECTION, NotePad.Notes.COLUMN_NAME_FILE_ID + " is NULL", null, null);

      Log.d(TAG, "Inserting new local files: " + cursor.getCount());

      if (cursor.moveToFirst()) {
        do {
          Uri localFileUri = getNoteUri(mAccount.name, cursor.getString(COLUMN_INDEX_ID));

          if (cursor.getShort(COLUMN_INDEX_DELETED) != 0) {
            mProvider.delete(localFileUri, null, null);
          } else {
            File newFile = new File();

            newFile.setTitle(cursor.getString(COLUMN_INDEX_TITLE));
            newFile.setMimeType(TEXT_PLAIN);
            String content = cursor.getString(COLUMN_INDEX_NOTE);

            try {
              File insertedFile = null;

              if (content != null && content.length() > 0) {
                insertedFile =
                    mService
                        .files()
                        .insert(newFile, ByteArrayContent.fromString(TEXT_PLAIN, content))
                        .execute();
              } else {
                insertedFile = mService.files().insert(newFile).execute();
              }

              // Update the local file to add the file ID.
              ContentValues values = new ContentValues();
              values.put(
                  NotePad.Notes.COLUMN_NAME_MODIFICATION_DATE,
                  insertedFile.getModifiedDate().getValue());
              values.put(
                  NotePad.Notes.COLUMN_NAME_CREATE_DATE, insertedFile.getCreatedDate().getValue());
              values.put(NotePad.Notes.COLUMN_NAME_FILE_ID, insertedFile.getId());

              mProvider.update(localFileUri, values, null, null);
            } catch (IOException e) {
              e.printStackTrace();
            }
          }
        } while (cursor.moveToNext());
      }
    } catch (RemoteException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 16
0
 /** @inheritdoc */
 @Override
 public Firsatlarim readEntity(Cursor cursor, int offset) {
   Firsatlarim entity =
       new Firsatlarim( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
           cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // firsat_id
           cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // sure
           cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3) != 0 // yararlanildi_mi
           );
   return entity;
 }
Ejemplo n.º 17
0
 /** @inheritdoc */
 @Override
 public void readEntity(Cursor cursor, Rule entity, int offset) {
   entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setName(cursor.getString(offset + 1));
   entity.setDiscription(cursor.getString(offset + 2));
   entity.setApplied(cursor.getShort(offset + 3) != 0);
   entity.setEvent_type(cursor.getInt(offset + 4));
   entity.setEvent_id(cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5));
   entity.setPlugin_id(cursor.getLong(offset + 6));
   entity.setGesture_id(cursor.getLong(offset + 7));
 }
Ejemplo n.º 18
0
 /** @inheritdoc */
 @Override
 public void readEntity(Cursor cursor, UserActivity entity, int offset) {
   entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
   entity.setSummary(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
   entity.setDescription(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
   entity.setClassified(cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0);
   entity.setLevelOfJoy(cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5));
   entity.setStartDate(cursor.isNull(offset + 6) ? null : cursor.getLong(offset + 6));
   entity.setEndDate(cursor.isNull(offset + 7) ? null : cursor.getLong(offset + 7));
 }
  /**
   * Returns all available activity samples from between the two timestamps (inclusive), of the
   * given provided and type(s).
   *
   * @param timestamp_from
   * @param timestamp_to
   * @param activityTypes ORed combination of #TYPE_DEEP_SLEEP, #TYPE_LIGHT_SLEEP, #TYPE_ACTIVITY
   * @param provider the producer of the samples to be sought
   * @return
   */
  private ArrayList<ActivitySample> getGBActivitySamples(
      int timestamp_from, int timestamp_to, int activityTypes, SampleProvider provider) {
    if (timestamp_to < 0) {
      throw new IllegalArgumentException("negative timestamp_to");
    }
    if (timestamp_from < 0) {
      throw new IllegalArgumentException("negative timestamp_from");
    }
    ArrayList<ActivitySample> samples = new ArrayList<>();
    final String where =
        "(provider="
            + provider.getID()
            + " and timestamp>="
            + timestamp_from
            + " and timestamp<="
            + timestamp_to
            + getWhereClauseFor(activityTypes, provider)
            + ")";
    LOG.info("Activity query where: " + where);
    final String order = "timestamp";
    try (SQLiteDatabase db = this.getReadableDatabase()) {
      try (Cursor cursor =
          db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order)) {
        LOG.info("Activity query result: " + cursor.getCount() + " samples");
        if (cursor.moveToFirst()) {
          do {
            GBActivitySample sample =
                new GBActivitySample(
                    provider,
                    cursor.getInt(cursor.getColumnIndex(KEY_TIMESTAMP)),
                    cursor.getShort(cursor.getColumnIndex(KEY_INTENSITY)),
                    cursor.getShort(cursor.getColumnIndex(KEY_STEPS)),
                    (byte) cursor.getShort(cursor.getColumnIndex(KEY_TYPE)));
            samples.add(sample);
          } while (cursor.moveToNext());
        }
      }
    }

    return samples;
  }
Ejemplo n.º 20
0
 /** @inheritdoc */
 @Override
 public PasswordType readEntity(Cursor cursor, int offset) {
   PasswordType entity =
       new PasswordType( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
           cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1), // icon
           cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // name
           cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // status
           cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // remark
           cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5), // theme
           cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0 // excludeFromQuery
           );
   return entity;
 }
Ejemplo n.º 21
0
 /** @inheritdoc */
 @Override
 public Address readEntity(Cursor cursor, int offset) {
   Address entity =
       new Address( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
           cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // username
           cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // mobileNo
           cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // area
           cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // street
           cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // detail
           cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0 // isDefault
           );
   return entity;
 }
Ejemplo n.º 22
0
 public synchronized boolean hasLastMessage(Chat chat, Message message) {
   Contact contact = chat.getContact();
   boolean hasMessage = false;
   Cursor cursor = null;
   try {
     cursor =
         SawimApplication.getDatabaseHelper()
             .getReadableDatabase()
             .query(
                 DatabaseHelper.TABLE_CHAT_HISTORY,
                 null,
                 DatabaseHelper.CONTACT_ID + " = ?",
                 new String[] {uniqueUserId},
                 null,
                 null,
                 DatabaseHelper.DATE + " DESC",
                 String.valueOf(60));
     if (cursor.moveToLast()) {
       do {
         short rowData = cursor.getShort(cursor.getColumnIndex(DatabaseHelper.ROW_DATA));
         MessData mess =
             Chat.buildMessage(
                 contact,
                 message,
                 contact.isConference() ? message.getName() : chat.getFrom(message),
                 false,
                 Chat.isHighlight(message.getProcessedText(), contact.getMyName()));
         MessData messFromDataBase = buildMessage(chat, cursor);
         boolean isMessage =
             (rowData & MessData.PRESENCE) == 0
                 && (rowData & MessData.SERVICE) == 0
                 && (rowData & MessData.PROGRESS) == 0;
         if (isMessage) {
           hasMessage = hasMessage(mess, messFromDataBase);
           if (hasMessage) {
             return true;
           }
         }
       } while (cursor.moveToPrevious());
     }
   } catch (Exception e) {
     DebugLog.panic(e);
   } finally {
     if (cursor != null) {
       cursor.close();
     }
   }
   return hasMessage;
 }
Ejemplo n.º 23
0
 /** @inheritdoc */
 @Override
 public Rule readEntity(Cursor cursor, int offset) {
   Rule entity =
       new Rule( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
           cursor.getString(offset + 1), // name
           cursor.getString(offset + 2), // discription
           cursor.getShort(offset + 3) != 0, // applied
           cursor.getInt(offset + 4), // event_type
           cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5), // event_id
           cursor.getLong(offset + 6), // plugin_id
           cursor.getLong(offset + 7) // gesture_id
           );
   return entity;
 }
Ejemplo n.º 24
0
 /** @inheritdoc */
 @Override
 public void readEntity(Cursor cursor, Order entity, int offset) {
   entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
   entity.setTopic(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
   entity.setStartTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
   entity.setEndTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
   entity.setPrice(cursor.isNull(offset + 5) ? null : cursor.getDouble(offset + 5));
   entity.setRealtime(cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0);
   entity.setContactName(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
   entity.setContactGender(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
   entity.setContactPhone(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
   entity.setExpertId(cursor.isNull(offset + 10) ? null : cursor.getLong(offset + 10));
   entity.setUserId(cursor.isNull(offset + 11) ? null : cursor.getLong(offset + 11));
 }
 @Override
 public TestData readEntity(Cursor cursor, int offset) {
   TestData entity =
       new TestData( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
           cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // testString
           cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2), // testLong
           cursor.isNull(offset + 3)
               ? null
               : new java.util.Date(cursor.getLong(offset + 3)), // testDate
           cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4), // testInt
           cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0 // testBoolean
           );
   return entity;
 }
Ejemplo n.º 26
0
 /** @inheritdoc */
 @Override
 public UserActivity readEntity(Cursor cursor, int offset) {
   UserActivity entity =
       new UserActivity( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
           cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // type
           cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // summary
           cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // description
           cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0, // classified
           cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5), // levelOfJoy
           cursor.isNull(offset + 6) ? null : cursor.getLong(offset + 6), // startDate
           cursor.isNull(offset + 7) ? null : cursor.getLong(offset + 7) // endDate
           );
   return entity;
 }
Ejemplo n.º 27
0
 /** @inheritdoc */
 @Override
 protected FavoItem readEntity(Cursor cursor, int offset) {
   FavoItem entity =
       new FavoItem( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
           cursor.isNull(offset + 1)
               ? null
               : typeConverter.convertToEntityProperty(
                   ReaderItemType.class, cursor.getString(offset + 1)), // type
           cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // actualId
           cursor.isNull(offset + 3)
               ? null
               : addDateConverter.convertToEntityProperty(
                   Timestamp.class, cursor.getLong(offset + 3)), // addDate
           cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // url
           cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // title
           cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // excerpt
           cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // thumbC
           cursor.isNull(offset + 8) ? null : cursor.getLong(offset + 8), // otherId
           cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // author
           cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // authorEmail
           cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // authorUrl
           cursor.isNull(offset + 12)
               ? null
               : dateConverter.convertToEntityProperty(
                   Timestamp.class, cursor.getLong(offset + 12)), // date
           cursor.isNull(offset + 13) ? null : cursor.getLong(offset + 13), // votePositive
           cursor.isNull(offset + 14) ? null : cursor.getLong(offset + 14), // voteNegative
           cursor.isNull(offset + 15) ? null : cursor.getLong(offset + 15), // commentCount
           cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // threadId
           cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // content
           cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // textContent
           cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // pics
           cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // picFirst
           cursor.isNull(offset + 21) ? null : cursor.getLong(offset + 21), // picCount
           cursor.isNull(offset + 22) ? null : cursor.getShort(offset + 22) != 0, // hasGif
           cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // videoThumbnail
           cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // videoTitle
           cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // videoDescription
           cursor.isNull(offset + 26) ? null : cursor.getFloat(offset + 26), // videoDuration
           cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // videoLink
           cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // videoPlayer
           cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29) // videoSource
           );
   return entity;
 }
Ejemplo n.º 28
0
 public UserProfile(Cursor cursor) {
   username = cursor.getString(cursor.getColumnIndex("username"));
   try {
     dob =
         new SimpleDateFormat("yyyy-MM-dd").parse(cursor.getString(cursor.getColumnIndex("dob")));
   } catch (ParseException e) {
     Log.e("UserProfile", e.getMessage());
   }
   setGender(cursor.getString(cursor.getColumnIndex("gender")));
   height = cursor.getDouble(cursor.getColumnIndex("height"));
   weight = cursor.getDouble(cursor.getColumnIndex("weight"));
   activityLevel = cursor.getDouble(cursor.getColumnIndex("activityLevel"));
   calories = cursor.getDouble(cursor.getColumnIndex("calories"));
   goal = cursor.getDouble(cursor.getColumnIndex("goal"));
   mode = GoalMode.valueOf(cursor.getString(cursor.getColumnIndex("mode")));
   dirty = cursor.getShort(cursor.getColumnIndex("dirty")) > 0;
 }
Ejemplo n.º 29
0
 /** @inheritdoc */
 @Override
 protected void readEntity(Cursor cursor, FavoItem entity, int offset) {
   entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
   entity.setType(
       cursor.isNull(offset + 1)
           ? null
           : typeConverter.convertToEntityProperty(
               ReaderItemType.class, cursor.getString(offset + 1)));
   entity.setActualId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
   entity.setAddDate(
       cursor.isNull(offset + 3)
           ? null
           : addDateConverter.convertToEntityProperty(
               Timestamp.class, cursor.getLong(offset + 3)));
   entity.setUrl(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
   entity.setTitle(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
   entity.setExcerpt(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
   entity.setThumbC(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
   entity.setOtherId(cursor.isNull(offset + 8) ? null : cursor.getLong(offset + 8));
   entity.setAuthor(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
   entity.setAuthorEmail(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
   entity.setAuthorUrl(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
   entity.setDate(
       cursor.isNull(offset + 12)
           ? null
           : dateConverter.convertToEntityProperty(Timestamp.class, cursor.getLong(offset + 12)));
   entity.setVotePositive(cursor.isNull(offset + 13) ? null : cursor.getLong(offset + 13));
   entity.setVoteNegative(cursor.isNull(offset + 14) ? null : cursor.getLong(offset + 14));
   entity.setCommentCount(cursor.isNull(offset + 15) ? null : cursor.getLong(offset + 15));
   entity.setThreadId(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
   entity.setContent(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
   entity.setTextContent(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
   entity.setPics(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
   entity.setPicFirst(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
   entity.setPicCount(cursor.isNull(offset + 21) ? null : cursor.getLong(offset + 21));
   entity.setHasGif(cursor.isNull(offset + 22) ? null : cursor.getShort(offset + 22) != 0);
   entity.setVideoThumbnail(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
   entity.setVideoTitle(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
   entity.setVideoDescription(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
   entity.setVideoDuration(cursor.isNull(offset + 26) ? null : cursor.getFloat(offset + 26));
   entity.setVideoLink(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27));
   entity.setVideoPlayer(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28));
   entity.setVideoSource(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29));
 }
Ejemplo n.º 30
0
 /** @inheritdoc */
 @Override
 public Order readEntity(Cursor cursor, int offset) {
   Order entity =
       new Order( //
           cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
           cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // type
           cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // topic
           cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // startTime
           cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // endTime
           cursor.isNull(offset + 5) ? null : cursor.getDouble(offset + 5), // price
           cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0, // realtime
           cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // contactName
           cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // contactGender
           cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // contactPhone
           cursor.isNull(offset + 10) ? null : cursor.getLong(offset + 10), // expertId
           cursor.isNull(offset + 11) ? null : cursor.getLong(offset + 11) // userId
           );
   return entity;
 }