Adding/Removing/Replacing Objects (RETS 1.8 only)

For servers that support the RETS 1.8 PostObject transaction, RETSUserSession provides a number of methods for manipulating objects.


  /**
   * Add a new object from a file or input stream.
   */
  public PostObjectResponse addObject(String objectPath, Integer objectId, 
                                      File objectContent, Map<String, String> attributes);
  public PostObjectResponse addObject(String objectPath, Integer objectId, 
                                      File objectContent, int contentLength, Map<String, String> attributes);

  /**
   * Add a new object from a file or input stream BEFORE the object specified
   * by UID in the object path. Note that some servers may return an error
   * for this operation. The non-UID variants are recommended.
   */
  public PostObjectResponse addObjectByUID(String objectPath, File objectContent, 
                                           Map<String, String> attributes);
  public PostObjectResponse addObjectByUID(String objectPath,File objectContent, 
                                           int contentLength, Map<String, String> attributes);

  /**
   * Replace an existing object with content from the given file or input stream.
   */
  public PostObjectResponse replaceObject(String objectPath, Integer objectId, 
                                          File objectContent, Map<String, String> attributes);
  public PostObjectResponse replaceObject(String objectPath, Integer objectId, 
                                          File objectContent, int contentLength, Map<String, String> attributes);

  public PostObjectResponse replaceObjectByUID(String objectPath, File objectContent, 
                                               Map<String, String> attributes);
  public PostObjectResponse replaceObjectByUID(String objectPath, File objectContent, 
                                               int contentLength, Map<String, String> attributes);

  /**
   * Delete the object specified by path/objectID or UID.
   */
  public PostObjectResponse deleteObject(String objectPath, Integer objectId);
  public PostObjectResponse deleteObjectByUID(String objectPath);

    		  

Object paths are interpreted in a similar way to those described in Get Object however object paths for post object operations cannot use paths that specify multiple objects. As such, the methods above take an object path that specify a resource entity, as well as a separate object identifier parameter. Consequently, the path /Property/Photo/10000:1 is invalid, and should instead be passed as /Property/Photo/10000 with 1 as the object identifier parameter. The byUID variants take an object path of the form /Resource/ObjectType/UID.