com.netmera.mobile
Class NetmeraContent

java.lang.Object
  extended by com.netmera.mobile.BaseContent
      extended by com.netmera.mobile.NetmeraContent

public class NetmeraContent
extends BaseContent

The NetmeraContent object is used to run CRUD operations over the data.

After creating object use add() method to fill data and call create() method to add data into cloud.


Constructor Summary
NetmeraContent(java.lang.String objectName)
          Constructor that takes content name as parameter.
 
Method Summary
 void create()
          Adds data to the cloud.
 void createInBackground()
          Adds data to the cloud in the background thread.Since it runs on the background thread it does not block program.It is recommended over create() method.
 void createInBackground(NetmeraCallback<NetmeraContent> callback)
          Adds data to the cloud in the background thread.
 boolean delete()
          Deletes data from the cloud.Before calling this method path of the data should be setted by calling setPath(String) method.
 void deleteInBackground()
          Deletes data from the cloud in the background thread.Since it runs on the background thread it does not block program.It is recommended over delete() method.
 void deleteInBackground(NetmeraCallback<java.lang.Boolean> netmeraCallback)
          Deletes data from the cloud in the background thread.Since it runs on the background thread it does not block program.It is recommended over delete() method.
 boolean equals(java.lang.Object obj)
           
 java.util.Date getCreateDate()
          Gets the createDate of the content.
 java.lang.String getObjectName()
          Returns the name of the content.
 java.lang.String getPath()
          Returns the path of the content.
 NetmeraPrivacy getPrivacy()
           
 java.util.Date getUpdateDate()
          Gets the updateDate of the content.
 int hashCode()
           
 void setOwner(NetmeraUser user)
          Sets the owner to the content.
 void setPath(java.lang.String path)
          Sets the path of the content.This is used to find the content to delete and update.
 void setPrivacy(NetmeraPrivacy privacy)
          allows user to set the privacy of the content
 java.lang.String toString()
           
 void update()
          Updates data
 void updateInBackground()
          Updates data in the background thread.Since it runs on the background thread it does not block program.It is recommended over update() method.
 void updateInBackground(NetmeraCallback<NetmeraContent> callback)
          Updates data in the background thread.
 
Methods inherited from class com.netmera.mobile.BaseContent
add, get, getBoolean, getDouble, getInt, getJSONArray, getJSONObject, getLong, getNetmeraGeoLocation, getNetmeraUser, getString, increment
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetmeraContent

public NetmeraContent(java.lang.String objectName)
Constructor that takes content name as parameter.

Parameters:
objectName - - Name of the content
Method Detail

create

public void create()
            throws NetmeraException
Adds data to the cloud.

Throws:
NetmeraException - Throws exception if it cannot access server

createInBackground

public void createInBackground(NetmeraCallback<NetmeraContent> callback)
Adds data to the cloud in the background thread. Since it runs on the background thread it does not block program.It is recommended over create() method.

Parameters:
callback - NetmeraCallback.onSuccess(Object) or NetmeraCallback.onFail(NetmeraException) methods called when create operation finishes.

createInBackground

public void createInBackground()
Adds data to the cloud in the background thread.Since it runs on the background thread it does not block program.It is recommended over create() method.


update

public void update()
            throws NetmeraException
Updates data

Throws:
NetmeraException - Throws exception if it cannot access server.

updateInBackground

public void updateInBackground(NetmeraCallback<NetmeraContent> callback)
Updates data in the background thread. Since it runs on the background thread it does not block program.It is recommended over update() method.

Parameters:
callback - - NetmeraCallback.onSuccess(Object) or NetmeraCallback.onFail(NetmeraException) methods called when update operation finishes.

updateInBackground

public void updateInBackground()
Updates data in the background thread.Since it runs on the background thread it does not block program.It is recommended over update() method.


delete

public boolean delete()
               throws NetmeraException
Deletes data from the cloud.Before calling this method path of the data should be setted by calling setPath(String) method.

Throws:
NetmeraException - - Throws exception if it cannot access server.
org.json.JSONException

deleteInBackground

public void deleteInBackground(NetmeraCallback<java.lang.Boolean> netmeraCallback)
Deletes data from the cloud in the background thread.Since it runs on the background thread it does not block program.It is recommended over delete() method.

Before calling this method path of the data should be setted by calling setPath(String) method.

Parameters:
netmeraCallback - - NetmeraCallback.onSuccess(Object) or NetmeraCallback.onFail(NetmeraException) methods called when delete operation finishes

deleteInBackground

public void deleteInBackground()
Deletes data from the cloud in the background thread.Since it runs on the background thread it does not block program.It is recommended over delete() method.

Before calling this method path of the data should be setted by calling setPath(String) method.


getPath

public java.lang.String getPath()
                         throws NetmeraException
Returns the path of the content.

Returns:
Returns the path of the content
Throws:
NetmeraException

setPath

public void setPath(java.lang.String path)
Sets the path of the content.This is used to find the content to delete and update.

Parameters:
path - - path of the content

setOwner

public void setOwner(NetmeraUser user)
              throws NetmeraException
Sets the owner to the content.

Parameters:
user - current logged user
Throws:
NetmeraException - Throws exception if user is null or type is different than NetmeraUser

getObjectName

public java.lang.String getObjectName()
Returns the name of the content.

Returns:
Returns the name of the content

getCreateDate

public java.util.Date getCreateDate()
                             throws NetmeraException
Gets the createDate of the content.

Returns:
Returns createDate
Throws:
NetmeraException - Throws exception if it cannot get object

getUpdateDate

public java.util.Date getUpdateDate()
                             throws NetmeraException
Gets the updateDate of the content.

Returns:
Returns updateDate
Throws:
NetmeraException - Throws exception if it cannot get object

getPrivacy

public NetmeraPrivacy getPrivacy()
Returns:
the privacy of the content

setPrivacy

public void setPrivacy(NetmeraPrivacy privacy)
allows user to set the privacy of the content

Parameters:
privacy - NetmeraPrivacy to set the privacy of the content

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object