LBAC-13 Added implementation to create RefApp location glopal property #19
Conversation
@@ -45,6 +47,16 @@ public void willStart() { | |||
* @see ModuleActivator#started() | |||
*/ | |||
public void started() { | |||
String refAppLocationGlobalProperty = Context.getAdministrationService().getGlobalProperty(LocationBasedAccessConstants.REF_APP_LOCATION_USER_PROPERTY_NAME); | |||
if(StringUtils.isNotBlank(refAppLocationGlobalProperty) && refAppLocationGlobalProperty != LocationBasedAccessConstants.LOCATION_USER_PROPERTY_NAME) { |
dkayiwa
Jul 26, 2018
Member
Does this give a user the flexibility of turning it off with a different value?
Does this give a user the flexibility of turning it off with a different value?
suthagar23
Jul 27, 2018
Author
Member
Yes, If the value exists in the system, then it will exit from creating the new global property.
Yes, If the value exists in the system, then it will exit from creating the new global property.
@@ -45,6 +47,16 @@ public void willStart() { | |||
* @see ModuleActivator#started() | |||
*/ | |||
public void started() { | |||
String refAppLocationGlobalProperty = Context.getAdministrationService().getGlobalProperty(LocationBasedAccessConstants.REF_APP_LOCATION_USER_PROPERTY_NAME); | |||
if(StringUtils.isNotBlank(refAppLocationGlobalProperty) && refAppLocationGlobalProperty != LocationBasedAccessConstants.LOCATION_USER_PROPERTY_NAME) { |
dkayiwa
Jul 26, 2018
Member
String comparison is not usually done like that.
String comparison is not usually done like that.
@@ -45,6 +47,19 @@ public void willStart() { | |||
* @see ModuleActivator#started() | |||
*/ | |||
public void started() { | |||
String refAppLocationGlobalProperty = Context.getAdministrationService().getGlobalProperty(LocationBasedAccessConstants.REF_APP_LOCATION_USER_PROPERTY_NAME); |
dkayiwa
Jul 27, 2018
Member
What does ref app global property mean?
What does ref app global property mean?
suthagar23
Jul 27, 2018
Author
Member
better to change as "locationUserPropertyName". Do you agree?
better to change as "locationUserPropertyName". Do you agree?
dkayiwa
Jul 27, 2018
Member
That would be better.
That would be better.
log.debug("RefApp Location global property created with value - " + LocationBasedAccessConstants.LOCATION_USER_PROPERTY_NAME); | ||
} | ||
} | ||
else if(StringUtils.isNotBlank(refAppLocationGlobalProperty) && !refAppLocationGlobalProperty.equals(LocationBasedAccessConstants.LOCATION_USER_PROPERTY_NAME)) { |
dkayiwa
Jul 27, 2018
Member
I thought this was just a flag that is set to either true or false?
I thought this was just a flag that is set to either true or false?
suthagar23
Jul 27, 2018
Author
Member
Then we need two Global properties for this implementation.
- One for True or False (to show locations or not)
- To get the location user property name
Do want me to make this by two GPs?
Then we need two Global properties for this implementation.
- One for True or False (to show locations or not)
- To get the location user property name
Do want me to make this by two GPs?
dkayiwa
Jul 27, 2018
Member
I think one instead of two would make it less work to configure. In that case it will be a property pointing to the user property name. Whenever it is set, we know that it is true. If not set, we know it is false.
I think one instead of two would make it less work to configure. In that case it will be a property pointing to the user property name. Whenever it is set, we know that it is true. If not set, we know it is false.
suthagar23
Jul 27, 2018
Author
Member
In addition to this, I thought to have when evet it is set, we know that it true, if not set or has value as "false" we know it is false. Is it alright?
In addition to this, I thought to have when evet it is set, we know that it true, if not set or has value as "false" we know it is false. Is it alright?
dkayiwa
Jul 27, 2018
Member
What happens when it points to wrong property name?
What happens when it points to wrong property name?
suthagar23
Jul 27, 2018
Author
Member
that might be a problem. So better to remove this and, follow Whenever it is set, we know that it is true. If not set, we know it is false.
that might be a problem. So better to remove this and, follow Whenever it is set, we know that it is true. If not set, we know it is false.
suthagar23
Jul 27, 2018
Author
Member
In this line, it is checking for the exisiting value with the actual value to show the WARN message.
In this line, it is checking for the exisiting value with the actual value to show the WARN message.
1b7e0b7
to
49e837c
LBAC-13 Added implementation to create RefApp location glopal property
@@ -14,4 +14,6 @@ | |||
|
|||
public static final String LOCATION_ATTRIBUTE_GLOBAL_PROPERTY_NAME = "locationbasedaccess.locationAttributeUuid"; | |||
public static final String LOCATION_USER_PROPERTY_NAME = "locationUuid"; | |||
|
|||
public static final String REF_APP_LOCATION_USER_PROPERTY_NAME = "referenceapplication.locationUserPropertyName"; |
dkayiwa
Jul 27, 2018
Member
Of what value is this GP when you expect the user property to be named as "locationUuid"?
Of what value is this GP when you expect the user property to be named as "locationUuid"?
suthagar23
Jul 27, 2018
Author
Member
exactly "locationUuid" as the GP value
exactly "locationUuid" as the GP value
dkayiwa
Jul 27, 2018
Member
We do not do global properties for fixed values that we know. Otherwise, of what value would the gp be?
We do not do global properties for fixed values that we know. Otherwise, of what value would the gp be?
suthagar23
Jul 27, 2018
Author
Member
So can we move the locationUserProperty to a global property name as "locationbasedaccess.locationUserPropertyName"? So the userProperty name also will be fetched from the GP, and use that same value to this RefApp GP as well?
So can we move the locationUserProperty to a global property name as "locationbasedaccess.locationUserPropertyName"? So the userProperty name also will be fetched from the GP, and use that same value to this RefApp GP as well?
dkayiwa
Jul 27, 2018
Member
What do you think? What are the pros and cons of either side?
What do you think? What are the pros and cons of either side?
suthagar23
Jul 27, 2018
Author
Member
No need to create new one, Will reopen this : https://issues.openmrs.org/browse/LBAC-2
No need to create new one, Will reopen this : https://issues.openmrs.org/browse/LBAC-2
suthagar23
Jul 27, 2018
Author
Member
We decided to drop this idea and go with it for now. So are there any more comments?
We decided to drop this idea and go with it for now. So are there any more comments?
dkayiwa
Jul 27, 2018
Member
So what are you using the gp for?
So what are you using the gp for?
suthagar23
Jul 27, 2018
Author
Member
We need this to connect our module with RefApp module without any direct coupling. Since both need this userPropertyName. So we can connect them through this GP.
Otherwise we need to hardcode this value in both module.
We need this to connect our module with RefApp module without any direct coupling. Since both need this userPropertyName. So we can connect them through this GP.
Otherwise we need to hardcode this value in both module.
dkayiwa
Jul 27, 2018
Member
Got you! 😊
Got you!
@@ -45,6 +47,18 @@ public void willStart() { | |||
* @see ModuleActivator#started() | |||
*/ | |||
public void started() { | |||
String locationUserPropertyName = Context.getAdministrationService().getGlobalProperty(LocationBasedAccessConstants.REF_APP_LOCATION_USER_PROPERTY_NAME); | |||
if(StringUtils.isBlank(locationUserPropertyName)) { | |||
Context.getAdministrationService().setGlobalProperty(LocationBasedAccessConstants.REF_APP_LOCATION_USER_PROPERTY_NAME, |
dkayiwa
Jul 27, 2018
Member
If you expect the value to be LocationBasedAccessConstants.LOCATION_USER_PROPERTY_NAME, then why are you doing a gp for it?
If you expect the value to be LocationBasedAccessConstants.LOCATION_USER_PROPERTY_NAME, then why are you doing a gp for it?
suthagar23
Jul 27, 2018
Author
Member
The reason was, in our module, we can use this LocationBasedAccessConstants.LOCATION_USER_PROPERTY_NAME.
But in the RefApp module, it should be decoupled to use another property names for different usages. So I used the RefApp GP to track that value, and for only our module I used this.
The reason was, in our module, we can use this LocationBasedAccessConstants.LOCATION_USER_PROPERTY_NAME.
But in the RefApp module, it should be decoupled to use another property names for different usages. So I used the RefApp GP to track that value, and for only our module I used this.
Description
This PR contains the implementation to create the refapp location global propery while starting the module.
Ticket Information
Ticekt : https://issues.openmrs.org/browse/LBAC-13