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