private void fillWrappedObject(LoanedItem loanedItem) {

    this.setFromDate(DateFormat.getDefaultInstance(locale).format(loanedItem.getFromDate()));
    this.setToDate(DateFormat.getDefaultInstance(locale).format(loanedItem.getToDate()));

    Register register = loanedItem.getRegister();
    BibliographicRecord bibliographicRecord = register.getBibliographicRecord();

    this.setBiblioMainEntry(bibliographicRecord.getMainEntry());
    this.biblioPublisher = bibliographicRecord.getPublisherName();
    this.biblioPublishDate = bibliographicRecord.getPublishDate();
    this.biblioLcClass = bibliographicRecord.getLCClass();
    this.biblioDeClass = bibliographicRecord.getDEClass();
    this.biblioNlmClass = bibliographicRecord.getNLMClass();
    this.biblioCallNumber = bibliographicRecord.getCallNumber();
    this.biblioNativeCallNumber = bibliographicRecord.getNativeCallNumber();
    this.gmdType = bibliographicRecord.getGmdText();

    this.setBiblioTitle(bibliographicRecord.getTitle());
    this.setRegisterNumberType(register.getRegNo());
    this.setRetriveNoLabel(register.getRetriveNo());
    this.setVolume(register.getVolume());
    this.setSectionAddress(register.getAddress());
    this.setLocQualifier(register.getLocationQualifier());
    this.setDocumentCopy(register.getCopy());
    //         if (loanHistory.getLoanRequest() != null) {
    int loanType = loanedItem.getLoanStatus();
    if (loanType == LoanedItem.ORDINARY_LOAN) {
      this.setLoanType(MessageFactory.getInstance().getMessage("loan.ordinary").getSummary());
    } else if (loanType == LoanedItem.HOURLY_LOAN) {
      this.setLoanType(MessageFactory.getInstance().getMessage("loan.hourly").getSummary());
    }
    //         }

    LoanProfileView loanProfileView = loanedItem.getLoanProfileView();
    this.setProfileTitle(loanProfileView.getMemberTitle());
    this.setMembershipNumber(loanProfileView.getMembershipNo());
    this.loanStatus = loanedItem.getLoanStatus();
    this.lender = loanedItem.getLender().getTitle();
    this.holdingLocation = register.getLocation().getItemName();
    int interval = DateUtils.calculateDateInterval(loanedItem.getToDate(), new Date(), true) - 1;
    if (interval > 0) {
      this.setDelayDays(String.valueOf(interval));
    }
    this.setComments(loanedItem.getLoanRequest().getComments());
  }
  public void onPoll(PollEvent event) {
    try {
      final boolean isLeftToRight = registerBean.isLeftToRight();
      final Register currentRecord = registerBean.getCurrentRecord();
      final String servicePolicy = registerBean.getServicePolicy();
      final String acquisitionStatus = registerBean.getAcquisitionStatus();
      final StorageContainer.NodeIterator regList = registerBean.getRegList();

      if (regList.hasNext()) {
        String registerNo = (String) regList.next();
        registerNo =
            (isLeftToRight)
                ? StringUtils.extendedArabicToLatinDigit(registerNo)
                : StringUtils.latinToExtendedArabicDigit(registerNo);

        currentRecord.setSubfieldData(Tags.HOL_INFO_SERVICE_POLICY, 'a', servicePolicy);
        currentRecord.setSubfieldRangeData(
            Tags.HOL_ACQUISITION_STATUS, 'a', acquisitionStatus, 1, 1);
        currentRecord.setSubfieldData(
            Tags.HOL_LOC_CALL_NO, 'b', registerBean.getLocationItem().getCode());
        currentRecord.setSubfieldData(Tags.HOL_LOC_CALL_NO, 'm', registerNo);

        // regsList.getIndex() started of 1
        final int index = regList.getIndex() - 1;

        String volume = registerBean.getVolume();
        if (registerBean.isHasCounterVolume()) {
          volume = String.valueOf(Integer.valueOf(volume) + index);
        }
        volume =
            (isLeftToRight)
                ? StringUtils.extendedArabicToLatinDigit(volume)
                : StringUtils.latinToExtendedArabicDigit(volume);
        currentRecord.setSubfieldData(Tags.HOL_COPY_VOL_INFO, 'a', volume);

        String copy = registerBean.getCopy();
        if (registerBean.isHasCounterCopy()) {
          copy = String.valueOf(Integer.valueOf(copy) + index);
        }
        copy =
            (isLeftToRight)
                ? StringUtils.extendedArabicToLatinDigit(copy)
                : StringUtils.latinToExtendedArabicDigit(copy);
        currentRecord.setSubfieldData(Tags.HOL_COPY_VOL_INFO, 'b', copy);

        String address = registerBean.getAddress();
        if (registerBean.isHasCounterAddress()) {
          address = String.valueOf(Integer.valueOf(address) + index);
        }
        address =
            (isLeftToRight)
                ? StringUtils.extendedArabicToLatinDigit(address)
                : StringUtils.latinToExtendedArabicDigit(address);
        currentRecord.setSubfieldData(Tags.HOL_COPY_VOL_INFO, 'c', address);

        String section = registerBean.getSection();
        if (registerBean.isHasCounterSection()) {
          section = String.valueOf(Integer.valueOf(section) + index);
        }
        section =
            (isLeftToRight)
                ? StringUtils.extendedArabicToLatinDigit(section)
                : StringUtils.latinToExtendedArabicDigit(section);
        currentRecord.setSubfieldData(Tags.HOL_COPY_VOL_INFO, 'd', section);

        String date = registerBean.getDate();
        if (StringUtils.isNotEmpty(date)) {
          date =
              (isLeftToRight)
                  ? StringUtils.extendedArabicToLatinDigit(date)
                  : StringUtils.latinToExtendedArabicDigit(date);
          currentRecord.setSubfieldData(Tags.HOL_COPY_VOL_INFO, 'e', date);
        }

        String print = registerBean.getPrint();
        if (StringUtils.isNotEmpty(print)) {
          print =
              (isLeftToRight)
                  ? StringUtils.extendedArabicToLatinDigit(print)
                  : StringUtils.latinToExtendedArabicDigit(print);
          currentRecord.setSubfieldData(Tags.HOL_LOC_CALL_NO, '9', print);
        }

        String ref = registerBean.isReferences() ? "1" : "0";
        ref =
            (isLeftToRight)
                ? StringUtils.extendedArabicToLatinDigit(ref)
                : StringUtils.latinToExtendedArabicDigit(ref);
        currentRecord.setSubfieldData(Tags.HOL_COPY_VOL_INFO, 'r', ref);

        DataEntryModel dataEntryModel = registerBean.getDataEntryModel();
        try {
          StorageWebUtils.getInstance()
              .tryToPost(
                  dataEntryModel,
                  currentRecord.getBibliographicRecord(),
                  currentRecord,
                  registerNo,
                  registerBean.getLocationItem(),
                  JsfUtils.getInstance().getLocale());
        } catch (DuplicateRegisterRecordException e) {
          JsfUtils.getInstance().addFormattedError(e.getMessage());
          regList.next();
        }
        dataEntryModel.cancel();
        StorageWebUtils.getInstance()
            .releaseRecordLock(currentRecord.getClass(), currentRecord.getId(), true);
        dataEntryModel =
            StorageWebUtils.getInstance()
                .createDataEntryModel(
                    Register.class, null, 0, currentRecord.getBibliographicRecord(), true);
        registerBean.setDataEntryModel(dataEntryModel);
      }
    } catch (Exception e) {

    }
  }