Esempio n. 1
0
 public void tagDataOrderedByName(Callback<TagData> callback) {
   query(
       callback,
       Query.select(TagData.PROPERTIES)
           .where(Criterion.and(TagData.DELETION_DATE.eq(0), TagData.NAME.isNotNull()))
           .orderBy(Order.asc(Functions.upper(TagData.NAME))));
 }
Esempio n. 2
0
  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    synchronized (this) {
      if (dataLoaded) return;
      dataLoaded = true;
    }

    String tag = getIntent().getStringExtra(EXTRA_TAG_NAME);
    long remoteId = getIntent().getLongExtra(EXTRA_TAG_REMOTE_ID, 0);

    if (tag == null && remoteId == 0) return;

    TodorooCursor<TagData> cursor =
        tagDataService.query(
            Query.select(TagData.PROPERTIES)
                .where(
                    Criterion.or(
                        TagData.NAME.eq(tag),
                        Criterion.and(TagData.REMOTE_ID.gt(0), TagData.REMOTE_ID.eq(remoteId)))));
    try {
      tagData = new TagData();
      if (cursor.getCount() == 0) {
        tagData.setValue(TagData.NAME, tag);
        tagData.setValue(TagData.REMOTE_ID, remoteId);
        tagDataService.save(tagData);
      } else {
        cursor.moveToFirst();
        tagData.readFromCursor(cursor);
      }
    } finally {
      cursor.close();
    }

    String fetchKey = LAST_FETCH_KEY + tagData.getId();
    long lastFetchDate = Preferences.getLong(fetchKey, 0);
    if (DateUtilities.now() > lastFetchDate + 300000L) {
      refreshData(false, false);
      Preferences.setLong(fetchKey, DateUtilities.now());
    }

    setUpUpdateList();
    setUpMemberPage();
  }
Esempio n. 3
0
 public TagData getTagByName(String name, Property<?>... properties) {
   return getFirst(Query.select(properties).where(TagData.NAME.eqCaseInsensitive(name)));
 }