protected List<SyncDLObject> getSyncDLObjects(
      List<SyncDLObject> syncDLObjects,
      long companyId,
      long repositoryId,
      long parentFolderId,
      long lastAccessTime)
      throws PortalException {

    List<SyncDLObject> curSyncDLObjects =
        syncDLObjectFinder.filterFindByC_M_R_P(
            companyId, lastAccessTime, repositoryId, parentFolderId);

    if (!InlineSQLHelperUtil.isEnabled(repositoryId)) {
      curSyncDLObjects = checkSyncDLObjects(curSyncDLObjects);
    }

    syncDLObjects.addAll(curSyncDLObjects);

    for (SyncDLObject curSyncDLObject : curSyncDLObjects) {
      String type = curSyncDLObject.getType();

      if (!type.equals(SyncConstants.TYPE_FOLDER)) {
        continue;
      }

      getSyncDLObjects(
          syncDLObjects, companyId, repositoryId, curSyncDLObject.getTypePK(), lastAccessTime);
    }

    return syncDLObjects;
  }
  protected List<SyncDLObject> checkSyncDLObjects(List<SyncDLObject> syncDLObjects) {

    Iterator<SyncDLObject> iterator = syncDLObjects.iterator();

    while (iterator.hasNext()) {
      SyncDLObject syncDLObject = iterator.next();

      String type = syncDLObject.getType();

      try {
        if (type.equals(SyncConstants.TYPE_FILE)
            || type.equals(SyncConstants.TYPE_PRIVATE_WORKING_COPY)) {

          dlAppService.getFileEntry(syncDLObject.getTypePK());
        } else {
          dlAppService.getFolder(syncDLObject.getTypePK());
        }
      } catch (Exception e) {
        iterator.remove();
      }
    }

    return syncDLObjects;
  }