Package com.tmm.enterprise.microblog.security

Examples of com.tmm.enterprise.microblog.security.Account


    return statusDao.loadAllStatus(limit);
  }

  @Transactional
  public void createStatus(String newStatus, String userName) {
    Account acc = accountService.loadAccountByUserName(userName);
    Person currentUser = acc.getUserProfile();
    if (currentUser != null) {
      Status s = new Status(currentUser, newStatus);
      currentUser.addStatus(s);
      statusDao.persist(s);
    }
View Full Code Here


    return getEntityManager().find(WorkTask.class, id);
  }

  @Transactional
  public void createWorkTask(String title, String description, String currentUserName, long assignedToId, String priority) {
    Account acc = accountService.loadAccountByUserName(currentUserName);
    Person currentUser = acc.getUserProfile();
    if (currentUser != null) {
      Contactable contact = contactService.loadContactable(assignedToId);
      WorkTask wt = new WorkTask();
      wt.setTitle(title);
      wt.setDetails(description);
View Full Code Here

      Contactable ass = contactService.loadContactable(assignedToId);
      wt.setAssignedTo(ass);
    }

    if (body != null && !"".equals(body.trim())) {
      Account acc = accountService.loadAccountByUserName(userName);
      Person currentUser = acc.getUserProfile();
      TicketUpdate update = new TicketUpdate();
      update.setDetails(body);
      update.setTicket(wt);
      update.setRaisedBy(currentUser);
      update.setAssignedTo(wt.getRaisedBy());
View Full Code Here

   * @throws Exception
   */
  @RequestMapping("/settings")
  public ModelAndView loadAdminPage(HttpServletRequest request, HttpServletResponse response) throws Exception {
    String userName = request.getRemoteUser();
    Account user = accountService.loadAccountByUserName(userName);
    Map<String, Object> model = jsonService.buildUserProfile(user);
    List<Contactable> contacts = contactService.loadAllContactables();
    jsonService.addContactsToModel(contacts, model);
    return new ModelAndView("adminPage", model);
  }
View Full Code Here

      logger.debug("Error - No Username entered when navigating to user home");
      return ControllerHelper.buildErrorMAV(ERROR_MESSAGE);
    }

    // check if this is the current user's page being browsed
    Account viewedUser = getAccountService().loadAccountByUserName(userName);
    if (request.getRemoteUser().equals(userName)) {
      Map<String, Object> model = jsonService.buildUserProfile(viewedUser);
      List<Contactable> contacts = contactService.loadAllContactables();
      jsonService.addContactsToModel(contacts, model);
      jsonService.addConnectionsToModel(viewedUser, model);
View Full Code Here

  public Account getAccount() {
    return getAccountService().loadAccountByUserName(BATCH_USER_NAME);
  }

  public void setCredentials() {
    Account account = getAccountService().loadAccountByUserName(BATCH_USER_NAME);

    GrantedAuthority[] auths = new GrantedAuthority[1];
    auths[0] = new GrantedAuthorityImpl("ROLE_USER");

    ApplicationUser user = new ApplicationUser(new Long(account.getId()), account.getUserName(), account.getPassword(), true, true, true, true,
        auths);

    Authentication auth = new TestingAuthenticationToken(user, "ignored", auths);

    auth.setAuthenticated(true);
View Full Code Here

    this.accountService = accountService;
  }

  @Before
  public void createAccount() {
    Account account = accountService.createNewBatchUser("test", "", "");
    GrantedAuthority[] auths = new GrantedAuthority[1];
    auths[0] = new GrantedAuthorityImpl("ROLE_USER");
    ApplicationUser user = new ApplicationUser(new Long(account.getId()),
        account.getUserName(), account.getPassword(), true, true, true,
        true, auths);
    Authentication auth = new TestingAuthenticationToken(user, "ignored",
        auths);
    auth.setAuthenticated(true);
    SecurityContextHolder.getContext().setAuthentication(auth);
View Full Code Here

    emailService.setEntityManager(entitManager);
  }

  @Test
  public void testSendEmail() {
    Account acc = new Account();
    acc.setId(1l);
    acc.setUserName("rob");
    Role r = new Role();
    r.setRole(UserRole.MEMBER.toString());
    acc.addRole(r);

    Person p = new Person();
    p.setRole(UserRole.MEMBER);
    p.setLinkedAccount(acc);
    acc.setUserProfile(p);

    // mock out calls to other service classes
    when(accountService.loadAccountByUserName("rob")).thenReturn(acc);
    when(contactService.loadPerson(1l)).thenReturn(p);
View Full Code Here

    boolean isAnon = UserHelper.isAnonymousUser(request);
    if (isAnon) {
      return new ModelAndView("anonhomepage");
    } else {
      String userName = request.getRemoteUser();
      Account user = getAccountService().loadAccountByUserName(userName);
      List<Contactable> contacts = contactService.loadAllContactables();
      Map<String, Object> model = jsonService.buildUserProfile(user);
      jsonService.addContactsToModel(contacts, model);
      jsonService.addConnectionsToModel(user, model);
      return new ModelAndView("userhomepage", model);
View Full Code Here

  }

  @PrePersist
  public void onCreate() {
    Date now = new Date();
    Account user = null;

    user = ApplicationService.getInstance().getModifyingAccount();

    if (creationAccount == null) {
      creationAccount = user;
View Full Code Here

TOP

Related Classes of com.tmm.enterprise.microblog.security.Account

Copyright © 2018 www.massapicom. 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.