Search in sources :

Example 1 with AppProperty

use of com.pratilipi.data.type.AppProperty in project pratilipi by Pratilipi.

the class AuditLogProcessApi method get.

@Get
public GenericResponse get(GenericRequest request) throws UnexpectedServerException {
    DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
    // Fetching AppProperty
    String appPropertyId = "Api.AuditLogProcess";
    AppProperty appProperty = dataAccessor.getAppProperty(appPropertyId);
    if (appProperty == null)
        appProperty = dataAccessor.newAppProperty(appPropertyId);
    // Fetching list of audit logs
    DataListCursorTuple<AuditLog> auditLogDataListCursorTuple = dataAccessor.getAuditLogList(// Mon Aug 01 00:00:00 IST 2016
    new Date(1469989800000L), (String) appProperty.getValue(), 5000);
    // Make sets of PrimaryContent ids
    Map<Long, Set<Long>> pratilipiUpdateIds = new HashMap<>();
    Set<String> userPratilipiUpdateIds = new HashSet<>();
    Set<String> userAuthorUpdateIds = new HashSet<>();
    Set<Long> commentUpdateIds = new HashSet<>();
    Set<String> voteUpdateIds = new HashSet<>();
    Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new GsonLongDateAdapter()).create();
    for (AuditLog auditLog : auditLogDataListCursorTuple.getDataList()) {
        // TODO: Delete following condition as soon as 'legacy' module is removed
        if (auditLog.getUserId() == null || auditLog.getPrimaryContentId() == null) {
            continue;
        }
        if (auditLog.getUserId().equals(SystemProperty.SYSTEM_USER_ID)) {
            continue;
        }
        if (auditLog.getAccessType() == AccessType.PRATILIPI_UPDATE) {
            Pratilipi oldPratilipi = gson.fromJson(auditLog.getEventDataOld(), PratilipiEntity.class);
            Pratilipi newPratilipi = gson.fromJson(auditLog.getEventDataNew(), PratilipiEntity.class);
            if (oldPratilipi.getState() == PratilipiState.DRAFTED && newPratilipi.getState() == PratilipiState.PUBLISHED) {
                Set<Long> userIdSet = pratilipiUpdateIds.get(auditLog.getPrimaryContentIdLong());
                if (userIdSet == null) {
                    userIdSet = new HashSet<>();
                    pratilipiUpdateIds.put(auditLog.getPrimaryContentIdLong(), userIdSet);
                }
                userIdSet.add(auditLog.getUserId());
            }
        } else if (auditLog.getAccessType() == AccessType.USER_PRATILIPI_REVIEW) {
            UserPratilipi oldUserPratilipi = gson.fromJson(auditLog.getEventDataOld(), UserPratilipiEntity.class);
            UserPratilipi newUserPratilipi = gson.fromJson(auditLog.getEventDataNew(), UserPratilipiEntity.class);
            if (oldUserPratilipi.getRating() == null && oldUserPratilipi.getReview() == null && (newUserPratilipi.getRating() != null || newUserPratilipi.getReview() != null))
                userPratilipiUpdateIds.add(auditLog.getPrimaryContentId());
        } else if (auditLog.getAccessType() == AccessType.USER_AUTHOR_FOLLOWING) {
            UserAuthor oldUserAuthor = gson.fromJson(auditLog.getEventDataOld(), UserAuthorEntity.class);
            UserAuthor newUserAuthor = gson.fromJson(auditLog.getEventDataNew(), UserAuthorEntity.class);
            if (oldUserAuthor.getFollowState() == null && newUserAuthor.getFollowState() == UserFollowState.FOLLOWING)
                userAuthorUpdateIds.add(auditLog.getPrimaryContentId());
        } else if (auditLog.getAccessType() == AccessType.COMMENT_ADD) {
            commentUpdateIds.add(auditLog.getPrimaryContentIdLong());
        } else if (auditLog.getAccessType() == AccessType.VOTE) {
            Vote newVote = gson.fromJson(auditLog.getEventDataNew(), VoteEntity.class);
            if (newVote.getType() == VoteType.LIKE)
                voteUpdateIds.add(auditLog.getPrimaryContentId());
        }
    }
    // Batch get Vote entities
    logger.log(Level.INFO, "Fetching " + voteUpdateIds.size() + " Vote Entities.");
    Map<String, Vote> votes = dataAccessor.getVotes(voteUpdateIds);
    // Batch get Comment and entities
    Set<Long> commentIds = new HashSet<>(commentUpdateIds);
    for (Vote vote : votes.values()) if (vote.getParentType() == VoteParentType.COMMENT)
        commentIds.add(vote.getParentIdLong());
    logger.log(Level.INFO, "Fetching " + commentIds.size() + " Comment Entities.");
    Map<Long, Comment> comments = dataAccessor.getComments(commentIds);
    // Batch get UserPratilipi entities
    Set<String> userPratilipiIds = new HashSet<>(userPratilipiUpdateIds);
    for (Comment comment : comments.values()) if (comment.getParentType() == CommentParentType.REVIEW)
        userPratilipiIds.add(comment.getParentId());
    for (Vote vote : votes.values()) if (vote.getParentType() == VoteParentType.REVIEW)
        userPratilipiIds.add(vote.getParentId());
    logger.log(Level.INFO, "Fetching " + userPratilipiIds.size() + " UserPratilipi Entities.");
    Map<String, UserPratilipi> userPratilipis = dataAccessor.getUserPratilipis(userPratilipiIds);
    // Batch get Pratilipi entities
    Set<Long> pratilipiIds = new HashSet<>(pratilipiUpdateIds.keySet());
    for (UserPratilipi userPratilipi : userPratilipis.values()) pratilipiIds.add(userPratilipi.getPratilipiId());
    logger.log(Level.INFO, "Fetching " + pratilipiIds.size() + " Pratilipi Entities.");
    Map<Long, Pratilipi> pratilipis = dataAccessor.getPratilipis(pratilipiIds);
    // Batch get UserAuthor entities
    logger.log(Level.INFO, "Fetching " + userAuthorUpdateIds.size() + " UserAuthor Entities.");
    Map<String, UserAuthor> userAuthors = dataAccessor.getUserAuthors(userAuthorUpdateIds);
    // Batch get Author entities
    Set<Long> authorIds = new HashSet<>();
    for (Pratilipi pratilipi : pratilipis.values()) authorIds.add(pratilipi.getAuthorId());
    for (UserAuthor userAuthor : userAuthors.values()) authorIds.add(userAuthor.getAuthorId());
    logger.log(Level.INFO, "Fetching " + authorIds.size() + " Author Entities.");
    Map<Long, Author> authors = dataAccessor.getAuthors(authorIds);
    List<Email> totalEmailList = new ArrayList<>();
    // auditLog.getAccessType() == AccessType.PRATILIPI_UPDATE
    for (Long pratilipiId : pratilipiUpdateIds.keySet()) {
        Pratilipi pratilipi = pratilipis.get(pratilipiId);
        Set<Long> followerUserIdList = new HashSet<>(dataAccessor.getUserAuthorFollowList(null, pratilipi.getAuthorId(), null, null, null).getDataList());
        Email email = _createPratilipiPublishedEmail(pratilipi, authors.get(pratilipi.getAuthorId()));
        if (email != null)
            totalEmailList.add(email);
        totalEmailList.addAll(_createPratilipiPublishedEmails(pratilipi, followerUserIdList));
        // Send notification to all AEEs as well
        // only if the content is self-published
        List<Long> aeeUserIdList = _getAeeUserIdList(pratilipi.getLanguage());
        Set<Long> userIdSet = pratilipiUpdateIds.get(pratilipiId);
        for (Long userId : userIdSet) {
            if (!aeeUserIdList.contains(userId)) {
                followerUserIdList.addAll(aeeUserIdList);
                break;
            }
        }
        _createPratilipiPublishedNotification(pratilipi, authors.get(pratilipi.getAuthorId()));
        _createPratilipiPublishedNotifications(pratilipi, followerUserIdList);
    }
    // auditLog.getAccessType() == AccessType.USER_PRATILIPI_REVIEW
    for (String userPratilipiId : userPratilipiUpdateIds) {
        UserPratilipi userPratilipi = userPratilipis.get(userPratilipiId);
        if (userPratilipi.getReviewState() != UserReviewState.PUBLISHED)
            continue;
        Long pratilipiId = userPratilipi.getPratilipiId();
        Email email = _createUserPratilipiReviewEmail(userPratilipi, authors.get(pratilipis.get(pratilipiId).getAuthorId()));
        if (email != null)
            totalEmailList.add(email);
    }
    // auditLog.getAccessType() == AccessType.USER_AUTHOR_FOLLOWING
    for (String userAuthorId : userAuthorUpdateIds) {
        UserAuthor userAuthor = userAuthors.get(userAuthorId);
        _createUserAuthorFollowingNotifications(userAuthor, authors.get(userAuthor.getAuthorId()));
        Email email = _createUserAuthorFollowingEmail(userAuthor, authors.get(userAuthor.getAuthorId()));
        if (email != null)
            totalEmailList.add(email);
    }
    // auditLog.getAccessType() == AccessType.COMMENT_ADD
    for (Long commentId : commentUpdateIds) {
        Comment comment = comments.get(commentId);
        if (comment.getParentType() != CommentParentType.REVIEW)
            continue;
        UserPratilipi userPratilipi = userPratilipis.get(comment.getParentId());
        Email email = _createCommentAddedReviewerEmail(userPratilipi, comment);
        if (email != null)
            totalEmailList.add(email);
    /*	// Business call - Not to send CommentAddedAuthorEmail.
			Pratilipi pratilipi = pratilipis.get( userPratilipi.getPratilipiId() );
			Author author = authors.get( pratilipi.getAuthorId() );
			email = _createCommentAddedAuthorEmail( author, comment );
			if( email != null )
				totalEmailList.add( email );
			*/
    }
    // auditLog.getAccessType() == AccessType.VOTE
    for (String voteId : voteUpdateIds) {
        Vote vote = votes.get(voteId);
        if (vote.getParentType() == VoteParentType.REVIEW) {
            UserPratilipi userPratilipi = userPratilipis.get(vote.getParentId());
            // To the reviewer
            Email email = _createVoteOnReviewReviewerEmail(userPratilipi, vote);
            if (email != null)
                totalEmailList.add(email);
        } else if (vote.getParentType() == VoteParentType.COMMENT) {
            // To the commentor
            Email email = _createVoteOnCommentCommentorEmail(comments.get(vote.getParentIdLong()), vote);
            if (email != null)
                totalEmailList.add(email);
        }
    }
    _updateEmailTable(totalEmailList);
    // Updating AppProperty.
    if (auditLogDataListCursorTuple.getDataList().size() > 0) {
        appProperty.setValue(auditLogDataListCursorTuple.getCursor());
        appProperty = dataAccessor.createOrUpdateAppProperty(appProperty);
    }
    return new GenericResponse();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) Email(com.pratilipi.data.type.Email) HashMap(java.util.HashMap) DataAccessor(com.pratilipi.data.DataAccessor) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) AuditLog(com.pratilipi.data.type.AuditLog) UserPratilipi(com.pratilipi.data.type.UserPratilipi) UserAuthor(com.pratilipi.data.type.UserAuthor) HashSet(java.util.HashSet) Comment(com.pratilipi.data.type.Comment) Vote(com.pratilipi.data.type.Vote) GsonBuilder(com.google.gson.GsonBuilder) GenericResponse(com.pratilipi.api.shared.GenericResponse) Date(java.util.Date) UserAuthor(com.pratilipi.data.type.UserAuthor) Author(com.pratilipi.data.type.Author) UserPratilipi(com.pratilipi.data.type.UserPratilipi) Pratilipi(com.pratilipi.data.type.Pratilipi) AppProperty(com.pratilipi.data.type.AppProperty) GsonLongDateAdapter(com.pratilipi.common.util.GsonLongDateAdapter) UserPratilipiEntity(com.pratilipi.data.type.gae.UserPratilipiEntity) Get(com.pratilipi.api.annotation.Get)

Example 2 with AppProperty

use of com.pratilipi.data.type.AppProperty in project pratilipi by Pratilipi.

the class PratilipiBackupApi method get.

@Get
public GenericResponse get(GetRequest request) throws UnexpectedServerException {
    DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
    // Fetching Cursor from AppProperty
    AppProperty appProperty = dataAccessor.getAppProperty(AppProperty.API_PRATILIPI_BACKUP);
    if (appProperty == null)
        appProperty = dataAccessor.newAppProperty(AppProperty.API_PRATILIPI_BACKUP);
    Cursor cursor = appProperty.getValue() == null ? null : Cursor.fromWebSafeString((String) appProperty.getValue());
    QueryResultIterator<Key<PratilipiEntity>> itr = ObjectifyService.ofy().load().type(PratilipiEntity.class).filter("LAST_UPDATED >=", // Thu Dec 01 00:00:00 IST 2016
    new Date(1480530600000L)).order("LAST_UPDATED").startAt(cursor).keys().iterator();
    int batchSize = 1000;
    List<Task> taskList = new ArrayList<>(batchSize);
    while (itr.hasNext()) {
        TaskQueueFactory.getPratilipiTaskQueue().add(TaskQueueFactory.newTask().setUrl("/pratilipi/backup").addParam("pratilipiId", itr.next().getId() + ""));
        if (taskList.size() == batchSize || !itr.hasNext()) {
            TaskQueueFactory.getPratilipiTaskQueue().addAll(taskList);
            taskList.clear();
        }
    }
    // Updating Cursor to AppProperty
    appProperty.setValue(itr.getCursor().toWebSafeString());
    dataAccessor.createOrUpdateAppProperty(appProperty);
    /*		DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
		BlobAccessor blobAccessor = DataAccessorFactory.getBlobAccessorBackup();
		
		Date backupDate = new Date();

		DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
		DateFormat csvDateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm" );
		DateFormat dateTimeFormat = new SimpleDateFormat( "yyyy-MM-dd-HH:mm-z" );
		dateFormat.setTimeZone( TimeZone.getTimeZone( "Asia/Kolkata" ) );
		csvDateFormat.setTimeZone( TimeZone.getTimeZone( "Asia/Kolkata" ) );
		dateTimeFormat.setTimeZone( TimeZone.getTimeZone( "Asia/Kolkata" ) );

		StringBuilder backup = new StringBuilder();
		StringBuilder csv = new StringBuilder( CSV_HEADER + LINE_SEPARATOR );

		int count = 0;
		String cursor = null;
		PratilipiFilter pratilipiFilter = new PratilipiFilter();
		Gson gson = new GsonBuilder().registerTypeAdapter( Date.class, new GsonIstDateAdapter() ).create();
		
		while( true ) {
			DataListCursorTuple<Pratilipi> pratilipiListCursorTuple = dataAccessor.getPratilipiList( pratilipiFilter, cursor, 1000 );
			List<Pratilipi> pratilipiList = pratilipiListCursorTuple.getDataList();

			for( Pratilipi pratilipi : pratilipiList ) {
                backup.append( gson.toJson( pratilipi ) + LINE_SEPARATOR );

				if( request.generateCsv != null && request.generateCsv )
					csv.append( "'" + pratilipi.getId() )
							.append( CSV_SEPARATOR ).append( pratilipi.getAuthorId() == null ? "" : "'" + pratilipi.getAuthorId() )
							.append( CSV_SEPARATOR ).append( pratilipi.getTitle()	 == null ? "" : "\"" + pratilipi.getTitle().replace( "\"", "\"\"" ) + "\"" )
							.append( CSV_SEPARATOR ).append( pratilipi.getTitleEn()	 == null ? "" : "\"" + pratilipi.getTitleEn().replace( "\"", "\"\"" ) + "\"" )
							.append( CSV_SEPARATOR ).append( pratilipi.getLanguage() )
							.append( CSV_SEPARATOR ).append( pratilipi.getSummary() != null && pratilipi.getSummary().trim().length() != 0 )
							.append( CSV_SEPARATOR ).append( pratilipi.getType() )
							.append( CSV_SEPARATOR ).append( pratilipi.getContentType() )
							.append( CSV_SEPARATOR ).append( pratilipi.getState() )
							.append( CSV_SEPARATOR ).append( pratilipi.getCoverImage() != null )
							.append( CSV_SEPARATOR ).append( csvDateFormat.format( pratilipi.getListingDate() ) )
							.append( CSV_SEPARATOR ).append( pratilipi.getReviewCount() )
							.append( CSV_SEPARATOR ).append( pratilipi.getRatingCount() )
							.append( CSV_SEPARATOR ).append( pratilipi.getTotalRating() )
							.append( CSV_SEPARATOR ).append( pratilipi.getReadCount() )
							.append( LINE_SEPARATOR );
				
			}
			
			count = count + pratilipiList.size();

			if( pratilipiList.size() < 1000 )
				break;
			else
				cursor = pratilipiListCursorTuple.getCursor();
		}
		

		String fileName = "datastore.pratilipi/"
				+ dateFormat.format( backupDate ) + "/"
				+ "pratilipi-" + dateTimeFormat.format( backupDate );

		BlobEntry pratilipiBackupEntry = blobAccessor.newBlob(
				fileName,
				backup.toString().getBytes( Charset.forName( "UTF-8" ) ),
				"text/plain" );
		
		blobAccessor.createOrUpdateBlob( pratilipiBackupEntry );
		
		
		if( request.generateCsv != null && request.generateCsv ) {
			BlobEntry authorCsvEntry = blobAccessor.newBlob(
					"datastore/pratilipi.csv",
					csv.toString().getBytes( Charset.forName( "UTF-8" ) ),
					"text/csv" );
			blobAccessor.createOrUpdateBlob( authorCsvEntry );
		}
		

		logger.log( Level.INFO, "Backed up " + count + " Pratilipi Entities." );
*/
    return new GenericResponse();
}
Also used : Task(com.pratilipi.taskqueue.Task) PratilipiEntity(com.pratilipi.data.type.gae.PratilipiEntity) GenericResponse(com.pratilipi.api.shared.GenericResponse) DataAccessor(com.pratilipi.data.DataAccessor) ArrayList(java.util.ArrayList) Cursor(com.google.appengine.api.datastore.Cursor) Date(java.util.Date) AppProperty(com.pratilipi.data.type.AppProperty) Key(com.googlecode.objectify.Key) Get(com.pratilipi.api.annotation.Get)

