Project

General

Profile

« Previous | Next » 

Revision ceced5aa

Added by Katja Luther over 12 years ago

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IdentifiableServiceBase.java
34 34
import eu.etaxonomy.cdm.model.common.LSID;
35 35
import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
36 36
import eu.etaxonomy.cdm.model.media.Rights;
37
import eu.etaxonomy.cdm.model.name.NonViralName;
37 38
import eu.etaxonomy.cdm.model.reference.Reference;
38 39
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
39 40
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
......
232 233
					entity.setProtectedTitleCache(true);
233 234
					String titleCache = entity.getTitleCache();
234 235
					entity.setProtectedTitleCache(false);
236
					String nameCache = null;
237
					if (entity instanceof NonViralName ){
238
						NonViralName nvn = (NonViralName) entity;
239
						if (!nvn.isProtectedNameCache()){
240
							nvn.setProtectedNameCache(true);
241
							nameCache = nvn.getNameCache();
242
							nvn.setProtectedNameCache(false);
243
						}
244
						
245
						
246
					}
235 247
					setOtherCachesNull(entity); //TODO find better solution
236 248
					String newTitleCache = entityCacheStrategy.getTitleCache(entity);
237
					if (titleCache == null || titleCache != null && ! titleCache.equals(newTitleCache)){
249
					if (titleCache == null || titleCache != null && ! titleCache.equals(newTitleCache) ){
238 250
						entity.setTitleCache(null, false);
239 251
						entity.getTitleCache();
252
						if (entity instanceof NonViralName){
253
							NonViralName nvn = (NonViralName) entity;
254
							String newnameCache = nvn.getNameCache();
255
						}
240 256
						entitiesToUpdate.add(entity);
257
					}else if (entity instanceof NonViralName){
258
						NonViralName nvn = (NonViralName) entity;
259
						String newnameCache = nvn.getNameCache();
260
						if (nameCache == null || (nameCache != null && !nameCache.equals(newnameCache))){
261
							entitiesToUpdate.add(entity);
262
						}
241 263
					}
264
					
242 265
				}
243 266
			}
267
			for (T entity: entitiesToUpdate){
268
				if (entity.getTitleCache() != null){
269
					System.err.println(entity.getTitleCache());
270
				}else{
271
					System.err.println("no titleCache" + ((NonViralName)entity).getNameCache());
272
				}
273
				
274
			}
244 275
			saveOrUpdate(entitiesToUpdate);
245 276
			monitor.worked(worked++);
246 277
			if (monitor.isCanceled()){

Also available in: Unified diff