Пример #1
0
  private void setRealProfileCondition(
      RealProfilePerson realPerson, StringBuffer query, List<Object> params) {
    if (realPerson.getProfile() != null) {
      if (StringUtils.isNotEmpty(realPerson.getProfile().getTitle())) {
        query.append(" AND UPPER(realPerson.profile.title) LIKE ?");
        params.add("%" + realPerson.getProfile().getTitle().toUpperCase() + "%");
      }

      if (realPerson.getProfile().getNationality() != null) {
        query.append(" AND realPerson.profile.nationality = ?");
        params.add(realPerson.getProfile().getNationality());
      }

      if (StringUtils.isNotEmpty(realPerson.getProfile().getUserName())) {
        query.append(" AND UPPER(realPerson.profile.userName) LIKE ?");
        params.add("%" + realPerson.getProfile().getUserName().toUpperCase() + "%");
      }

      if (realPerson.getProfile().getStatus() != 0) {
        query.append(" AND realPerson.profile.status = ?");
        params.add(realPerson.getProfile().getStatus());
      }

      if (realPerson.getProfile().getUserType() != 0) {
        query.append(" AND realPerson.profile.userType = ?");
        params.add(realPerson.getProfile().getUserType());
      }

      if (realPerson.getProfile().getRegisterType() != 0) {
        query.append(" AND realPerson.profile.registerType = ?");
        params.add(realPerson.getProfile().getRegisterType());
      }

      if (realPerson.getProfile().getMembershipNo() != null) {
        query.append(" AND realPerson.profile.membershipNo = ?");
        params.add(realPerson.getProfile().getMembershipNo());
      }

      if (realPerson.getProfile().getActivationDate() != null) {
        query.append(" AND realPerson.profile.activationDate = ?");
        params.add(realPerson.getProfile().getActivationDate());
      }

      if (realPerson.getProfile().getExpirationDate() != null) {
        query.append(" AND realPerson.profile.expirationDate = ?");
        params.add(realPerson.getProfile().getExpirationDate());
      }

      if (realPerson.getProfile().getRfidTag() != null) {
        query.append(" AND realPerson.profile.rfidTag = ?");
        params.add(realPerson.getProfile().getRfidTag());
      }

      if (realPerson.getProfile().getRegisterDate() != null) {
        query.append(" AND realPerson.profile.registerDate = ?");
        params.add(realPerson.getProfile().getRegisterDate());
      }
    }
  }
Пример #2
0
  @Override
  @SuppressWarnings("unchecked")
  protected void _populate() {
    _tableModel = (List<TermDataEntryBean>) (JsfUtils.getFromPageFlow(panelName));
    if (_tableModel == null || _tableModel.size() == 0) {
      super._populate();

      TreeNodeWrapper subField2 = null; /*QUALIFIER ELEMENT - $9*/
      for (int i = 0; i < fieldList.size(); i++) {
        TreeModelWrapper fld = fieldList.get(i);
        subField =
            WorksheetWebUtils.findTreeNodeWrapperSubFieldByTag(
                fld, Tags.Subfields.AUTH_ENTRY_ELEMENT);
        subField2 =
            WorksheetWebUtils.findTreeNodeWrapperSubFieldByTag(fld, Tags.Subfields.AUTH_QUALIFIER);
        //				subFielc3 = WorksheetWebUtils.findTreeNodeWrapperSubFieldByTag(fld,
        // Tags.Subfields.AUTH_INSTRUCTION_PHRASE);
        if (StringUtils.isNotEmpty(subField.getData())) {
          TermDataEntryBean row =
              new TermDataEntryBean(
                  i, subField.getData(), subField2.getData(), false, fld.getField().getTreeNode());
          _tableModel.add(row);
        }
      }
      _postPopulate();
    }
  }
  private void confirmActionPerformed() {

    if (isValidData()) {
      int count = 0;
      try {
        con = getConnection();
        count = getCount(con);
      } catch (SQLException e) {
        if (con == null) {
          System.err.println("Could not establish connection");
          MessagePanes.showErrorDialog(
              LoanMemberDataExchangeScreen.this,
              props.getProperty("invalid-connection.text"),
              getLocale());
        } else {
          MessagePanes.showErrorDialog(
              LoanMemberDataExchangeScreen.this,
              props.getProperty("system-error.text"),
              getLocale());
        }
        e.printStackTrace();
      } catch (Throwable e) {
        e.printStackTrace();
      }

      ProgressMonitorHandler monitor =
          new ProgressMonitorHandler(
              this,
              new ExchangeTask(count),
              props.getProperty("progress.text") + StringUtils.rtlString("..."));
      monitor.intialize();
    } else {
      MessagePanes.showErrorDialog(this, errorMessage, getLocale());
    }
  }
 public void insertAction(ActionEvent event) {
   try {
     String fromIndex = StringUtils.extendedArabicToLatinDigit(registerBean.getRegNoFrom());
     String toIndex = StringUtils.extendedArabicToLatinDigit(registerBean.getRegNoUntil());
     RegisterContainer registerContainer = RegisterNumberParser.parse(fromIndex, toIndex);
     registerBean.setRegList((StorageContainer.NodeIterator) registerContainer.iterator());
     JsfUtils.callFunctionScript("disableAllElements", "");
   } catch (NumberFormatException e) {
     JsfUtils.getInstance().addError("invalidNumberFormatMsg");
     JsfUtils.callFunctionScript("enableAllElements()", "");
   } catch (IllegalArgumentException e) {
     JsfUtils.getInstance().addError("regnoFrom_is_greater_than_regnoTo_message");
     JsfUtils.callFunctionScript("enableAllElements()", "");
   } catch (IllegalStateException e) {
     JsfUtils.getInstance().addError("regno_is_too_long_message");
     JsfUtils.callFunctionScript("enableAllElements()", "");
   }
 }
