Examples of AuxDataCache


Examples of com.tll.client.cache.AuxDataCache

   * @return The filtered data request to send to the server or
   *         <code>null</code> if the filtering yields no needed aux data.
   */
  public static AuxDataRequest filterRequest(AuxDataRequest adr) {
    if(adr == null) return null;
    final AuxDataCache adc = AuxDataCache.get();
    final AuxDataRequest sadr = new AuxDataRequest();

    // ref data
    final Iterator<RefDataType> rdi = adr.getRefDataRequests();
    if(rdi != null) {
      while(rdi.hasNext()) {
        final RefDataType rdt = rdi.next();
        if(!adc.isCached(AuxDataType.REFDATA, rdt)) {
          sadr.requestAppRefData(rdt);
        }
      }
    }

    // entities
    Iterator<IEntityType> ets = adr.getEntityRequests();
    if(ets != null) {
      while(ets.hasNext()) {
        final IEntityType et = ets.next();
        if(!adc.isCached(AuxDataType.ENTITY, et)) {
          sadr.requestEntityList(et);
        }
      }
    }

    // entity prototypes
    ets = adr.getEntityPrototypeRequests();
    if(ets != null) {
      while(ets.hasNext()) {
        final IEntityType et = ets.next();
        if(!adc.isCached(AuxDataType.ENTITY_PROTOTYPE, et)) {
          sadr.requestEntityPrototype(et);
        }
      }
    }

View Full Code Here

Examples of com.tll.client.cache.AuxDataCache

   * Caches the resultant aux data received from the server.
   * @param payload The aux data payload
   */
  public static void cache(AuxDataPayload payload) {

    final AuxDataCache adc = AuxDataCache.get();

    // ref data maps
    final Map<RefDataType, Map<String, String>> map = payload.getRefDataMaps();
    if(map != null) {
      for(final Map.Entry<RefDataType, Map<String, String>> e : map.entrySet()) {
        adc.cacheRefDataMap(e.getKey(), e.getValue());
      }
    }

    // entity lists
    final Map<IEntityType, List<Model>> egm = payload.getEntityMap();
    if(egm != null) {
      for(final Map.Entry<IEntityType, List<Model>> e : egm.entrySet()) {
        adc.cacheEntityList(e.getKey(), e.getValue());
      }
    }

    // entity prototypes
    final Set<Model> eps = payload.getEntityPrototypes();
    if(eps != null) {
      for(final Model p : eps) {
        adc.cacheEntityPrototype(p);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.