/** * Returns form-open element <tt><form></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); }
/** * Returns form-open element <tt><form></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); }
/** * Returns form-open element <tt><form></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); }
protected void setUp() { super.setUp(); if (entryHome == null) entryHome = ActiveRecordUtil.getHomeInstance(Entry.class); }