private void populateTabs(TrackingConfigurationVo trackingConfig) { if (trackingConfig != null) { form.lyr1().tabAreaDefinition().ccAreaDefinition().setValue(trackingConfig.getAreas()); form.lyr1().tabAreaDefinition().ccAreaDefinition().initialize(form.chkActive().getValue()); if (form.lyr1().tabSendToConfig().isVisible()) { // form.lyr1().tabSendToConfig().ccSendToConfig().setValue(form.getLocalContext().getTrackingArea()); //form.lyr1().tabSendToConfig().ccSendToConfig().setValue(form.lyr1().tabSendToConfig().ccSendToConfig().getFromAreaCombo()); form.lyr1().tabSendToConfig().ccSendToConfig().setValue(form.getLocalContext().getAreaFromSendToConfig()); } else if (form.lyr1().tabAreaWorkspace().isVisible()) // WDEV-14347 { // form.lyr1().tabAreaWorkspace().ccAreaWorkspaceConfig().setValue(form.getLocalContext().getTrackingArea()); //form.lyr1().tabAreaWorkspace().ccAreaWorkspaceConfig().setValue(form.lyr1().tabAreaWorkspace().ccAreaWorkspaceConfig().getFromAreaCombo()); form.lyr1().tabAreaWorkspace().ccAreaWorkspaceConfig().setValue(form.getLocalContext().getAreaFromAreaWorkspace()); } } }
private void populateGridToArea() { //TrackingAreaVoCollection collAreas = domain.getAreasDefinitions(form.cmbFromArea().getValue().getEDLocation()); TrackingConfigurationVo trackConfig = domain.getTrackingConfig(form.cmbFromArea().getValue().getEDLocation()); if (trackConfig==null) return; TrackingAreaVoCollection collAreas = trackConfig.getAreas(); if (collAreas==null) return; for (int i=0;i<collAreas.size();i++) { if (collAreas.get(i).getIsRegistrationArea() || collAreas.get(i).getIsOverallView() || (collAreas.get(i).getStatusIsNotNull() && PreActiveActiveInactiveStatus.INACTIVE.equals(collAreas.get(i).getStatus()))) continue; if (!collAreas.get(i).equals(form.cmbFromArea().getValue())) { addRow(collAreas.get(i)); } } }
public TrackingConfigurationVo save(TrackingConfigurationVo trackingConfigToSave) throws StaleObjectException, UniqueKeyViolationException { if (trackingConfigToSave == null ) throw new CodingRuntimeException("Cannot save TrackingConfiguration if null or get TrackingConfiguration on null ID . "); if (!trackingConfigToSave.isValidated()) throw new CodingRuntimeException("TrackingConfigurationVo not Validated"); try { DomainFactory factory = getDomainFactory(); TrackingConfiguration trackingConfig = TrackingConfigurationVoAssembler.extractTrackingConfiguration(factory,trackingConfigToSave); factory.save(trackingConfig); return TrackingConfigurationVoAssembler.create(trackingConfig); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("This Configuration Already Exist!", e); } }
public Boolean isStale(TrackingConfigurationVo trackingConfig) { if (trackingConfig == null || trackingConfig.getID_TrackingConfiguration() == null) { throw new CodingRuntimeException("Cannot get TrackingConfigurationVo on null Id "); } DomainFactory factory = getDomainFactory(); TrackingConfiguration domainTrackingConfig = (TrackingConfiguration) factory.getDomainObject(TrackingConfiguration.class, trackingConfig.getID_TrackingConfiguration()); if(domainTrackingConfig==null) { return true; } if (domainTrackingConfig.getVersion() > trackingConfig.getVersion_TrackingConfiguration()) { return true; } return false; }
public TrackingConfigurationVo getTrackingConfig(LocationRefVo locationID) { if(locationID == null) throw new CodingRuntimeException("Can not get TrackingConfiguration value on null locationID."); StringBuffer hql = new StringBuffer(); hql.append("select trackConfig from TrackingConfiguration as trackConfig "); hql.append("where trackConfig.eDLocation.id = :locationID "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"locationID"}, new Object[] {locationID.getID_Location()}); if (list!=null && list.size()>0) { return TrackingConfigurationVoAssembler.createTrackingConfigurationVoCollectionFromTrackingConfiguration(list).get(0); } return null; }
public TrackingConfigurationVo getTrackingConfig(LocationRefVo locationId) { if(locationId == null) throw new CodingRuntimeException("Can not get TrackingConfiguration value on null locationID."); StringBuffer hql = new StringBuffer(); hql.append("select trackConfig from TrackingConfiguration as trackConfig "); hql.append("where trackConfig.eDLocation.id = :locationID "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"locationID"}, new Object[] {locationId.getID_Location()}); if (list!=null && list.size()>0) { return TrackingConfigurationVoAssembler.createTrackingConfigurationVoCollectionFromTrackingConfiguration(list).get(0); } return null; }
public TrackingConfigurationVo getTrackingConfig(LocationRefVo locationRef) { if(locationRef == null) throw new CodingRuntimeException("Can not get TrackingConfiguration value on null locationID."); StringBuffer hql = new StringBuffer(); hql.append("select trackConfig from TrackingConfiguration as trackConfig "); hql.append("where trackConfig.eDLocation.id = :locationID "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"locationID"}, new Object[] {locationRef.getID_Location()}); if (list!=null && list.size()>0) { return TrackingConfigurationVoAssembler.createTrackingConfigurationVoCollectionFromTrackingConfiguration(list).get(0); } return null; }
private TrackingAreaVo populateTrackingArea(TrackingAreaVo areaToAdd) { TrackingConfigurationVo tracking = form.getLocalContext().getcurrentTrackingConfig(); TrackingAreaVo areaToSave = new TrackingAreaVo(); TrackingAreaVoCollection collAreas = tracking.getAreas(); for (int i = 0; i < collAreas.size(); i++) { if (collAreas.get(i).getIsOverallView() && areaToAdd.getIsOverallView()) { areaToSave = collAreas.get(i); break; } else if (collAreas.get(i).getIsRegistrationArea() && areaToAdd.getIsRegistrationArea()) { areaToSave = collAreas.get(i); break; } } ColumnDetailVoCollection collColumnsToAdd = areaToAdd.getColumns(); for (int i = 0; i < collColumnsToAdd.size(); i++) { collColumnsToAdd.get(i).setID_ColumnDetail(null); areaToSave.getColumns().add(collColumnsToAdd.get(i)); } return areaToSave; }
public TrackingConfigurationVo saveTrackinConfig(TrackingConfigurationVo trackingConfigToSave, TrackingAreaVo trackingAreaToSave) throws StaleObjectException { if (trackingConfigToSave == null && trackingAreaToSave==null) throw new CodingRuntimeException("Cannot save TrackingConfiguration/TrackingArea if null or get TrackingConfiguration/TrackingArea on null ID . "); DomainFactory factory = getDomainFactory(); if (trackingConfigToSave!=null) { if (!trackingConfigToSave.isValidated()) throw new CodingRuntimeException("TrackingConfigurationVo not Validated"); TrackingConfiguration trackingConfig = TrackingConfigurationVoAssembler.extractTrackingConfiguration(factory,trackingConfigToSave); factory.save(trackingConfig); return TrackingConfigurationVoAssembler.create(trackingConfig); } else if (trackingAreaToSave!=null) { if (!trackingAreaToSave.isValidated()) throw new CodingRuntimeException("TrackingAreaVo not Validated"); TrackingArea trackingArea = TrackingAreaVoAssembler.extractTrackingArea(factory,trackingAreaToSave); factory.save(trackingArea); return null; } return null; }