public class Entry extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ContentType |
contentType |
protected String |
contentTypeUid |
protected org.json.JSONArray |
exceptFieldArray |
protected org.json.JSONObject |
exceptJsonObject |
protected LinkedHashMap<String,Object> |
headers |
protected String |
language |
protected org.json.JSONArray |
objectUidForOnly |
protected org.json.JSONObject |
onlyJsonObject |
protected HashMap<String,Object> |
owner |
protected org.json.JSONObject |
params |
protected org.json.JSONObject |
publishDetails |
protected org.json.JSONArray |
referenceArray |
protected org.json.JSONObject |
resultJson |
protected String |
rteContent |
protected String[] |
tags |
protected String |
title |
protected String |
uid |
protected String |
url |
| Modifier | Constructor and Description |
|---|---|
protected |
Entry() |
protected |
Entry(String contentTypeName) |
| Modifier and Type | Method and Description |
|---|---|
Entry |
addParam(String key,
String value)
This method adds key and value to an Entry.
|
Entry |
configure(org.json.JSONObject jsonObject) |
Entry |
except(String[] fieldUid)
Specifies list of field uids that would be 'excluded' from the
response.
|
Entry |
exceptWithReferenceUid(ArrayList<String> fieldUid,
String referenceFieldUid)
Specifies an array of 'except' keys that would be 'excluded'
in the response.
|
void |
fetch(EntryResultCallBack callback)
Fetches the latest version of the entries from Contentstack.com content stack
|
Object |
get(String key)
Get object value for key.
|
ArrayList<Entry> |
getAllEntries(String refKey,
String refContentType)
Get value for the given reference key.
|
Asset |
getAsset(String key)
Get an asset from the entry
|
List<Asset> |
getAssets(String key)
Get an assets from the entry.
|
Boolean |
getBoolean(String key)
Get boolean value for key.
|
String |
getContentType()
Get contentType name.
|
Calendar |
getCreateAt()
Get
Calendar value of creation time of entry. |
String |
getCreatedBy()
Get uid who created this entry.
|
Calendar |
getDate(String key)
Get
Calendar value for key |
Calendar |
getDeleteAt()
Get
Calendar value of deletion time of entry. |
String |
getDeletedBy()
Get uid who deleted this entry.
|
double |
getDouble(String key)
Get double value for key
|
float |
getFloat(String key)
Get integer value for key
|
Group |
getGroup(String key) |
List<Group> |
getGroups(String key)
Get a list of group from entry.
|
int |
getInt(String key)
Get integer value for key
|
org.json.JSONArray |
getJSONArray(String key)
Get
JSONArray value for key |
org.json.JSONObject |
getJSONObject(String key)
Get
JSONObject value for key |
String |
getLocale() |
long |
getLong(String key)
Get long value for key
|
Number |
getNumber(String key)
Get
JSONObject value for key |
Map<String,Object> |
getOwner()
Deprecated.
|
short |
getShort(String key)
Get short value for key
|
String |
getString(String key)
Get string value for key.
|
String[] |
getTags()
Get tags.
|
String |
getTitle()
Get title string
|
String |
getUid()
Get uid.
|
Calendar |
getUpdateAt()
Get
Calendar value of updating time of entry. |
String |
getUpdatedBy()
Get uid who updated this entry.
|
String |
getURL()
Get url string
|
Entry |
includeBranch()
Includes Branch in the entry response
|
Entry |
includeContentType()
Include Content Type of all returned objects along with objects themselves.
|
Entry |
includeEmbeddedItems()
includeEmbeddedItems instance of Entry Include Embedded Objects (Entries and
Assets) along with entry/entries details.
|
Entry |
includeFallback()
Retrieve the published content of the fallback locale if an entry is not
localized in specified locale
|
Entry |
includeReference(String referenceField)
Add a constraint that requires a particular reference key details.
|
Entry |
includeReference(String[] referenceFields)
Add a constraint that requires a particular reference key details.
|
Entry |
includeReferenceContentTypeUID()
This method also includes the content type UIDs of the referenced entries
returned in the response
|
Entry |
only(String[] fieldUid)
Specifies an array of 'only' keys in BASE object that would be
'included' in the response.
|
Entry |
onlyWithReferenceUid(ArrayList<String> fieldUid,
String referenceFieldUid)
Specifies an array of 'only' keys that would be 'included' in
the response.
|
void |
removeHeader(String key)
Remove header key.
|
protected void |
setContentType(ContentType contentType,
LinkedHashMap<String,Object> header) |
void |
setHeader(String key,
String value)
Set headers.
|
Entry |
setLocale(String locale) |
protected void |
setTags(String[] tags) |
protected void |
setUid(String uid) |
org.json.JSONObject |
toJSON()
Get entry representation in json
|
protected org.json.JSONObject params
protected LinkedHashMap<String,Object> headers
protected String uid
protected org.json.JSONObject publishDetails
protected org.json.JSONObject resultJson
protected String title
protected String url
protected String language
protected String contentTypeUid
protected ContentType contentType
protected String[] tags
protected org.json.JSONArray referenceArray
protected org.json.JSONArray objectUidForOnly
protected org.json.JSONArray exceptFieldArray
protected org.json.JSONObject onlyJsonObject
protected org.json.JSONObject exceptJsonObject
protected String rteContent
protected Entry()
throws IllegalAccessException
IllegalAccessExceptionprotected Entry(String contentTypeName)
protected void setContentType(@NotNull
ContentType contentType,
@NotNull
LinkedHashMap<String,Object> header)
public Entry configure(org.json.JSONObject jsonObject)
public void setHeader(String key, String value)
key - custom_header_keyvalue - custom_header_value
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Entry entry = stack.contentType("form_name").entry("entry_uid");
entry.setHeader("custom_header_key", "custom_header_value");
public void removeHeader(String key)
key - custom_header_key
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Entry entry = stack.contentType("form_name").entry("entry_uid");
entry.removeHeader("custom_header_key");
public String getTitle()
String title = entry.getTitle();
public String getURL()
String url = entry.getURL();
public String[] getTags()
String[] tags = entry.getURL();
protected void setTags(String[] tags)
public String getContentType()
String contentType = entry.getFileType();
public String getUid()
String uid = entry.getUid();
protected void setUid(String uid)
public String getLocale()
public Entry setLocale(@NotNull String locale)
locale - String
Entry entry = entry.setLanguage();
@Deprecated public Map<String,Object> getOwner()
public org.json.JSONObject toJSON()
JSONObject json = entry.toJSON();
public Object get(@NotNull String key)
key - field_uid as key.
Object obj = entry.get("key");
public String getString(@NotNull String key)
key - field_uid as key.
String value = entry.getString("key");
public Boolean getBoolean(@NotNull String key)
key - field_uid as key.
Boolean value = entry.getBoolean("key");
public org.json.JSONArray getJSONArray(@NotNull
String key)
JSONArray value for keykey - field_uid as key.
JSONArray value = entry.getJSONArray("key");
public org.json.JSONObject getJSONObject(@NotNull
String key)
JSONObject value for keykey - field_uid as key.
JSONObject value = entry.getJSONObject("key");
public Number getNumber(@NotNull String key)
JSONObject value for keykey - field_uid as key.
JSONObject value = entry.getJSONObject("key");
public int getInt(@NotNull
String key)
key - field_uid as key.
int value = entry.getInt("key");
public float getFloat(@NotNull
String key)
key - field_uid as key.
float value = entry.getFloat("key");
public double getDouble(@NotNull
String key)
key - field_uid as key.
double value = entry.getDouble("key");
public long getLong(@NotNull
String key)
key - field_uid as key.
long value = entry.getLong("key");
public short getShort(@NotNull
String key)
key - field_uid as key.
short value = entry.getShort("key");
public Calendar getDate(@NotNull String key)
Calendar value for keykey - field_uid as key.
Calendar value = entry.getDate("key");
public Calendar getCreateAt()
Calendar value of creation time of entry.
Calendar createdAt = entry.getCreateAt("key");
public String getCreatedBy()
String createdBy_uid = entry.getCreatedBy();
public Calendar getUpdateAt()
Calendar value of updating time of entry.
Calendar updatedAt = entry.getUpdateAt("key");
public String getUpdatedBy()
String updatedBy_uid = entry.getUpdatedBy();
public Calendar getDeleteAt()
Calendar value of deletion time of entry.
Calendar updatedAt = entry.getUpdateAt("key");
public String getDeletedBy()
String deletedBy_uid = entry.getDeletedBy();
public Asset getAsset(String key)
key - field_uid as key.
Asset asset = entry.getAsset("key");
public List<Asset> getAssets(String key)
{
@code
List asset = entry.getAssets("key");
}
key - This is the String keypublic Group getGroup(String key)
key - Get a group from entry.key - field_uid as key.
Group innerGroup = entry.getGroup("key");
return null
Grouppublic List<Group> getGroups(String key)
Note :- This will work when group is multiple true.
key - field_uid as key.
Group innerGroup = entry.getGroups("key");
public ArrayList<Entry> getAllEntries(String refKey, String refContentType)
refKey - key of a reference field.refContentType - class uid.ArrayList of Entry instances. Also specified
contentType value will be set as class uid for all Entry
instance.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Query csQuery = stack.contentType("contentType_name").query();
csQuery.includeReference("for_bug");
csQuery.find(new QueryResultsCallBack() {<br>
@Override
public void onCompletion(ResponseType responseType, QueryResult queryResult, Error error) {<br>
if(error == null){
List<Entry> list = builtqueryresult.getResultObjects();
for (int i = 0; i < list.queueSize(); i++) {
Entry entry = list.get(i);
Entry taskEntry = entry.getAllEntries("for_task", "task");
}
}
}
});
public Entry except(@NotNull String[] fieldUid)
fieldUid - field uid which get 'excluded' from the response.Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Entry entry = stack.contentType("form_name").entry("entry_uid");
entry.except(new String[]{"name", "description"});
public Entry includeReference(@NotNull String referenceField)
referenceField - key that to be constrained.Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Entry entry = stack.contentType("form_name").entry("entry_uid");
entry.includeReference("referenceUid");
public Entry includeReference(@NotNull String[] referenceFields)
referenceFields - array key that to be constrained.Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Entry entry = stack.contentType("form_name").entry("entry_uid");
entry.includeReference(new String[]{"referenceUid_A", "referenceUid_B"});
public Entry only(String[] fieldUid)
fieldUid - Array of the 'only' reference keys to be included in
response.Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Entry entry = stack.contentType("form_name").entry("entry_uid");
entry.only(new String[]{"name", "description"});
public Entry onlyWithReferenceUid(@NotNull ArrayList<String> fieldUid, @NotNull String referenceFieldUid)
fieldUid - Array of the 'only' reference keys to be
included in response.referenceFieldUid - Key who has reference to some other class object..Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Entry entry = stack.contentType("form_name").entry("entry_uid");
ArrayList<String> array = new ArrayList<String>();
array.add("description");
array.add("name");
entry.onlyWithReferenceUid(array, "referenceUid");
public Entry exceptWithReferenceUid(@NotNull ArrayList<String> fieldUid, @NotNull String referenceFieldUid)
fieldUid - Array of the 'except' reference keys to be
excluded in response.referenceFieldUid - Key who has reference to some other class object.Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Entry entry = stack.contentType("form_name").entry("entry_uid");
ArrayList<String> array = new ArrayList<String>();
array.add("description");
array.add("name");
entry.onlyWithReferenceUid(array, "referenceUid");
public void fetch(EntryResultCallBack callback)
callback - EntryResultCallBack object to notify the application
when the request has completed.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
Entry entry = stack.contentType("form_name").entry("entry_uid");<br>
entry.fetch(new EntryResultCallBack() {<br>
@Override
public void onCompletion(ResponseType responseType, Error error) {
}<br>
});<br>
public Entry addParam(@NotNull String key, @NotNull String value)
key - The key as string which needs to be added to an Entryvalue - The value as string which needs to be added to an EntryEntry
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
final Entry entry = stack.contentType("user").entry("entryUid"); <br>
entry.addParam("include_dimensions", "true"); <br>
entry.fetch(new ResultCallBack() {
<br>@ Override
public void onCompletion(ResponseType responseType, Error error) {
}<br>
});<br>
public Entry includeReferenceContentTypeUID()
Entry
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
final Entry entry = stack.contentType("user").entry("entryUid"); <br>
entry.includeReferenceContentTypeUID; <br>
entry.fetch(new EntryResultCallBack() {
<br>@Override
public void onCompletion(ResponseType responseType, Error error) {
}<br>
});<br>
public Entry includeContentType()
Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
final Entry entry = stack.contentType("user").entry("entryUid");
entry.includeContentType();
public Entry includeFallback()
Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
final Entry entry = stack.contentType("user").entry("entryUid");
entry.includeFallback();
public Entry includeEmbeddedItems()
Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
final Entry entry = stack.contentType("user").entry("entryUid");
entry.includeEmbeddedItems();
public Entry includeBranch()
Entry object, so you can chain this call.
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment");
final Entry entry = stack.contentType("user").entry("entryUid");
entry.includeBranch();
Copyright © 2021 Contentstack.. All rights reserved.