Skip to content

Commit 2838a84

Browse files
Merge pull request #6 from contentstack/development
Development
2 parents e62d07d + db88065 commit 2838a84

File tree

15 files changed

+177
-54
lines changed

15 files changed

+177
-54
lines changed

CHANGELOG.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
11

22
## CHANGELOG
33

4+
## Version 1.4.0
5+
###### Date: 26-July-2019
6+
- [Entry] - Added support for includeReferenceContentTypeUid support in Entry.
7+
- [Query] - Added support for includeReferenceContentTypeUid support in Query.
8+
- [Entry] - setLanguage and getLanguage Deprecated in Entry.
9+
- [Query] - language deprecated in Query
10+
- [Entry] - Added method for getLocale and setLocale(String locale) in Entry
11+
- [Query] - Added method for locale in Query.
12+
- [Query] - Removed deprecated method for includeSchema in Query
13+
14+
------------------------------------------------
15+
416

517
## Version 1.3.3
6-
### Date: 21-June-2019
7-
Override response hot-fix
18+
###### Date: 21-June-2019
19+
- Override response hot-fix
820

921
------------------------------------------------
1022

1123
## Version 1.3.2
1224
### Date: 13-May-2019
13-
Removed println
14-
Added support for Logger
25+
- Removed println
26+
- Added support for Logger
1527

1628
------------------------------------------------
1729

1830
## Version 1.3.1
19-
### Date: May-02-2019
20-
Change: include reference bug fixed
21-
added testcase report for v1.3.1
31+
###### Date: May-02-2019
32+
- Change: include reference bug fixed
33+
- added testcase report for v1.3.1
2234

2335

2436
------------------------------------------------
2537

2638

2739
## Version 1.3.0
28-
### Date: Apr-12-2019
40+
###### Date: Apr-12-2019
2941
Change: Added support of below methods in SDK
3042

3143
```
@@ -40,7 +52,7 @@ Below two support from the Config class has been removed permanently
4052
------------------------------------------------
4153

4254
## Version 1.2.1
43-
### Date: 14-Mar-2019
55+
###### Date: 14-Mar-2019
4456
- Note: Bug Fixes and code clean up:
4557

4658
--------------------------------
@@ -51,7 +63,7 @@ Folder structure modified.
5163

5264
------------------------------------------------
5365
## Version 1.2.0
54-
### Date: 15-Dec-2017
66+
###### Date: 15-Dec-2017
5567
- New Features:
5668
```
5769
Entry- added method ‘addParam’
@@ -61,8 +73,9 @@ Asset- added method 'addParam'
6173
------------------------------------------------
6274

6375
## Version 1.1.0
64-
### Date: 10-Nov-2017
76+
###### Date: 10-Nov-2017
6577
- New Features:
78+
6679
```
6780
Stack- added method 'ImageTransform'
6881
Query- added method 'includeContentType'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ To use the Contentstack Java SDK to your existing project, perform the steps giv
2020
<dependency>
2121
<groupId>com.contentstack.sdk</groupId>
2222
<artifactId>java</artifactId>
23-
<version>1.3.3</version>
23+
<version>1.4.0</version>
2424
</dependency>
2525
```
2626

2727
2. **Gradle**
2828
```
29-
implementation 'com.contentstack.sdk:java:1.3.3'
29+
implementation 'com.contentstack.sdk:java:1.4.0'
3030
```
3131

3232
### Key Concepts for using Contentstack

pom.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Written manually.
2-
version=1.3.2
2+
version=1.4.0
33
groupId=com.contentstack.sdk
44
artifactId=java

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.contentstack.sdk</groupId>
88
<artifactId>java</artifactId>
9-
<version>1.3.3</version>
9+
<version>1.4.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>contentstack-java</name>

src/main/java/com/contentstack/sdk/AssetLibrary.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import java.util.*;
99

