Ejemplo n.º 1
0
Archivo: F.java Proyecto: femto/scooter
 /**
  * Returns form-open element <tt>&lt;form&gt;</tt>for a resource. If the object's restful id is
  * null, the form is for adding a new object. Otherwise it is for editing the object.
  *
  * @param resourceName name of the resource
  * @param object an ActiveRecord object
  * @return form-open element for a resource object
  */
 public static String formForOpen(String resourceName, ActiveRecord object) {
   RESTified record = getAndValidateObject(resourceName, object);
   storeObjectToCurrentCache(object);
   String objectKey = ActiveRecordUtil.getModelName(object);
   storeObjectKeyToCurrentCache(objectKey);
   return R.formForResource(resourceName, record);
 }
Ejemplo n.º 2
0
Archivo: F.java Proyecto: femto/scooter
 /**
  * Returns form-open element <tt>&lt;form&gt;</tt>for a nested resource.
  *
  * <p>If ActiveRecord object's restful id is null, the form is for adding a new object. Otherwise
  * it is for editing the object.
  *
  * @param parentResourceName name of the parent resource
  * @param parentObject the parent object
  * @param resourceName name of the nested resource
  * @param object an ActiveRecord object
  * @return form-open element for a nested resource object
  */
 public static String formForOpen(
     String parentResourceName, RESTified parentObject, String resourceName, ActiveRecord object) {
   RESTified parentRecord = validateObject(parentResourceName, parentObject);
   storeObjectToCurrentCache(object);
   String objectKey = ActiveRecordUtil.getModelName(object);
   storeObjectKeyToCurrentCache(objectKey);
   return R.formForNestedResourceRecord(parentResourceName, parentRecord, resourceName, object);
 }
Ejemplo n.º 3
0
Archivo: F.java Proyecto: femto/scooter
 /**
  * Returns form-open element <tt>&lt;form&gt;</tt>for a nested resource.
  *
  * <p><tt>parentResourceNames</tt> is an array of ancestors. The oldest is at the beginning of the
  * array. <tt>parentRestfuls</tt> is an array of either restful id strings or RESTified records of
  * ancestors.
  *
  * <p>If ActiveRecord object's restful id is null, the form is for adding a new object. Otherwise
  * it is for editing the object.
  *
  * @param parentResourceNames names of the parent resources
  * @param parentRestfuls the parent restful ids or RESTified objects
  * @param resourceName name of the nested resource
  * @param object an ActiveRecord object
  * @return form-open element for a nested resource object
  */
 public static String formForOpen(
     String[] parentResourceNames,
     Object[] parentRestfuls,
     String resourceName,
     ActiveRecord object) {
   Object[] parentRecords = validateParentObject(parentResourceNames, parentRestfuls);
   storeObjectToCurrentCache(object);
   String objectKey = ActiveRecordUtil.getModelName(object);
   storeObjectKeyToCurrentCache(objectKey);
   return R.formForNestedResourceRecord(parentResourceNames, parentRecords, resourceName, object);
 }
Ejemplo n.º 4
0
 protected void setUp() {
   super.setUp();
   if (entryHome == null) entryHome = ActiveRecordUtil.getHomeInstance(Entry.class);
 }