Project

General

Profile

« Previous | Next » 

Revision 933e5ac3

Added by Cherian Mathew about 9 years ago

ICdmCacher, ICdmUuidCacher, CdmCacher, CdmTermCacher : refactored and added load method
Language, NameRelationshipType, Rank : now uses cacher only if termap is null or empty and only when class matches the specific term type
MockCdmCacher: not required anymore
DefaultTermInitializer : removed acall to mock cacher
MatchStrategyConfigurator : moved from editor to cdmlib
CdmDataChangeEvent : added constructor
CommonServiceImpl, ICommonService : added call to findMatchingStrategy with enum instead of object
DescriptionServiceImpl, IDescriptionService, PolytomousKeyNodeServiceImpl, IPolytomousKeyNodeService, TaxonNodeServiceImpl, ITaxonNodeService, TaxonServiceImpl: added uuid methods

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefinedTermBase.java
48 48

  
49 49
import au.com.bytecode.opencsv.CSVWriter;
50 50
import eu.etaxonomy.cdm.hibernate.search.DefinedTermBaseClassBridge;
51
import eu.etaxonomy.cdm.model.ICdmCacher;
51
import eu.etaxonomy.cdm.model.ICdmUuidCacher;
52 52
import eu.etaxonomy.cdm.model.description.Feature;
53 53
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
54 54
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
......
476 476
    }
477 477

  
478 478
    // Currently the CDM Caching mechanism is only used for caching terms
479
    private static ICdmCacher cacher;
479
    private static ICdmUuidCacher cacher;
480 480

  
481 481
    /**
482 482
     * Gets the CDM cacher object
483 483
     *
484 484
     * @return the CDM cacher object
485 485
     */
486
    public static ICdmCacher getCacher() {
486
    public static ICdmUuidCacher getCacher() {
487 487
		return cacher;
488 488
	}
489 489

  
......
492 492
	 *
493 493
	 * @param cacher the CDM cacher object
494 494
	 */
495
	public static void setCacher(ICdmCacher cacher) {
495
	public static void setCacher(ICdmUuidCacher cacher) {
496 496
		DefinedTermBase.cacher = cacher;
497 497
	}
498

  
499
	public static <T extends DefinedTermBase> T getTermByClassAndUUID(Class<T> clazz, UUID uuid) {
500
	    if(cacher != null) {
501
	        Object obj = getCacher().load(uuid);
502
	        if(obj != null && obj.getClass().equals(clazz)) {
503
	            return (T)obj;
504
	        }
505
	    }
506
	    return null;
507
	}
498 508
}

Also available in: Unified diff