예제 #1
0
  /**
   *
   *
   * <pre>
   * Get Lecture Detail Infomation
   * </pre>
   *
   * @return
   */
  public RestResponse createOrUpdateLectureReview(LectureReviewDto lectureReview) {

    // Make couchbase key
    String key = "lecture::" + lectureReview.getLectureCode() + "::review";

    // Initialize Response Data
    RestResponse response = new RestResponse();

    // Get Data from Couchbase
    LectureReviewRepositoryDto repositoryDto = new LectureReviewRepositoryDto();

    repositoryDto.setKey(key);
    repositoryDto.setLectureCode(lectureReview.getLectureCode());
    repositoryDto.setCustomerCode(lectureReview.getCustomerCode());
    repositoryDto.setSubject(lectureReview.getSubject());
    repositoryDto.setCommenct(lectureReview.getCommenct());

    try {
      repositoryDto = lectureReviewRepository.save(repositoryDto);
      response.setStatus(true);
      response.setMessage("ok");
    } catch (Exception e) {
      response.setStatus(false);
      response.setMessage("fail to connect");
      return response;
    }

    // return
    return response;
  }
예제 #2
0
  /**
   *
   *
   * <pre>
   * Get Lecture Detail Infomation
   * </pre>
   *
   * @return
   */
  public RestResponse getLectureReview(String lecturecode) {

    // Make couchbase key
    String key = "lecture::" + lecturecode + "::review";

    // Initialize Response Data
    RestResponse response = new RestResponse();
    response.setStatus(true);
    response.setMessage("ok");

    // Get Data from Couchbase
    LectureReviewRepositoryDto repositoryDto = null;
    try {
      repositoryDto = lectureReviewRepository.findOne(key);
    } catch (Exception e) {
      response.setStatus(false);
      response.setMessage("fail to connect");
      return response;
    }

    // Set Lecture Detail Infomation
    LectureReviewDto dto = new LectureReviewDto();
    dto.setLectureCode(repositoryDto.getLectureCode());
    dto.setCustomerCode(repositoryDto.getCustomerCode());
    dto.setSubject(repositoryDto.getSubject());
    dto.setCommenct(repositoryDto.getCommenct());

    // Setting Lecture Detail Infomation to Response Data
    response.setData(dto);

    // return
    return response;
  }