Provided descriptions + todo for empty classes
This commit is contained in:
@@ -50,8 +50,8 @@ public final class AmazonProductDataSource implements DataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductDTO getProductDTOById(final String productId) {
|
||||
JSONObject offer = null;
|
||||
public ProductDTO getProductDTOById(final String productId) throws IllegalArgumentException {
|
||||
StringBuilder response = new StringBuilder();
|
||||
ProductDTO product = new ProductDTO(productId, DATA_ORIGIN);
|
||||
|
||||
try {
|
||||
@@ -73,27 +73,21 @@ public final class AmazonProductDataSource implements DataSource {
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||
reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
} else {
|
||||
return product;
|
||||
throw new IllegalArgumentException(
|
||||
"Amazon API responded with error code " + responseCode);
|
||||
}
|
||||
|
||||
String line;
|
||||
StringBuilder response = new StringBuilder();
|
||||
while ((line = reader.readLine()) != null) {
|
||||
response.append(line);
|
||||
}
|
||||
reader.close();
|
||||
|
||||
offer = new JSONObject(response.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (offer == null) {
|
||||
return product;
|
||||
throw new IllegalArgumentException("Couldn't fulfill Amazon API request");
|
||||
}
|
||||
|
||||
try {
|
||||
offer = offer.getJSONObject("featuredOffer");
|
||||
JSONObject offer = new JSONObject(response.toString()).getJSONObject("featuredOffer");
|
||||
|
||||
product.setDataOrigin(DATA_ORIGIN);
|
||||
product.setAvailable(offer
|
||||
@@ -113,7 +107,7 @@ public final class AmazonProductDataSource implements DataSource {
|
||||
.getJSONObject("merchant")
|
||||
.getString("name"));
|
||||
} catch (JSONException e) {
|
||||
return product;
|
||||
// Pass, allow incomplete ProductDTO to pass for later validation
|
||||
}
|
||||
|
||||
return product;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package de.rwu.easydrop.data.connector;
|
||||
|
||||
/**
|
||||
* Allows connecting to a SQLite Database.
|
||||
*
|
||||
* @todo implement
|
||||
*/
|
||||
public class DatabaseConnector {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package de.rwu.easydrop.data.dao;
|
||||
|
||||
/**
|
||||
* Product data access object.
|
||||
*
|
||||
* @todo implement
|
||||
*/
|
||||
public class ProductDAO {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package de.rwu.easydrop.data.model;
|
||||
|
||||
/**
|
||||
* A Product
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
public class Product {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package de.rwu.easydrop.service.mapping;
|
||||
|
||||
/**
|
||||
* Maps between Product, ProductDAO and ProductDTO.
|
||||
*
|
||||
* @since 0.1.0
|
||||
* @see Product
|
||||
* @see ProductDTO
|
||||
* @see ProductDAO
|
||||
*/
|
||||
public class ProductMapper {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package de.rwu.easydrop.service.processing;
|
||||
|
||||
/**
|
||||
* Processes dropshipping orders
|
||||
*
|
||||
* @todo implement
|
||||
*/
|
||||
public class OrderManager {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package de.rwu.easydrop.service.validation;
|
||||
|
||||
/**
|
||||
* Confirms validity of Product data
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
public class ProductValidator {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user