Example #1
0
 private boolean isDuplicateQuestionSet() {
   List<Integer> tempQustCheckMaps = new ArrayList<Integer>();
   List<Integer> temp = new ArrayList<Integer>();
   for (AuditDataQustCheckMap qcM : getSelCheckList().getAuditDataQustCheckMaps()) {
     tempQustCheckMaps.add(qcM.getPkQcMapId());
   }
   List<AuditDataQuestion> tempQues =
       checklistService.getChklistQuestions(getCurrentVersion(), tempQustCheckMaps);
   tempQustCheckMaps.clear();
   for (AuditDataQuestion adq : tempQues) {
     tempQustCheckMaps.add(adq.getPkQuestionId());
   }
   for (AuditDataQuestion adq : getQlist()) {
     temp.add(adq.getPkQuestionId());
   }
   for (Integer in : temp) {
     if (tempQustCheckMaps.contains(in.intValue())) {
       tempQustCheckMaps.remove(in);
     }
   }
   if (tempQustCheckMaps.size() < 1) {
     return true;
   } else {
     return false;
   }
 }
Example #2
0
 /**
  * This method will remove the selected row from the datatable
  *
  * @param questiondetails
  * @throws IOException
  */
 public void deleteRow(AuditDataQuestion questiondetails) throws IOException {
   qlist.remove(questiondetails);
   Object[] arr = new Object[5];
   arr[0] = questiondetails.getPkQuestionId();
   arr[1] = questiondetails.getQuestionText();
   arr[2] = questiondetails.getLookFor();
   arr[3] = getSelCheckList().getAuditDataStandardArtefact().getName();
   arr[4] = getSelCheckList().getAuditMasterType().getAuditTypeName();
   if (isDisplayAddQuestions()) {
     getAddList().add(arr);
   }
   if (qlist.size() < 1) {
     reset();
     FacesContext.getCurrentInstance().getExternalContext().redirect("createVersion.xhtml");
   }
 }
Example #3
0
  public void addQuestions() {
    getAddList().clear();
    setDisplayAddQuestions(true);
    List<Integer> artifactList = new ArrayList<Integer>();
    artifactList.add(getSelCheckList().getAuditDataStandardArtefact().getSartId());
    try {
      // setQuestList(checklistService.searchQuestions(auditStdId,
      // auditTypeId, artifactList));
      List<Object[]> data =
          getChecklistService()
              .searchQuestionsforVersion(
                  getSelCheckList().getAuditMasterStandard().getPkAuditStdId(),
                  getSelCheckList().getAuditMasterType().getPkAuditTypeId(),
                  artifactList);
      setQuestList(data);
      for (Object[] arr : data) {
        System.out.println("questionid: " + arr[0]);
        System.out.println("text: " + arr[1]);
        System.out.println("lookfor: " + arr[2]);
        System.out.println("name: " + arr[3]);
        System.out.println("auditType: " + arr[4]);
      }

    } catch (AuditGeneralException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    List<Integer> currQues = new ArrayList<Integer>();
    for (AuditDataQuestion ques : getQlist()) {
      currQues.add(ques.getPkQuestionId());
    }

    if (getQuestList().size() > 1) {

      for (Object[] objArr : getQuestList()) {
        if (currQues.contains(objArr[0]) == false) {
          getAddList().add(objArr);
        }
      }
    }
    System.out.println("Size of addlist ::" + getAddList().size());
  }