Thank you @darius,
This is indeed a substantial change, and I would be more than happy to be part of discussions and explanations regarding this topic. The video demo discussed a component called Access Control Relationships. This is one of the simpler components, so we can focus on that for this example.
The Access Control Relationships are represented by two Java classes, “AccessRelationship” and “AccessRelationshipType” in the org.openmrs package. The “AccessRelationship” class represents the actual relationship, and the “AccessRelationshipType” class represents the type of the relationship. These class are created similar to the “Relationship” and “RelationshipType” classes that are already part of OpenMRS. An AccessRelationship object has 3 major components, “PersonA”, “PersonB”, and “AccessRelationshipType”. And an AccessRelationshipType object only has one major component, which is its label.
An API interface is generated to allow the webapp to interact with the Access Control Relationships. The API interface is called “AccessRelationshipService” and can be found in the org.openmrs.api package. This interface provides basic methods, such as “save”, “purge”, “get”, etc. The API interface is implemented by the “AccessRelationshipServiceImpl” class found in the org.openmrs.api.impl package. Following the OpenMRS architecture, the DAO interface is called “AccessRelationshipDAO” and can be found in org.openmrs.api.db. The DAO interface is implemented by the “HibernateAccessRelationshipDAO” class found in org.openmrs.api.db.hibernate.
On the database side, 2 tables have been created to save these objects, “access_relationship_type” and “access_relationship”. The schema for these tables can be found in the “liquibase-update-to-latest.xml” file, (under the “resources” folder) between the lines 7354 and 7423. The Hibernate mapping files for these objects can be found in the appropriate location (api/src/main/resources/org/openmrs/api/db/hibernate). These files are named “AccessRelationship.hbm.xml” and “AccessRelationshipType.hbm.xml”.
On the webapp side, 2 admin pages have been introduced for managing these objects directly. These pages can be found at /webapp/src/main/webapp/WEB-INF/view/admin/rebac.
The first page, “accessRelationshipList.jsp”, allows admin users to search, add, and delete AccessRelationship objects. The second page, “accessRelationshipTypeList.jsp”, allows admin users to view, add, and delete AccessRelationshipType objects. Note: An AccessRelationshipType object cannot be deleted if it is part of an AccessRelationship object.
The controlled for the 2 admin pages can be found in the “web” module at the following location; /web/src/main/java/org/openmrs/web/controller/rebac. “AccessRelationshipListController.java” is the controller for “accessRelationshipList.jsp” and “AccessRelationshipTypeListController.java” is the controller for “accessRelationshipTypeList.jsp”. The controllers allow interaction between the web application and the system backend.
The property editors for the AccessRelationship and AccessRelationshipType classes can be found in the org.openmrs.propertyeditor package, within the “api” module.