private void cmbLocationValueChanged() { LocShortVo voLoc = form.ctnServiceDetail().cmbLocation().getValue(); form.ctnServiceDetail().txtAddressService().setValue(null); if (voLoc != null) { if (voLoc.getAddressIsNotNull()) form.ctnServiceDetail().txtAddressService().setValue(voLoc.getAddress().toDisplayStringForMultiLineTextBox()); LocationServiceVo voLocService = domain.getLocationService(voLoc, form.ctnServiceDetail().cmbService().getValue()); if (voLocService == null) return; form.getLocalContext().setlocationService(voLocService); if (voLocService.getContact() != null) { if(voLocService.getContact().getNameIsNotNull()) form.ctnServiceDetail().txtContactPerson().setValue(voLocService.getContact().getName().toString()); form.ctnServiceDetail().txtPhoneNoService().setValue(voLocService.getContact().getContactNumber()); } } }
private void cmbLocationValueChanged() { LocShortVo voLoc = form.lyrProServices().tabServices().cmbLocation().getValue(); if (voLoc != null) { if (voLoc.getAddressIsNotNull()) form.lyrProServices().tabServices().txtAddressService().setValue(voLoc.getAddress().toDisplayStringForMultiLineTextBox()); LocationServiceVo voLocService = domain.getLocationService(voLoc, form.lyrProServices().tabServices().cmbService().getValue()); if (voLocService == null) return; form.getLocalContext().setlocationService(voLocService); if (voLocService.getContact() != null) { if (voLocService.getContact().getNameIsNotNull()) form.lyrProServices().tabServices().txtContactPerson().setValue(voLocService.getContact().getName().toString()); form.lyrProServices().tabServices().txtPhoneNoService().setValue(voLocService.getContact().getContactNumber()); } } else form.lyrProServices().tabServices().txtAddressService().setValue(null); }
private void cmbLocationValueChanged() { LocationServiceVo voLoc = form.lyrSupportServices().tabPageServices().cmbLocationServices().getValue(); if (voLoc != null && voLoc.getLocationIsNotNull()) { if (voLoc.getLocation().getAddressIsNotNull()) form.lyrSupportServices().tabPageServices().txtAddressService().setValue(voLoc.getLocation().getAddress().toDisplayStringForMultiLineTextBox()); if (voLoc.getContact() != null) { if (voLoc.getContact().getNameIsNotNull()) form.lyrSupportServices().tabPageServices().txtContactPerson().setValue(voLoc.getContact().getName().toString()); form.lyrSupportServices().tabPageServices().txtPhoneNoService().setValue(voLoc.getContact().getContactNumber()); } } else form.lyrSupportServices().tabPageServices().txtAddressService().setValue(null); }
private StringBuilder getFormattedNodeDetails(TreeNode node, StringBuilder out) { if (node.getValue() instanceof LocShortVo) { LocShortVo vo = (LocShortVo) node.getValue(); out = formatLocationDetails(out, vo); if (node.isExpanded()) { TreeNodeCollection treeNodeColl = node.getNodes(); for (int i = 0; i < treeNodeColl.size(); i++) { out = getFormattedNodeDetails(treeNodeColl.get(i), out); } } } else if (node.getValue() instanceof LocationServiceVo) { out = formatServiceDetails(out, (LocationServiceVo) node.getValue()); } return out; }
private void populateScreenFromDataContact(LocationServiceVo voLocService) { if (voLocService.getContactIsNotNull()) { if (voLocService.getContact().getNameIsNotNull()) { form.lyr1().Edit().lyrLocationDetail().tabPageContact().txtForename().setValue(voLocService.getContact().getName().getForenameIsNotNull() ? voLocService.getContact().getName().getForename() : null); form.lyr1().Edit().lyrLocationDetail().tabPageContact().txtSurname().setValue(voLocService.getContact().getName().getSurnameIsNotNull() ? voLocService.getContact().getName().getSurname() : null); form.lyr1().Edit().lyrLocationDetail().tabPageContact().txtMiddleName().setValue(voLocService.getContact().getName().getMiddleNameIsNotNull() ? voLocService.getContact().getName().getMiddleName() : null); form.lyr1().Edit().lyrLocationDetail().tabPageContact().cmbTitle().setValue(voLocService.getContact().getName().getTitleIsNotNull() ? voLocService.getContact().getName().getTitle() : null); } form.lyr1().Edit().lyrLocationDetail().tabPageContact().txtContactNumber().setValue(voLocService.getContact().getContactNumberIsNotNull() ? voLocService.getContact().getContactNumber() : null); } // WDEV-2895 if (voLocService.getDefaultPrinter() != null) { form.lyr1().Edit().lyrLocationDetail().tabPageContact().qmbPrinter().newRow(voLocService.getDefaultPrinter(), voLocService.getDefaultPrinter()); form.lyr1().Edit().lyrLocationDetail().tabPageContact().qmbPrinter().setValue(voLocService.getDefaultPrinter()); } }
protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException { if (save() == false) return; TreeNode node = form.treHeader().getSelectedNode(); if (node != null) { Object value = node.getValue(); // this came from an Add Provider User action if (value instanceof LocationServiceVo) addProviderSystem(node); treeViewSelectionChanged(node); } form.setMode(FormMode.VIEW); }
/** * @param node */ private void addProviderSystem(TreeNode node) { Object value = node.getValue(); if (value instanceof LocationServiceVo) { LocSvcProviderSysVoCollection voLocSvcProviderSys = null; if (node.getNodes().size() > 0) { node.getNodes().clear(); // get list of locserviceproviders for this locationservice voLocSvcProviderSys = domain.listLocationServiceProvider(((LocationServiceVo) value).getID_LocationService()); if (voLocSvcProviderSys != null) { for (int i = 0; i < voLocSvcProviderSys.size(); i++) { TreeNode providerNode = node.getNodes().add(voLocSvcProviderSys, getProviderSystemName(voLocSvcProviderSys.get(i))); providerNode.setExpandedImage(form.getImages().OCRR.Provider); providerNode.setCollapsedImage(form.getImages().OCRR.Provider); } } } } }
public ims.core.vo.LocationServiceVo saveLocationService(ims.core.vo.LocationServiceVo locationService) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.ForeignKeyViolationException, ims.domain.exceptions.UniqueKeyViolationException { DomainFactory factory = getDomainFactory(); LocationService doLocService = LocationServiceVoAssembler.extractLocationService(factory, locationService); try { factory.save(doLocService); locationService = LocationServiceVoAssembler.create(doLocService); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException(locationService.getService().getServiceName().toString() + " already exists. Duplicates not allowed.", e); } return locationService; }
public void removeLocationService(ims.core.vo.LocationServiceVo voLocationService) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.ForeignKeyViolationException { DomainFactory factory = getDomainFactory(); LocationService doLocService = LocationServiceVoAssembler.extractLocationService(factory, voLocationService); try { try { factory.delete(doLocService); } catch (ForeignKeyViolationException e) { throw new ForeignKeyViolationException(e.getMessage()); } } catch (DomainRuntimeException re) // SN: catching // DomainRuntimeException here as // this is what Hib is returning // with e.getCause() = // ConstrainViolationException { throw new ForeignKeyViolationException(re.getMessage()); } return; }
private String activeLocationServiceLinks(ims.core.vo.ServiceVo voService) { LocationService impl = (LocationService) getDomainImpl(LocationServiceImpl.class); LocationServiceVo voLocSer = new LocationServiceVo(); voLocSer.setService(voService); voLocSer.setIsActive(new Boolean(true)); LocationServiceVoCollection voColl = impl.listLocationService(voLocSer); if (voColl != null && voColl.size() > 0) { String activeMessage = "These " + ConfigFlag.UI.DISPLAY_NAME_LOCATION.getValue(true) + " contain active records for the " + ConfigFlag.UI.DISPLAY_NAME_SERVICE.getValue(false) + " : " + voService.getServiceName(); for (int i = 0; i < voColl.size(); i++) { activeMessage += "\r\n" + voColl.get(i).getLocation().getName(); } return activeMessage; } else return null; }
public LocationServiceVo getLocationService(LocShortVo locShort, ServiceRefVo service) { if (locShort == null || service == null) throw new DomainRuntimeException("Failed to get LocationService record, location and/or service not supplied"); DomainFactory factory = getDomainFactory(); List lstLocService = factory.find("from LocationService locService where locService.location.id = :locationId and locService.service.id = :serviceId", new String[]{"locationId", "serviceId"}, new Object[]{locShort.getID_Location(), service.getID_Service()}); LocationServiceVoCollection voCollLocServices = LocationServiceVoAssembler.createLocationServiceVoCollectionFromLocationService(lstLocService); if (voCollLocServices != null && voCollLocServices.size() > 0) return voCollLocServices.get(0); return null; }
public LocationServiceVo getLocationService(LocationRefVo location, ServiceRefVo service) { if(location == null || service == null) throw new CodingRuntimeException("location and service are madatory in method getLocationService"); DomainFactory factory = getDomainFactory(); List locServics = factory.find("from LocationService locSer where locSer.location.id = :idLocation and locSer.service.id = :idService", new String[] {"idLocation", "idService"}, new Object[] { location.getID_Location(), service.getID_Service()}); if(locServics != null && locServics.size() > 0) return LocationServiceVoAssembler.create((ims.core.resource.place.domain.objects.LocationService) locServics.get(0)); return null; }
private boolean checkServiceExists(ServiceShortVo voServiceShort, LocationServiceVo voLocationService) { ServiceVo voService = new ServiceVo(); voService.setID_Service(voServiceShort.getID_Service()); voLocationService.setService(voService); return (domain.listLocationService(voLocationService).size() > 0); }
private void removeService() { if (form.getLocalContext().getSelectedRecordLocationServiceIsNotNull()) { if ((form.treHeader().getSelectedNode().getValue() != null) && (form.treHeader().getSelectedNode().getValue() instanceof LocationServiceVo)) { LocationServiceVo voLocSer = (LocationServiceVo) form.treHeader().getSelectedNode().getValue(); try { try { domain.removeLocationService(voLocSer); if (form.treHeader().getSelectedNode().getParent() != null) { try { onTreHeaderTreeViewSelectionChanged(form.treHeader().getSelectedNode().getParent()); } catch (PresentationLogicException pe) { engine.showMessage(pe.getMessage()); } } } catch (ForeignKeyViolationException fe) { if (form.getLocalContext().getSelectedRecordLocationService().getServiceIsNotNull()) engine.showMessage("Cannot remove " + ConfigFlag.UI.DISPLAY_NAME_SERVICE.getValue() + " : " + (form.getLocalContext().getSelectedRecordLocationService().getService().getServiceNameIsNotNull() ? form.getLocalContext().getSelectedRecordLocationService().getService().getServiceName() : "") + ". It is already referenced."); else engine.showMessage("Cannot remove this" + ConfigFlag.UI.DISPLAY_NAME_SERVICE.getValue() + " as it is already referenced."); } } catch (StaleObjectException se) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); populateLocationServices(form.treHeader().getSelectedNode().getParent(), (LocShortVo) form.treHeader().getSelectedNode().getParent().getValue()); } } } }
private String[] validateRules(LocationServiceVo voLocService) { if (voLocService == null || !voLocService.getServiceIsNotNull()) return null; if (!voLocService.getService().getIsActiveIsNotNull() || !voLocService.getService().getIsActive().booleanValue()) return new String[]{"Service "+voLocService.getService().getServiceName()+" is not active"}; return null; }