NIHVIVO-143 Fix to previous commit: took isVitroNsProp value out of the EditConfiguration and put it in the request.
This commit is contained in:
parent
1de471536a
commit
014d9a3762
8 changed files with 75 additions and 57 deletions
|
@ -87,7 +87,6 @@ public class EditConfiguration {
|
|||
String entityToReturnTo;
|
||||
String formUrl;
|
||||
String editKey;
|
||||
boolean isVitroNsProp;
|
||||
|
||||
EditN3Generator n3generator;
|
||||
private String originalJson;
|
||||
|
@ -169,9 +168,6 @@ public class EditConfiguration {
|
|||
entityToReturnTo = subjectUri;
|
||||
|
||||
urlPatternToReturnTo = obj.getString("urlPatternToReturnTo");
|
||||
|
||||
String vitroNsPropParam = obj.getString("isVitroNsProp");
|
||||
isVitroNsProp = vitroNsPropParam != null && vitroNsPropParam.equalsIgnoreCase("true");
|
||||
|
||||
JSONArray predicate = obj.getJSONArray("predicate");
|
||||
if( predicate.length() != 2 )
|
||||
|
@ -514,14 +510,6 @@ public class EditConfiguration {
|
|||
public void setUrlPatternToReturnTo(String s) {
|
||||
urlPatternToReturnTo = s;
|
||||
}
|
||||
|
||||
public boolean isVitroNsProp() {
|
||||
return isVitroNsProp;
|
||||
}
|
||||
|
||||
public void setIsVitroNsProp(boolean b) {
|
||||
isVitroNsProp = b;
|
||||
}
|
||||
|
||||
/** return a copy of the value so that the configuration is not modified by external code.
|
||||
* @return
|
||||
|
|
|
@ -327,14 +327,25 @@ public class PropertyEditLinks extends TagSupport{
|
|||
|
||||
int index = 0;
|
||||
|
||||
if ( contains( allowedAccessTypeArray, EditLinkAccess.MODIFY ) ){
|
||||
log.debug("Permission found to UPDATE vitro namespace property " + predicateUri);
|
||||
boolean deleteAllowed = ( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) &&
|
||||
!( predicateUri.endsWith("#label") || predicateUri.endsWith("#type") ) );
|
||||
|
||||
if( contains( allowedAccessTypeArray, EditLinkAccess.MODIFY ) ){
|
||||
log.debug("permission found to UPDATE vitro namepsace property statement "+ predicateUri);
|
||||
LinkStruct ls = new LinkStruct();
|
||||
String url = makeRelativeHref(dispatchUrl,
|
||||
"subjectUri", subjectUri,
|
||||
"predicateUri", predicateUri,
|
||||
"datapropKey", dpropHash,
|
||||
"vitroNsProp", "true");
|
||||
String url = deleteAllowed
|
||||
? makeRelativeHref(dispatchUrl,
|
||||
"subjectUri", subjectUri,
|
||||
"predicateUri", predicateUri,
|
||||
"datapropKey", dpropHash,
|
||||
"vitroNsProp", "true")
|
||||
: makeRelativeHref(dispatchUrl,
|
||||
"subjectUri", subjectUri,
|
||||
"predicateUri", predicateUri,
|
||||
"datapropKey", dpropHash,
|
||||
"vitroNsProp", "true",
|
||||
"deleteProhibited", "prohibited");
|
||||
|
||||
ls.setHref(url);
|
||||
ls.setType("edit");
|
||||
ls.setMouseoverText("edit this text");
|
||||
|
@ -346,24 +357,22 @@ public class PropertyEditLinks extends TagSupport{
|
|||
}
|
||||
|
||||
// Name and type can be edited but not deleted
|
||||
if ( !( predicateUri.endsWith("#label") || predicateUri.endsWith("#type") ) ) {
|
||||
if ( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) ){
|
||||
LinkStruct ls = new LinkStruct();
|
||||
log.debug("Permission found to DELETE vitro namespace property " + predicateUri);
|
||||
String url = makeRelativeHref(dispatchUrl,
|
||||
"subjectUri", subjectUri,
|
||||
"predicateUri", predicateUri,
|
||||
"datapropKey", dpropHash,
|
||||
"vitroNsProp", "true");
|
||||
ls.setHref(url);
|
||||
ls.setType("delete");
|
||||
ls.setMouseoverText("delete this text");
|
||||
links[index] = ls;
|
||||
index++;
|
||||
}
|
||||
else {
|
||||
log.debug("NO permission found to DELETE vitro namespace property " + predicateUri);
|
||||
}
|
||||
if ( deleteAllowed ) {
|
||||
LinkStruct ls = new LinkStruct();
|
||||
log.debug("Permission found to DELETE vitro namespace property " + predicateUri);
|
||||
String url = makeRelativeHref(dispatchUrl,
|
||||
"subjectUri", subjectUri,
|
||||
"predicateUri", predicateUri,
|
||||
"datapropKey", dpropHash,
|
||||
"vitroNsProp", "true");
|
||||
ls.setHref(url);
|
||||
ls.setType("delete");
|
||||
ls.setMouseoverText("delete this text");
|
||||
links[index] = ls;
|
||||
index++;
|
||||
}
|
||||
else {
|
||||
log.debug("NO permission found to DELETE vitro namespace property " + predicateUri);
|
||||
}
|
||||
|
||||
return links;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue