tweaks to make the boolean values work.
This commit is contained in:
parent
daac8c3c4f
commit
1439c2195d
4 changed files with 54 additions and 10 deletions
|
@ -24,6 +24,7 @@ public class FauxProperty extends BaseResourceBean implements ResourceBean,
|
||||||
// May be null. Partial identifier on delete.
|
// May be null. Partial identifier on delete.
|
||||||
private String domainURI;
|
private String domainURI;
|
||||||
|
|
||||||
|
private String baseLabel;
|
||||||
private String rangeLabel;
|
private String rangeLabel;
|
||||||
private String domainLabel;
|
private String domainLabel;
|
||||||
|
|
||||||
|
@ -95,6 +96,14 @@ public class FauxProperty extends BaseResourceBean implements ResourceBean,
|
||||||
this.rangeURI = rangeURI;
|
this.rangeURI = rangeURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBaseLabel() {
|
||||||
|
return (baseLabel == null) ? localName(getBaseURI()) : baseLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseLabel(String baseLabel) {
|
||||||
|
this.baseLabel = baseLabel;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRangeLabel() {
|
public String getRangeLabel() {
|
||||||
return (rangeLabel == null) ? localName(rangeURI) : rangeLabel;
|
return (rangeLabel == null) ? localName(rangeURI) : rangeLabel;
|
||||||
}
|
}
|
||||||
|
@ -212,13 +221,13 @@ public class FauxProperty extends BaseResourceBean implements ResourceBean,
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "FauxProperty[domainURI=" + domainURI + ", baseUri=" + getURI()
|
return "FauxProperty[domainURI=" + domainURI + ", baseUri=" + getURI()
|
||||||
+ ", rangeURI=" + rangeURI + ", rangeLabel=" + rangeLabel
|
+ ", baseLabel=" + baseLabel + ", rangeURI=" + rangeURI
|
||||||
+ ", domainLabel=" + domainLabel + ", pickListName="
|
+ ", rangeLabel=" + rangeLabel + ", domainLabel=" + domainLabel
|
||||||
+ getPickListName() + ", contextUri=" + contextUri
|
+ ", pickListName=" + getPickListName() + ", contextUri="
|
||||||
+ ", configUri=" + configUri + ", groupURI=" + groupURI
|
+ contextUri + ", configUri=" + configUri + ", groupURI="
|
||||||
+ "publicDescription=" + publicDescription + ", displayTier="
|
+ groupURI + "publicDescription=" + publicDescription
|
||||||
+ displayTier + ", displayLimit=" + displayLimit
|
+ ", displayTier=" + displayTier + ", displayLimit="
|
||||||
+ ", collateBySubclass=" + collateBySubclass
|
+ displayLimit + ", collateBySubclass=" + collateBySubclass
|
||||||
+ ", selectFromExisting=" + selectFromExisting
|
+ ", selectFromExisting=" + selectFromExisting
|
||||||
+ ", offerCreateNewOption=" + offerCreateNewOption
|
+ ", offerCreateNewOption=" + offerCreateNewOption
|
||||||
+ ", customEntryForm=" + customEntryForm + ", customListView="
|
+ ", customEntryForm=" + customEntryForm + ", customListView="
|
||||||
|
|
|
@ -128,11 +128,15 @@ public class FauxPropertyRetryController extends BaseEditController {
|
||||||
.getObjectPropertyDao()
|
.getObjectPropertyDao()
|
||||||
.getObjectPropertyByURI(beanForEditing.getURI());
|
.getObjectPropertyByURI(beanForEditing.getURI());
|
||||||
|
|
||||||
|
addCheckboxValuesToTheRequest();
|
||||||
|
|
||||||
setFieldValidators();
|
setFieldValidators();
|
||||||
|
|
||||||
doABunchOfOtherJunk();
|
doABunchOfOtherJunk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String determineAction() {
|
private String determineAction() {
|
||||||
return (req.getParameter("create") == null) ? "update" : "insert";
|
return (req.getParameter("create") == null) ? "update" : "insert";
|
||||||
}
|
}
|
||||||
|
@ -170,9 +174,25 @@ public class FauxPropertyRetryController extends BaseEditController {
|
||||||
fp.setHiddenFromDisplayBelowRoleLevel(base.getHiddenFromDisplayBelowRoleLevel());
|
fp.setHiddenFromDisplayBelowRoleLevel(base.getHiddenFromDisplayBelowRoleLevel());
|
||||||
fp.setHiddenFromPublishBelowRoleLevel(base.getHiddenFromPublishBelowRoleLevel());
|
fp.setHiddenFromPublishBelowRoleLevel(base.getHiddenFromPublishBelowRoleLevel());
|
||||||
fp.setProhibitedFromUpdateBelowRoleLevel(base.getProhibitedFromUpdateBelowRoleLevel());
|
fp.setProhibitedFromUpdateBelowRoleLevel(base.getProhibitedFromUpdateBelowRoleLevel());
|
||||||
|
log.debug("Created new FauxProperty: " + fp);
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addCheckboxValuesToTheRequest() {
|
||||||
|
req.setAttribute("selectFromExisting",beanForEditing.isSelectFromExisting());
|
||||||
|
req.setAttribute("offerCreateNewOption", beanForEditing.isOfferCreateNewOption());
|
||||||
|
req.setAttribute("collateBySubclass", beanForEditing.isCollateBySubclass());
|
||||||
|
|
||||||
|
// checkboxes on HTML forms are pretty annoying : we don't know if
|
||||||
|
// someone *unchecked* a box, so we have to default to false on
|
||||||
|
// updates.
|
||||||
|
if (beanForEditing.getURI() != null) {
|
||||||
|
beanForEditing.setSelectFromExisting(false);
|
||||||
|
beanForEditing.setOfferCreateNewOption(false);
|
||||||
|
beanForEditing.setCollateBySubclass(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setFieldValidators() {
|
private void setFieldValidators() {
|
||||||
epo.getValidatorMap()
|
epo.getValidatorMap()
|
||||||
.put("RangeURI",
|
.put("RangeURI",
|
||||||
|
|
|
@ -86,6 +86,15 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
this.models = new LockingOntModelSelector(wadf.getOntModelSelector());
|
this.models = new LockingOntModelSelector(wadf.getOntModelSelector());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Need to override this, so the boolean convenience methods will work off
|
||||||
|
* the correct model.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected OntModel getOntModel() {
|
||||||
|
return getOntModelSelector().getDisplayModel();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FauxProperty> getFauxPropertiesForBaseUri(String uri) {
|
public List<FauxProperty> getFauxPropertiesForBaseUri(String uri) {
|
||||||
try (LockedOntModel displayModel = models.getDisplayModel().read()) {
|
try (LockedOntModel displayModel = models.getDisplayModel().read()) {
|
||||||
|
@ -110,6 +119,7 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
fpList.add(fp);
|
fpList.add(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.debug("Located " + fpList.size() + " FauxProperties.");
|
||||||
return fpList;
|
return fpList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,6 +167,7 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
FauxProperty fp = new FauxProperty(domainUri, baseUri, rangeUri);
|
FauxProperty fp = new FauxProperty(domainUri, baseUri, rangeUri);
|
||||||
fp.setContextUri(contextUri);
|
fp.setContextUri(contextUri);
|
||||||
populateInstance(fp);
|
populateInstance(fp);
|
||||||
|
log.debug("Loaded FauxProperty: " + fp);
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,6 +185,7 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
FauxProperty fp = new FauxProperty(domainUri, baseUri, rangeUri);
|
FauxProperty fp = new FauxProperty(domainUri, baseUri, rangeUri);
|
||||||
fp.setContextUri(contexts.iterator().next().getContextUri());
|
fp.setContextUri(contexts.iterator().next().getContextUri());
|
||||||
populateInstance(fp);
|
populateInstance(fp);
|
||||||
|
log.debug("Loaded FauxProperty: " + fp);
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,6 +271,8 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFauxProperty(FauxProperty fp) {
|
public void updateFauxProperty(FauxProperty fp) {
|
||||||
|
log.debug("Updating FauxProperty: " + fp);
|
||||||
|
|
||||||
try (LockedOntModel displayModel = models.getDisplayModel().read()) {
|
try (LockedOntModel displayModel = models.getDisplayModel().read()) {
|
||||||
if (fp.getContextUri() == null) {
|
if (fp.getContextUri() == null) {
|
||||||
throw new IllegalStateException("ContextURI may not be null: "
|
throw new IllegalStateException("ContextURI may not be null: "
|
||||||
|
@ -385,6 +399,7 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateLabelsFromTBox(FauxProperty fp) {
|
private void populateLabelsFromTBox(FauxProperty fp) {
|
||||||
|
fp.setBaseLabel(findLabelForClass(fp.getBaseURI()));
|
||||||
fp.setRangeLabel(findLabelForClass(fp.getRangeURI()));
|
fp.setRangeLabel(findLabelForClass(fp.getRangeURI()));
|
||||||
fp.setDomainLabel(findLabelForClass(fp.getDomainURI()));
|
fp.setDomainLabel(findLabelForClass(fp.getDomainURI()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<tr class="editformcell">
|
<tr class="editformcell">
|
||||||
<td valign="top" colspan="2">
|
<td valign="top" colspan="2">
|
||||||
<b>Base property</b><br/>
|
<b>Base property</b><br/>
|
||||||
<input type="text" class="fullWidthInput" name="Base property" value="<form:value name="BaseURI"/>" disabled="disabled" /></br>
|
<input type="text" class="fullWidthInput" name="Base property" value="<form:value name="BaseLabel"/>" disabled="disabled" /></br>
|
||||||
<i>a specification of this property</i></br>
|
<i>a specification of this property</i></br>
|
||||||
</td>
|
</td>
|
||||||
<td valign="top" colspan="2">
|
<td valign="top" colspan="2">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue