/** * @param b */ private void populateSupplierCollection(Boolean bActive) { OrgShortVo voOrg = new OrgShortVo(); voOrg.setName(form.txtSupplierName().getValue()); OrgShortVoCollection voCollOrg = domain.listOrganisationForType(OrganisationType.SUPPLIER, voOrg, bActive); if(voCollOrg == null || voCollOrg.size() == 0) { engine.showMessage("No results found."); } OrgShortVoCollection voCollActiveOrgs = new OrgShortVoCollection(); OrgShortVoCollection voCollInactiveOrgs = new OrgShortVoCollection(); for(int i=0;i<voCollOrg.size();i++) { if(voCollOrg.get(i).getIsActiveIsNotNull() && voCollOrg.get(i).getIsActive().booleanValue()) voCollActiveOrgs.add(voCollOrg.get(i)); else voCollInactiveOrgs.add(voCollOrg.get(i)); } form.getLocalContext().setActiveSuppliers(voCollActiveOrgs); form.getLocalContext().setInActiveSuppliers(voCollInactiveOrgs); }
/** * @throws PresentationLogicException * */ private void removeSupplier() throws PresentationLogicException { if (form.treSuppliers().getSelectedNode() == null) return; if (form.treSuppliers().getSelectedNode().getValue() instanceof OrgShortVo) { form.getLocalContext().setbFullSaveRequired(Boolean.FALSE); form.btnSave().setEnabled(true); OrgShortVo voOrg = (OrgShortVo) form.treSuppliers().getSelectedNode().getValue(); voOrg.setIsActive(Boolean.FALSE); OrgShortVoCollection voCollInActiveSuppliers = form.getLocalContext().getInActiveSuppliers(); voCollInActiveSuppliers.add(voOrg); form.getLocalContext().setInActiveSuppliers(voCollInActiveSuppliers); form.treSuppliers().getNodes().remove(form.treSuppliers().getSelectedNode()); OrgShortVoCollection voCollActiveSuppliers = form.getLocalContext().getActiveSuppliers(); for (int i = 0; i < voCollActiveSuppliers.size(); i++) { if (voCollActiveSuppliers.get(i).equals(voOrg)) { voCollActiveSuppliers.remove(i); saveSupplier(voOrg); break; } } form.getLocalContext().setActiveSuppliers(voCollActiveSuppliers); onBtnSearchClick(); //populateSuppliersTree(); form.getContextMenus().getSupplierTreeMenuADDSUPPLIERItem().setVisible(true); } }
public OrgShortVoCollection listOrganisationsShort(OrgShortVo filter) { List orgs = listDomOrganisation(filter); OrgShortVoCollection voCollOrgShorts = OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(orgs); voCollOrgShorts.sort(); return voCollOrgShorts; }
public OrgShortVoCollection listOrganisation() { DomainFactory factory = getDomainFactory(); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); StringBuffer condStr = new StringBuffer(); String andStr = " and "; List orgs = null; String hql = " from Organisation o where o.type.id != " + OrganisationType.SUPPLIER.getID(); condStr.append(andStr + " (o.type != :GP or o.type.id is null)"); markers.add("GP"); values.add(getDomLookup(OrganisationType.GPP)); condStr.append(andStr + " o.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); condStr.append(andStr + " o.parentOrganisation is null"); hql += condStr.toString(); orgs = factory.find(hql, markers, values); return OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(orgs).sort(); }
public OrgShortVo getOrganisationShort(String name) { if(name == null) throw new CodingRuntimeException("The Organisation Name must not be null. "); if(name != null) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from Organisation as o1_1 where "); String andStr = " "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); hql.append(andStr + " o1_1.name = :NAME"); markers.add("NAME"); values.add(name); andStr = " and "; hql.append(andStr + " o1_1.isActive = :ACTIVE"); markers.add("ACTIVE"); values.add(Boolean.TRUE); List list = factory.find(hql.toString(), markers,values); if(list != null && list.size() > 0) { OrgShortVoCollection voColl = OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(list); if(voColl != null && voColl.size() > 0) return voColl.get(0); } } return null; }
public OrgShortVoCollection getOrganisationShortCollection(String name) { if(name == null) throw new CodingRuntimeException("The Organisation Name must not be null. "); if(name != null) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from Organisation as o1_1 where "); String andStr = " "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); hql.append(andStr + " o1_1.name = :NAME"); markers.add("NAME"); values.add(name); andStr = " and "; hql.append(andStr + " o1_1.isActive = :ACTIVE"); markers.add("ACTIVE"); values.add(Boolean.TRUE); List list = factory.find(hql.toString(), markers,values); if(list != null && list.size() > 0) { OrgShortVoCollection voColl = OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(list); return voColl; } } return null; }
public OrgShortVoCollection listOrganisationsShort(OrgShortVo filter) { ReportRunnerDialog impl = (ReportRunnerDialog) getDomainImpl(ReportRunnerDialogImpl.class); return impl.listOrganisationsShort(filter); }
public OrgShortVoCollection listOrganisationsShort(OrgShortVo filter) { OrganisationAndLocation organisationAndLocation = (OrganisationAndLocation) getDomainImpl(OrganisationAndLocationImpl.class); return organisationAndLocation.listOrganisationsShort(filter); }
/** * @throws PresentationLogicException * */ private void restoreSupplier() throws PresentationLogicException { if (form.treSuppliers().getSelectedNode() == null) return; if (form.treSuppliers().getSelectedNode().getValue() instanceof OrgShortVo) { OrgShortVo voOrg = (OrgShortVo) form.treSuppliers().getSelectedNode().getValue(); //--------------- if(voOrg != null && voOrg.getNameIsNotNull()) { OrgShortVo orgVo1 = domain.getOrganisationShort(voOrg.getName()); if(orgVo1 != null) { engine.showErrors(new String[]{"An active Provider with the same Name already exist"}); form.treSuppliers().setValue(null); form.getContextMenus().getSupplierTreeMenuADDSUPPLIERItem().setVisible(true); clearDetailsTab(); return; } } //--------------- form.getLocalContext().setbFullSaveRequired(Boolean.TRUE); form.btnSave().setEnabled(true); voOrg.setIsActive(Boolean.TRUE); OrgShortVoCollection voCollActiveSuppliers = form.getLocalContext().getActiveSuppliers(); voCollActiveSuppliers.add(voOrg); form.getLocalContext().setActiveSuppliers(voCollActiveSuppliers); form.treSuppliers().getNodes().remove(form.treSuppliers().getSelectedNode()); OrgShortVoCollection voCollInActiveSuppliers = form.getLocalContext().getInActiveSuppliers(); for (int i = 0; i < voCollInActiveSuppliers.size(); i++) { if (voCollInActiveSuppliers.get(i).equals(voOrg)) { voCollInActiveSuppliers.remove(i); saveSupplier(voOrg); break; } } form.getLocalContext().setInActiveSuppliers(voCollInActiveSuppliers); //populateSuppliersTree(); onBtnSearchClick(); } }
public OrgShortVoCollection list(Boolean activeOnly) { return OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation( getDomainFactory().find("select o1_1 from Organisation as o1_1 where (o1_1.type = -82) ")); }
public OrgShortVoCollection listOrganisationForType(OrganisationType type, OrgShortVo voOrgShort, Boolean bActive) { if (type == null) throw new DomainRuntimeException("No type provided for listOrganisationForType"); DomainFactory factory = getDomainFactory(); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String hql = " from Organisation o "; StringBuffer condStr = new StringBuffer(); String andStr = " "; List orgs = null; condStr.append(andStr + " o.type.id = " + type.getID()); andStr = " and "; if (voOrgShort != null && voOrgShort.getNameIsNotNull()) { String name = voOrgShort.getName(); if (name.endsWith("%")) name = name.substring(0,name.length()-1); condStr.append(andStr + " (upper(o.name) like :orgName "); markers.add("orgName"); values.add("%"+ name.toUpperCase() + "%"); condStr.append(")"); andStr = " and "; } if (bActive != null) { condStr.append(andStr + "o.isActive = :active"); markers.add("active"); values.add(bActive); } hql += " where "; hql += condStr.toString(); orgs = factory.find(hql, markers, values, 1000); OrgShortVoCollection voCollOrgs = OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(orgs); voCollOrgs.sort(); return voCollOrgs; }
public OrgShortVoCollection listOrganisationsShort(OrgShortVo filter) { OrganisationAndLocation orgLocImpl = (OrganisationAndLocation) getDomainImpl(OrganisationAndLocationImpl.class); return orgLocImpl.listOrganisationsShort(filter); }