/**
   * set Overview.
   *
   * @param result - MeasurePackageOverview.
   */
  private void setOverview(final MeasurePackageOverview result) {
    overview = result;
    view.setClauses(result.getClauses());
    // QDM elements
    view.setQDMElements(result.getQdmElements());

    view.setMeasurePackages(result.getPackages());

    if (result.getPackages().size() > 0) {
      if (currentDetail != null) {
        for (int i = 0; i < result.getPackages().size(); i++) {
          MeasurePackageDetail mpDetail = result.getPackages().get(i);
          if (mpDetail.getSequence().equalsIgnoreCase(currentDetail.getSequence())) {
            setMeasurePackage(result.getPackages().get(i).getSequence());
          }
        }
      } else {
        setMeasurePackage(result.getPackages().get(0).getSequence());
      }

    } else {
      setNewMeasurePackage();
    }

    ReadOnlyHelper.setReadOnlyForCurrentMeasure(view.asWidget(), isEditable());
    view.setViewIsEditable(isEditable(), result.getPackages());
  }
 /** set New MeasurePackage. */
 private void setNewMeasurePackage() {
   currentDetail = new MeasurePackageDetail();
   currentDetail.setMeasureId(MatContext.get().getCurrentMeasureId());
   currentDetail.setSequence(Integer.toString(getMaxSequence(overview) + 1));
   view.setMeasurePackages(overview.getPackages());
   setMeasurePackageDetailsOnView();
 }
 /**
  * Sets the measure package.
  *
  * @param measurePackageId - String.
  */
 private void setMeasurePackage(final String measurePackageId) {
   for (MeasurePackageDetail detail : overview.getPackages()) {
     if (detail.getSequence().equals(measurePackageId)) {
       currentDetail = detail;
       setMeasurePackageDetailsOnView();
       break;
     }
   }
 }
 /**
  * Get Max Sequence.
  *
  * @param measurePackageOverview - MeasurePackageOverview.
  * @return Integer.
  */
 private int getMaxSequence(final MeasurePackageOverview measurePackageOverview) {
   int max = 0;
   for (MeasurePackageDetail detail : measurePackageOverview.getPackages()) {
     int seqInt = Integer.parseInt(detail.getSequence());
     if (seqInt > max) {
       max = seqInt;
     }
   }
   return max;
 }
  /** setMeasurePackageDetailsOnView. */
  private void setMeasurePackageDetailsOnView() {
    List<MeasurePackageClauseDetail> packageClauses = currentDetail.getPackageClauses();
    List<MeasurePackageClauseDetail> remainingClauses =
        removeClauses(overview.getClauses(), packageClauses);

    view.setPackageName(currentDetail.getPackageName());
    view.setClausesInPackage(packageClauses);
    view.setClauses(remainingClauses);
    view.setQDMElementsInSuppElements(overview.getSuppDataElements());
    view.setQDMElements(overview.getQdmElements());
  }
 /** updateSuppDataDetailsFromView. */
 private void updateSuppDataDetailsFromView() {
   currentDetail.setSuppDataElements(view.getQDMElementsInSuppElements());
   currentDetail.setQdmElements(view.getQDMElements());
 }
 /** updateDetailsFromView. */
 private void updateDetailsFromView() {
   currentDetail.setPackageClauses(view.getClausesInPackage());
   currentDetail.setValueSetDate(null);
 }