1010
/**
11+
* @Author Shailesh Mishra
12+
*
1113
* MIT License
1214
*
1315
* Copyright (c) 2012 - 2019 Contentstack

src/main/java/com/contentstack/sdk/AssetModel.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88

99
/**
10+
* @Author Shailesh Mishra
11+
*
1012
* MIT License
1113
*
1214
* Copyright (c) 2012 - 2019 Contentstack

src/main/java/com/contentstack/sdk/CSBackgroundTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package com.contentstack.sdk;import com.contentstack.sdk.utility.CSAppConstants;import org.json.JSONObject;import java.util.HashMap;import java.util.LinkedHashMap;/** * @Author Contentstack * * MIT License * * Copyright (c) 2012 - 2019 Contentstack * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */class CSBackgroundTask { public CSBackgroundTask(Query queryInstance, Stack stackInstance, String controller, String url, LinkedHashMap<String, Object> headers, LinkedHashMap<String, Object> urlQueries, JSONObject jsonMain, String requestInfo, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(queryInstance); csConnectionRequest.setQueryInstance(queryInstance); csConnectionRequest.setURLQueries(urlQueries); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } public CSBackgroundTask(Entry entryInstance, Stack stackInstance, String controller, String url, LinkedHashMap<String, Object> headers, HashMap<String, Object> urlQueries, JSONObject jsonMain, String requestInfo, boolean isOffline, CSAppConstants.RequestMethod method, ResultCallBack callBack) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(entryInstance); csConnectionRequest.setURLQueries(urlQueries); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callBack); } else { sendErrorForHeader(callBack); } } else { sendErrorToUser(callBack); } } public CSBackgroundTask(AssetLibrary assetLibrary, Stack stackInstance, String controller, String url, LinkedHashMap<String, Object> headers, HashMap<String, Object> urlQueries, JSONObject jsonMain, String requestInfo, boolean isOffline, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(assetLibrary); csConnectionRequest.setURLQueries(urlQueries); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } public CSBackgroundTask(Asset asset, Stack stackInstance, String controller, String url, LinkedHashMap<String, Object> headers, HashMap<String, Object> urlQueries, JSONObject jsonMain, String requestInfo, boolean isOffline, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(asset); csConnectionRequest.setURLQueries(urlQueries); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } public CSBackgroundTask(Stack stackInstance, String controller, String url, HashMap<String, Object> headers, HashMap<String, Object> urlParams, JSONObject jsonMain, String requestInfo, boolean b, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(stackInstance); csConnectionRequest.setStackInstance(stackInstance); csConnectionRequest.setURLQueries(urlParams); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } public CSBackgroundTask(ContentType contentTypeInstance, Stack stackInstance, String controller, String url, HashMap<String, Object> headers, HashMap<String, Object> urlParams, JSONObject jsonMain, String requestInfo, boolean b, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(contentTypeInstance); csConnectionRequest.setURLQueries(urlParams); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } private void sendErrorToUser(ResultCallBack callbackObject){ Error error = new Error(); error.setErrorCode(CSAppConstants.NONETWORKCONNECTION); error.setErrorMessage(CSAppConstants.ErrorMessage_NoNetwork); if(callbackObject != null){ callbackObject.onRequestFail(ResponseType.UNKNOWN,error); } } private void sendErrorForHeader(ResultCallBack callbackObject) { Error error = new Error(); error.setErrorMessage(CSAppConstants.ErrorMessage_CalledDefaultMethod); if (callbackObject != null) { callbackObject.onRequestFail(ResponseType.UNKNOWN, error); } }}
1+
package com.contentstack.sdk;import com.contentstack.sdk.utility.CSAppConstants;import org.json.JSONObject;import java.util.HashMap;import java.util.LinkedHashMap;/** * @Author Contentstack * * MIT License * * Copyright (c) 2012 - 2019 Contentstack * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */class CSBackgroundTask { public CSBackgroundTask(Query queryInstance, Stack stackInstance, String controller, String url, LinkedHashMap<String, Object> headers, LinkedHashMap<String, Object> urlQueries, JSONObject jsonMain, String requestInfo, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(queryInstance); csConnectionRequest.setQueryInstance(queryInstance); csConnectionRequest.setURLQueries(urlQueries); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } public CSBackgroundTask(Entry entryInstance, Stack stackInstance, String controller, String url, LinkedHashMap<String, Object> headers, HashMap<String, Object> urlQueries, JSONObject jsonMain, String requestInfo, boolean isOffline, CSAppConstants.RequestMethod method, ResultCallBack callBack) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(entryInstance); csConnectionRequest.setURLQueries(urlQueries); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callBack); } else { sendErrorForHeader(callBack); } } else { sendErrorToUser(callBack); } } public CSBackgroundTask(AssetLibrary assetLibrary, Stack stackInstance, String controller, String url, LinkedHashMap<String, Object> headers, HashMap<String, Object> urlQueries, JSONObject jsonMain, String requestInfo, boolean isOffline, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(assetLibrary); csConnectionRequest.setURLQueries(urlQueries); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } public CSBackgroundTask(Asset asset, Stack stackInstance, String controller, String url, LinkedHashMap<String, Object> headers, HashMap<String, Object> urlQueries, JSONObject jsonMain, String requestInfo, boolean isOffline, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(asset); csConnectionRequest.setURLQueries(urlQueries); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } public CSBackgroundTask(Stack stackInstance, String controller, String url, HashMap<String, Object> headers, HashMap<String, Object> urlParams, JSONObject jsonMain, String requestInfo, boolean b, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(stackInstance); csConnectionRequest.setStackInstance(stackInstance); csConnectionRequest.setURLQueries(urlParams); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } public CSBackgroundTask(ContentType contentTypeInstance, Stack stackInstance, String controller, String url, HashMap<String, Object> headers, HashMap<String, Object> urlParams, JSONObject jsonMain, String requestInfo, boolean b, CSAppConstants.RequestMethod method, ResultCallBack callback) { if (CSAppConstants.isNetworkAvailable()) { if (headers != null && headers.size() > 0) { String URL = stackInstance.URLSCHEMA + stackInstance.URL + url; CSConnectionRequest csConnectionRequest = new CSConnectionRequest(contentTypeInstance); csConnectionRequest.setURLQueries(urlParams); csConnectionRequest.setParams(URL, method, controller, jsonMain, headers, requestInfo, callback); } else { sendErrorForHeader(callback); } } else { sendErrorToUser(callback); } } private void sendErrorToUser(ResultCallBack callbackObject){ int NONETWORKCONNECTION = 408; Error error = new Error(); error.setErrorCode(NONETWORKCONNECTION); error.setErrorMessage(CSAppConstants.ErrorMessage_NoNetwork); if(callbackObject != null){ callbackObject.onRequestFail(ResponseType.UNKNOWN,error); } } private void sendErrorForHeader(ResultCallBack callbackObject) { Error error = new Error(); error.setErrorMessage(CSAppConstants.ErrorMessage_CalledDefaultMethod); if (callbackObject != null) { callbackObject.onRequestFail(ResponseType.UNKNOWN, error); } }}

src/main/java/com/contentstack/sdk/CSConnectionRequest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.*;
99

1010
/**
11-
* @Author Contentstack
11+
* @Author Shailesh Mishra
1212
*
1313
* MIT License
1414
*
@@ -223,6 +223,8 @@ else if(controller.equalsIgnoreCase(CSController.SINGLEQUERYOBJECT)){
223223
entryInstance.ownerUid = model.ownerUid;
224224
entryInstance.title = model.title;
225225
entryInstance.url = model.url;
226+
entryInstance.language = model.language;
227+
226228
if(model.ownerMap != null) {
227229
entryInstance.owner = new HashMap<>(model.ownerMap);
228230
}

src/main/java/com/contentstack/sdk/CSHttpConnection.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import java.io.*;
88
import java.net.*;
99
import java.util.*;
10-
import java.util.logging.Level;
11-
import java.util.logging.Logger;
1210

1311
/**
1412
* @Author Contentstack
@@ -375,4 +373,4 @@ private void generateBuiltError(HttpURLConnection connection){
375373
}
376374

377375

378-
}
376+
}

0 commit comments

Comments
 (0)