diff options
Diffstat (limited to 'src/main/java/com/wipro/www/sonhms/dao')
5 files changed, 219 insertions, 0 deletions
diff --git a/src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java b/src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java new file mode 100644 index 0000000..bdbdb6e --- /dev/null +++ b/src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * pcims + * ================================================================================ + * Copyright (C) 2018 Wipro Limited. + * ============================================================================== + * 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 com.wipro.www.sonhms.dao; + +import com.wipro.www.sonhms.entity.BufferedNotifications; + +import java.util.List; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + + +@Repository +public interface BufferedNotificationsRepository extends CrudRepository<BufferedNotifications, String> { + + @Query(nativeQuery = true, value = "SELECT cluster_id FROM buffered_notifications WHERE notification=?1") + public String getClusterIdForNotification(String notification); + + @Query(nativeQuery = true, + value = "DELETE FROM buffered_notifications " + "WHERE notification = ( SELECT notification " + + "FROM buffered_notifications WHERE cluster_id=?1) RETURNING notification;") + public List<String> getNotificationsFromQueue(String clusterId); + +} diff --git a/src/main/java/com/wipro/www/sonhms/dao/CellInfoRepository.java b/src/main/java/com/wipro/www/sonhms/dao/CellInfoRepository.java new file mode 100644 index 0000000..c4e1f8b --- /dev/null +++ b/src/main/java/com/wipro/www/sonhms/dao/CellInfoRepository.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * pcims + * ================================================================================ + * Copyright (C) 2018 Wipro Limited. + * ============================================================================== + * 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 com.wipro.www.sonhms.dao; + +import com.wipro.www.sonhms.entity.CellInfo; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + + +@Repository +public interface CellInfoRepository extends CrudRepository<CellInfo, String> { + + // public void + +} diff --git a/src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java b/src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java new file mode 100644 index 0000000..a833fbf --- /dev/null +++ b/src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * pcims + * ================================================================================ + * Copyright (C) 2018 Wipro Limited. + * ============================================================================== + * 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 com.wipro.www.sonhms.dao; + +import com.wipro.www.sonhms.entity.ClusterDetails; + +import java.util.List; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + + +@Repository +@Transactional +public interface ClusterDetailsRepository extends CrudRepository<ClusterDetails, String> { + + @Modifying + @Query(nativeQuery = true, value = "UPDATE CLUSTER_DETAILS SET cluster_info=?1 WHERE cluster_id = ?2") + public void updateCluster(String clusterInfo, String clusterId); + + @Query(nativeQuery = true, value = "SELECT * FROM cluster_details") + public List<ClusterDetails> getAllClusterDetails(); + + @Query(nativeQuery = true, value = "SELECT child_thread_id FROM cluster_details WHERE cluster_id = ?1") + public long getChildThreadForCluster(String clusterId); + + @Query(nativeQuery = true, value = "SELECT cluster_id FROM cluster_details WHERE child_thread_id = ?1") + public String getClusterIdForChildThread(long childThreadId); + + @Modifying + @Query(nativeQuery = true, value = "DELETE FROM cluster_details WHERE child_thread_id = ?1") + public void deleteByChildThreadId(Long threadId); + + @Modifying + @Query(nativeQuery = true, value = "UPDATE cluster_details SET child_thread_id = ?2 WHERE cluster_id = ?1") + public void updateThreadId(String clusterId, Long threadId); + +} diff --git a/src/main/java/com/wipro/www/sonhms/dao/DmaapNotificationsRepository.java b/src/main/java/com/wipro/www/sonhms/dao/DmaapNotificationsRepository.java new file mode 100644 index 0000000..1ac2ff4 --- /dev/null +++ b/src/main/java/com/wipro/www/sonhms/dao/DmaapNotificationsRepository.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * pcims + * ================================================================================ + * Copyright (C) 2018 Wipro Limited. + * ============================================================================== + * 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 com.wipro.www.sonhms.dao; + +import com.wipro.www.sonhms.entity.DmaapNotifications; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + + +@Repository +public interface DmaapNotificationsRepository extends CrudRepository<DmaapNotifications, String> { + + @Query(nativeQuery = true, + value = "DELETE FROM dmaap_notifications " + + "WHERE notification = ( SELECT notification FROM dmaap_notifications ORDER BY " + + "created_at FOR UPDATE SKIP LOCKED LIMIT 1 ) RETURNING notification;") + + public String getNotificationFromQueue(); + +} diff --git a/src/main/java/com/wipro/www/sonhms/dao/SonRequestsRepository.java b/src/main/java/com/wipro/www/sonhms/dao/SonRequestsRepository.java new file mode 100644 index 0000000..6b0458d --- /dev/null +++ b/src/main/java/com/wipro/www/sonhms/dao/SonRequestsRepository.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * pcims + * ================================================================================ + * Copyright (C) 2018 Wipro Limited. + * ============================================================================== + * 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 com.wipro.www.sonhms.dao; + +import com.wipro.www.sonhms.entity.PciRequests; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + + +@Repository +@Transactional +public interface SonRequestsRepository extends CrudRepository<PciRequests, String> { + + @Query(nativeQuery = true, value = "SELECT child_thread_id FROM pci_requests WHERE transaction_id = ?1") + public long getChildThreadMapping(String transactionId); + + @Modifying + @Query(nativeQuery = true, value = "DELETE FROM pci_requests WHERE child_thread_id = ?1") + public void deleteByChildThreadId(Long threadId); + +} |