Example #1
0
 /**
  * Get the local ID corresponding to remote tagId
  *
  * @throws ServiceException
  */
 public int localTagId(int id) throws ServiceException {
   if (!isMappingRequired(id)) {
     return id;
   }
   try {
     if (localIdFromRemote.containsKey(id)) {
       return localIdFromRemote.get(id);
     }
     DataSourceMapping mapping = new DataSourceMapping(tagDs, id + "");
     OfflineLog.offline.debug("got localId %d from remote %d", mapping.getItemId(), id);
     localIdFromRemote.put(id, mapping.getItemId());
     return mapping.getItemId();
   } catch (ServiceException se) {
     if (MailServiceException.NO_SUCH_ITEM.equals(se.getCode())) {
       return -1;
     }
     throw se;
   }
 }
Example #2
0
 /**
  * Get the remoteId corresponding to local tagId
  *
  * @throws ServiceException
  */
 public int remoteTagId(int id) throws ServiceException {
   if (mappingRequired) {
     if (remoteIdFromLocal.containsKey(id)) {
       return remoteIdFromLocal.get(id);
     }
     try {
       DataSourceMapping mapping = new DataSourceMapping(tagDs, id);
       int remoteId = Integer.valueOf(mapping.getRemoteId());
       OfflineLog.offline.debug("got remoteId %d from localId %d", remoteId, id);
       remoteIdFromLocal.put(id, remoteId);
       return remoteId;
     } catch (ServiceException se) {
       if (MailServiceException.NO_SUCH_ITEM.equals(se.getCode())) {
         return -1;
       }
       throw se;
     }
   } else {
     return id;
   }
 }