Package com.adaptrex.core.ext

Examples of com.adaptrex.core.ext.ExtConfig


  private ORMModelInstance modelInstance;
  private Object entity;
 
  public RestModel(String className, Map<String,Object> data, UriInfo uriInfo, String factoryName) {
    ExtConfig extConfig = new ExtConfig(className, factoryName);
   
    /*
     * Process parameters
     */
    if (uriInfo != null) {
      MultivaluedMap<String,String> params = uriInfo.getQueryParameters();
      /*
       * Add include/exclude/associations to the config
       */
      if (params.containsKey("include")) {
        extConfig.setIncludes(params.get("include").get(0));
      }
      if (params.containsKey("exclude")) {
        extConfig.setExcludes(params.get("exclude").get(0));
      }
      if (params.containsKey("associations")) {
        extConfig.setAssociations(params.get("associations").get(0));
      }     
    }
   
    ORMPersistenceManager orm = AdaptrexRegistry.getPersistenceManager(factoryName);
    this.modelInstance = orm.createModelinstance(extConfig, data);
View Full Code Here


    ORMPersistenceManager orm = AdaptrexRegistry.getPersistenceManager(factoryName);
    this.modelInstance = orm.createModelinstance(extConfig, data);
  }
 
  public RestModel(String className, Object id, UriInfo uriInfo, String factoryName) {
    ExtConfig extConfig = new ExtConfig(className, factoryName);
    ORMPersistenceManager orm = AdaptrexRegistry.getPersistenceManager(factoryName);
    entity = orm.getEntity(extConfig.getEntityClass(), id);
   
    /*
     * Process parameters
     */
    if (uriInfo != null) {
      MultivaluedMap<String,String> params = uriInfo.getQueryParameters();
      /*
       * Add include/exclude/associations to the config
       */
      if (params.containsKey("include")) {
        extConfig.setIncludes(params.get("include").get(0));
      }
      if (params.containsKey("exclude")) {
        extConfig.setExcludes(params.get("exclude").get(0));
      }
      if (params.containsKey("associations")) {
        extConfig.setAssociations(params.get("associations").get(0));
      }     
    }
   
    this.modelInstance = orm.getModelInstance(extConfig, entity);
  }
