From c215646d898e3d9910519c9c3c32910824fc1f78 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Thu, 21 Sep 2017 11:17:15 +0800 Subject: remove unused variables major: L42 L56 L62 L75 L90 L93 L108 L111 L131 L133 L135 L148 Change-Id: I994b19ea7efa1ed4f5bace99dd7e9e4a462bc785 Signed-off-by: Harry Huang Issue-Id: VNFSDK-85 --- .../vnfsdk/marketplace/db/wrapper/BaseHandler.java | 46 ++++++---------------- .../marketplace/db/wrapper/PackageHandler.java | 29 +------------- 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 { 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 { */ @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 { * @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 { * @throws MarketplaceResourceException e1 */ @SuppressWarnings({"rawtypes", "unchecked"}) - public List query(Map queryParam, String resouceType) + public List query(Map queryParam) throws MarketplaceResourceException { logger.info("BaseHandler:start query data .info:" + MarketplaceDbUtil.objectToString(queryParam)); - List datas = null; IMarketplaceDao dao = new MarketplaceDaoImpl(); - datas = dao.getAllPackageData(); + List datas = dao.getAllPackageData(); logger.info("BaseHandler: query data end .info:" + MarketplaceDbUtil.objectToString(datas)); return datas; } @@ -105,17 +99,9 @@ public abstract class BaseHandler { * @throws MarketplaceResourceException e1 */ @SuppressWarnings({"rawtypes", "unchecked"}) - public List unionQuery(String filter, String resouceType) throws MarketplaceResourceException { + public List unionQuery(String filter) throws MarketplaceResourceException { logger.info("BaseHandler:start union query data.fliter:" + filter); List 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 { * @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,30 +64,10 @@ public class PackageHandler extends BaseHandler { 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."); } - /** - * query package data by map. - * @param queryParam map data - * @return PackageData list - * @throws MarketplaceResourceException e - */ - public ArrayList query(Map queryParam) - throws MarketplaceResourceException { - logger.info("packageHandler:start query package info."); - ArrayList data = new ArrayList(); - Object result = query(queryParam, MarketplaceResourceType.PACKAGE.name()); - if (result != null) { - data = (ArrayList) 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 @@ -111,13 +90,9 @@ public class PackageHandler extends BaseHandler { 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 { } } + -- cgit 1.2.3-korg