Example 3 with AppProperty

use of com.pratilipi.data.type.AppProperty in project pratilipi by Pratilipi.

the class PratilipiProcessApi method getPratilipiProcess.

@Get
public GenericResponse getPratilipiProcess(GenericRequest request) throws UnexpectedServerException {
    DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
    // START: Creating ValidateData Tasks
    // Fetching AppProperty
    String appPropertyId = "Api.PratilipiProcess.ValidateData";
    AppProperty appProperty = dataAccessor.getAppProperty(appPropertyId);
    if (appProperty == null) {
        appProperty = dataAccessor.newAppProperty(appPropertyId);
        appProperty.setValue(new Date(0));
    }
    // Fetching list of Pratilipi ids.
    PratilipiFilter pratilipiFilter = new PratilipiFilter();
    pratilipiFilter.setMinLastUpdate((Date) appProperty.getValue(), false);
    List<Long> pratilipiIdList = dataAccessor.getPratilipiIdList(pratilipiFilter, null, 0, 10000).getDataList();
    // Creating one task per Pratilipi id.
    List<Task> taskList = new ArrayList<>(pratilipiIdList.size());
    for (Long pratilipiId : pratilipiIdList) {
        Task task = TaskQueueFactory.newTask().setUrl("/pratilipi/process").addParam("pratilipiId", pratilipiId.toString()).addParam("validateData", "true");
        taskList.add(task);
    }
    TaskQueueFactory.getPratilipiOfflineTaskQueue().addAll(taskList);
    logger.log(Level.INFO, "Added " + taskList.size() + " ValidateData tasks.");
    // Updating AppProperty.
    if (pratilipiIdList.size() > 0) {
        Pratilipi pratilipi = dataAccessor.getPratilipi(pratilipiIdList.get(pratilipiIdList.size() - 1));
        Date lastUpdatedDate = pratilipi.getLastUpdated();
        logger.log(Level.INFO, "Processing all contents updated from " + (Date) appProperty.getValue() + " to " + lastUpdatedDate + ".");
        logger.log(Level.INFO, "Last Updated PratilipiID : " + pratilipi.getId());
        appProperty.setValue(lastUpdatedDate);
        appProperty = dataAccessor.createOrUpdateAppProperty(appProperty);
    }
    return new GenericResponse();
}
Also used : PratilipiFilter(com.pratilipi.common.util.PratilipiFilter) Task(com.pratilipi.taskqueue.Task) GenericResponse(com.pratilipi.api.shared.GenericResponse) DataAccessor(com.pratilipi.data.DataAccessor) ArrayList(java.util.ArrayList) Pratilipi(com.pratilipi.data.type.Pratilipi) AppProperty(com.pratilipi.data.type.AppProperty) Date(java.util.Date) Get(com.pratilipi.api.annotation.Get)