View Full Code Here

  private ORMStoreData storeData;
  private String factoryName;
 
  public RestStore(String className, UriInfo uriInfo, String factoryName) {
    ExtConfig extConfig = new ExtConfig(className, factoryName);
    this.factoryName = factoryName;
   
    /*
     * Process parameters
     */
    MultivaluedMap<String,String> params = uriInfo.getQueryParameters();

    /*
     * Add include/exclude/associations to the config
     */
    if (params.containsKey("include")) {
      extConfig.setIncludes(params.get("include").get(0));
    }
    if (params.containsKey("exclude")) {
      extConfig.setExcludes(params.get("exclude").get(0));
    }
    if (params.containsKey("associations")) {
      extConfig.setAssociations(params.get("associations").get(0));
    }   
   
    storeData = AdaptrexRegistry.getPersistenceManager(factoryName).getStoreData(extConfig);
   
    if (params.containsKey("start")) storeData.setStart(getInt(params.get("start")));
View Full Code Here

    this(request, entityClassName, null);
  }
 
  public ModelComponent(HttpServletRequest request, String entityClassName, String factoryName) {
    this.request = request;
    this.extConfig = new ExtConfig(entityClassName, factoryName);
   
    if (request.getAttribute("adaptrex_touch") != null) {
      this.extConfig.setTouch((Boolean) request.getAttribute("adaptrex_touch"));
    }
   
View Full Code Here

 
  public StoreComponent(HttpServletRequest request, String entityClassName, String factoryName) {
    this.request = request;
    this.entityClassName = entityClassName;
    this.factoryName = factoryName;
    this.extConfig = new ExtConfig(entityClassName, factoryName);
   
    if (request.getAttribute("adaptrex_touch") != null) {
      this.extConfig.setTouch(true);
    }
   
View Full Code Here

      this.setNamespace((String) request.getAttribute("adaptrex_namespace"));
    }   
  };
 
  public String toString() {
    ExtConfig config = this.extConfig;
   
    /*
     * The first thing a store needs is a model
     */
    ModelComponent modelComponent = new ModelComponent(request, entityClassName, factoryName);
    modelComponent.setNamespace(config.getNamespace());
    if (config.getModelName() != nullmodelComponent.setModelName(config.getModelName());
    if (this.includes != null)      modelComponent.setInclude(this.includes);
    if (this.excludes != null)      modelComponent.setExclude(this.excludes);
    if (this.associations != null)    modelComponent.setAssociations(this.associations);
    if (this.rest != null)         modelComponent.setRest(this.rest);
   
    String modelName = config.getModelName();
    String fullModelName = config.getNamespace() + ".model." + modelName;
   
    String storeName = StringUtilities.pluralize(modelName);
    String fullStoreName = config.getNamespace() + ".store." + storeName;
   
    /*
     * Create the store definition
     */
    StoreDefinition storeDefinition = new StoreDefinition();
    storeDefinition.setModelName(fullModelName);
   
    storeDefinition.setClearOnPageLoad(this.clearOnPageLoad);
    storeDefinition.setClearRemovedOnLoad(this.clearRemovedOnLoad);
    storeDefinition.setAutoSync(this.autoSync);
    storeDefinition.setAutoLoad(this.autoLoad);
    storeDefinition.setRemoteGroup(this.remoteGroup);
    storeDefinition.setRemoteSort(this.remoteSort);
    storeDefinition.setRemoteFilter(this.remoteFilter);
    storeDefinition.setSortOnFilter(this.sortOnFilter);
    storeDefinition.setBuffered(this.buffered);
    storeDefinition.setTrailingBufferZone(this.trailingBufferZone);
    storeDefinition.setLeadingBufferZone(this.leadingBufferZone);
    storeDefinition.setPurgePageCount(this.purgePageCount);
    storeDefinition.setGroupers(this.groupers);
    storeDefinition.setSorters(this.sorters);
    storeDefinition.setPageSize(this.pageSize);
    storeDefinition.setFilters(this.filters);
   
   

    if (this.inline != null && this.inline) {
      ORMStoreData storeData = config.getORMPersistenceManager().getStoreData(config);
      storeData.setFilters(this.filters);
      storeData.setGroupers(this.groupers);
      storeData.setLimit(this.pageSize);
      storeData.setParams(this.params);
      storeData.setSorters(this.sorters);
View Full Code Here

  private ORMStoreData storeData;
  private String factoryName;
 
  public RestStore(String className, UriInfo uriInfo, String factoryName) {
    ExtConfig extConfig = new ExtConfig(className, factoryName);
    this.factoryName = factoryName;
   
    /*
     * Process parameters
     */
    MultivaluedMap<String,String> params = uriInfo.getQueryParameters();

    /*
     * Add include/exclude/associations to the config
     */
    if (params.containsKey("include")) {
      extConfig.setIncludes(params.get("include").get(0));
    }
    if (params.containsKey("exclude")) {
      extConfig.setExcludes(params.get("exclude").get(0));
    }
    if (params.containsKey("associations")) {
      extConfig.setAssociations(params.get("associations").get(0));
    }   
   
    storeData = AdaptrexServices.getPersistenceManager(factoryName).getStoreData(extConfig);
    if (params.containsKey("start")) storeData.setStart(getInt(params.get("start")));
    if (params.containsKey("limit")) storeData.setLimit(getInt(params.get("limit")));
View Full Code Here

 
  RestProxy restProxy;
 
  public ModelComponent(HttpServletRequest request, String entityClassName, String factoryName) {
    this.request = request;
    this.extConfig = new ExtConfig(entityClassName, factoryName);
   
    if (request.getAttribute("adaptrex_touch") != null) {
      this.extConfig.setTouch(true);
    }
  };
View Full Code Here

    this.configComponent = (ConfigComponent) request.getAttribute(ConfigComponent.ATTRIBUTE);
    if (this.configComponent == null) {
      configComponent = new ConfigComponent(request, namespace, false);
      this.configComponent = (ConfigComponent) request.getAttribute(ConfigComponent.ATTRIBUTE);
   
    this.extConfig = new ExtConfig(request.getServletContext(), entityClassName, factoryName);
  };
View Full Code Here

   
    this.extConfig = new ExtConfig(request.getServletContext(), entityClassName, factoryName);
  };
 
  public String getJavaScript() throws Exception {
    ExtConfig config = this.extConfig;
    if (config.getEntityClass() == null) {
      String str = "Adaptrex Store Error: Persistent Class Not Found (" + this.extConfig.getModelName() + ")";
      log.warn(str);
      return StringUtilities.getErrorJavaScript(str);
    }
   
    String namespace = configComponent.getNamespace();
    String modelName = config.getModelName();
   
    /*
     * The first thing a store needs is a model
     */
    ModelComponent modelComponent = new ModelComponent(
        request,
        this.configComponent,
        extConfig
      );
    modelComponent.applyRest(this.rest);
   
   
    String fullModelName = namespace + ".model." + modelName;
    String storeName = Inflector.getInstance().pluralize(modelName);
    String fullStoreName = namespace + ".store." + storeName;
   
    /*
     * Create the store definition
     */
    log.debug("Creating store definition for " + fullModelName);
    StoreDefinition storeDefinition = this.configComponent.isTouch()
        ? new TouchStoreDefinition()
        : new StoreDefinition();
    storeDefinition.setModelName(fullModelName);
   
    storeDefinition.setClearOnPageLoad(this.clearOnPageLoad);
    storeDefinition.setClearRemovedOnLoad(this.clearRemovedOnLoad);
    storeDefinition.setAutoSync(this.autoSync);
    storeDefinition.setAutoLoad(this.autoLoad);
    storeDefinition.setRemoteGroup(this.remoteGroup);
    storeDefinition.setRemoteSort(this.remoteSort);
    storeDefinition.setRemoteFilter(this.remoteFilter);
    storeDefinition.setSortOnFilter(this.sortOnFilter);
    storeDefinition.setBuffered(this.buffered);
    storeDefinition.setTrailingBufferZone(this.trailingBufferZone);
    storeDefinition.setLeadingBufferZone(this.leadingBufferZone);
    storeDefinition.setPurgePageCount(this.purgePageCount);
    storeDefinition.setGroupers(this.groupers);
    storeDefinition.setSorters(this.sorters);
    storeDefinition.setPageSize(this.pageSize);
    storeDefinition.setFilters(this.filters);

    if (this.inline != null && this.inline) {
      AdaptrexStoreData storeData = config.getORMPersistenceManager().getStoreData(config);
      storeData.setFilters(this.filters);
      storeData.setGroupers(this.groupers);
      storeData.setLimit(this.pageSize);
      storeData.setParams(this.params);
      storeData.setSorters(this.sorters);
View Full Code Here

TOP

Related Classes of com.adaptrex.core.ext.ExtConfig

Copyright © 2018 www.massapicom. 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.