Пример #5
0
  private List generateHoldings(Record storageRecord) {
    List result = new ArrayList();
    EntityObject wd = dataEntryService.findDefaultHoldingWorksheetFast(storageRecord);

    List holdDataFields = MarcUtils.getVaribleFieldList(storageRecord, "999");
    for (int i = 0; i < holdDataFields.size(); i++) {
      DataField hold = (DataField) holdDataFields.get(i);
      String locCode = MarcUtils.getSubfieldData(hold, 's', 0);
      locCode = StringUtils.extendedArabicToLatinDigit(locCode);
      ConstantTableItem location = findOrCreateLocationByCode(locCode);
      if (location == null) {
        continue;
      }
      String regNo = MarcUtils.getSubfieldData(hold, 'r', 0);
      if (regNo == null || regNo.length() == 0) {
        continue;
      }
      String vol = MarcUtils.getSubfieldData(hold, 'v', 0);
      String copy = MarcUtils.getSubfieldData(hold, 'c', 0);
      String part = MarcUtils.getSubfieldData(hold, 'p', 0);

      Record marc =
          dataEntryService.createPreparedRegisterRecordFast(
              Register.class, storageRecord, location, AppSession.getInstance().getCurrentUser());

      DataField df = ensureFieldExists(marc, Tags.HOL_LOC_CALL_NO);
      MarcUtils.setSubfieldData(df, 'b', locCode);
      MarcUtils.setSubfieldData(df, 'm', regNo);

      df = (DataField) ensureFieldExists(marc, Tags.HOL_COPY_VOL_INFO);
      MarcUtils.setSubfieldData(df, 'a', vol);
      MarcUtils.setSubfieldData(df, 'b', copy);
      MarcUtils.setSubfieldData(df, 'c', part);

      Register reg = new Register();
      reg.setRegNo(regNo);
      reg.setVolume(vol);
      reg.setCopy(copy);
      reg.setLocation(location);
      if (wd != null) reg.setWorksheetDefinitionId(wd.getId());
      reg.setContent(MarcUtils.marshalContent(marc));

      //			reg.setBibliographicRecord(storageRecord);
      //			storageRecord.getRegisters().add(reg);
      result.add(reg);
      storageRecord.getDataFieldList().remove(hold);
    }
    return result;
    // remove 999 fields
    //		  for (Iterator iter = storageRecord.getDataFieldList().iterator(); iter.hasNext();) {
    //			DataField element = (DataField) iter.next();
    //			if ("999".equals(element.getTag()))
    //				iter.remove();
    //		  }

  }
Пример #6
0
 /** <code>print()</code> defines for showing print or print preview of results. */
 private void printActionPerformed() {
   Hashtable parameters = new Hashtable();
   parameters.put(props.getProperty("printHeader.name"), radioValue);
   if (StringUtils.isNotEmpty(previewHeaderText))
     parameters.put(props.getProperty("header1.name"), previewHeaderText);
   ReportData reportData = new ReportData(grid, new HashMap(), grid.getLocale());
   java.util.List itemList = new ArrayList();
   itemList = grid.getDataModel().getData().getDataList();
   reportData.setTitle(getTitle());
   reportData.setConditionMap(parameters);
   reportData.setSelectedRows(itemList);
   PrintSetupScreen.showPrintSetupScreen(this.getSubsystemApp(), screenLocale, reportData);
 }
  public String doSave() {

    try {

      if (StringUtils.isEmpty(membershipNumber)) {
        ErrorReportingUtils.getInstance().reportErrors("membership-number-is-missing");
        return "";
      }
      if (selectedUnitOrLib instanceof LibraryUnit
          && selectedRequestType == UserManagementDataMap.Request_type.Scholar.getValue()) {
        ErrorReportingUtils.getInstance().reportErrors("select-valid-unit-library");
        return "";
      }

      if (selectedUnitOrLib instanceof OrganizationUnit
          && selectedRequestType != UserManagementDataMap.Request_type.Scholar.getValue()) {
        ErrorReportingUtils.getInstance().reportErrors("select-valid-unit-library");
        return "";
      }

      if (this.realPerson.getProfile() == null) this.realPerson.setProfile(new ProfilePerson());

      ProfilePerson profile = this.realPerson.getProfile();
      profile.setNationality(getNationality());
      profile.setTitle(this.realPerson.getFirstName() + " " + this.realPerson.getLastName());
      profile.setMembershipNo(this.membershipNumber);

      profile.setUserType(ProfilePerson.BOTH);
      profile.setRegisterType(Byte.valueOf(JsfUtils.getFromPageFlow("registerType").toString()));
      profile.setUserName(this.userName);
      profile.setPassword(WebApplication.getInstance().encodePassword(this.password));
      profile.setEmail(this.email);
      this.realPerson.setUniqeName(this.realPerson.createPersonIdentifierKey());

      if (this.selectedRequestType == UserManagementDataMap.Request_type.SafeKeeping.getValue()) {
        service.saveRealLoanProfileRequest(this.realPerson, this.selectedUnitOrLib);
      } else if (this.selectedRequestType
          == UserManagementDataMap.Request_type.Exchange.getValue()) {
        service.saveRealExchangeProfileRequest(this.realPerson, this.selectedUnitOrLib);
      } else if (this.selectedRequestType
          == UserManagementDataMap.Request_type.Scholar.getValue()) {
        service.saveRealProberProfileRequest(this.realPerson, this.selectedUnitOrLib);
      }

      this.realPerson = service.findRealProfilePersonByProfilePersonId(profile.getId());

      NliMailDefinitionServiceProxy.getInstance()
          .sendMessage(
              this.email,
              JsfUtils.getStringFromBundle("userNamePassEmailSubject"),
              "body",
              Constants.UTF8);

      Map map = RequestContext.getCurrentInstance().getPageFlowScope();
      map.put("realPerson", this.realPerson);
      map.put("selectedUnit", this.selectedUnitOrLib);
      map.put("requestType", this.selectedRequestType);

    } catch (DuplicateMembershipNoException exp) {
      ErrorReportingUtils.getInstance()
          .reportErrors(JsfUtils.getStringFromBundle("duplicateMembershipNoException"));
      return "";
    } catch (DuplicateMemberException e) {
      ErrorReportingUtils.getInstance()
          .reportErrors(JsfUtils.getStringFromBundle("duplicateMemberException"));
      return "";
    } catch (DuplicateNationalCodeException e) {
      ErrorReportingUtils.getInstance()
          .reportErrors(JsfUtils.getStringFromBundle("duplicateNationalCodeException"));
      return "";
    } catch (DuplicateUserNameException e) {
      ErrorReportingUtils.getInstance()
          .reportErrors(JsfUtils.getStringFromBundle("duplicateUsernameException"));
      return "";
    } catch (DuplicateLoanProfileException exp) {

      return processException(exp, 0);

    } catch (DuplicateExchangeProfileException exp) {

      return processException(exp, 1);

    } catch (DuplicateProberProfileException exp) {

      return processException(exp, 2);

    } catch (Exception exp) {
      exp.printStackTrace();

      return "";
    } finally {

    }

    return goBackList();
  }
Пример #8
0
  public SearchQueryBuilder getCriteriaBuilder() {
    BibliographicSearchLimitQueryBuilder qb = new BibliographicSearchLimitQueryBuilder(this.schema);

    Object tmp;
    tmp = cmCodingLevel.getSelectedItem(); // ldr 17
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setCodingLevel(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmCataloguingForm.getSelectedItem(); // ldr 18
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setCataloguingForm(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmBiblevel.getSelectedItem(); // ldr 07
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setBibLevel(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmHierarchicalLevel.getSelectedItem(); // ldr 08
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setHierarchicalLevel(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmDoctype.getSelectedItem();
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setBiblioDocType(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmLanguage.getSelectedItem();
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setLanguage(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmLocation.getSelectedItem();
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setLocation(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmRecType.getSelectedItem(); // ldr 06
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setRecordType(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmRecStatus.getSelectedItem(); // ldr 05
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setRecordStatus(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmDescriptionLevel.getSelectedItem();
    if (tmp != null && tmp instanceof ConstantTableItem) {
      qb.setLevelOfDescription(((ConstantTableItem) tmp).getCode());
    }
    tmp = cmGMD.getSelectedItem();
    if (tmp != null && tmp instanceof ConstantTableItem) {
      ConstantTableItem item = (ConstantTableItem) tmp;
      String s = null;
      if (language == LocaleUtils.PERSIAN) {
        s = item.getFarsiItemName();
      }
      if (StringUtils.isEmpty(s)) {
        s = item.getEnglishItemName();
      }

      if (StringUtils.isNotEmpty(s)) {
        qb.setGmd(s);
      }
    }
    tmp = txfRetriveNo.getText();
    if (tmp != null && tmp instanceof String && ((String) tmp).length() != 0) {
      qb.setRetriveNo((String) tmp);
    }

    if (rDateRange.isSelected()) {
      qb.setUseDateRange(Boolean.TRUE);
      tmp = cmCalendar.getSelectedItem();
      if (tmp != null && tmp instanceof ConstantTableItem) {
        qb.setCalendar(((ConstantTableItem) tmp).getCode());
      }

      if (rGt.isSelected()) {
        qb.setDateComparisonOperator(BibliographicSearchLimitQueryBuilder.GT);
        qb.setFrom(txfFrom.getText());
      }
      if (rLt.isSelected()) {
        qb.setDateComparisonOperator(BibliographicSearchLimitQueryBuilder.LT);
        qb.setTo(txfTo.getText());
      }

      if (rBetween.isSelected()) {
        qb.setDateComparisonOperator(BibliographicSearchLimitQueryBuilder.BETWEEN);
        qb.setFrom(txfFrom.getText());
        qb.setTo(txfTo.getText());
      }
    }
    if (rYear.isSelected()) {
      qb.setUseDateRange(Boolean.FALSE);

      tmp = cmCalendar.getSelectedItem();
      if (tmp != null && tmp instanceof ConstantTableItem) {
        qb.setCalendar(((ConstantTableItem) tmp).getCode());
      }
      qb.setYear(txfYear.getText());
    }

    if (cbHasAttachment.isSelected()) {
      qb.setAttachment(Boolean.TRUE);
    }
    if (cbIsOpenShelf.isSelected()) {
      qb.setIsOpenShelf(Boolean.TRUE);
    }
    if (cbIsLendable.isSelected()) {
      qb.setIsLendable(Boolean.TRUE);
    }

    String tt = txfLCClass.getText();
    qb.setLcRangeStart(tt);

    return qb;
  }
  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) {

    }
  }
Пример #10
0
  /**
   * <code>reportActionPerformed()</code> defiens for searching copyrights in DB according to search
   * keys.
   */
  private void reportActionPerformed() {
    filterObject = new TempRequestReport();
    int counter = 0;
    previewHeaderText = new String();
    radioValue = new String();

    if (!txfTitle.getText().equals(""))
      filterObject.setTitle((txfTitle.getText().toUpperCase().trim()));

    if (!txfNumber.getText().equals(""))
      filterObject.setNumber(StringUtils.arabicToLatinDigit(txfNumber.getText()).trim());

    if (rdoAnswerReq.isSelected()) {
      filterObject.setIsAnswered(WorkflowConstants.IS_ANSWERED_REQUEST);
      radioValue = props.getProperty("print_answered_req.name");
    } else if (rdoNoAnswerReq.isSelected()) {
      filterObject.setIsAnswered(WorkflowConstants.IS_NOT_ANSWERED_REQUEST);
      radioValue = props.getProperty("print_no_answered_req.name");
    }

    if (rdoHasNumber.isSelected()) {
      filterObject.setHasNumber(WorkflowConstants.HAS_NUMBER);
      radioValue += " " + props.getProperty("print_has_number_req.name");
    } else if (rdoNoNumber.isSelected()) {
      filterObject.setHasNumber(WorkflowConstants.NO_NUMBER);
      radioValue += " " + props.getProperty("print_no_number_req.name");
    }

    if (txfUserName.getText() != null
        && txfUserName.getText() != ""
        && txfUserName.getText().length() != 0) filterObject.setUserId(userId);

    if (rdoCopyrightReq.isSelected()) {
      filterObject.setType(WorkflowConstants.COPY_RIGHT_BOOK_TYPE);
      filterObject.setDocType("");
      radioValue += " " + props.getProperty("print_copy_right_req.name");
    } else if (rdoDepositReq.isSelected()) {
      filterObject.setType(WorkflowConstants.COPY_RIGHT_NON_BOOK_TYPE);
      if (cmbDocType.getSelectedIndex() != 0) {
        filterObject.setDocType(((ConstantTableItem) cmbDocType.getSelected()).getCode());
      } else filterObject.setDocType("");
      radioValue += " " + props.getProperty("print_deposit_req.name");
    }

    if (chkAnswerDate.isSelected()) {
      filterObject.setAnswerDate(WorkflowConstants.SELECTED);
      previewHeaderText = props.getProperty("answer_date.name");
      counter++;
    }
    if (chkRequestDate.isSelected()) {
      filterObject.setRequestDate(WorkflowConstants.SELECTED);
      if (counter > 0)
        previewHeaderText += " " + '\u060c' + " " + props.getProperty("request_date.name");
      else previewHeaderText += " " + props.getProperty("request_date.name");
      counter++;
    }

    if (chkSetNumberDate.isSelected()) {
      filterObject.setSetNumberDate(WorkflowConstants.SELECTED);
      if (counter > 0)
        previewHeaderText += " " + '\u060c' + " " + props.getProperty("set_number_date.name");
      else previewHeaderText += " " + props.getProperty("set_number_date.name");
    }

    if (txfFromDate.getDate() != null && txfToDate.getDate() != null) {
      if (txfFromDate.getDate().getTime() > txfToDate.getDate().getTime()) {
        MessagePanes.showErrorDialog(
            this, props.getProperty("from_date_larger.name"), LocaleUtils.PERSIAN);
        return;
      }
    }

    if (txfFromDate.getDate() != null) {
      filterObject.setFromDate(txfFromDate.getDate());
      if (!previewHeaderText.equals(""))
        previewHeaderText +=
            " "
                + props.getProperty("from_date.name")
                + " "
                + StringUtils.RTL_MARK
                + txfFromDate.getDate();
    }
    if (txfToDate.getDate() != null) {
      filterObject.setToDate(txfToDate.getDate());
      if (!previewHeaderText.equals(""))
        previewHeaderText +=
            " "
                + props.getProperty("to_date.name")
                + " "
                + StringUtils.RTL_MARK
                + txfToDate.getDate();
    }
    if (txfToDate.getDate() == null && txfFromDate.getDate() == null)
      previewHeaderText = new String();

    dataFetcher.setReportObject(filterObject);
    grid.refresh();
    if (grid.getDataModel().getData().getDataList() == null
        || grid.getDataModel().getData().getDataList().size() == 0)
      MessagePanes.showInfoDialog(this, props.getProperty("empty_list.name"), LocaleUtils.PERSIAN);
  }
Пример #11
0
  public ResultPage findRealProfilePersonBySearchCriteria(
      RealProfilePerson realPerson,
      AbstractWorkGroup workGroup,
      Role roles,
      UserGroup userGroup,
      boolean checkChildren,
      int offset,
      int fetchSize,
      GridFilter gridFilter) {
    StringBuffer query =
        new StringBuffer(
            "SELECT realPerson.id FROM " + getPersistentClass().getName() + " realPerson");

    java.util.List<Object> params = new ArrayList<Object>();

    //		if (userGroup != null) {
    //            query.append("  JOIN realPerson.profile.userGroups userUserGroup"
    //                    + "  JOIN userUserGroup.userGroup userGroup ");
    //        }

    //        if (roles != null) {
    //            query.append("  JOIN realPerson.profile.userRoles as userRole "
    //                    + "  JOIN userRole.role role ");
    //        }

    //        if (workGroup != null) {
    //            query.append(", RegisterationUnit unit ");
    //        }

    query.append(" WHERE 1=1 ");

    setRealProfileCondition(realPerson, query, params);

    if (workGroup != null) {
      //            query.append("AND unit.profilePerson = realPerson.profile AND ");
      //            if(checkChildren){
      //            	query.append("(unit.workGroup = ? or unit.workGroup.parent= ?)");
      //            	params.add(workGroup);
      //            }else{
      //            	query.append("unit.workGroup = ?");
      //            }
      query.append(
          " AND realPerson.profile in (  select unit.profilePerson from RegisterationUnit unit where ");
      if (checkChildren) {
        query.append("(unit.workGroup = ? or unit.workGroup.parent= ?)) ");
        params.add(workGroup);
      } else {
        query.append("unit.workGroup = ?) ");
      }
      params.add(workGroup);
    }

    if (roles != null) {
      //            query.append(" AND role = ?");
      query.append(
          " AND realPerson.profile in (select r.profilePerson from UserRole r where r.role = ?) ");
      params.add(roles);
    }
    if (userGroup != null) {
      //            query.append(" AND userGroup = ?");
      query.append(
          " AND realPerson.profile in (select g.profilePerson from UserUserGroup g where g.userGroup = ?) ");

      params.add(userGroup);
    }

    if (StringUtils.isNotEmpty(realPerson.getFirstName())) {
      query.append(" AND UPPER(realPerson.firstName) LIKE ?");
      params.add("%" + realPerson.getFirstName() + "%");
    }

    if (StringUtils.isNotEmpty(realPerson.getLastName())) {
      query.append(" AND UPPER(realPerson.lastName) LIKE ?");
      params.add("%" + realPerson.getLastName() + "%");
    }

    if (StringUtils.isNotEmpty(realPerson.getNationalCode())) {
      query.append(" AND realPerson.nationalCode = ?");
      params.add(realPerson.getNationalCode());
    }

    if (StringUtils.isNotEmpty(realPerson.getStudentNumber())) {
      query.append(" AND realPerson.studentNumber = ?");
      params.add(realPerson.getStudentNumber());
    }

    if (StringUtils.isNotEmpty(realPerson.getCollegeName())) {
      query.append(" AND realPerson.collegeName LIKE ?");
      params.add("%" + realPerson.getCollegeName() + "%");
    }

    if (StringUtils.isNotEmpty(realPerson.getPersonelNumber())) {
      query.append(" AND realPerson.personelNumber = ?");
      params.add(realPerson.getPersonelNumber());
    }

    if (StringUtils.isNotEmpty(realPerson.getParent())) {
      query.append(" AND UPPER(realPerson.parent) LIKE ?");
      params.add("%" + realPerson.getParent() + "%");
    }

    if (StringUtils.isNotEmpty(realPerson.getRealNo())) {
      query.append(" AND realPerson.realNo = ?");
      params.add(realPerson.getRealNo());
    }

    query.append(" ORDER bY realPerson.id");
    ResultPage pageByCriteria =
        findPageByCriteria(
            query.toString(), params.toArray(), offset, fetchSize, gridFilter, "realPerson");
    return new ResultPage(
        getByIdList(getPersistentClass(), pageByCriteria.getResult()), pageByCriteria.getCount());
  }
    protected void run() {

      exchanger =
          new LoanMemberDatabaseExchange(
              txfImageURL.getText(),
              librarySelectedList,
              loanGroupSelectedList,
              (Location) cmbLocations.getSelectedItem(),
              props,
              cbUseUniqueNameToFindUser.isSelected(),
              cbIsOrg.isSelected(),
              cbIsUniversity.isSelected(),
              cbUseProfileSetting.isSelected());
      try {
        exchanger.setProgressListener(new EchangeProgressListener(this));
        exchanger.exchange(
            con,
            txfProfileDatabase.getText(),
            txfMultimediaDatabase.getText(),
            Long.valueOf(txfFromMemberNo.getText()),
            Long.valueOf(txfToMemberNo.getText()),
            txfImageURL.getText());
        MessagePanes.showInfoDialog(
            LoanMemberDataExchangeScreen.this,
            props.getProperty("successful-exchange.text"),
            getLocale());
      } catch (SQLException e) {
        if (con == null) {
          System.err.println("Could not establish connection");
          MessagePanes.showErrorDialog(
              LoanMemberDataExchangeScreen.this,
              props.getProperty("invalid-connection.text"),
              getLocale());
        } else {
          MessagePanes.showErrorDialog(
              LoanMemberDataExchangeScreen.this,
              props.getProperty("system-error.text"),
              getLocale());
        }
        e.printStackTrace();
      } catch (ImagePathException e) {
        MessagePanes.showErrorDialog(
            LoanMemberDataExchangeScreen.this,
            props.getProperty("not-valid--image-path.text")
                + "\n "
                + props.getProperty("test-file-exist1.text")
                + StringUtils.rtlString("test.pim")
                + props.getProperty("test-file-exist2.text"),
            getLocale());
        e.printStackTrace();
      } catch (Throwable e) {
        e.printStackTrace();
      } finally {
        if (con != null) {
          try {
            con.close();
          } catch (SQLException e) {
            e
                .printStackTrace(); // To change body of catch statement use File | Settings | File
                                    // Templates.
          }
        } else {
          System.err.println("Could not establish connection");
          MessagePanes.showErrorDialog(
              LoanMemberDataExchangeScreen.this,
              props.getProperty("invalid-connection.text"),
              getLocale());
        }
        //                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
      }
    }
  private boolean isValidData() {
    errorMessage = props.getProperty("fill-field.text");
    if (StringUtils.isEmpty(txfDatabaseURL.getText())) {
      errorMessage = errorMessage + "\n " + props.getProperty("database-url.text");
      txfDatabaseURL.requestFocus();
      return false;
    }
    if (StringUtils.isEmpty(txfProfileDatabase.getText())) {
      errorMessage = errorMessage + "\n " + props.getProperty("profile-database.text");
      txfDatabaseURL.requestFocus();
      return false;
    }
    if (StringUtils.isEmpty(txfImageURL.getText())) {
      errorMessage = errorMessage + "\n " + props.getProperty("image-url.text");
      txfImageURL.requestFocus();
      return false;
    }
    if (StringUtils.isEmpty(txfFromMemberNo.getText())) {
      errorMessage = errorMessage + "\n " + props.getProperty("from-member-no.text");
      txfFromMemberNo.requestFocus();
      return false;
    }
    if (StringUtils.isEmpty(txfToMemberNo.getText())) {
      errorMessage = errorMessage + "\n " + props.getProperty("to-membership-no.text");
      txfToMemberNo.requestFocus();
      return false;
    }
    if (StringUtils.isEmpty(txfUserName.getText())) {
      errorMessage = errorMessage + "\n " + props.getProperty("username.text");
      txfUserName.requestFocus();
      return false;
    }
    if (StringUtils.isEmpty(txfPassword.getText())) {
      errorMessage = errorMessage + "\n " + props.getProperty("password.text");
      txfPassword.requestFocus();
      return false;
    }

    librarySelectedList = new ArrayList<LibraryUnit>();
    loanGroupSelectedList = new ArrayList<LoanGroup>();
    for (int intRow = 0; tblLibrary.getRowCount() > intRow; intRow++) {
      if ((Boolean) tblLibrary.getValueAt(intRow, 2) == Boolean.TRUE) {
        if (((String) tblLibrary.getValueAt(intRow, 1)) != null) {
          List<LoanGroup> loanGroup =
              NliProfileServiceProxy.getInstance()
                  .findAllLoanGroupsByCodeTitleLibrary(
                      "",
                      (String) tblLibrary.getValueAt(intRow, 1),
                      "",
                      (LibraryUnit) libraryList.get(intRow),
                      0,
                      10000,
                      new GridFilter())
                  .getResult();

          if (loanGroup.get(0).getLoanGroupSetting() != null) {
            loanGroupSelectedList.add(loanGroup.get(0));
            librarySelectedList.add((LibraryUnit) libraryList.get(intRow));
          } else {
            errorMessage =
                props.getProperty("LoanGroupSetting.text")
                    + " : "
                    + ((LibraryUnit) libraryList.get(intRow)).getFarsiItemName();
            return false;
          }
        } else {
          errorMessage =
              props.getProperty("LoanGroupSetting.text")
                  + " : "
                  + ((LibraryUnit) libraryList.get(intRow)).getFarsiItemName();
          return false;
        }
      }
    }

    return true;
  }