Package com.adaptrex.core.ext

Examples of com.adaptrex.core.ext.ModelInstance


    /*
     * Are we creating an instance?
     */
    String modelInstanceString = "";
    if (this.entityId != null || entityKey != null) {
      ModelInstance modelInstance = this.entityId != null
          ? new ModelInstance(extConfig, this.entityId)
          : new ModelInstance(extConfig, this.entityKey, this.entityValue);
     
      modelInstanceString = "Ext.ns('" + namespace + ".instance');" + "\n" +
          namespace + ".instance." + modelName + "=Ext.create('" +
          fullModelName + "', " + StringUtilities.json(modelInstance.getData()) + ");\n";
    }
   
   
    return "<script type='text/javascript'>\n" +
      StringUtilities.join(modelDefinitionStrings, ";\n") + "\n" +
View Full Code Here


    /*
     * Are we creating an instance?
     */
    String modelInstanceString = "";
    if (this.entityId != null || entityKey != null) {
      ModelInstance modelInstance = this.entityId != null
          ? new ModelInstance(extConfig, this.entityId)
          : new ModelInstance(extConfig, this.entityKey, this.entityValue);
     
      modelInstanceString = "Ext.ns('" + namespace + ".instance');" + "\n" +
          namespace + ".instance." + modelName + "=Ext.create('" +
          fullModelName + "', " + StringUtilities.json(modelInstance.getData()) + ");\n";
    }
   
   
    return "<script type='text/javascript'>\n" +
      StringUtilities.join(modelDefinitionStrings, ";\n") + "\n" +
View Full Code Here

   
    /*
     * We need to do some formatting on the response
     */
    Map<String,Object> response = new HashMap<String,Object>();
    ModelInstance modelInstance = model.getModelInstance();
    if (modelInstance.getData().isEmpty()) {
      response.put("success", false);
      response.put("message", "Record Not Found");
    } else {
      response.put("data", modelInstance.getData());
      response.put("id", modelInstance.getData().get("id"));
      response.put("success", true);
    }
   
    try {
      String json = StringUtilities.json(response);
View Full Code Here

    /*
     * Are we creating an instance?
     */
    String modelInstanceString = "";
    if (this.entityId != null || entityKey != null) {
      ModelInstance modelInstance = this.entityId != null
          ? new ModelInstance(extConfig, this.entityId)
          : new ModelInstance(extConfig, this.entityKey, this.entityValue);
     
      modelInstanceString = "Ext.ns('" + namespace + ".instance');" + "\n" +
          namespace + ".instance." + modelName + "=Ext.create('" +
          fullModelName + "', " + StringUtilities.json(modelInstance.getData()) + ");\n";
    }
   
   
    return "<script type='text/javascript'>\n" +
      StringUtilities.join(modelDefinitionStrings, ";\n") + "\n" +
View Full Code Here

   
    /*
     * We need to do some formatting on the response
     */
    Map<String,Object> response = new HashMap<String,Object>();
    ModelInstance modelInstance = model.getModelInstance();
    if (modelInstance.getData().isEmpty()) {
      response.put("success", false);
      response.put("message", "Record Not Found");
    } else {
      response.put("data", modelInstance.getData());
      response.put("id", modelInstance.getData().get("id"));
      response.put("success", true);
    }
   
    try {
      String json = StringUtilities.json(response);
View Full Code Here

       * Start and limit
       */
      if (this.getLimit() != null) query.setFetchLimit(this.getLimit());
      if (this.getStart() != null) query.setFetchOffset(this.getStart().intValue());
      for (Object entity : objectContext.performQuery(query)) {
        data.add(new ModelInstance(extConfig, entity).getData());
      }

     
      /*
       * Total Count / Inspired by http://goo.gl/W6rhG
View Full Code Here

    if (this.getLimit() != null) selectQuery.setFetchLimit(this.getLimit());
    if (this.getStart() != null) selectQuery.setFetchOffset(this.getStart().intValue());
   
    for (Object entity : objectContext.performQuery(selectQuery)) {
      data.add(new ModelInstance(extConfig, entity).getData());
    }
   
    return data;
  }
View Full Code Here

     * we also return an online instance
     * TODO: We should add the ability to load this via rest to enable associations
     */
    String modelInstanceString = "";
    if (this.entityId != null || entityKey != null) {
      ModelInstance modelInstance = this.entityId != null
          ? apm.getModelInstance(this.extConfig, this.entityId)
          : apm.getModelInstance(this.extConfig, this.entityKey, this.entityValue);
         
//      ModelInstance modelInstance = this.entityId != null
//          ? new ModelInstance(extConfig, this.entityId)
//          : new ModelInstance(extConfig, this.entityKey, this.entityValue);
         
      modelInstanceString = "Ext.ns('" + namespace + ".instance');" + "\n" +
          namespace + ".instance." + this.extConfig.getModelName() + "=Ext.create('" +
          fullModelName + "', " +
          StringUtilities.json(modelInstance.getData(), this.request.getServletContext()) + ");\n";
    }
   
   
    StringBuffer javascript = new StringBuffer();
    if (!configComponent.isWritten()) {
View Full Code Here

 

  @Override
  public ModelInstance getModelInstance(ExtConfig extConfig, Object id) throws Exception {
    Object entity = this.getEntity(extConfig.getEntityClass(), id);
    return new ModelInstance(extConfig, entity);
  }
View Full Code Here

  }

  @Override
  public ModelInstance getModelInstance(ExtConfig extConfig, String key, Object value) throws Exception {
    Object entity = this.getEntity(extConfig.getEntityClass(), key, value);
    return new ModelInstance(extConfig, entity);
  }
View Full Code Here

TOP

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

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.