@Override @Transactional(readOnly = true) public FetcherRequestDTO prepareFetcherRequest(Collection dbCollection) { FetcherRequestDTO dto = new FetcherRequestDTO(); UserConnection userconnection = userConnectionService.fetchByCombinedUserName(dbCollection.getOwner().getUserName()); dto.setAccessToken(userconnection.getAccessToken()); dto.setAccessTokenSecret(userconnection.getSecret()); dto.setCollectionName(dbCollection.getName()); dto.setCollectionCode(dbCollection.getCode()); if (dbCollection.getProvider() == CollectionType.Facebook) { dto.setToFollow(dbCollection.getFollow()); } else { dto.setToFollow( getFollowTwitterIDs(dbCollection.getFollow(), dbCollection.getOwner().getUserName())); } dto.setToTrack(dbCollection.getTrack()); dto.setGeoLocation(dbCollection.getGeo()); dto.setGeoR(dbCollection.getGeoR()); dto.setLanguageFilter(dbCollection.getLangFilters()); dto.setSaveMediaEnabled(dbCollection.isSaveMediaEnabled()); dto.setFetchInterval(dbCollection.getFetchInterval()); dto.setProvider(dbCollection.getProvider().toString()); dto.setFetchInterval(dbCollection.getFetchInterval()); dto.setFetchFrom(dbCollection.getFetchFrom()); dto.setLastExecutionTime(dbCollection.getLastExecutionTime()); // Added by koushik accessTokenStr = dto.getAccessToken(); accessTokenSecretStr = dto.getAccessTokenSecret(); return dto; }
private CollectionSummaryInfo adaptCollectionToCollectionSummaryInfo(Collection collection) { CollectionSummaryInfo summaryInfo = new CollectionSummaryInfo(); summaryInfo.setCode(collection.getCode()); summaryInfo.setName(collection.getName()); summaryInfo.setCurator(collection.getOwner().getUserName()); summaryInfo.setStartDate(collection.getStartDate()); summaryInfo.setEndDate(collection.getEndDate()); summaryInfo.setCollectionCreationDate(collection.getCreatedAt()); // TODO to fetch from collection log try { summaryInfo.setTotalCount( collectionLogService.countTotalDownloadedItemsForCollection(collection.getId())); } catch (Exception e) { logger.warn("Error in fetch count from collection log.", e); summaryInfo.setTotalCount(collection.getCount()); } summaryInfo.setStatus(collection.getStatus().getStatus()); // TODO summaryInfo.setCreatedAt(collection.getCreatedAt()); summaryInfo.setLanguage(collection.getLangFilters()); summaryInfo.setKeywords(collection.getTrack()); summaryInfo.setGeo(collection.getGeo()); summaryInfo.setLabelCount(taggerService.getLabelCount(collection.getId())); summaryInfo.setPubliclyListed(collection.isPubliclyListed()); summaryInfo.setProvider(collection.getProvider().toString()); return summaryInfo; }