Package com.tmm.enterprise.microblog.util

Source Code of com.tmm.enterprise.microblog.util.CreateNotification

package com.tmm.enterprise.microblog.util;

import org.springframework.transaction.annotation.Transactional;

import com.tmm.enterprise.microblog.domain.Notification;
import com.tmm.enterprise.microblog.domain.Person;
import com.tmm.enterprise.microblog.domain.ToDo;
import com.tmm.enterprise.microblog.security.Account;

public class CreateNotification extends BatchProcess {

  @Transactional
  public void execute() throws Exception {
    setCredentials();
    Person belongsTo = getContactableService().loadPerson(50);

    ToDo todo = new ToDo();
    todo.setAssignedTo(belongsTo);
    todo.setDetails("its a todo item!");
    todo.setTitle("new todo..");
    getActivityService().getEntityManager().persist(todo);
    Account acc = getAccount();

    // TODO persist activity here..

    Notification notification = new Notification();
    notification.setActivity(todo);

    getNotificationService().createNotification(notification);
  }

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception {
    new CreateNotification().execute();
  }
}
TOP

Related Classes of com.tmm.enterprise.microblog.util.CreateNotification

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.