aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/BaseHandler.java46
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/PackageHandler.java29
2 files changed, 14 insertions, 61 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/BaseHandler.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/BaseHandler.java
index cd413296..4f3a3a6f 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/BaseHandler.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/BaseHandler.java
@@ -27,22 +27,19 @@ import org.onap.vnfsdk.marketplace.db.util.MarketplaceDbUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.gson.Gson;
-
/**
* an abstract class for NFV wrapper class.
* provide the common methods to process the CRUD rest request.
- *
+ *
*/
public abstract class BaseHandler<T extends BaseData> {
private static final Logger logger = LoggerFactory.getLogger(BaseHandler.class);
- public Gson gson = new Gson();
/**
- * create date.
+ * create date.
* @param data data to create
* @param resouceType resouce type
* @return T
@@ -50,16 +47,14 @@ public abstract class BaseHandler<T extends BaseData> {
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public PackageData create(PackageData data, String resouceType) throws MarketplaceResourceException {
- PackageData rtnData = null;
+ PackageData rtnData = null;
logger.info("BaseHandler:start create data.info:" + MarketplaceDbUtil.objectToString(data));
try {
-// check(data);
IMarketplaceDao dao = new MarketplaceDaoImpl();
dao.savePackageData(data);
rtnData = data;
} catch (Exception e1) {
logger.error("BaseHandler:error while creating " + resouceType, e1);
- // throw e1;
}
logger.info("BaseHandler:create data end.info:" + MarketplaceDbUtil.objectToString(data));
return rtnData;
@@ -72,7 +67,7 @@ public abstract class BaseHandler<T extends BaseData> {
* @throws MarketplaceResourceException e1
*/
@SuppressWarnings({"rawtypes", "unchecked"})
- public void delete(T data, String resouceType) throws MarketplaceResourceException {
+ public void delete(T data) throws MarketplaceResourceException {
logger.info("BaseHandler:start delete data.info:" + MarketplaceDbUtil.objectToString(data));
IMarketplaceDao dao = new MarketplaceDaoImpl();
dao.deletePackageData(((PackageData)data).getCsarId());
@@ -87,12 +82,11 @@ public abstract class BaseHandler<T extends BaseData> {
* @throws MarketplaceResourceException e1
*/
@SuppressWarnings({"rawtypes", "unchecked"})
- public List<PackageData> query(Map<String, String> queryParam, String resouceType)
+ public List<PackageData> query(Map<String, String> queryParam)
throws MarketplaceResourceException {
logger.info("BaseHandler:start query data .info:" + MarketplaceDbUtil.objectToString(queryParam));
- List<PackageData> datas = null;
IMarketplaceDao dao = new MarketplaceDaoImpl();
- datas = dao.getAllPackageData();
+ List<PackageData> datas = dao.getAllPackageData();
logger.info("BaseHandler: query data end .info:" + MarketplaceDbUtil.objectToString(datas));
return datas;
}
@@ -105,17 +99,9 @@ public abstract class BaseHandler<T extends BaseData> {
* @throws MarketplaceResourceException e1
*/
@SuppressWarnings({"rawtypes", "unchecked"})
- public List<T> unionQuery(String filter, String resouceType) throws MarketplaceResourceException {
+ public List<T> unionQuery(String filter) throws MarketplaceResourceException {
logger.info("BaseHandler:start union query data.fliter:" + filter);
List<T> datas = null;
- /* try {
- BaseDao dao = DaoManager.getInstance().getDao(resouceType);
- datas = dao.unionQuery(filter);
-
- } catch (MarketplaceResourceException e1) {
- logger.error("BaseHandler:error while union querying " + resouceType, e1);
- throw e1;
- }*/
logger.info("BaseHandler:union query data end .info:" + MarketplaceDbUtil.objectToString(datas));
return datas;
}
@@ -128,36 +114,28 @@ public abstract class BaseHandler<T extends BaseData> {
* @throws MarketplaceResourceException e1
*/
@SuppressWarnings({"rawtypes", "unchecked"})
- public int unionDelete(String filter, String resouceType) throws MarketplaceResourceException {
+ public int unionDelete(String filter) throws MarketplaceResourceException {
logger.info("BaseHandler:start delete query data.fliter:" + filter);
-// int num;
int num=0;
- /*try {
- BaseDao dao = DaoManager.getInstance().getDao(resouceType);
- num = dao.unionDelete(filter);
-
- } catch (MarketplaceResourceException e1) {
- logger.error("BaseHandler:error while union delete " + resouceType, e1);
- throw e1;
- }*/
logger.info("BaseHandler:union delete data end .num:" + num);
return num;
}
@SuppressWarnings({"rawtypes", "unchecked"})
- public void update(T data, String resouceType) throws MarketplaceResourceException {
+ public void update(T data) throws MarketplaceResourceException {
logger.info("BaseHandler:start update data.info:" + MarketplaceDbUtil.objectToString(data));
IMarketplaceDao dao = new MarketplaceDaoImpl();
dao.updatePackageData((PackageData)data);
logger.info("update data end");
}
-
+
/**
* check if the related object id exists in the system.
- *
+ *
* @param data data to check
* @throws MarketplaceResourceException e
*/
public abstract void check(T data) throws MarketplaceResourceException;
}
+
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/PackageHandler.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/PackageHandler.java
index 3619a745..3a3859a2 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/PackageHandler.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/wrapper/PackageHandler.java
@@ -19,7 +19,6 @@ import java.util.ArrayList;
import java.util.Map;
import org.onap.vnfsdk.marketplace.db.common.MarketplaceResourceType;
-import org.onap.vnfsdk.marketplace.db.common.Parameters;
import org.onap.vnfsdk.marketplace.db.entity.PackageData;
import org.onap.vnfsdk.marketplace.db.exception.MarketplaceResourceException;
import org.onap.vnfsdk.marketplace.db.impl.MarketplaceDaoImpl;
@@ -65,7 +64,7 @@ public class PackageHandler extends BaseHandler<PackageData> {
logger.info("packageHandler:start delete package info.");
PackageData packageData = new PackageData();
packageData.setCsarId(id);
- delete(packageData, MarketplaceResourceType.PACKAGE.name());
+ delete(packageData);
logger.info("packageHandler: delete package info end.");
}
@@ -75,26 +74,6 @@ public class PackageHandler extends BaseHandler<PackageData> {
* @return PackageData list
* @throws MarketplaceResourceException e
*/
- public ArrayList<PackageData> query(Map<String, String> queryParam)
- throws MarketplaceResourceException {
- logger.info("packageHandler:start query package info.");
- ArrayList<PackageData> data = new ArrayList<PackageData>();
- Object result = query(queryParam, MarketplaceResourceType.PACKAGE.name());
- if (result != null) {
- data = (ArrayList<PackageData>) result;
- } else {
- logger.info("packageHandler: query package info is null.");
- }
- logger.info("packageHandler: query package info end.");
- return data;
- }
-
- /**
- * query package data by map.
- * @param queryParam map data
- * @return PackageData list
- * @throws MarketplaceResourceException e
- */
public ArrayList<PackageData> queryByID(String csarID)
throws MarketplaceResourceException {
logger.info("packageHandler:start query package info.");
@@ -111,13 +90,9 @@ public class PackageHandler extends BaseHandler<PackageData> {
return data;
}
- public void update(PackageData oPackageData) throws MarketplaceResourceException{
- update(oPackageData, MarketplaceResourceType.PACKAGE.name());
- logger.info("packageHandler: update package info end.");
- }
-
@Override
public void check(PackageData packageData) throws MarketplaceResourceException {
}
}
+