Пример #1
0
 @Override
 public void setToken(String setting) {
   super.setToken(setting);
   if (TextUtils.isEmpty(setting)) {
     RemoteModelDao.setOutstandingEntryFlags(RemoteModelDao.OUTSTANDING_FLAG_UNINITIALIZED);
   } else {
     RemoteModelDao.setOutstandingEntryFlags(
         RemoteModelDao.OUTSTANDING_ENTRY_FLAG_ENQUEUE_MESSAGES
             | RemoteModelDao.OUTSTANDING_ENTRY_FLAG_RECORD_OUTSTANDING);
   }
 }
Пример #2
0
 @Override
 public void onModelUpdated(MTYPE model, boolean outstandingEntries) {
   if (outstandingEntries
       && RemoteModelDao.getOutstandingEntryFlag(
           RemoteModelDao.OUTSTANDING_ENTRY_FLAG_ENQUEUE_MESSAGES)) {
     ChangesHappened<?, ?> ch =
         ChangesHappened.instantiateChangesHappened(model.getId(), modelType);
     enqueueMessage(model, ch);
   }
 }
Пример #3
0
 @Override
 protected boolean shouldRecordOutstanding(TagMetadata item) {
   ContentValues cv = item.getSetValues();
   return super.shouldRecordOutstanding(item)
       && cv != null
       && ((cv.containsKey(TagMetadata.KEY.name)
               && TagMemberMetadata.KEY.equals(item.getValue(TagMetadata.KEY)))
           || (cv.containsKey(TagMetadata.DELETION_DATE.name)
               && item.getValue(TagMetadata.DELETION_DATE) > 0))
       && RemoteModelDao.getOutstandingEntryFlag(
           RemoteModelDao.OUTSTANDING_ENTRY_FLAG_RECORD_OUTSTANDING);
 }
Пример #4
0
 public synchronized void enqueueMessage(
     ClientToServerMessage<?> message, SyncMessageCallback callback) {
   if (!RemoteModelDao.getOutstandingEntryFlag(
       RemoteModelDao.OUTSTANDING_ENTRY_FLAG_ENQUEUE_MESSAGES)) {
     return;
   }
   if (!pendingMessages.contains(message)) {
     pendingMessages.add(message);
     if (callback != null) {
       pendingCallbacks.put(message, callback);
     }
     synchronized (monitor) {
       monitor.notifyAll();
     }
   }
 }