------------------------------------------------------------ revno: 20578 committer: Morten Olav Hansen <morte...@gmail.com> branch nick: dhis2 timestamp: Thu 2015-10-08 13:16:29 +0700 message: minor, cache schema references modified: dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java
-- lp:dhis2 https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk Your team DHIS 2 developers is subscribed to branch lp:dhis2. To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java 2015-09-24 03:20:17 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java 2015-10-08 06:16:29 +0000 @@ -444,15 +444,22 @@ this.propertyMap = propertyMap; } + private Set<Class> references; + @JsonProperty @JacksonXmlElementWrapper( localName = "references", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "reference", namespace = DxfNamespaces.DXF_2_0 ) @SuppressWarnings( "rawtypes" ) public Set<Class> getReferences() { - return getProperties().stream() - .filter( p -> p.isCollection() ? PropertyType.REFERENCE == p.getItemPropertyType() : PropertyType.REFERENCE == p.getPropertyType() ) - .map( p -> p.isCollection() ? p.getItemKlass() : p.getKlass() ).collect( Collectors.toSet() ); + if ( references == null ) + { + references = getProperties().stream() + .filter( p -> p.isCollection() ? PropertyType.REFERENCE == p.getItemPropertyType() : PropertyType.REFERENCE == p.getPropertyType() ) + .map( p -> p.isCollection() ? p.getItemKlass() : p.getKlass() ).collect( Collectors.toSet() ); + } + + return references; } public Map<String, Property> getPersistedProperties() @@ -461,7 +468,8 @@ { persistedProperties = new HashMap<>(); - getPropertyMap().entrySet().stream().filter( entry -> entry.getValue().isPersisted() ) + getPropertyMap().entrySet().stream() + .filter( entry -> entry.getValue().isPersisted() ) .forEach( entry -> persistedProperties.put( entry.getKey(), entry.getValue() ) ); } @@ -474,7 +482,8 @@ { nonPersistedProperties = new HashMap<>(); - getPropertyMap().entrySet().stream().filter( entry -> !entry.getValue().isPersisted() ) + getPropertyMap().entrySet().stream() + .filter( entry -> !entry.getValue().isPersisted() ) .forEach( entry -> nonPersistedProperties.put( entry.getKey(), entry.getValue() ) ); } @@ -523,7 +532,8 @@ { List<String> authorityList = Lists.newArrayList(); - authorities.stream().filter( authority -> type.equals( authority.getType() ) ) + authorities.stream() + .filter( authority -> type.equals( authority.getType() ) ) .forEach( authority -> authorityList.addAll( authority.getAuthorities() ) ); authorityMap.put( type, authorityList );
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp