Refactoring code for webpage management/editing generators to enabling addition of new webpage generators for data and metadata links in Datastar code.
This commit is contained in:
parent
fbcbaa75cb
commit
876bf71a74
3 changed files with 81 additions and 60 deletions
|
@ -48,6 +48,16 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
|
|||
private static String formTemplate = "addEditWebpageForm.ftl";
|
||||
@Override
|
||||
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) throws Exception {
|
||||
EditConfigurationVTwo config = setupConfig(vreq, session);
|
||||
prepare(vreq, config);
|
||||
return config;
|
||||
}
|
||||
|
||||
//Have broken this method down into two portions to allow for overriding of edit configuration
|
||||
//without having to copy the entire method and before prepare is called
|
||||
|
||||
protected EditConfigurationVTwo setupConfig(VitroRequest vreq, HttpSession session) throws Exception{
|
||||
|
||||
EditConfigurationVTwo config = new EditConfigurationVTwo();
|
||||
|
||||
config.setTemplate(this.getTemplate());
|
||||
|
@ -61,12 +71,12 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
|
|||
|
||||
config.addNewResource("link", DEFAULT_NS_FOR_NEW_RESOURCE);
|
||||
|
||||
config.setN3Required(list( N3_FOR_WEBPAGE, N3_FOR_URLTYPE ));
|
||||
config.setN3Required(list( this.getN3ForWebpage(), N3_FOR_URLTYPE ));
|
||||
config.setN3Optional(list( N3_FOR_ANCHOR, N3_FOR_RANK));
|
||||
|
||||
config.addUrisInScope("webpageProperty", list( this.getWebpageProperty()));
|
||||
config.addUrisInScope("inverseProperty", list( this.getWebpageOfProperty()));
|
||||
config.addUrisInScope("linkClass", list( core + "URLLink"));
|
||||
config.addUrisInScope("linkClass", list( this.getURLLinkClass()));
|
||||
config.addUrisInScope("linkURI", list( core + "linkURI" ));
|
||||
config.addUrisInScope("linkAnchorPredicate", list( core + "linkAnchorText" ));
|
||||
config.addUrisInScope("rankPredicate", list( core + "rank"));
|
||||
|
@ -88,7 +98,7 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
|
|||
setName("urlType").
|
||||
setValidators( list("nonempty") ).
|
||||
setOptions(
|
||||
new ChildVClassesWithParent(core + "URLLink")));
|
||||
new ChildVClassesWithParent(this.getURLLinkClass())));
|
||||
|
||||
config.addField(new FieldVTwo().
|
||||
setName("anchor"));
|
||||
|
@ -106,7 +116,6 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
|
|||
|
||||
//might be null
|
||||
config.addFormSpecificData("subjectName", getName( config, vreq));
|
||||
prepare(vreq, config);
|
||||
return config;
|
||||
}
|
||||
|
||||
|
@ -210,4 +219,12 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
|
|||
}
|
||||
|
||||
|
||||
protected String getURLLinkClass() {
|
||||
return core + "URLLink";
|
||||
}
|
||||
|
||||
protected String getN3ForWebpage() {
|
||||
return N3_FOR_WEBPAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ManageWebpagesForIndividualGenerator extends BaseEditConfigurationG
|
|||
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) {
|
||||
|
||||
EditConfigurationVTwo config = new EditConfigurationVTwo();
|
||||
config.setTemplate("manageWebpagesForIndividual.ftl");
|
||||
config.setTemplate(this.getTemplate());
|
||||
|
||||
initBasics(config, vreq);
|
||||
initPropertyParameters(vreq, session, config);
|
||||
|
@ -120,4 +120,8 @@ public class ManageWebpagesForIndividualGenerator extends BaseEditConfigurationG
|
|||
protected String getQuery() {
|
||||
return WEBPAGE_QUERY;
|
||||
}
|
||||
|
||||
protected String getTemplate() {
|
||||
return "manageWebpagesForIndividual.ftl";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue