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 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(); }
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; }