Package com.m4f.business.domain

Examples of com.m4f.business.domain.InternalUser


 
  private static InternalUser root;
 
  public InternalUserDetailService(String rootUser,
      String rootPassword) {
    root = new InternalUser();
    root.setEmail(rootUser);
    root.setPassword(rootPassword);
  }
View Full Code Here


    if(root.getEmail().equals(username)) {
      return makeRootUser(root);
    }
   
    try {
      InternalUser user = this.serviceLocator.getUserService().getUser(username);
      return this.makeUser(user);
    } catch(Exception e) {
      throw new UsernameNotFoundException("User not found: " + username);
    }
  }
View Full Code Here

  }

  @Override
  public MediationService getMediationServiceByUser(String username) {
    try {
      InternalUser intUser = this.getUserService().getUser(username);
      return this.getMediatorService().getMediationServiceByUser(intUser.getId(), null);
    } catch(Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
      return null;
    }
  }
View Full Code Here

    /*
     * TODO extract only the currentUser's courses but is necessary modify business logic
     * to annotate into course the provider's id.
     */
    try {
      InternalUser user = this.serviceLocator.getUserService().getUser(currentUser.getName());
      // get mediator because, they are the unique users with a provider associated and internaluser
      MediationService mediator = this.serviceLocator.getMediatorService().getMediationServiceByUser(user.getId(), locale);
      PageManager<Course> paginator = new PageManager<Course>();
      paginator.setUrlBase("/" + locale.getLanguage()+ "/provider/courses/");
      paginator.setStart((page-1)*paginator.getOffset());
      paginator.setSize(this.serviceLocator.getCourseService().countCoursesByProvider(mediator.getId()));
      paginator.setCollection(this.serviceLocator.getCourseService().getCoursesByProvider(mediator.getId(), "title", locale,
View Full Code Here

        model.addAttribute("schools",
            this.serviceLocator.getExtendedSchoolService().getAllSchools(null, locale));
        return "extended.course.form";
      }
      if(principal != null) {
        InternalUser user = this.serviceLocator.getUserService().getUser(principal.getName());
        MediationService mediationService =
          this.serviceLocator.getMediatorService().getMediationServiceByUser(user.getId(), locale);
        course.setMediationService(mediationService.getId());
        if(course.getId() == null) {
          course.setCreated(new Date());
        }
        course.setUpdated(new Date());
View Full Code Here

  public String save(@ModelAttribute("form") @Valid UserForm form,
      BindingResult result, Model model, Locale locale,
      @RequestHeader("Host") String host, HttpSession session) {
    // Check if exist an user with this mail
    try {
      InternalUser oldUser = this.serviceLocator.getUserService().getUser(form.getUser().getEmail());
     
      if(result.hasErrors() || (oldUser != null && form.getUser().getId() == null)) {
        return "user.form";
      }
      if(form.getUser().getId() != null) { // Editing mode. Remove user from his mediationservice
View Full Code Here

  @RequestMapping(value="/edit/{userId}", method=RequestMethod.GET)
  public String edit(@PathVariable Long userId, Model model, Locale locale,
      @RequestHeader(required=false, value="referer") String referer,
      HttpSession session) {
    try {
      InternalUser user = this.serviceLocator.getUserService().getUser(userId);
      UserForm form = new UserForm();
      form.setUser(user);
      model.addAttribute("form", form);
      model.addAttribute("mediations",
          this.serviceLocator.getMediatorService().getAllMediationService(locale));
View Full Code Here

  @RequestMapping(value="/delete/{userId}", method=RequestMethod.GET)
  public String delete(@PathVariable Long userId, Locale locale,
      @RequestHeader(required=false,value="referer") String referer,
      @RequestHeader("Host") String host) {
    try {
      InternalUser user = this.serviceLocator.getUserService().getUser(userId);
      if(user != null) {
        this.serviceLocator.getUserService().delete(user);
      }
    } catch(Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
View Full Code Here

  }
 
  @RequestMapping(value="/detail/{userId}", method=RequestMethod.GET)
  public String detail(@PathVariable Long userId, Model model, Locale locale) {
    try {
      InternalUser user = this.serviceLocator.getUserService().getUser(userId);
      model.addAttribute("user", user);
      model.addAttribute("mediationService",
          this.serviceLocator.getMediatorService().getMediationServiceByUser(userId, locale));
    } catch(Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
View Full Code Here

    if(currentUser ==null) {
      return "home";
    }
    String customHome = "";
    try {
      InternalUser user = this.serviceLocator.getUserService().getUser(currentUser.getName());
      //The root user isn't into datastore.
      if(user==null) {
        customHome = "redirect:/" + locale.getLanguage() + "/dashboard/admin/";
      } else {
        if(user.isAdmin()) {
          customHome = "redirect:/" + locale.getLanguage() + "/dashboard/admin/";
        } else {
          customHome = "redirect:/" + locale.getLanguage() + "/dashboard/mediator/";
        }
      } 
View Full Code Here

TOP

Related Classes of com.m4f.business.domain.InternalUser

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.