Re-refactoring in template model objects: move vreq instance member out of BaseTemplateModel and into only those classes that use it. Also add final modifier to some instance variables, and remove initializations to null.
This commit is contained in:
parent
2e757891e3
commit
f99b450c83
27 changed files with 83 additions and 110 deletions
|
@ -76,6 +76,7 @@ public class MenuDaoJena extends JenaBaseDao implements MenuDao {
|
||||||
//run SPARQL query to get menu and menu items
|
//run SPARQL query to get menu and menu items
|
||||||
QueryExecution qexec = QueryExecutionFactory.create(menuQuery, displayModel, initialBindings );
|
QueryExecution qexec = QueryExecutionFactory.create(menuQuery, displayModel, initialBindings );
|
||||||
try{
|
try{
|
||||||
|
// ryounes Seems suspicious that a dao is creating a template model object. What's this all about?
|
||||||
MainMenu menu = new MainMenu();
|
MainMenu menu = new MainMenu();
|
||||||
|
|
||||||
/* bdc34: currently there is no good way to decide which url to show
|
/* bdc34: currently there is no good way to decide which url to show
|
||||||
|
|
|
@ -16,16 +16,6 @@ public abstract class BaseTemplateModel {
|
||||||
private static final Log log = LogFactory.getLog(BaseTemplateModel.class);
|
private static final Log log = LogFactory.getLog(BaseTemplateModel.class);
|
||||||
|
|
||||||
protected static ServletContext servletContext;
|
protected static ServletContext servletContext;
|
||||||
protected final VitroRequest vreq;
|
|
||||||
|
|
||||||
protected BaseTemplateModel(VitroRequest vreq) {
|
|
||||||
this.vreq = vreq;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Provide no-arg constructor for types that don't need vreq.
|
|
||||||
protected BaseTemplateModel() {
|
|
||||||
this.vreq = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Convenience method so subclasses can call getUrl(path)
|
// Convenience method so subclasses can call getUrl(path)
|
||||||
protected String getUrl(String path) {
|
protected String getUrl(String path) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import java.util.LinkedHashSet;
|
||||||
|
|
||||||
public class Tags extends BaseTemplateModel {
|
public class Tags extends BaseTemplateModel {
|
||||||
|
|
||||||
protected LinkedHashSet<String> tags = null;
|
protected final LinkedHashSet<String> tags;
|
||||||
|
|
||||||
public Tags() {
|
public Tags() {
|
||||||
this.tags = new LinkedHashSet<String>();
|
this.tags = new LinkedHashSet<String>();
|
||||||
|
|
|
@ -16,11 +16,12 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.SiteAdminControlle
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||||
|
|
||||||
public class User extends BaseTemplateModel {
|
public class User extends BaseTemplateModel {
|
||||||
|
private final VitroRequest vreq;
|
||||||
private final UserAccount currentUser;
|
private final UserAccount currentUser;
|
||||||
private final String profileUrl;
|
private final String profileUrl;
|
||||||
|
|
||||||
public User(VitroRequest vreq) {
|
public User(VitroRequest vreq) {
|
||||||
super(vreq);
|
this.vreq = vreq;
|
||||||
this.currentUser = LoginStatusBean.getCurrentUser(vreq);
|
this.currentUser = LoginStatusBean.getCurrentUser(vreq);
|
||||||
this.profileUrl = figureAssociatedProfileUrl();
|
this.profileUrl = figureAssociatedProfileUrl();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ public class VClassGroupTemplateModel extends BaseTemplateModel {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(VClassGroupTemplateModel.class.getName());
|
private static final Log log = LogFactory.getLog(VClassGroupTemplateModel.class.getName());
|
||||||
|
|
||||||
private VClassGroup vClassGroup = null;
|
private final VClassGroup vClassGroup;
|
||||||
private List<VClassTemplateModel> classes = null;
|
private List<VClassTemplateModel> classes;
|
||||||
|
|
||||||
public VClassGroupTemplateModel(VClassGroup vClassGroup) {
|
public VClassGroupTemplateModel(VClassGroup vClassGroup) {
|
||||||
this.vClassGroup = vClassGroup;
|
this.vClassGroup = vClassGroup;
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class VClassTemplateModel extends BaseTemplateModel {
|
||||||
private static final Log log = LogFactory.getLog(VClassTemplateModel.class);
|
private static final Log log = LogFactory.getLog(VClassTemplateModel.class);
|
||||||
private static final String PATH = Route.INDIVIDUAL_LIST.path();
|
private static final String PATH = Route.INDIVIDUAL_LIST.path();
|
||||||
|
|
||||||
private VClass vclass;
|
private final VClass vclass;
|
||||||
|
|
||||||
public VClassTemplateModel(VClass vclass) {
|
public VClassTemplateModel(VClass vclass) {
|
||||||
this.vclass = vclass;
|
this.vclass = vclass;
|
||||||
|
|
|
@ -7,10 +7,11 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel;
|
||||||
|
|
||||||
public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
||||||
EditConfigurationVTwo editConfig;
|
|
||||||
VitroRequest vreq;
|
|
||||||
|
|
||||||
public EditConfigurationTemplateModel( EditConfigurationVTwo editConfig, VitroRequest vreq){
|
final EditConfigurationVTwo editConfig;
|
||||||
|
final VitroRequest vreq;
|
||||||
|
|
||||||
|
public EditConfigurationTemplateModel(EditConfigurationVTwo editConfig, VitroRequest vreq){
|
||||||
this.editConfig = editConfig;
|
this.editConfig = editConfig;
|
||||||
this.vreq = vreq;
|
this.vreq = vreq;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,12 @@ import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
|
||||||
|
|
||||||
public class EditSubmissionTemplateModel {
|
public class EditSubmissionTemplateModel {
|
||||||
private EditSubmission editSub;
|
|
||||||
|
private final EditSubmission editSub;
|
||||||
|
|
||||||
|
public EditSubmissionTemplateModel(EditSubmission editSub){
|
||||||
|
this.editSub = editSub;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, Literal> getLiteralsFromForm() {
|
public Map<String, Literal> getLiteralsFromForm() {
|
||||||
return editSub.getLiteralsFromForm();
|
return editSub.getLiteralsFromForm();
|
||||||
|
@ -23,11 +28,4 @@ public class EditSubmissionTemplateModel {
|
||||||
return editSub.getUrisFromForm();
|
return editSub.getUrisFromForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditSubmissionTemplateModel(EditSubmission editSub){
|
|
||||||
this.editSub = editSub;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,12 @@ import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.MultiValueEditSubmission;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.MultiValueEditSubmission;
|
||||||
|
|
||||||
public class MultiValueEditSubmissionTemplateModel {
|
public class MultiValueEditSubmissionTemplateModel {
|
||||||
private MultiValueEditSubmission editSub;
|
|
||||||
|
private final MultiValueEditSubmission editSub;
|
||||||
|
|
||||||
|
public MultiValueEditSubmissionTemplateModel(MultiValueEditSubmission editSub){
|
||||||
|
this.editSub = editSub;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, List<Literal>> getLiteralsFromForm() {
|
public Map<String, List<Literal>> getLiteralsFromForm() {
|
||||||
return editSub.getLiteralsFromForm();
|
return editSub.getLiteralsFromForm();
|
||||||
|
@ -24,11 +29,4 @@ public class MultiValueEditSubmissionTemplateModel {
|
||||||
return editSub.getUrisFromForm();
|
return editSub.getUrisFromForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiValueEditSubmissionTemplateModel(MultiValueEditSubmission editSub){
|
|
||||||
this.editSub = editSub;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,16 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(BaseIndividualTemplateModel.class);
|
private static final Log log = LogFactory.getLog(BaseIndividualTemplateModel.class);
|
||||||
|
|
||||||
protected Individual individual;
|
protected final Individual individual;
|
||||||
|
protected final LoginStatusBean loginStatusBean;
|
||||||
|
protected final VitroRequest vreq;
|
||||||
|
|
||||||
protected GroupedPropertyList propertyList;
|
protected GroupedPropertyList propertyList;
|
||||||
protected LoginStatusBean loginStatusBean;
|
|
||||||
private EditingPolicyHelper policyHelper;
|
private EditingPolicyHelper policyHelper;
|
||||||
|
|
||||||
public BaseIndividualTemplateModel(Individual individual, VitroRequest vreq) {
|
public BaseIndividualTemplateModel(Individual individual, VitroRequest vreq) {
|
||||||
super(vreq);
|
this.vreq = vreq;
|
||||||
this.individual = individual;
|
this.individual = individual;
|
||||||
this.loginStatusBean = LoginStatusBean.getBean(vreq);
|
this.loginStatusBean = LoginStatusBean.getBean(vreq);
|
||||||
// Needed for getting portal-sensitive urls. Remove if multi-portal support is removed.
|
// Needed for getting portal-sensitive urls. Remove if multi-portal support is removed.
|
||||||
|
|
|
@ -19,8 +19,8 @@ public abstract class BaseObjectPropertyDataPostProcessor implements
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(BaseObjectPropertyDataPostProcessor.class);
|
private static final Log log = LogFactory.getLog(BaseObjectPropertyDataPostProcessor.class);
|
||||||
|
|
||||||
protected ObjectPropertyTemplateModel objectPropertyTemplateModel;
|
protected final ObjectPropertyTemplateModel objectPropertyTemplateModel;
|
||||||
protected WebappDaoFactory wdf;
|
protected final WebappDaoFactory wdf;
|
||||||
|
|
||||||
public BaseObjectPropertyDataPostProcessor(ObjectPropertyTemplateModel optm, WebappDaoFactory wdf) {
|
public BaseObjectPropertyDataPostProcessor(ObjectPropertyTemplateModel optm, WebappDaoFactory wdf) {
|
||||||
this.objectPropertyTemplateModel = optm;
|
this.objectPropertyTemplateModel = optm;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class CollatedObjectPropertyTemplateModel extends ObjectPropertyTemplateM
|
||||||
private static final Pattern ORDER_BY_SUBCLASS_PATTERN =
|
private static final Pattern ORDER_BY_SUBCLASS_PATTERN =
|
||||||
Pattern.compile("ORDER\\s+BY\\s+(DESC\\s*\\(\\s*)?\\?" + SUBCLASS_VARIABLE_NAME, Pattern.CASE_INSENSITIVE);
|
Pattern.compile("ORDER\\s+BY\\s+(DESC\\s*\\(\\s*)?\\?" + SUBCLASS_VARIABLE_NAME, Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
private SortedMap<String, List<ObjectPropertyStatementTemplateModel>> subclasses;
|
private final SortedMap<String, List<ObjectPropertyStatementTemplateModel>> subclasses;
|
||||||
|
|
||||||
CollatedObjectPropertyTemplateModel(ObjectProperty op, Individual subject,
|
CollatedObjectPropertyTemplateModel(ObjectProperty op, Individual subject,
|
||||||
VitroRequest vreq, EditingPolicyHelper policyHelper,
|
VitroRequest vreq, EditingPolicyHelper policyHelper,
|
||||||
|
@ -47,8 +47,6 @@ public class CollatedObjectPropertyTemplateModel extends ObjectPropertyTemplateM
|
||||||
|
|
||||||
super(op, subject, vreq, policyHelper);
|
super(op, subject, vreq, policyHelper);
|
||||||
|
|
||||||
subclasses = new TreeMap<String, List<ObjectPropertyStatementTemplateModel>>();
|
|
||||||
|
|
||||||
if (populatedObjectPropertyList.contains(op)) {
|
if (populatedObjectPropertyList.contains(op)) {
|
||||||
log.debug("Getting data for populated object property " + op.getURI());
|
log.debug("Getting data for populated object property " + op.getURI());
|
||||||
|
|
||||||
|
@ -66,6 +64,7 @@ public class CollatedObjectPropertyTemplateModel extends ObjectPropertyTemplateM
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.debug("Object property " + getUri() + " is unpopulated.");
|
log.debug("Object property " + getUri() + " is unpopulated.");
|
||||||
|
subclasses = new TreeMap<String, List<ObjectPropertyStatementTemplateModel>>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ public class DataPropertyStatementTemplateModel extends PropertyStatementTemplat
|
||||||
private static final Log log = LogFactory.getLog(DataPropertyStatementTemplateModel.class);
|
private static final Log log = LogFactory.getLog(DataPropertyStatementTemplateModel.class);
|
||||||
private static final String EDIT_PATH = "edit/editDatapropStmtRequestDispatch.jsp";
|
private static final String EDIT_PATH = "edit/editDatapropStmtRequestDispatch.jsp";
|
||||||
|
|
||||||
protected String value = null;
|
protected String value;
|
||||||
|
|
||||||
// Used for editing
|
// Used for editing
|
||||||
protected String dataPropHash = null;
|
protected String dataPropHash;
|
||||||
|
|
||||||
//Extended to include vitro request to check for special parameters
|
//Extended to include vitro request to check for special parameters
|
||||||
DataPropertyStatementTemplateModel(String subjectUri, String propertyUri,
|
DataPropertyStatementTemplateModel(String subjectUri, String propertyUri,
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel {
|
||||||
private static final String TYPE = "data";
|
private static final String TYPE = "data";
|
||||||
private static final String EDIT_PATH = "edit/editDatapropStmtRequestDispatch.jsp";
|
private static final String EDIT_PATH = "edit/editDatapropStmtRequestDispatch.jsp";
|
||||||
|
|
||||||
private List<DataPropertyStatementTemplateModel> statements;
|
private final List<DataPropertyStatementTemplateModel> statements;
|
||||||
|
|
||||||
DataPropertyTemplateModel(DataProperty dp, Individual subject, VitroRequest vreq,
|
DataPropertyTemplateModel(DataProperty dp, Individual subject, VitroRequest vreq,
|
||||||
EditingPolicyHelper policyHelper, List<DataProperty> populatedDataPropertyList) {
|
EditingPolicyHelper policyHelper, List<DataProperty> populatedDataPropertyList) {
|
||||||
|
|
|
@ -44,19 +44,17 @@ public class GroupedPropertyList extends BaseTemplateModel {
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
protected static final List<String> VITRO_PROPS_TO_ADD_TO_LIST = new ArrayList<String>() {{
|
protected static final List<String> VITRO_PROPS_TO_ADD_TO_LIST = new ArrayList<String>() {{
|
||||||
add(VitroVocabulary.PRIMARY_LINK);
|
|
||||||
add(VitroVocabulary.ADDITIONAL_LINK);
|
|
||||||
add(VitroVocabulary.IND_MAIN_IMAGE);
|
add(VitroVocabulary.IND_MAIN_IMAGE);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private Individual subject;
|
private final Individual subject;
|
||||||
private VitroRequest vreq;
|
private final VitroRequest vreq;
|
||||||
private WebappDaoFactory wdf;
|
private final WebappDaoFactory wdf;
|
||||||
|
|
||||||
private List<PropertyGroupTemplateModel> groups;
|
private List<PropertyGroupTemplateModel> groups;
|
||||||
|
|
||||||
GroupedPropertyList(Individual subject, VitroRequest vreq, EditingPolicyHelper policyHelper) {
|
GroupedPropertyList(Individual subject, VitroRequest vreq, EditingPolicyHelper policyHelper) {
|
||||||
super(vreq);
|
this.vreq = vreq;
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
this.wdf = vreq.getWebappDaoFactory();
|
this.wdf = vreq.getWebappDaoFactory();
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
|
||||||
|
|
||||||
private static final String EDIT_PATH = "edit/editRequestDispatch.jsp";
|
private static final String EDIT_PATH = "edit/editRequestDispatch.jsp";
|
||||||
|
|
||||||
private Map<String, String> data;
|
private final Map<String, String> data;
|
||||||
|
|
||||||
// Used for editing
|
// Used for editing
|
||||||
private String objectUri;
|
private final String objectUri;
|
||||||
private String templateName;
|
private final String templateName;
|
||||||
|
|
||||||
//Updating to include Vitro Request
|
//Updating to include Vitro Request
|
||||||
ObjectPropertyStatementTemplateModel(String subjectUri, String propertyUri, String objectKey,
|
ObjectPropertyStatementTemplateModel(String subjectUri, String propertyUri, String objectKey,
|
||||||
|
@ -42,18 +42,6 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
|
||||||
setEditAccess(policyHelper);
|
setEditAccess(policyHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method handles the special case where we are creating a DataPropertyStatementTemplateModel
|
|
||||||
* outside the GroupedPropertyList. Specifically, it allows vitro:primaryLink and vitro:additionalLink
|
|
||||||
* to be treated like object property statements and thus have editing links. (In a future version,
|
|
||||||
* these properties will be replaced by vivo core ontology properties.) It could potentially be used
|
|
||||||
* for other properties outside the property list as well.
|
|
||||||
*/
|
|
||||||
ObjectPropertyStatementTemplateModel(String subjectUri, String propertyUri,
|
|
||||||
VitroRequest vreq, EditingPolicyHelper policyHelper) {
|
|
||||||
super(subjectUri, propertyUri, policyHelper, vreq);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setEditAccess(EditingPolicyHelper policyHelper) {
|
private void setEditAccess(EditingPolicyHelper policyHelper) {
|
||||||
// If the policyHelper is non-null, we are in edit mode, so create the list of editing permissions.
|
// If the policyHelper is non-null, we are in edit mode, so create the list of editing permissions.
|
||||||
// We do this now rather than in getEditUrl() and getDeleteUrl(), because getEditUrl() also needs to know
|
// We do this now rather than in getEditUrl() and getDeleteUrl(), because getEditUrl() also needs to know
|
||||||
|
|
|
@ -91,10 +91,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
||||||
private String objectKey;
|
private String objectKey;
|
||||||
|
|
||||||
// Used for editing
|
// Used for editing
|
||||||
private boolean addAccess = false;
|
private boolean addAccess; // defaults to false
|
||||||
|
|
||||||
//To allow for checking of special parameters
|
|
||||||
private VitroRequest vitroRequest = null;
|
|
||||||
|
|
||||||
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq,
|
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq,
|
||||||
EditingPolicyHelper policyHelper)
|
EditingPolicyHelper policyHelper)
|
||||||
|
@ -588,7 +585,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
||||||
"predicateUri", propertyUri);
|
"predicateUri", propertyUri);
|
||||||
|
|
||||||
//Check if special parameters being sent
|
//Check if special parameters being sent
|
||||||
HashMap<String, String> specialParams = UrlBuilder.getSpecialParams(vitroRequest);
|
HashMap<String, String> specialParams = UrlBuilder.getSpecialParams(vreq);
|
||||||
if(specialParams.size() > 0) {
|
if(specialParams.size() > 0) {
|
||||||
params.putAll(specialParams);
|
params.putAll(specialParams);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ public class PropertyGroupTemplateModel extends BaseTemplateModel {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(PropertyGroupTemplateModel.class);
|
private static final Log log = LogFactory.getLog(PropertyGroupTemplateModel.class);
|
||||||
|
|
||||||
private String name;
|
private final String name;
|
||||||
private List<PropertyTemplateModel> properties;
|
private final List<PropertyTemplateModel> properties;
|
||||||
|
|
||||||
PropertyGroupTemplateModel(VitroRequest vreq, PropertyGroup group,
|
PropertyGroupTemplateModel(VitroRequest vreq, PropertyGroup group,
|
||||||
Individual subject, EditingPolicyHelper policyHelper,
|
Individual subject, EditingPolicyHelper policyHelper,
|
||||||
|
|
|
@ -20,21 +20,21 @@ public abstract class PropertyStatementTemplateModel extends BaseTemplateModel {
|
||||||
EDIT, DELETE;
|
EDIT, DELETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected final VitroRequest vreq;
|
||||||
// Used for editing
|
// Used for editing
|
||||||
protected String subjectUri = null;
|
protected final String subjectUri;
|
||||||
protected String propertyUri = null;
|
protected final String propertyUri;
|
||||||
private List<EditAccess> editAccessList = null;
|
private final List<EditAccess> editAccessList;
|
||||||
|
|
||||||
|
|
||||||
PropertyStatementTemplateModel(String subjectUri, String propertyUri, EditingPolicyHelper policyHelper, VitroRequest vreq) {
|
PropertyStatementTemplateModel(String subjectUri, String propertyUri, EditingPolicyHelper policyHelper, VitroRequest vreq) {
|
||||||
super(vreq);
|
this.vreq = vreq;
|
||||||
// Instantiate the list even if not editing, so calls to getEditUrl() and getDeleteUrl() from
|
// Instantiate the list even if not editing, so calls to getEditUrl() and getDeleteUrl() from
|
||||||
// dump methods don't generate an error when they call isEditable() and isDeletable().
|
// dump methods don't generate an error when they call isEditable() and isDeletable().
|
||||||
editAccessList = new ArrayList<EditAccess>();
|
editAccessList = new ArrayList<EditAccess>();
|
||||||
|
|
||||||
if (policyHelper != null) { // we're editing
|
|
||||||
this.subjectUri = subjectUri;
|
this.subjectUri = subjectUri;
|
||||||
this.propertyUri = propertyUri;
|
this.propertyUri = propertyUri;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void markEditable() {
|
protected void markEditable() {
|
||||||
|
|
|
@ -26,15 +26,17 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(PropertyTemplateModel.class);
|
private static final Log log = LogFactory.getLog(PropertyTemplateModel.class);
|
||||||
|
|
||||||
|
protected final VitroRequest vreq;
|
||||||
|
protected final String subjectUri;
|
||||||
|
protected final String propertyUri;
|
||||||
|
private final String localName;
|
||||||
|
|
||||||
|
protected Map<String, Object> verboseDisplay;
|
||||||
|
protected boolean addAccess; // defaults to false
|
||||||
private String name;
|
private String name;
|
||||||
private String localName;
|
|
||||||
protected String propertyUri;
|
|
||||||
protected Map<String, Object> verboseDisplay = null;
|
|
||||||
protected String subjectUri = null;
|
|
||||||
protected boolean addAccess = false;
|
|
||||||
|
|
||||||
PropertyTemplateModel(Property property, Individual subject, EditingPolicyHelper policyHelper, VitroRequest vreq) {
|
PropertyTemplateModel(Property property, Individual subject, EditingPolicyHelper policyHelper, VitroRequest vreq) {
|
||||||
super(vreq);
|
this.vreq = vreq;
|
||||||
subjectUri = subject.getURI();
|
subjectUri = subject.getURI();
|
||||||
propertyUri = property.getURI();
|
propertyUri = property.getURI();
|
||||||
localName = property.getLocalName();
|
localName = property.getLocalName();
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class UncollatedObjectPropertyTemplateModel extends ObjectPropertyTemplat
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(UncollatedObjectPropertyTemplateModel.class);
|
private static final Log log = LogFactory.getLog(UncollatedObjectPropertyTemplateModel.class);
|
||||||
|
|
||||||
private List<ObjectPropertyStatementTemplateModel> statements;
|
private final List<ObjectPropertyStatementTemplateModel> statements;
|
||||||
|
|
||||||
UncollatedObjectPropertyTemplateModel(ObjectProperty op, Individual subject,
|
UncollatedObjectPropertyTemplateModel(ObjectProperty op, Individual subject,
|
||||||
VitroRequest vreq, EditingPolicyHelper policyHelper,
|
VitroRequest vreq, EditingPolicyHelper policyHelper,
|
||||||
|
|
|
@ -19,10 +19,11 @@ public abstract class BaseListedIndividual extends BaseTemplateModel {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(BaseListedIndividual.class);
|
private static final Log log = LogFactory.getLog(BaseListedIndividual.class);
|
||||||
|
|
||||||
protected Individual individual;
|
protected final Individual individual;
|
||||||
|
protected final VitroRequest vreq;
|
||||||
|
|
||||||
public BaseListedIndividual(Individual individual, VitroRequest vreq) {
|
public BaseListedIndividual(Individual individual, VitroRequest vreq) {
|
||||||
super(vreq);
|
this.vreq = vreq;
|
||||||
this.individual = individual;
|
this.individual = individual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,12 @@ public class MainMenu extends Menu {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final Log log = LogFactory.getLog(MainMenu.class);
|
private static final Log log = LogFactory.getLog(MainMenu.class);
|
||||||
|
|
||||||
public MainMenu(){ }
|
protected VitroRequest vreq;
|
||||||
|
|
||||||
|
public MainMenu() { }
|
||||||
|
|
||||||
public MainMenu(VitroRequest vreq) {
|
public MainMenu(VitroRequest vreq) {
|
||||||
super(vreq);
|
this.vreq = vreq;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(String text, String path) {
|
public void addItem(String text, String path) {
|
||||||
|
|
|
@ -18,11 +18,6 @@ public class Menu extends BaseTemplateModel {
|
||||||
|
|
||||||
protected List<MenuItem> items;
|
protected List<MenuItem> items;
|
||||||
|
|
||||||
public Menu(VitroRequest vreq) {
|
|
||||||
super(vreq);
|
|
||||||
items = new ArrayList<MenuItem>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Menu() {
|
public Menu() {
|
||||||
items = new ArrayList<MenuItem>();
|
items = new ArrayList<MenuItem>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ public class MenuItem extends BaseTemplateModel {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(MenuItem.class.getName());
|
private static final Log log = LogFactory.getLog(MenuItem.class.getName());
|
||||||
|
|
||||||
private String text;
|
private final String text;
|
||||||
private String path;
|
private final String path;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
|
|
||||||
public MenuItem(String linkText, String path) {
|
public MenuItem(String linkText, String path) {
|
||||||
|
|
|
@ -22,10 +22,11 @@ public abstract class BaseIndividualSearchResult extends BaseTemplateModel {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(BaseIndividualSearchResult.class);
|
private static final Log log = LogFactory.getLog(BaseIndividualSearchResult.class);
|
||||||
|
|
||||||
protected Individual individual;
|
protected final VitroRequest vreq;
|
||||||
|
protected final Individual individual;
|
||||||
|
|
||||||
public BaseIndividualSearchResult(Individual individual, VitroRequest vreq) {
|
public BaseIndividualSearchResult(Individual individual, VitroRequest vreq) {
|
||||||
super(vreq);
|
this.vreq = vreq;
|
||||||
this.individual = individual;
|
this.individual = individual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@ public class IndividualSearchResult extends BaseIndividualSearchResult {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(IndividualSearchResult.class);
|
private static final Log log = LogFactory.getLog(IndividualSearchResult.class);
|
||||||
|
|
||||||
protected Individual individual;
|
|
||||||
|
|
||||||
public IndividualSearchResult(Individual individual, VitroRequest vreq) {
|
public IndividualSearchResult(Individual individual, VitroRequest vreq) {
|
||||||
super(individual, vreq);
|
super(individual, vreq);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue