public void moveRightLeft() { Collection<Enrollment> studentRSelects = (Collection<Enrollment>) lstStudentSelecteds.getValue(); List<Enrollment> lstLeftSelecteds = new ArrayList<Enrollment>(); for (Enrollment enr : studentRSelects) { lstLeftSelecteds.add(enr); for (Enrollment itemRem : (Collection<Enrollment>) lstStudentSelecteds.getItemIds()) { if (enr.getId().equals(itemRem.getId())) { lstStudentSelecteds.removeItem(itemRem); break; } } } for (Enrollment enr : (Collection<Enrollment>) lstStudents.getItemIds()) { boolean flagExist = false; for (Enrollment itemAdd : lstLeftSelecteds) { if (enr.getId().equalsIgnoreCase(itemAdd.getId())) { flagExist = true; } } if (flagExist == false) { lstLeftSelecteds.add(enr); } } loadStudents(lstLeftSelecteds); }
private boolean dtlValidation() { boolean isValid = true; if (cbUom.getValue() == null) { cbUom.setComponentError(new UserError(GERPErrorCodes.NULL_MATERIAL_UOM)); isValid = false; } else { cbUom.setComponentError(null); } if ((tfEnqQty.getValue() == "0")) { tfEnqQty.setComponentError(new UserError(GERPErrorCodes.NULL_ENQUIRY_QTY)); isValid = false; } else { tfEnqQty.setComponentError(null); isValid = true; } Long achievedQty; try { achievedQty = Long.valueOf(tfEnqQty.getValue()); if (achievedQty < 0) { tfEnqQty.setComponentError(new UserError(GERPErrorCodes.LESS_THEN_ZERO)); isValid = false; } } catch (Exception e) { tfEnqQty.setComponentError(new UserError(GERPErrorCodes.QUNATITY_CHAR_VALIDATION)); isValid = false; } if (lsProduct.getValue() == null) { lsProduct.setComponentError(new UserError(GERPErrorCodes.NULL_PRODUCT_NAME)); isValid = false; } else { lsProduct.setComponentError(null); } return isValid; }
@Override protected void validateDetails() throws ValidationException { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Validating Data "); Boolean errorFlag = false; if (cbBranch.getValue() == null) { cbBranch.setComponentError(new UserError(GERPErrorCodes.NULL_BRACH_NAME)); errorFlag = true; } else { cbBranch.setComponentError(null); errorFlag = false; } if (lsVendorName.getValue() == null || lsVendorName.getValue().toString() == "[]") { lsVendorName.setComponentError(new UserError(GERPErrorCodes.NULL_VENDOR_NAME)); errorFlag = true; } else { lsVendorName.setComponentError(null); errorFlag = false; } if (tblSmsEnqDtl.size() == 0) { cbUom.setComponentError(new UserError(GERPErrorCodes.NULL_MATERIAL_UOM)); tfEnqQty.setComponentError(new UserError(GERPErrorCodes.NULL_ENQUIRY_QTY)); lsProduct.setComponentError(new UserError(GERPErrorCodes.NULL_PRODUCT_NAME)); errorFlag = true; } if ((dfEnqDate.getValue() != null) || (dfDueDate.getValue() != null)) { if (dfEnqDate.getValue().after(dfDueDate.getValue())) { dfDueDate.setComponentError(new UserError(GERPErrorCodes.MMS_DATE_OUTOFRANGE)); logger.warn( "Company ID : " + companyid + " | User Name : " + username + " > " + "Throwing ValidationException. User data is > " + dfEnqDate.getValue()); errorFlag = true; } } if (errorFlag) { throw new ERPException.ValidationException(); } }
@Override public void buttonClick(final ClickEvent event) { final Object o = orgUnitList.getValue(); if (o instanceof Set) { final Set set = (Set) o; for (final Object ob : set) { orgUnitList.removeItem(ob); } } else if (o != null) { orgUnitList.removeItem(o); } }
@Override public void buttonClick(ClickEvent event) { switch ((Integer) event.getButton().getData()) { case ADD_NEW_CATEGORY: try { catFrm.commit(); if (catFrm.isValid()) { accSvc.addNewPaymentCategory( (String) catFrm.getField(ADD_CATG_FLD_NAME).getValue(), ((CheckBox) catFrm.getField(ADD_CATG_CREDIT_BOOL)).booleanValue(), balSheet); } } catch (InvalidValueException e) { // Ignoring InvalidValueException as // an appropriate msg is displayed in UI } catch (AccountsSheetException e) { close(); Messenger.genericMessage( MessageSeverity.ERROR, STRINGS.getString(AccountsMessages.MSGR_UNRECOVERABLE_ERROR), "Failed trying to add Payment Categories for Balance Sheet", e); } break; case ADD_NEW_TYPE: try { typeFrm.commit(); if (typeFrm.isValid()) { accSvc.addNewPaymentType( (String) typeFrm.getField(ADD_TYPE_FLD_NAME).getValue(), categories.get(typeFrm.getField(ADD_TYPE_FLD_CAT).getValue())); } } catch (InvalidValueException e) { // Ignoring InvalidValueException as // an appropriate msg is displayed in UI } catch (AccountsSheetException e) { close(); Messenger.genericMessage( MessageSeverity.ERROR, STRINGS.getString(AccountsMessages.MSGR_UNRECOVERABLE_ERROR), "Failed trying to add Payment Types for Balance Sheet", e); } break; } populatePaymentCategories(); populatePaymentTypes(categories.get(paymentCategories.getValue())); accordion.setSelectedTab(current); }
public PaymentTypeMgmt(BalanceSheet sheet) { super(AccountsMessages.BAL_SHEET_NEW_PAY_TYPE); this.balSheet = sheet; setWidth("320px"); setIcon(IconManager.getIcon(IconManager.CATG_MGMT_SM)); accordion = new Accordion(); accordion.setSizeFull(); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); VerticalLayout vl1 = new VerticalLayout(); vl1.setSpacing(true); paymentCategories = new ListSelect(STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_CATEGORY)); populatePaymentCategories(); paymentCategories.setNullSelectionAllowed(false); paymentCategories.setImmediate(true); paymentCategories.setRows(NUM_ROWS); paymentCategories.addListener(this); Set<String> keys = categories.keySet(); if (keys.size() > 0) paymentCategories.select(keys.iterator().next()); vl1.addComponent(paymentCategories); hl.addComponent(vl1); VerticalLayout vl2 = new VerticalLayout(); vl2.setSpacing(true); paymentTypes = new ListSelect(STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_TYPE)); populatePaymentTypes(categories.get(paymentCategories.getValue())); paymentTypes.setNullSelectionAllowed(false); paymentTypes.setImmediate(true); paymentTypes.setRows(NUM_ROWS); vl2.addComponent(paymentTypes); hl.addComponent(vl2); current = accordion.addTab(hl); current.setCaption(STRINGS.getString(AccountsMessages.CURRENT)); addNewCategory = accordion.addTab(generateCreateNewCategoryForm()); addNewCategory.setCaption( STRINGS.getString(AccountsMessages.ADD_NEW) + " " + STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_CATEGORY)); addNewType = accordion.addTab(generateCreateNewTypeForm()); addNewType.setCaption( STRINGS.getString(AccountsMessages.ADD_NEW) + " " + STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_TYPE)); addComponent(accordion); }
@Override public void valueChange(ValueChangeEvent event) { populatePaymentTypes(categories.get(paymentCategories.getValue())); }
private void saveEnqDtl() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Saving Data... "); try { int count = 0; String[] split = lsProduct.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(","); for (String obj : split) { if (obj.trim().length() > 0) { for (SmsPurEnqDtlDM smsPurEnqDtlDM : listEnqDtls) { if (smsPurEnqDtlDM.getProductId().equals(Long.valueOf(obj.trim()))) { count++; break; } } if (tblSmsEnqDtl.getValue() != null) { count = 0; } if (count == 0) { SmsPurEnqDtlDM enqDtlObj = new SmsPurEnqDtlDM(); if (tblSmsEnqDtl.getValue() != null) { enqDtlObj = beanPurEnqDtlDM.getItem(tblSmsEnqDtl.getValue()).getBean(); listEnqDtls.remove(enqDtlObj); } if (lsProduct.getValue() != null) { enqDtlObj.setProductId(Long.valueOf(obj.trim())); enqDtlObj.setPordName( serviceProduct .getProductList( null, Long.valueOf(obj.trim()), null, null, null, null, null, "P") .get(0) .getProdname()); } if (cbUom.getValue() != null) { cbUom.setReadOnly(false); enqDtlObj.setProductUom(cbUom.getValue().toString()); cbUom.setReadOnly(true); } enqDtlObj.setRemarks(taEnqDtlRem.getValue().toString()); if (tfEnqQty.getValue() != null && tfEnqQty.getValue().trim().length() > 0) { enqDtlObj.setEnquiryQty(Long.valueOf(tfEnqQty.getValue())); } if (cbEnqDtlStatus.getValue() != null) { enqDtlObj.setEnqDtlStaus((cbEnqDtlStatus.getValue().toString())); } enqDtlObj.setLastUpdateddt(DateUtils.getcurrentdate()); enqDtlObj.setLastUpdatedby(username); listEnqDtls.add(enqDtlObj); loadPurDtl(); btnaddSpec.setCaption("Add"); count = 0; } else { lsProduct.setComponentError(new UserError("Product Already Exist..")); } } } enqDtlresetFields(); } catch (Exception e) { logger.info(e.getMessage()); } }
@Override protected void saveDetails() throws SaveException, FileNotFoundException, IOException { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Saving Data... "); try { SmsPurEnqHdrDM purEnqobj = new SmsPurEnqHdrDM(); if (tblMstScrSrchRslt.getValue() != null) { purEnqobj = beanPurEnqHdrDM.getItem(tblMstScrSrchRslt.getValue()).getBean(); purEnqobj.setEnquiryNo(tfEnqNo.getValue()); } purEnqobj.setEnquiryNo(tfEnqNo.getValue()); purEnqobj.setCompanyId(companyid); purEnqobj.setEnqRemark(taEnqRem.getValue().toString()); purEnqobj.setBranchId((Long) cbBranch.getValue()); purEnqobj.setDueDate((Date) dfDueDate.getValue()); purEnqobj.setEnquiryDate((Date) dfEnqDate.getValue()); purEnqobj.setEnquiryStatus(((String) cbEnqStatus.getValue())); purEnqobj.setPreparedBy(employeeId); purEnqobj.setReviewedBy(null); purEnqobj.setActionedBy(null); purEnqobj.setLastUpdateddt(DateUtils.getcurrentdate()); purEnqobj.setLastUpdatedby(username); serviceSmsPurEnqHdr.saveorUpdateSmsPurEnqHdrDetails(purEnqobj); enquiryId = purEnqobj.getEnquiryId(); String[] split = lsVendorName.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(","); for (String obj : split) { if (obj.trim().length() > 0) { EnquiryVendorDtlDM enqvendtl = new EnquiryVendorDtlDM(); enqvendtl.setEnqid(purEnqobj.getEnquiryId()); System.out.println("vendid" + Long.valueOf(obj.trim())); enqvendtl.setVendorid(Long.valueOf(obj.trim())); serviceEnquiryVendorDtl.save(enqvendtl); } } @SuppressWarnings("unchecked") Collection<SmsPurEnqDtlDM> itemIds = (Collection<SmsPurEnqDtlDM>) tblSmsEnqDtl.getVisibleItemIds(); for (SmsPurEnqDtlDM save : (Collection<SmsPurEnqDtlDM>) itemIds) { save.setEnquiryId(Long.valueOf(purEnqobj.getEnquiryId().toString())); serviceSmsPurEnqDtl.saveorUpdateSmsPurEnqDtlDetails(save); } comments.resetfields(); if (tblMstScrSrchRslt.getValue() == null) { try { SlnoGenDM slnoObj = serviceSlnogen.getSequenceNumber(companyid, branchId, moduleId, "SM_ENQRYNO").get(0); if (slnoObj.getAutoGenYN().equals("Y")) { serviceSlnogen.updateNextSequenceNumber(companyid, branchId, moduleId, "SM_ENQRYNO"); } } catch (Exception e) { } } tfEnqNo.setReadOnly(false); tfEnqNo.setValue(purEnqobj.getEnquiryNo()); tfEnqNo.setReadOnly(true); comments.saveEnquiry(purEnqobj.getEnquiryId(), purEnqobj.getEnquiryStatus()); loadSrchRslt(); enqDtlresetFields(); } catch (Exception e) { logger.info(e.getMessage()); } }