Example 4 with AppProperty

use of com.pratilipi.data.type.AppProperty in project pratilipi by Pratilipi.

the class AuthorProcessApi method get.

@Get
public GenericResponse get(GenericRequest request) {
    DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
    // Fetching AppProperty
    String appPropertyId = "Api.AuthorProcess.ValidateData";
    AppProperty appProperty = dataAccessor.getAppProperty(appPropertyId);
    if (appProperty == null) {
        appProperty = dataAccessor.newAppProperty(appPropertyId);
        appProperty.setValue(new Date(0));
    }
    // Fetching list of author ids.
    AuthorFilter authorFilter = new AuthorFilter();
    authorFilter.setMinLastUpdate((Date) appProperty.getValue(), false);
    List<Long> authorIdList = dataAccessor.getAuthorIdList(authorFilter, null, 10000).getDataList();
    // Creating one task per author id.
    List<Task> taskList = new ArrayList<>(authorIdList.size());
    for (Long authorId : authorIdList) {
        Task task = TaskQueueFactory.newTask().setUrl("/author/process").addParam("authorId", authorId.toString()).addParam("validateData", "true");
        taskList.add(task);
    }
    TaskQueueFactory.getAuthorOfflineTaskQueue().addAll(taskList);
    logger.log(Level.INFO, "Added " + taskList.size() + " tasks.");
    // Updating AppProperty.
    if (authorIdList.size() > 0) {
        appProperty.setValue(dataAccessor.getAuthor(authorIdList.get(authorIdList.size() - 1)).getLastUpdated());
        appProperty = dataAccessor.createOrUpdateAppProperty(appProperty);
    }
    return new GenericResponse();
}
Also used : Task(com.pratilipi.taskqueue.Task) GenericResponse(com.pratilipi.api.shared.GenericResponse) DataAccessor(com.pratilipi.data.DataAccessor) AuthorFilter(com.pratilipi.common.util.AuthorFilter) ArrayList(java.util.ArrayList) AppProperty(com.pratilipi.data.type.AppProperty) Date(java.util.Date) Get(com.pratilipi.api.annotation.Get)

