diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-10 09:28:05 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-10 09:33:37 -0400 |
commit | dfdb5a1d8cff4327a88220dfcc7f8df31814bf65 (patch) | |
tree | 2bd3933dddadf10b5f33bb9f851dd978378a4c4d /mso-api-handlers/mso-requests-db/src/main/java | |
parent | 63b09e55e00fed781eaaa92fe9e79673ee601d8f (diff) |
sparate beans and repositories
Seperate out Beans and repositories for RequestDB
Change-Id: I67d6597d580e9828b6bb8faafaea7e09cc6467c0
Issue-ID: SO-999
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/main/java')
14 files changed, 0 insertions, 1077 deletions
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/META-INF/MANIFEST.MF b/mso-api-handlers/mso-requests-db/src/main/java/META-INF/MANIFEST.MF deleted file mode 100644 index 5e9495128c..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0
-Class-Path:
-
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java deleted file mode 100644 index 603f9bb494..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import org.onap.so.db.request.beans.ArchivedInfraRequests; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; -import org.springframework.stereotype.Repository; - -@RepositoryRestResource(collectionResourceRel = "archivedInfraRequests", path = "archivedInfraRequests") -public interface ArchivedInfraRequestsRepository extends JpaRepository<ArchivedInfraRequests, String> { - -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java deleted file mode 100644 index cd25b122be..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import java.util.Date; -import java.util.List; - -import org.onap.so.db.request.beans.InfraActiveRequests; -import org.springframework.data.domain.Pageable; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; - - -@RepositoryRestResource(collectionResourceRel = "infraActiveRequests", path = "infraActiveRequests") -public interface InfraActiveRequestsRepository extends JpaRepository<InfraActiveRequests, String>, InfraActiveRequestsRepositoryCustom { - - InfraActiveRequests findOneByRequestIdOrClientRequestId(String requestId, String clientRequestId); - InfraActiveRequests findOneByRequestIdOrClientRequestIdAndRequestType(String requestId,String clientRequestId, String requestType); - InfraActiveRequests findOneByRequestId(String string); - InfraActiveRequests findOneByRequestBody(String requestBody); - List<InfraActiveRequests> findByEndTimeLessThan(Date endTime, Pageable request); - List<InfraActiveRequests> findByStartTimeLessThanAndEndTime(Date startTime, Date endTime, Pageable request); -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java deleted file mode 100644 index 570861dfa1..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.onap.so.db.request.beans.InfraActiveRequests; -import org.springframework.stereotype.Repository; - -@Repository -public interface InfraActiveRequestsRepositoryCustom { - - public boolean healthCheck(); - - public InfraActiveRequests getRequestFromInfraActive(String requestId); - - public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, - String requestScope); - - public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap); - - // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB - // (infra_active_requests table) for operationalEnvId and OperationalEnvName - public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap); - - public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName, String queryValue, - String requestType); - - public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType); - - public InfraActiveRequests checkDuplicateByVnfName(String vnfName, String action, String requestType); - - public InfraActiveRequests checkDuplicateByVnfId(String vnfId, String action, String requestType); - - public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId); - - List<InfraActiveRequests> getInfraActiveRequests(final Map<String, String[]> filters, final long startTime, - final long endTime, final Integer maxResult); - -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java deleted file mode 100644 index d66e378146..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java +++ /dev/null @@ -1,618 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import java.sql.Timestamp; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; - -import javax.persistence.EntityManager; -import javax.persistence.NonUniqueResultException; -import javax.persistence.Query; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Order; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.logger.MsoLogger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - - -@Repository -@Transactional(readOnly = true) -public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRepositoryCustom { - - - @Qualifier("requestEntityManagerFactory") - @Autowired - private EntityManager entityManager; - - protected static MsoLogger msoLogger = - MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, InfraActiveRequestsRepositoryImpl.class); - - protected static final String REQUEST_STATUS = "requestStatus"; - protected static final String SOURCE = "source"; - protected static final String START_TIME = "startTime"; - protected static final String END_TIME = "endTime"; - protected static final String REQUEST_TYPE = "requestType"; - protected static final String SERVICE_INSTANCE_ID = "serviceInstanceId"; - protected static final String SERVICE_INSTANCE_NAME = "serviceInstanceName"; - protected static final String VNF_INSTANCE_NAME = "vnfName"; - protected static final String VNF_INSTANCE_ID = "vnfId"; - protected static final String VOLUME_GROUP_INSTANCE_NAME = "volumeGroupName"; - protected static final String VOLUME_GROUP_INSTANCE_ID = "volumeGroupId"; - protected static final String VFMODULE_INSTANCE_NAME = "vfModuleName"; - protected static final String VFMODULE_INSTANCE_ID = "vfModuleId"; - protected static final String NETWORK_INSTANCE_NAME = "networkName"; - protected static final String CONFIGURATION_INSTANCE_ID = "configurationId"; - protected static final String CONFIGURATION_INSTANCE_NAME = "configurationName"; - protected static final String OPERATIONAL_ENV_ID = "operationalEnvId"; - protected static final String OPERATIONAL_ENV_NAME = "operationalEnvName"; - protected static final String NETWORK_INSTANCE_ID = "networkId"; - protected static final String GLOBAL_SUBSCRIBER_ID = "globalSubscriberId"; - protected static final String SERVICE_NAME_VERSION_ID = "serviceNameVersionId"; - protected static final String SERVICE_ID = "serviceId"; - protected static final String SERVICE_VERSION = "serviceVersion"; - protected static final String REQUEST_ID = "requestId"; - protected static final String REQUESTOR_ID = "requestorId"; - protected static final String ACTION = "action"; - - private static final List<String> VALID_COLUMNS = - Arrays.asList(REQUEST_ID, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, ACTION, REQUEST_STATUS); - - - /* - * (non-Javadoc) - * - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#healthCheck() - */ - @Override - public boolean healthCheck() { - - final Query query = entityManager.createNativeQuery(" show tables "); - - final List<?> list = query.getResultList(); - - return true; - } - - private List<InfraActiveRequests> executeInfraQuery(final CriteriaQuery<InfraActiveRequests> crit, - final List<Predicate> predicates, final Order order) { - - final long startTime = System.currentTimeMillis(); - msoLogger.debug("Execute query on infra active request table"); - - List<InfraActiveRequests> results = new ArrayList<InfraActiveRequests>(); - - try { - final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - crit.where(cb.and(predicates.toArray(new Predicate[0]))); - crit.orderBy(order); - results = entityManager.createQuery(crit).getResultList(); - - } finally { - msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully", "RequestDB", "getInfraActiveRequest", null); - } - return results; - } - - /* - * (non-Javadoc) - * - * @see - * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java. - * lang.String) - */ - @Override - public InfraActiveRequests getRequestFromInfraActive(final String requestId) { - final long startTime = System.currentTimeMillis(); - msoLogger.debug("Get request " + requestId + " from InfraActiveRequests DB"); - - InfraActiveRequests ar = null; - try { - final Query query = entityManager.createQuery( - "from InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId"); - query.setParameter(REQUEST_ID, requestId); - ar = this.getSingleResult(query); - } finally { - - msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully", "InfraRequestDB", "getRequestFromInfraActive", null); - } - return ar; - } - - /* - * (non-Javadoc) - * - * @see - * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkInstanceNameDuplicate(java. - * util.HashMap, java.lang.String, java.lang.String) - */ - @Override - public InfraActiveRequests checkInstanceNameDuplicate(final HashMap<String, String> instanceIdMap, - final String instanceName, final String requestScope) { - - final List<Predicate> predicates = new LinkedList<>(); - final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - final Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); - - if (instanceName != null && !instanceName.equals("")) { - - if ("service".equals(requestScope)) { - predicates.add(cb.equal(tableRoot.get(SERVICE_INSTANCE_NAME), instanceName)); - } else if ("vnf".equals(requestScope)) { - predicates.add(cb.equal(tableRoot.get(VNF_INSTANCE_NAME), instanceName)); - } else if ("volumeGroup".equals(requestScope)) { - predicates.add(cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_NAME), instanceName)); - } else if ("vfModule".equals(requestScope)) { - predicates.add(cb.equal(tableRoot.get(VFMODULE_INSTANCE_NAME), instanceName)); - } else if ("network".equals(requestScope)) { - predicates.add(cb.equal(tableRoot.get(NETWORK_INSTANCE_NAME), instanceName)); - } else if (requestScope.equals("configuration")) { - predicates.add(cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_NAME), instanceName)); - } else if (requestScope.equals("operationalEnvironment")) { - predicates.add(cb.equal(tableRoot.get(OPERATIONAL_ENV_NAME), instanceName)); - } - - } else { - if (instanceIdMap != null) { - if ("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null) { - predicates - .add(cb.equal(tableRoot.get(SERVICE_INSTANCE_ID), instanceIdMap.get("serviceInstanceId"))); - } - - if ("vnf".equals(requestScope) && instanceIdMap.get("vnfInstanceId") != null) { - predicates.add(cb.equal(tableRoot.get(VNF_INSTANCE_ID), instanceIdMap.get("vnfInstanceId"))); - } - - if ("vfModule".equals(requestScope) && instanceIdMap.get("vfModuleInstanceId") != null) { - predicates.add( - cb.equal(tableRoot.get(VFMODULE_INSTANCE_ID), instanceIdMap.get("vfModuleInstanceId"))); - } - - if ("volumeGroup".equals(requestScope) && instanceIdMap.get("volumeGroupInstanceId") != null) { - predicates.add(cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_ID), - instanceIdMap.get("volumeGroupInstanceId"))); - } - - if ("network".equals(requestScope) && instanceIdMap.get("networkInstanceId") != null) { - predicates - .add(cb.equal(tableRoot.get(NETWORK_INSTANCE_ID), instanceIdMap.get("networkInstanceId"))); - } - - if (requestScope.equals("configuration") && instanceIdMap.get("configurationInstanceId") != null) { - predicates.add(cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_ID), - instanceIdMap.get("configurationInstanceId"))); - } - - if (requestScope.equals("operationalEnvironment") - && instanceIdMap.get("operationalEnvironmentId") != null) { - predicates.add( - cb.equal(tableRoot.get(OPERATIONAL_ENV_ID), instanceIdMap.get("operationalEnvironmentId"))); - } - } - } - - predicates.add(tableRoot.get(REQUEST_STATUS) - .in(Arrays.asList("PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK"))); - - final Order order = cb.desc(tableRoot.get(START_TIME)); - - final List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order); - - InfraActiveRequests infraActiveRequests = null; - - if (dupList != null && !dupList.isEmpty()) { - infraActiveRequests = dupList.get(0); - } - - return infraActiveRequests; - } - - /* - * (non-Javadoc) - * - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom# - * getOrchestrationFiltersFromInfraActive(java.util.Map) - */ - @Override - public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive( - final Map<String, List<String>> orchestrationMap) { - - - final List<Predicate> predicates = new LinkedList<>(); - final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - final Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); - for (final Map.Entry<String, List<String>> entry : orchestrationMap.entrySet()) { - String mapKey = entry.getKey(); - if ("serviceInstanceId".equalsIgnoreCase(mapKey)) { - mapKey = "serviceInstanceId"; - } else if ("serviceInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "serviceInstanceName"; - } else if ("vnfInstanceId".equalsIgnoreCase(mapKey)) { - mapKey = "vnfId"; - } else if ("vnfInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "vnfName"; - } else if ("vfModuleInstanceId".equalsIgnoreCase(mapKey)) { - mapKey = "vfModuleId"; - } else if ("vfModuleInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "vfModuleName"; - } else if ("volumeGroupInstanceId".equalsIgnoreCase(mapKey)) { - mapKey = "volumeGroupId"; - } else if ("volumeGroupInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "volumeGroupName"; - } else if ("networkInstanceId".equalsIgnoreCase(mapKey)) { - mapKey = "networkId"; - } else if ("networkInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "networkName"; - } else if (mapKey.equalsIgnoreCase("configurationInstanceId")) { - mapKey = "configurationId"; - } else if (mapKey.equalsIgnoreCase("configurationInstanceName")) { - mapKey = "configurationName"; - } else if ("lcpCloudRegionId".equalsIgnoreCase(mapKey)) { - mapKey = "aicCloudRegion"; - } else if ("tenantId".equalsIgnoreCase(mapKey)) { - mapKey = "tenantId"; - } else if ("modelType".equalsIgnoreCase(mapKey)) { - mapKey = "requestScope"; - } else if ("requestorId".equalsIgnoreCase(mapKey)) { - mapKey = "requestorId"; - } else if ("requestExecutionDate".equalsIgnoreCase(mapKey)) { - mapKey = "startTime"; - } - - final String propertyValue = entry.getValue().get(1); - if ("startTime".equals(mapKey)) { - final SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy"); - try { - final Date thisDate = format.parse(propertyValue); - final Timestamp minTime = new Timestamp(thisDate.getTime()); - final Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1)); - - if ("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) { - predicates.add(cb.or(cb.lessThan(tableRoot.get(mapKey), minTime), - cb.greaterThanOrEqualTo(tableRoot.get(mapKey), maxTime))); - } else { - predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime)); - } - } catch (final Exception e) { - msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage(), e); - return null; - } - } else if ("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) { - predicates.add(cb.notEqual(tableRoot.get(mapKey), propertyValue)); - } else { - predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue)); - } - - } - - final Order order = cb.asc(tableRoot.get(START_TIME)); - - return executeInfraQuery(crit, predicates, order); - } - - // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB - // (infra_active_requests table) for operationalEnvId and OperationalEnvName - /* - * (non-Javadoc) - * - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom# - * getCloudOrchestrationFiltersFromInfraActive(java.util.Map) - */ - @Override - public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive( - final Map<String, String> orchestrationMap) { - final List<Predicate> predicates = new LinkedList<>(); - final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - final Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); - - // Add criteria on OperationalEnvironment RequestScope when requestorId is only specified in - // the filter - // as the same requestorId can also match on different API methods - final String resourceType = orchestrationMap.get("resourceType"); - if (resourceType == null) { - predicates.add(cb.equal(tableRoot.get("requestScope"), "operationalEnvironment")); - } - - for (final Map.Entry<String, String> entry : orchestrationMap.entrySet()) { - String mapKey = entry.getKey(); - if (mapKey.equalsIgnoreCase("requestorId")) { - mapKey = "requestorId"; - } else if (mapKey.equalsIgnoreCase("requestExecutionDate")) { - mapKey = "startTime"; - } else if (mapKey.equalsIgnoreCase("operationalEnvironmentId")) { - mapKey = "operationalEnvId"; - } else if (mapKey.equalsIgnoreCase("operationalEnvironmentName")) { - mapKey = "operationalEnvName"; - } else if (mapKey.equalsIgnoreCase("resourceType")) { - mapKey = "requestScope"; - } - - final String propertyValue = entry.getValue(); - if (mapKey.equals("startTime")) { - final SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy"); - try { - final Date thisDate = format.parse(propertyValue); - final Timestamp minTime = new Timestamp(thisDate.getTime()); - final Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1)); - - predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime)); - } catch (final Exception e) { - msoLogger.debug("Exception in getCloudOrchestrationFiltersFromInfraActive(): + " + e.getMessage()); - return null; - } - } else { - predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue)); - } - } - - final Order order = cb.asc(tableRoot.get(START_TIME)); - return executeInfraQuery(crit, predicates, order); - } - - /* - * (non-Javadoc) - * - * @see - * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestListFromInfraActive(java - * .lang.String, java.lang.String, java.lang.String) - */ - @Override - public List<InfraActiveRequests> getRequestListFromInfraActive(final String queryAttributeName, - final String queryValue, final String requestType) { - msoLogger.debug("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue); - - - try { - final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - final Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class); - final Predicate isEqual = cb.equal(candidateRoot.get(queryAttributeName), queryValue); - final Predicate equalRequestType = cb.equal(candidateRoot.get(REQUEST_TYPE), requestType); - final Predicate isNull = cb.isNull(candidateRoot.get(REQUEST_TYPE)); - final Predicate orClause = cb.or(equalRequestType, isNull); - final Order orderDesc = cb.desc(candidateRoot.get(START_TIME)); - final Order orderAsc = cb.asc(candidateRoot.get(SOURCE)); - crit.where(cb.and(isEqual, orClause)).orderBy(orderDesc, orderAsc); - - final List<InfraActiveRequests> arList = entityManager.createQuery(crit).getResultList(); - if (arList != null && !arList.isEmpty()) { - return arList; - } - } catch (final Exception exception) { - msoLogger.error("Unable to execute query", exception); - } - return Collections.emptyList(); - } - - - /* - * (non-Javadoc) - * - * @see - * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java. - * lang.String, java.lang.String) - */ - @Override - public InfraActiveRequests getRequestFromInfraActive(final String requestId, final String requestType) { - final long startTime = System.currentTimeMillis(); - msoLogger.debug("Get infra request from DB with id " + requestId); - - InfraActiveRequests ar = null; - try { - final Query query = entityManager.createQuery( - "from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType"); - query.setParameter(REQUEST_ID, requestId); - query.setParameter(REQUEST_TYPE, requestType); - ar = this.getSingleResult(query); - } finally { - msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully", "RequestDB", "getRequestFromInfraActive", null); - } - return ar; - } - - - /* - * (non-Javadoc) - * - * @see - * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfName(java.lang. - * String, java.lang.String, java.lang.String) - */ - @Override - public InfraActiveRequests checkDuplicateByVnfName(final String vnfName, final String action, - final String requestType) { - - final long startTime = System.currentTimeMillis(); - msoLogger.debug("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " - + requestType); - - InfraActiveRequests ar = null; - try { - final Query query = entityManager.createQuery( - "from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC"); - query.setParameter("vnfName", vnfName); - query.setParameter("action", action); - query.setParameter(REQUEST_TYPE, requestType); - @SuppressWarnings("unchecked") - final List<InfraActiveRequests> results = query.getResultList(); - if (!results.isEmpty()) { - ar = results.get(0); - } - } finally { - msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully", "RequestDB", "checkDuplicateByVnfName", null); - } - - return ar; - } - - /* - * (non-Javadoc) - * - * @see - * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfId(java.lang. - * String, java.lang.String, java.lang.String) - */ - @Override - public InfraActiveRequests checkDuplicateByVnfId(final String vnfId, final String action, - final String requestType) { - - final long startTime = System.currentTimeMillis(); - msoLogger.debug("Get list of infra requests from DB for VNF " + vnfId + " and action " + action); - - InfraActiveRequests ar = null; - try { - final Query query = entityManager.createQuery( - "from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC"); - query.setParameter("vnfId", vnfId); - query.setParameter("action", action); - query.setParameter(REQUEST_TYPE, requestType); - @SuppressWarnings("unchecked") - final List<InfraActiveRequests> results = query.getResultList(); - if (!results.isEmpty()) { - ar = results.get(0); - } - } finally { - msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully", "RequestDB", "checkDuplicateByVnfId", null); - } - - return ar; - } - - /* - * (non-Javadoc) - * - * @see - * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkVnfIdStatus(java.lang.String) - */ - @Override - public InfraActiveRequests checkVnfIdStatus(final String operationalEnvironmentId) { - final long startTime = System.currentTimeMillis(); - msoLogger.debug("Get Infra request from DB for OperationalEnvironmentId " + operationalEnvironmentId); - - InfraActiveRequests ar = null; - try { - final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - final Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class); - final Predicate operationalEnvEq = - cb.equal(candidateRoot.get("operationalEnvId"), operationalEnvironmentId); - final Predicate requestStatusNotEq = cb.notEqual(candidateRoot.get(REQUEST_STATUS), "COMPLETE"); - final Predicate actionEq = cb.equal(candidateRoot.get("action"), "create"); - final Order startTimeOrder = cb.desc(candidateRoot.get("startTime")); - crit.select(candidateRoot); - crit.where(cb.and(operationalEnvEq, requestStatusNotEq, actionEq)); - crit.orderBy(startTimeOrder); - final TypedQuery<InfraActiveRequests> query = entityManager.createQuery(crit); - final List<InfraActiveRequests> results = query.getResultList(); - if (!results.isEmpty()) { - ar = results.get(0); - } - } finally { - msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully", "RequestDB", "checkDuplicateByVnfName", null); - } - - return ar; - } - - protected <T> T getSingleResult(final Query query) { - query.setMaxResults(1); - final List<T> list = query.getResultList(); - if (list == null || list.isEmpty()) { - return null; - } else if (list.size() == 1) { - return list.get(0); - } else { - throw new NonUniqueResultException(); - } - - } - - @Override - public List<InfraActiveRequests> getInfraActiveRequests(final Map<String, String[]> filters, final long startTime, - final long endTime, final Integer maxResult) { - if (filters == null) { - return Collections.emptyList(); - } - try { - final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); - final CriteriaQuery<InfraActiveRequests> criteriaQuery = - criteriaBuilder.createQuery(InfraActiveRequests.class); - final Root<InfraActiveRequests> tableRoot = criteriaQuery.from(InfraActiveRequests.class); - final List<Predicate> predicates = getPredicates(filters, criteriaBuilder, tableRoot); - - final Timestamp minTime = new Timestamp(startTime); - final Timestamp maxTime = new Timestamp(endTime); - predicates.add(criteriaBuilder.greaterThanOrEqualTo(tableRoot.get(START_TIME), minTime)); - predicates.add(criteriaBuilder.lessThanOrEqualTo(tableRoot.get(END_TIME), maxTime)); - - criteriaQuery.where(criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]))); - if (maxResult != null) { - return entityManager.createQuery(criteriaQuery).setMaxResults(maxResult).getResultList(); - } - return entityManager.createQuery(criteriaQuery).getResultList(); - } catch (final Exception exception) { - msoLogger.error("Unable to execute query using filters: " + filters, exception); - return Collections.emptyList(); - } - } - - private List<Predicate> getPredicates(final Map<String, String[]> filters, final CriteriaBuilder criteriaBuilder, - final Root<InfraActiveRequests> tableRoot) { - final List<Predicate> predicates = new LinkedList<>(); - for (final Entry<String, String[]> entry : filters.entrySet()) { - final String[] params = entry.getValue(); - if (VALID_COLUMNS.contains(entry.getKey()) && params.length == 2) { - final QueryOperationType operationType = QueryOperationType.getQueryOperationType(params[0]); - final Predicate predicate = - operationType.getPredicate(criteriaBuilder, tableRoot, entry.getKey(), params[1]); - predicates.add(predicate); - } - } - return predicates; - } -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java deleted file mode 100644 index 16e10e3d5b..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import org.onap.so.db.request.beans.OperationStatus; -import org.onap.so.db.request.beans.OperationStatusId; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.repository.query.Param; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; - -@RepositoryRestResource(collectionResourceRel = "operationStatus", path = "operationStatus") -public interface OperationStatusRepository extends JpaRepository<OperationStatus, OperationStatusId> { - - OperationStatus findOneByServiceIdAndOperationId(@Param("SERVICE_ID") String serviceId, @Param("OPERATION_ID") String operationId); - public OperationStatus findOneByServiceName(String serviceName); - public OperationStatus findOneByServiceId(String serviceId); -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java deleted file mode 100644 index e89755d565..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; -import org.springframework.transaction.annotation.Transactional; - -@RepositoryRestResource(collectionResourceRel = "operationalEnvDistributionStatus", path = "operationalEnvDistributionStatus") -public interface OperationalEnvDistributionStatusRepository extends JpaRepository<OperationalEnvDistributionStatus, String> { - - @Modifying - @Transactional - @Query("update OperationalEnvDistributionStatus set distributionIdStatus = :distributionIdStatus where " - + "distributionId = :distributionId and operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId") - public int setDistributionIdStatus(@Param("distributionIdStatus") String distributionIdStatus, - @Param("distributionId") String distributionId, - @Param("operationalEnvId") String operationalEnvId, - @Param("serviceModelVersionId") String serviceModelVersionId); -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java deleted file mode 100644 index bcad9ce6d5..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import java.util.List; - -import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; -import org.onap.so.db.request.beans.OperationalEnvServiceModelStatusId; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; -import org.springframework.transaction.annotation.Transactional; - -@RepositoryRestResource(collectionResourceRel = "operationalEnvServiceModelStatus", path = "operationalEnvServiceModelStatus") -public interface OperationalEnvServiceModelStatusRepository extends JpaRepository<OperationalEnvServiceModelStatus, OperationalEnvServiceModelStatusId>{ - - public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId); - public List<OperationalEnvServiceModelStatus> findAllByOperationalEnvIdAndRequestId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId, - @Param("REQUEST_ID") String requestId); - public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId, - @Param("SERVICE_MODEL_VERSION_ID") String serviceModelVersionId); - -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java deleted file mode 100644 index f80be0525c..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import java.util.List; - -import org.onap.so.db.request.beans.RequestProcessingData; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.repository.query.Param; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; - -@RepositoryRestResource(collectionResourceRel = "requestProcessingData", path = "requestProcessingData") -public interface RequestProcessingDataRepository extends JpaRepository<RequestProcessingData, Integer> { - RequestProcessingData findOneBySoRequestIdAndGroupingIdAndNameAndTag( - @Param("SO_REQUEST_ID") String soRequestId, @Param("GROUPING_ID") String groupingId, - @Param("NAME") String name, @Param("TAG") String tag); - - List<RequestProcessingData> findBySoRequestIdOrderByGroupingIdDesc(@Param("SO_REQUEST_ID") String soRequestId); -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java deleted file mode 100644 index b93bf7840b..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import java.util.List; - -import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.db.request.beans.ResourceOperationStatusId; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; -import org.springframework.stereotype.Repository; - -@RepositoryRestResource(collectionResourceRel = "resourceOperationStatus", path = "resourceOperationStatus") -public interface ResourceOperationStatusRepository extends JpaRepository<ResourceOperationStatus, ResourceOperationStatusId> { - - List<ResourceOperationStatus> findByServiceIdAndOperationId(String serviceId, String operationId); -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java deleted file mode 100644 index 179d40ad23..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import org.onap.so.db.request.beans.SiteStatus; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; -import org.springframework.stereotype.Repository; - -@RepositoryRestResource(collectionResourceRel = "siteStatus", path = "siteStatus") -public interface SiteStatusRepository extends JpaRepository<SiteStatus, String> { - SiteStatus findOneBySiteName(String siteName); - -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java deleted file mode 100644 index 138ec0fb4d..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import java.util.List; - -import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; -import org.onap.so.db.request.beans.WatchdogComponentDistributionStatusId; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; -import org.springframework.stereotype.Repository; - -@RepositoryRestResource(collectionResourceRel = "watchdogComponentDistributionStatus", path = "watchdogComponentDistributionStatus") -public interface WatchdogComponentDistributionStatusRepository extends JpaRepository<WatchdogComponentDistributionStatus, WatchdogComponentDistributionStatusId> { - - public List<WatchdogComponentDistributionStatus> findByDistributionId(String distributionId); -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java deleted file mode 100644 index fde8485e6d..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import org.onap.so.db.request.beans.WatchdogDistributionStatus; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; -import org.springframework.stereotype.Repository; - -@RepositoryRestResource(collectionResourceRel = "watchdogDistributionStatus", path = "watchdogDistributionStatus") -public interface WatchdogDistributionStatusRepository extends JpaRepository<WatchdogDistributionStatus, String> { - -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java deleted file mode 100644 index b9585d495e..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; -import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookupId; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; -import org.springframework.stereotype.Repository; - -@RepositoryRestResource(collectionResourceRel = "watchdogServiceModVerIdLookup", path = "watchdogServiceModVerIdLookup") -public interface WatchdogServiceModVerIdLookupRepository extends JpaRepository<WatchdogServiceModVerIdLookup, WatchdogServiceModVerIdLookupId> { - - public WatchdogServiceModVerIdLookup findOneByDistributionId(String distributionId); - -} |