Skip to content

Commit

Permalink
Merge pull request #417 from phuonghuynh/master
Browse files Browse the repository at this point in the history
Update changes
  • Loading branch information
phuonghuynh committed Sep 23, 2015
2 parents 7c77dcf + f46a082 commit a8c1841
Show file tree
Hide file tree
Showing 53 changed files with 6,046 additions and 1,728 deletions.
804 changes: 413 additions & 391 deletions src/main/java/com/techlooper/config/CoreConfiguration.java

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion src/main/java/com/techlooper/controller/ChallengeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Set;

@RestController
public class ChallengeController {
Expand Down Expand Up @@ -46,7 +47,7 @@ public ChallengeResponse publishChallenge(@RequestBody ChallengeDto challengeDto
if (EmailValidator.validate(challengeEntity.getAuthorEmail())) {
challengeService.sendPostChallengeEmailToEmployer(challengeEntity);
}
challengeService.sendPostChallengeEmailToTechloopies(challengeEntity);
challengeService.sendPostChallengeEmailToTechloopies(challengeEntity, Boolean.TRUE);
}

// Call Lead Management API to create new lead on CRM system
Expand All @@ -65,6 +66,9 @@ public ChallengeResponse publishChallenge(@RequestBody ChallengeDto challengeDto
LOGGER.error(ex.getMessage(), ex);
}
}
else {
challengeService.sendPostChallengeEmailToTechloopies(challengeEntity, Boolean.FALSE);
}

return new ChallengeResponse(challengeEntity.getChallengeId(), responseCode);
}
Expand Down Expand Up @@ -107,4 +111,19 @@ public void deleteChallengeById(@PathVariable Long id, HttpServletRequest reques
public ChallengeDto findChallengeById(@PathVariable Long challengeId) throws Exception {
return challengeService.findChallengeById(challengeId);
}

@PreAuthorize("hasAuthority('EMPLOYER')")
@RequestMapping(value = "/challenges/{challengeId}/registrants", method = RequestMethod.GET)
public Set<ChallengeRegistrantDto> getRegistrantsById(@PathVariable Long challengeId, HttpServletRequest request, HttpServletResponse response) {
return challengeService.findRegistrantsByOwner(request.getRemoteUser(), challengeId);
}


@PreAuthorize("hasAuthority('EMPLOYER')")
@RequestMapping(value = "/challengeDetail/registrant", method = RequestMethod.POST)
public ChallengeRegistrantDto saveRegistrant(@RequestBody ChallengeRegistrantDto dto, HttpServletRequest request) {
return challengeService.saveRegistrant(request.getRemoteUser(), dto);
}


}
14 changes: 12 additions & 2 deletions src/main/java/com/techlooper/controller/JobAlertController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.techlooper.model.JobSearchResponse;
import com.techlooper.service.JobAggregatorService;
import org.dozer.Mapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -17,6 +19,7 @@

import static com.techlooper.model.JobAlertEmailResultEnum.EMAIL_SENT;
import static com.techlooper.model.JobAlertEmailResultEnum.JOB_NOT_FOUND;
import static com.techlooper.model.JobAlertEmailResultEnum.SERVER_ERROR;

/**
* Job alert registration controller
Expand All @@ -27,6 +30,8 @@
@Controller
public class JobAlertController {

private final static Logger LOGGER = LoggerFactory.getLogger(JobAlertController.class);

@Resource
private JobAggregatorService jobAggregatorService;

Expand Down Expand Up @@ -59,8 +64,13 @@ public JobAlertRegistrationEntity registerJobAlert(@RequestBody JobAlertRegistra
JobSearchCriteria criteria = dozerMapper.map(jobAlertRegistrationEntity, JobSearchCriteria.class);
JobSearchResponse jobSearchResponse = jobAggregatorService.findJob(criteria);
if (jobSearchResponse.getTotalJob() > 0) {
jobAggregatorService.sendEmail(jobAlertRegistrationEntity, jobSearchResponse);
jobAggregatorService.updateSendEmailResultCode(jobAlertRegistrationEntity, EMAIL_SENT);
try {
jobAggregatorService.sendEmail(jobAlertRegistrationEntity, jobSearchResponse);
jobAggregatorService.updateSendEmailResultCode(jobAlertRegistrationEntity, EMAIL_SENT);
} catch (Exception ex) {
jobAggregatorService.updateSendEmailResultCode(jobAlertRegistrationEntity, SERVER_ERROR);
LOGGER.error(ex.getMessage(), ex);
}
} else {
jobAggregatorService.updateSendEmailResultCode(jobAlertRegistrationEntity, JOB_NOT_FOUND);
}
Expand Down
110 changes: 75 additions & 35 deletions src/main/java/com/techlooper/entity/ChallengeRegistrantDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,93 @@
*/
public class ChallengeRegistrantDto {

private Long challengeId;
private Long challengeId;

private String registrantEmail;
private String registrantEmail;

private String registrantFirstName;
private String registrantFirstName;

private String registrantLastName;
private String registrantLastName;

private Language lang;
private Language lang;

public Long getChallengeId() {
return challengeId;
}
private Double score;

public void setChallengeId(Long challengeId) {
this.challengeId = challengeId;
}
private Long registrantId;

public String getRegistrantEmail() {
return registrantEmail;
}
private Boolean disqualified;

public void setRegistrantEmail(String registrantEmail) {
this.registrantEmail = registrantEmail;
}
private String disqualifiedReason;

public String getRegistrantFirstName() {
return registrantFirstName;
}
public String getDisqualifiedReason() {
return disqualifiedReason;
}

public void setRegistrantFirstName(String registrantFirstName) {
this.registrantFirstName = registrantFirstName;
}
public void setDisqualifiedReason(String disqualifiedReason) {
this.disqualifiedReason = disqualifiedReason;
}

public String getRegistrantLastName() {
return registrantLastName;
}
public Boolean getDisqualified() {
return disqualified;
}

public void setRegistrantLastName(String registrantLastName) {
this.registrantLastName = registrantLastName;
}
public void setDisqualified(Boolean disqualified) {
this.disqualified = disqualified;
}

public Language getLang() {
return lang;
}
public Long getRegistrantId() {
return registrantId;
}

public void setLang(Language lang) {
this.lang = lang;
}
public void setRegistrantId(Long registrantId) {
this.registrantId = registrantId;
}

public Double getScore() {
return score;
}

public void setScore(Double score) {
this.score = score;
}

public Long getChallengeId() {
return challengeId;
}

public void setChallengeId(Long challengeId) {
this.challengeId = challengeId;
}

public String getRegistrantEmail() {
return registrantEmail;
}

public void setRegistrantEmail(String registrantEmail) {
this.registrantEmail = registrantEmail;
}

public String getRegistrantFirstName() {
return registrantFirstName;
}

public void setRegistrantFirstName(String registrantFirstName) {
this.registrantFirstName = registrantFirstName;
}

public String getRegistrantLastName() {
return registrantLastName;
}

public void setRegistrantLastName(String registrantLastName) {
this.registrantLastName = registrantLastName;
}

public Language getLang() {
return lang;
}

public void setLang(Language lang) {
this.lang = lang;
}
}
Loading

0 comments on commit a8c1841

Please sign in to comment.