Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. private long id;
  2.  
  3. private String questionNo;
  4.  
  5. private byte[] question;
  6.  
  7. private byte[] option1;
  8.  
  9. private byte[] option2;
  10.  
  11. private byte[] option3;
  12.  
  13. private byte[] option4;
  14.  
  15. private String answer;
  16.  
  17. private byte[] explanation;
  18.  
  19. private Topic topic;
  20.  
  21. private Chapter chapter;
  22.  
  23. private Subject subject;
  24.  
  25. public int validateQuestion(Question question){
  26. Question questionForCheckNo=questionService.findQuestionByQuestionNo(question.getQuestionNo());
  27. Question existingQuestion=questionService.findById(question.getId());
  28. if (existingQuestion != null
  29. && ((question.getSubject().getId() == existingQuestion
  30. .getSubject().getId())
  31. && (question.getChapter().getId() == existingQuestion
  32. .getChapter().getId())
  33. && (question.getTopic().getId() == existingQuestion
  34. .getTopic().getId())
  35. && (question.getQuestionNo().equals(existingQuestion
  36. .getQuestionNo()))
  37. && (question.getAnswer()
  38. .equals(existingQuestion.getAnswer()))
  39. &&(question.getIsMock()==existingQuestion.getIsMock())
  40. &&(!Arrays.equals(question.getQuestion(), existingQuestion.getQuestion()))
  41. &&(!Arrays.equals(question.getOption1(), existingQuestion.getOption1()))
  42. &&(!Arrays.equals(question.getOption2(), existingQuestion.getOption2()))
  43. &&(!Arrays.equals(question.getOption3(), existingQuestion.getOption3()))
  44. &&(!Arrays.equals(question.getOption4(), existingQuestion.getOption4()))
  45. &&(!Arrays.equals(question.getExplanation(), existingQuestion.getExplanation()))
  46.  
  47. )) {
  48.  
  49. return 1;
  50. }
  51. else if(questionForCheckNo!=null){
  52. return 2;
  53. }
  54.  
  55.  
  56.  
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement