1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 Wipro Limited.
6 * ==============================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 *******************************************************************************/
22 package org.onap.dcaegen2.services.sonhms.dao;
24 import org.onap.dcaegen2.services.sonhms.entity.ClusterDetails;
26 import java.util.List;
28 import org.springframework.data.jpa.repository.Modifying;
29 import org.springframework.data.jpa.repository.Query;
30 import org.springframework.data.repository.CrudRepository;
31 import org.springframework.stereotype.Repository;
32 import org.springframework.transaction.annotation.Transactional;
37 public interface ClusterDetailsRepository extends CrudRepository<ClusterDetails, String> {
40 @Query(nativeQuery = true, value = "UPDATE CLUSTER_DETAILS SET cluster_info=?1 WHERE cluster_id = ?2")
41 public void updateCluster(String clusterInfo, String clusterId);
43 @Query(nativeQuery = true, value = "SELECT * FROM cluster_details")
44 public List<ClusterDetails> getAllClusterDetails();
46 @Query(nativeQuery = true, value = "SELECT child_thread_id FROM cluster_details WHERE cluster_id = ?1")
47 public long getChildThreadForCluster(String clusterId);
49 @Query(nativeQuery = true, value = "SELECT cluster_id FROM cluster_details WHERE child_thread_id = ?1")
50 public String getClusterIdForChildThread(long childThreadId);
53 @Query(nativeQuery = true, value = "DELETE FROM cluster_details WHERE child_thread_id = ?1")
54 public void deleteByChildThreadId(Long threadId);
57 @Query(nativeQuery = true, value = "UPDATE cluster_details SET child_thread_id = ?2 WHERE cluster_id = ?1")
58 public void updateThreadId(String clusterId, Long threadId);