Guest User

Untitled

a guest
May 11th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. /*
  2. * This Source Code Form is subject to the terms of the Mozilla Public License,
  3. * v. 2.0. If a copy of the MPL was not distributed with this file, You can
  4. * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
  5. * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
  6. *
  7. * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
  8. * graphic logo is a trademark of OpenMRS Inc.
  9. */
  10. package org.openmrs.module.fhir2.api.dao.impl;
  11.  
  12. import static org.hibernate.criterion.Restrictions.eq;
  13.  
  14. import java.util.Collection;
  15.  
  16. import lombok.AccessLevel;
  17. import lombok.Setter;
  18. import org.hibernate.Criteria;
  19. import org.hibernate.SessionFactory;
  20. import org.openmrs.Obs;
  21. import org.openmrs.api.db.DAOException;
  22. import org.openmrs.module.fhir2.api.dao.FhirDiagnosticReportDao;
  23. import org.openmrs.module.fhir2.api.search.param.SearchParameterMap;
  24. import org.springframework.beans.factory.annotation.Autowired;
  25. import org.springframework.beans.factory.annotation.Qualifier;
  26. import org.springframework.stereotype.Component;
  27.  
  28. @Component
  29. @Setter(AccessLevel.PACKAGE)
  30. public class FhirDiagnosticReportDaoImpl extends BaseFhirDao<Obs> implements FhirDiagnosticReportDao {
  31.  
  32. /**
  33. *
  34. */
  35. private static final long serialVersionUID = 1L;
  36.  
  37. @Autowired
  38. @Qualifier("sessionFactory")
  39. SessionFactory sessionFactory;
  40.  
  41. @Override
  42. public Obs getObsGroupByUuid(String uuid) {
  43. return (Obs) sessionFactory.getCurrentSession().createCriteria(Obs.class).createAlias("groupMembers", "group")
  44. .add(eq("uuid", uuid)).uniqueResult();
  45. }
  46.  
  47. @Override
  48. public Obs saveObsGroup(Obs obs) throws DAOException {
  49. if (!obs.isObsGrouping()) {
  50. throw new IllegalArgumentException("Provided Obs must be an Obs grouping.");
  51. }
  52.  
  53. sessionFactory.getCurrentSession().saveOrUpdate(obs);
  54.  
  55. return obs;
  56. }
  57.  
  58. @Override
  59. public Obs get(String uuid) {
  60. // TODO Auto-generated method stub
  61. return super.get(uuid);
  62. }
  63.  
  64. @Override
  65. public Obs createOrUpdate(Obs newEntry) {
  66. // TODO Auto-generated method stub
  67. return super.createOrUpdate(newEntry);
  68. }
  69.  
  70. @Override
  71. public Obs delete(String uuid) {
  72. // TODO Auto-generated method stub
  73. return super.delete(uuid);
  74. }
  75.  
  76. @Override
  77. public Long getResultCounts(SearchParameterMap theParams) {
  78. // TODO Auto-generated method stub
  79. return super.getResultCounts(theParams);
  80. }
  81.  
  82. @Override
  83. public Integer getPreferredPageSize() {
  84. // TODO Auto-generated method stub
  85. return super.getPreferredPageSize();
  86. }
  87.  
  88. @Override
  89. public Collection<Obs> search(SearchParameterMap theParams) {
  90. // TODO Auto-generated method stub
  91. return super.search(theParams);
  92. }
  93.  
  94. @Override
  95. protected void setupSearchParams(Criteria criteria, SearchParameterMap theParams) {
  96. // TODO Auto-generated method stub
  97. super.setupSearchParams(criteria, theParams);
  98. }
  99. }
Add Comment
Please, Sign In to add comment