Ejemplo n.º 1
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.º 2
0
Archivo: F.java Proyecto: femto/scooter
 /**
  * Returns form-open element <tt>&lt;form&gt;</tt>for a nested resource.
  *
  * <p>The <tt>objectKey</tt> is used to retrieve the corresponding object for the nested resource.
  * The object must be of RESTified type.
  *
  * <p>If there is no object mapped to the key, or the 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 objectKey key pointing to the object
  * @return form-open element for a nested resource object
  */
 public static String formForOpen(
     String parentResourceName, RESTified parentObject, String resourceName, String objectKey) {
   RESTified parentRecord = validateObject(parentResourceName, parentObject);
   RESTified object = getAndValidateObject(resourceName, objectKey);
   storeObjectToCurrentCache(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
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>The <tt>objectKey</tt> is used to retrieve the corresponding object for the nested resource.
  * The object must be of RESTified type.
  *
  * <p>If there is no object mapped to the key, or the 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 objectKey key pointing to the object
  * @return form-open element for a nested resource object
  */
 public static String formForOpen(
     String[] parentResourceNames,
     Object[] parentRestfuls,
     String resourceName,
     String objectKey) {
   Object[] parentRecords = validateParentObject(parentResourceNames, parentRestfuls);
   RESTified object = getAndValidateObject(resourceName, objectKey);
   storeObjectToCurrentCache(object);
   storeObjectKeyToCurrentCache(objectKey);
   return R.formForNestedResourceRecord(parentResourceNames, parentRecords, resourceName, object);
 }