Project

General

Profile

« Previous | Next » 

Revision 5cf75203

Added by Cherian Mathew about 9 years ago

NewTaxonBaseComposite, INewTaxonBaseComposite, INewTaxonBaseComponentListener, NewTaxonBasePresenter : added new component for creating new taxon / synonym
CdmVaadinSessionUtilities : utility class for vaddin session
CdmVaadinUtilities : utility class for general vaadin ui
SQLUtils : utility class for cdm sql containers
CdmQueryFactory : added freeform query to mimic table query and using default id
CdmDataChangeService, CdmChangeEvent, ICdmChangeListener : service which calls registers listeners when events are fired
CdmBaseUI : base cdm ui class, currently manages the cdm data change service
AbstractAuthenticatedUI, AuthenticationView, CdmVaadinConversationalServlet : using CdmVaadinSessionUtilities to set session attributes
CdmSpringContextHelper : using vaadin connection pool and cleanup code
DistributionSelectionPresenter, DistributionTablePresenter : changes coming from update in CdmQueryFactory

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/presenter/dbstatus/DistributionTablePresenter.java
49 49
	private final ITaxonNodeService taxonNodeService;
50 50
	private final ITermService termService;
51 51
	private final DistributionTableView view;
52
	private ITaxonService taxonService;
52
	private final ITaxonService taxonService;
53 53

  
54 54
	public DistributionTablePresenter(DistributionTableView dtv) throws SQLException{
55 55
	    this.view = dtv;
56 56
	    view.addListener(this);
57
	    taxonService = (ITaxonService)CdmSpringContextHelper.newInstance().getBean("taxonServiceImpl");
58
	    classificationService = (IClassificationService)CdmSpringContextHelper.newInstance().getBean("classificationServiceImpl");
59
	    taxonNodeService = (ITaxonNodeService)CdmSpringContextHelper.newInstance().getBean("taxonNodeServiceImpl");
60
		vocabularyService = (IVocabularyService)CdmSpringContextHelper.newInstance().getBean("vocabularyServiceImpl");
61
		descriptionService = (IDescriptionService)CdmSpringContextHelper.newInstance().getBean("descriptionServiceImpl");
62
		termService = (ITermService)CdmSpringContextHelper.newInstance().getBean("termServiceImpl");
57
	    taxonService = CdmSpringContextHelper.getTaxonService();
58
	    classificationService = CdmSpringContextHelper.getClassificationService();
59
	    taxonNodeService = CdmSpringContextHelper.getTaxonNodeService();
60
		vocabularyService = CdmSpringContextHelper.getVocabularyService();
61
		descriptionService = CdmSpringContextHelper.getDescriptionService();
62
		termService = CdmSpringContextHelper.getTermService();
63 63
		view.dataBinding();
64 64
	}
65 65

  
66 66

  
67
	public ComboBox updateDistributionField(DescriptionElementBase deb,
67
	@Override
68
    public ComboBox updateDistributionField(DescriptionElementBase deb,
68 69
			Distribution db,
69 70
			BeanItemContainer<PresenceAbsenceTerm> termContainer, ComboBox box,
70 71
			Taxon taxon) {
......
81 82
		return term.getTerms();
82 83
	}
83 84

  
84
	
85

  
85 86
	public List<String> getTermList() {
86 87
		VaadinSession session = VaadinSession.getCurrent();
87 88
		UUID termUUID = (UUID) session.getAttribute("selectedTerm");
......
94 95
		}
95 96
		return list;
96 97
	}
97
	
98

  
98 99
	@Override
99 100
	public HashMap<DescriptionElementBase, Distribution> getDistribution(DefinedTermBase dt, Taxon taxon) {
100 101
		Set<Feature> setFeature = new HashSet<Feature>(Arrays.asList(Feature.DISTRIBUTION()));
......
116 117
	public List<DescriptionElementBase> listDescriptionElementsForTaxon(Taxon taxon, Set<Feature> setFeature){
117 118
		return descriptionService.listDescriptionElementsForTaxon(taxon, setFeature, null, null, null, DESCRIPTION_INIT_STRATEGY);
118 119
	}
119
	
120

  
120 121
	@Override
121 122
	public List<Distribution> getDistribution(Taxon taxon) {
122 123
		Set<Feature> setFeature = new HashSet<Feature>(Arrays.asList(Feature.DISTRIBUTION()));
123 124
		List<Distribution> listTaxonDescription = descriptionService.listDescriptionElementsForTaxon(taxon, setFeature, null, null, null, DESCRIPTION_INIT_STRATEGY);
124 125
		return listTaxonDescription;
125
		
126

  
126 127
	}
127
	
128

  
128 129
	@Override
129 130
	public List<TaxonNode> getAllNodes(int start, int end){
130 131
		Classification classification = getChosenClassification();
......
140 141
		Classification classification = classificationService.load(classificationUUID);
141 142
		return classification;
142 143
	}
143
	
144

  
144 145
	@Override
145 146
	public int getSizeOfClassification(){
146 147
		Classification classification = getChosenClassification();
147 148
		return taxonNodeService.countAllNodesForClassification(classification);
148 149
	}
149
	
150

  
150 151
	@Override
151 152
	public DbTableDTOS getDataList(int start, int end){
152 153
		List<TaxonNode> nodes = getAllNodes(start, end);
......
163 164
//						DistributionDTO distributionDTO = new DistributionDTO(db.getStatus().getTitleCache());
164 165
//						dbTableDTO.setdDTO(distributionDTO);
165 166
					}
166
					
167

  
167 168
				}
168
			}	
169
			}
169 170
			items.add(dbTableDTO);
170 171
		}
171 172
		return items;
172 173
	}
173
	
174

  
174 175
	@Override
175 176
	public CdmSQLContainer getSQLContainer() throws SQLException{
176 177
		Classification classification = getChosenClassification();
177 178
		int classificationId = classification.getId();
178 179
		List<String> termList = getTermList();
179
		CdmSQLContainer container = new CdmSQLContainer(new CdmQueryFactory().generateTaxonDistributionQuery("id", termList, classificationId));
180
		CdmSQLContainer container = new CdmSQLContainer(CdmQueryFactory.generateTaxonDistributionQuery(termList, classificationId));
180 181
		return container;
181 182
	}
182
	
183

  
183 184
	@Override
184 185
	public LazyLoadedContainer getLazyLoadedContainer(){
185 186
		LazyLoadedContainer lz = new LazyLoadedContainer(CdmTaxonTableCollection.class);
186 187
	    lz.addListener(this);
187 188
		return lz;
188
		
189

  
189 190
	}
190
	
191
	
191

  
192

  
192 193
	@Override
193 194
	public List<PresenceAbsenceTerm> getPresenceAbsenceTerms() {
194 195
		//TODO Better to use TermType instead of class to get the list
......
238 239
	public ITermService getTermService() {
239 240
		return termService;
240 241
	}
241
	
242

  
242 243
	@Override
243 244
	public LazyLoadedContainer getTableContainer() {
244 245
		// TODO Auto-generated method stub

Also available in: Unified diff