Ejemplo n.º 1
0
  public String listFeedbacks() {
    LOGGER.info("Inside listFeedbacks");
    user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    LOGGER.info("profile id:" + profile.getId());

    feedback = new Feedback();

    listOfFeedbacks = feedbackService.findListOfFeedbacks(feedback, profile.getId());

    LOGGER.info("list of feedbCks:" + listOfFeedbacks.size());

    List positiveListSize = feedbackService.findListOfFeedbacks(feedback, profile.getId());
    possitiveSize = positiveListSize.size();
    LOGGER.info("positive list of feedbCks:" + listOfFeedbacks.size());

    return "success";
  }
Ejemplo n.º 2
0
  public String validateEmail() {
    LOGGER.info("Inside validateEmail");

    result = employeeAccountService.findByEmailValidation(user, getEmail());
    if (result.equals("true")) {
      return "success";
    } else {
      return "failure";
    }
  }
Ejemplo n.º 3
0
  public List getCkBoxList() {
    LOGGER.info("Inside getCkBoxList");
    String[] temp = profile.getDays().split(",");
    String[] checkBoxSets = new String[temp.length];

    for (int i = 0; i < checkBoxSets.length; i++) {

      checkBoxSets[i] = temp[i].trim();
      ckBoxList.add(checkBoxSets[i]);
    }
    return ckBoxList;
  }
Ejemplo n.º 4
0
  public void prepare() throws Exception {
    LOGGER.info("in prepare method of createEmployeeAction");

    workTimeframe = new WorkTimeframe();
    workTimeFrameList = workTimeFrameService.findAll(workTimeframe);

    jobcategory = new JobCategory();
    jobCateoryList = jobCategoryService.findAll(jobcategory);

    salary = new Salary();
    salaryList = salaryService.findAll(salary);

    salaryType = new SalaryType();
    salaryTypeList = salaryTypeService.findAll(salaryType);
    LOGGER.info("salary type list" + salaryTypeList.size());

    workTimeframeList2 = workTimeFrameService.findAll(workTimeframe);

    days = new Days();
    daysList = daysService.findAll(days);
  }
Ejemplo n.º 5
0
  public List getCheckBoxList() {

    LOGGER.info("Inside getCheckBoxList");
    String[] temp = profile.getWorkTimeframe().split(",");
    String[] checkBoxSets = new String[temp.length];

    for (int i = 0; i < checkBoxSets.length; i++) {

      checkBoxSets[i] = temp[i].trim().replace("", "");
      checkBoxList.add(checkBoxSets[i]);
    }
    return checkBoxList;
  }
Ejemplo n.º 6
0
  public String searchAllEmployers() {
    LOGGER.info("Entered searchAllEmployers");

    User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();

    employerSearchList = searchService.findListOfEmployers(employerName, employerLocation);

    profiles = searchService.findListOfEmployeeProfiles(profile, user.getId());

    if (profiles.size() != 0) {
      currentProfile = employeeProfileService.getDefaultProfileForUser(user.getId());
      contactTypesList = privacygroupService.loadAllPrivacyGroupsOfUser(currentProfile.getId());
    }
    return "success";
  }
Ejemplo n.º 7
0
  public String validateEmailForEdit() {
    LOGGER.info("Inside validateEmailForEdit");
    User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();

    String result = "success";
    users = employeeAccountService.findByEmailValidationForEdit(getEmail());

    Iterator it = users.iterator();

    while (it.hasNext()) {
      User emailOwner = (User) it.next();

      if (user.getId() == emailOwner.getId()) {
        result = "success";
      } else {
        result = "failure";
      }
    }
    return result;
  }
Ejemplo n.º 8
0
  public String create() {
    LOGGER.info("Inside create");

    try {
      Role employeeRole = new Role();
      employeeRole.setName(RoleNames.ROLE_EMPLOYEE.name());
      List<Role> roles = this.roleService.findByExample(employeeRole);
      Set<Role> userRoles = new HashSet<Role>();
      userRoles.addAll(roles);
      user.setRoles(userRoles);

      // user.setAge(ageCalculator(user));
      user.setPassword(encrypt(user.getPassword()));
      System.out.println("dobCheckbox" + dobCheckbox);
      // if(dobCheckbox.equals("true")){
      // user.setCheckDOBYR(true);
      //	}else{
      // user.setCheckDOBYR(false);
      //	}
      this.userManagement.registerUser(user);

      user = employerAccountService.findByUserName(user, user.getEmail());

      try {
        String msg = "Your Account has been created";
        msgingService.sendEmail(
            "*****@*****.**",
            new String[] {user.getEmail()},
            "Registration to MyOwnBriefcase",
            msg);

      } catch (MessagingException e) {
        e.printStackTrace();
      }
      if (this.upload != null && upload.length() > 0) {
        this.userManagement.updateUserPicture(user, this.upload.getAbsolutePath(), uploadFileName);
      }

      // log newUser in automatically

      UsernamePasswordAuthenticationToken auth =
          new UsernamePasswordAuthenticationToken(
              user,
              "user.getPassword()",
              new GrantedAuthority[] {new GrantedAuthorityImpl(RoleNames.ROLE_EMPLOYEE.name())});

      System.out.println("Setting auth details");
      SecurityContext context = SecurityContextHolder.getContext();
      context.setAuthentication(auth);
      System.out.println("auth" + auth.getClass());
      getSession().put("ACEGI_SECURITY_CONTEXT", context);

      /*
       * SwitchUserProcessingFilter filter = new
       * SwitchUserProcessingFilter(); filter.setUserDetailsService(new
       * MockAuthenticationDaoUserJackLord());
       */
      System.out.println("Done");
    } catch (Exception e) {
      e.printStackTrace();
      return "error";
    }
    return Action.SUCCESS;
  }