Example 5 with AppProperty

use of com.pratilipi.data.type.AppProperty in project pratilipi by Pratilipi.

the class UserProcessApi method get.

@Get
public GenericResponse get(GenericRequest request) {
    DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
    // Fetching AppProperty
    AppProperty appProperty = dataAccessor.getAppProperty(appPropertyId);
    if (appProperty == null) {
        appProperty = dataAccessor.newAppProperty(appPropertyId);
        appProperty.setValue(new Date(0));
    }
    List<Key<UserEntity>> keyList = ObjectifyService.ofy().load().type(UserEntity.class).filter("SIGN_UP_DATE >", appProperty.getValue()).order("SIGN_UP_DATE").limit(10000).keys().list();
    // Creating task for each user.
    List<Task> taskList = new ArrayList<>(keyList.size());
    for (Key<UserEntity> key : keyList) {
        Task task = TaskQueueFactory.newTask().setUrl("/user/process").addParam("userId", key.getId() + "").addParam("validateData", "true");
        taskList.add(task);
    }
    TaskQueueFactory.getUserOfflineTaskQueue().addAll(taskList);
    logger.log(Level.INFO, "Added " + taskList.size() + " tasks.");
    // Updating AppProperty.
    if (taskList.size() > 0) {
        appProperty.setValue(dataAccessor.getUser(keyList.get(keyList.size() - 1).getId()).getSignUpDate());
        dataAccessor.createOrUpdateAppProperty(appProperty);
    }
    return new GenericResponse();
}
Also used : Task(com.pratilipi.taskqueue.Task) GenericResponse(com.pratilipi.api.shared.GenericResponse) DataAccessor(com.pratilipi.data.DataAccessor) ArrayList(java.util.ArrayList) AppProperty(com.pratilipi.data.type.AppProperty) Date(java.util.Date) UserEntity(com.pratilipi.data.type.gae.UserEntity) Key(com.googlecode.objectify.Key) Get(com.pratilipi.api.annotation.Get)

Aggregations

Get (com.pratilipi.api.annotation.Get)5 GenericResponse (com.pratilipi.api.shared.GenericResponse)5 DataAccessor (com.pratilipi.data.DataAccessor)5 AppProperty (com.pratilipi.data.type.AppProperty)5 ArrayList (java.util.ArrayList)5 Date (java.util.Date)5 Task (com.pratilipi.taskqueue.Task)4 Key (com.googlecode.objectify.Key)2 Pratilipi (com.pratilipi.data.type.Pratilipi)2 Cursor (com.google.appengine.api.datastore.Cursor)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 AuthorFilter (com.pratilipi.common.util.AuthorFilter)1 GsonLongDateAdapter (com.pratilipi.common.util.GsonLongDateAdapter)1 PratilipiFilter (com.pratilipi.common.util.PratilipiFilter)1 AuditLog (com.pratilipi.data.type.AuditLog)1 Author (com.pratilipi.data.type.Author)1 Comment (com.pratilipi.data.type.Comment)1 Email (com.pratilipi.data.type.Email)1 UserAuthor (com.pratilipi.data.type.UserAuthor)1