Remove trailing whitespace throughout project
This commit is contained in:
parent
74b8f16aa2
commit
bd6140a8cc
1753 changed files with 24077 additions and 24077 deletions
|
@ -20,7 +20,7 @@ public class Concept {
|
|||
private List<String> exactMatchURIList;
|
||||
private List<String> closeMatchURIList;
|
||||
private List<String> altLabelList;
|
||||
|
||||
|
||||
/**
|
||||
* default constructor
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ public class Concept {
|
|||
this.exactMatchURIList = new ArrayList<String>();
|
||||
this.closeMatchURIList = new ArrayList<String>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the conceptId
|
||||
*/
|
||||
|
|
|
@ -263,4 +263,4 @@ public class SKOSUtils {
|
|||
return URIs;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,35 +8,35 @@ public class ButtonForm {
|
|||
private String label = "no label specified";
|
||||
private String cssClass = null;
|
||||
private HashMap<String,String> params = null;
|
||||
|
||||
|
||||
public ButtonForm() {
|
||||
action = ""; // submits to same page
|
||||
cssClass = null;
|
||||
label = "no label specified";
|
||||
params = null;
|
||||
}
|
||||
|
||||
|
||||
public ButtonForm(String actionStr, String classStr, String labelStr, HashMap<String,String> paramMap) {
|
||||
action = actionStr;
|
||||
cssClass = classStr; // can be null
|
||||
label = labelStr;
|
||||
params = paramMap;
|
||||
}
|
||||
|
||||
|
||||
public String getAction(){
|
||||
return action;
|
||||
}
|
||||
public void setAction(String s){
|
||||
action = s;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel(){
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String s){
|
||||
label = s;
|
||||
}
|
||||
|
||||
|
||||
public String getCssClass(){
|
||||
if (cssClass==null){
|
||||
return "";
|
||||
|
@ -46,7 +46,7 @@ public class ButtonForm {
|
|||
public void setCssClass(String s){
|
||||
cssClass=s;
|
||||
}
|
||||
|
||||
|
||||
public HashMap<String,String> getParams(){
|
||||
return params;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class EditProcessObject implements Serializable {
|
|||
private Map<String, String[]> requestParameterMap = null;
|
||||
|
||||
private Map<String, String> badValueMap = new HashMap<String, String>();
|
||||
|
||||
|
||||
private Map<String,Object> attributeMap = new HashMap<String, Object>();
|
||||
|
||||
private Method getMethod = null;
|
||||
|
@ -311,13 +311,13 @@ public class EditProcessObject implements Serializable {
|
|||
public Map<String, Object> getAttributeMap() {
|
||||
return this.attributeMap;
|
||||
}
|
||||
|
||||
|
||||
public Object getAttribute(String key) {
|
||||
return this.attributeMap.get(key);
|
||||
}
|
||||
|
||||
|
||||
public void setAttribute(String key, Object value) {
|
||||
this.attributeMap.put(key, value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Option implements Serializable {
|
|||
//default constructor
|
||||
public Option() {
|
||||
}
|
||||
|
||||
|
||||
public Option (String value, String body, boolean selected) {
|
||||
this.value = value;
|
||||
this.body = body;
|
||||
|
|
|
@ -37,9 +37,9 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
|||
public class BaseEditController extends VitroHttpServlet {
|
||||
|
||||
public static final boolean FORCE_NEW = true; // when you know you're starting a new edit process
|
||||
|
||||
|
||||
public static final String JSP_PREFIX = "/templates/edit/specific/";
|
||||
|
||||
|
||||
protected static DateFormat DISPLAY_DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy");
|
||||
protected static final int BASE_10 = 10;
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class BaseEditController extends VitroHttpServlet {
|
|||
protected EditProcessObject createEpo(HttpServletRequest request) {
|
||||
return createEpo(request, false);
|
||||
}
|
||||
|
||||
|
||||
protected EditProcessObject createEpo(HttpServletRequest request, boolean forceNew) {
|
||||
/* this is actually a bit of a misnomer, because we will reuse an epo
|
||||
if an epoKey parameter is passed */
|
||||
|
@ -156,22 +156,22 @@ public class BaseEditController extends VitroHttpServlet {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<Option> getSortedList(HashMap<String,Option> hashMap, List<Option> optionList, VitroRequest vreq){
|
||||
|
||||
|
||||
class ListComparator implements Comparator<String>{
|
||||
|
||||
|
||||
Collator collator;
|
||||
|
||||
|
||||
public ListComparator(Collator collator) {
|
||||
this.collator = collator;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compare(String str1, String str2) {
|
||||
return collator.compare(str1, str2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
List<String> bodyVal = new ArrayList<String>();
|
||||
|
@ -180,23 +180,23 @@ public class BaseEditController extends VitroHttpServlet {
|
|||
hashMap.put(option.getBody(), option);
|
||||
bodyVal.add(option.getBody());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bodyVal.sort(new ListComparator(vreq.getCollator()));
|
||||
for (String aBodyVal : bodyVal) {
|
||||
options.add(hashMap.get(aBodyVal));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
protected WebappDaoFactory getWebappDaoFactory() {
|
||||
return ModelAccess.on(getServletContext()).getWebappDaoFactory(ASSERTIONS_ONLY);
|
||||
}
|
||||
|
||||
|
||||
protected WebappDaoFactory getWebappDaoFactory(String userURI) {
|
||||
return getWebappDaoFactory().getUserAwareDaoFactory(userURI);
|
||||
}
|
||||
|
||||
|
||||
public String getDefaultLandingPage(HttpServletRequest request) {
|
||||
return(request.getContextPath() + DEFAULT_LANDING_PAGE);
|
||||
}
|
||||
|
|
|
@ -44,13 +44,13 @@ public class EditFrontController extends VitroHttpServlet {
|
|||
((HttpServlet)controllerInstance).init(getServletConfig());
|
||||
} catch (Exception e) {
|
||||
String errMsg = "doPost() could not instantiate specific " +
|
||||
"controller " + controllerName;
|
||||
"controller " + controllerName;
|
||||
log.error(errMsg, e);
|
||||
throw new RuntimeException(errMsg, e);
|
||||
}
|
||||
} catch (ClassNotFoundException e){
|
||||
String errMsg = "doPost() could not find controller " +
|
||||
CONTROLLER_PKG + "." + controllerName;
|
||||
CONTROLLER_PKG + "." + controllerName;
|
||||
log.error(errMsg);
|
||||
throw new RuntimeException(errMsg);
|
||||
}
|
||||
|
@ -74,11 +74,11 @@ public class EditFrontController extends VitroHttpServlet {
|
|||
"while invoking " + controllerName;
|
||||
log.error(errMsg, e);
|
||||
throw new RuntimeException(errMsg, e);
|
||||
}
|
||||
}
|
||||
} catch (NoSuchMethodException e){
|
||||
log.error("could not find doPost() method in " + controllerName);
|
||||
throw new RuntimeException("could not find doPost() method in " +
|
||||
controllerName);
|
||||
controllerName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import edu.cornell.mannlib.vedit.validator.Validator;
|
|||
|
||||
@WebServlet(name = "OperationController", urlPatterns = {"/doEdit"} )
|
||||
public class OperationController extends BaseEditController {
|
||||
|
||||
|
||||
private static final Log log = LogFactory.getLog(OperationController.class.getName());
|
||||
|
||||
public void doPost (HttpServletRequest request, HttpServletResponse response) {
|
||||
|
@ -61,7 +61,7 @@ public class OperationController extends BaseEditController {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// if we're canceling, we don't need to do anything
|
||||
if (request.getParameter("_cancel") != null){
|
||||
String referer = epo.getReferer();
|
||||
|
@ -94,15 +94,15 @@ public class OperationController extends BaseEditController {
|
|||
}
|
||||
|
||||
try {
|
||||
|
||||
|
||||
Object newObj = getNewObj(epo);
|
||||
|
||||
|
||||
//populate this object from the req. params
|
||||
boolean valid = populateObjectFromRequestParamsAndValidate(epo, newObj, request);
|
||||
|
||||
|
||||
//run preprocessors
|
||||
runPreprocessors(epo, newObj);
|
||||
|
||||
|
||||
//applySimpleMask(epo, newObj);
|
||||
|
||||
//put the newObj back in the epo where other things can look at it
|
||||
|
@ -115,14 +115,14 @@ public class OperationController extends BaseEditController {
|
|||
return;
|
||||
}
|
||||
|
||||
String action = getAction(request);
|
||||
|
||||
String action = getAction(request);
|
||||
|
||||
boolean status = performEdit(epo, newObj, action);
|
||||
if (status == FAILURE) {
|
||||
retry(request, response, epo);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* put request parameters and attributes into epo where the listeners can see */
|
||||
epo.setRequestParameterMap(request.getParameterMap());
|
||||
|
||||
|
@ -165,13 +165,13 @@ public class OperationController extends BaseEditController {
|
|||
|
||||
} catch (Exception e) {
|
||||
log.error("Error performing edit", e);
|
||||
|
||||
|
||||
String errMsg = (e.getMessage() != null)
|
||||
? e.getMessage()
|
||||
: "Error performing edit";
|
||||
|
||||
|
||||
epo.setAttribute("globalErrorMsg", errMsg);
|
||||
|
||||
|
||||
try {
|
||||
retry(request, response, epo);
|
||||
} catch (IOException ioe) {
|
||||
|
@ -179,30 +179,30 @@ public class OperationController extends BaseEditController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void retry(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
|
||||
private void retry(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
EditProcessObject epo) throws IOException {
|
||||
String referer = request.getHeader("Referer");
|
||||
String referer = request.getHeader("Referer");
|
||||
referer = (referer == null) ? epo.getReferer() : referer;
|
||||
if( referer != null ){
|
||||
int epoKeyIndex = referer.indexOf("_epoKey");
|
||||
if (epoKeyIndex >= 0){
|
||||
String url = referer.substring(0,epoKeyIndex) + "_epoKey=" +
|
||||
String url = referer.substring(0,epoKeyIndex) + "_epoKey=" +
|
||||
request.getParameter("_epoKey");
|
||||
response.sendRedirect(url);
|
||||
return;
|
||||
}
|
||||
String redirectUrl = (referer.indexOf("?") > -1)
|
||||
? referer + "&"
|
||||
String redirectUrl = (referer.indexOf("?") > -1)
|
||||
? referer + "&"
|
||||
: referer + "?";
|
||||
redirectUrl += "_epoKey="+request.getParameter("_epoKey");
|
||||
response.sendRedirect(redirectUrl);
|
||||
response.sendRedirect(redirectUrl);
|
||||
} else {
|
||||
response.sendRedirect(getDefaultLandingPage(request));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void runPreprocessors(EditProcessObject epo, Object newObj) {
|
||||
if (epo.getPreProcessorList() != null && epo.getPreProcessorList().size()>0) {
|
||||
for (EditPreProcessor epp : epo.getPreProcessorList()) {
|
||||
|
@ -210,14 +210,14 @@ public class OperationController extends BaseEditController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Object getNewObj(EditProcessObject epo) {
|
||||
Object newObj = null;
|
||||
if (epo.getOriginalBean() != null) { // we're updating or deleting an existing bean
|
||||
if (epo.getImplementationClass() != null) {
|
||||
newObj = OperationUtils.cloneBean(
|
||||
epo.getOriginalBean(),
|
||||
epo.getImplementationClass(),
|
||||
epo.getOriginalBean(),
|
||||
epo.getImplementationClass(),
|
||||
epo.getBeanClass());
|
||||
} else {
|
||||
newObj = OperationUtils.cloneBean(epo.getOriginalBean());
|
||||
|
@ -235,7 +235,7 @@ public class OperationController extends BaseEditController {
|
|||
epo.setNewBean(newObj); // is this dangerous?
|
||||
return newObj;
|
||||
}
|
||||
|
||||
|
||||
private boolean populateObjectFromRequestParamsAndValidate(EditProcessObject epo, Object newObj, HttpServletRequest request) {
|
||||
boolean valid = true;
|
||||
String currParam="";
|
||||
|
@ -298,7 +298,7 @@ public class OperationController extends BaseEditController {
|
|||
} catch (NegativeIntegerException nie) {
|
||||
valid = false;
|
||||
epo.getErrMsgMap().put(currParam,"Please enter a positive integer");
|
||||
epo.getBadValueMap().put(currParam,currValue);
|
||||
epo.getBadValueMap().put(currParam,currValue);
|
||||
} catch (IllegalArgumentException f) {
|
||||
valid=false;
|
||||
log.error("doPost() reports IllegalArgumentException for "+currParam);
|
||||
|
@ -311,7 +311,7 @@ public class OperationController extends BaseEditController {
|
|||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
private String getAction(HttpServletRequest request) {
|
||||
if (request.getParameter("_update") != null ) {
|
||||
return "update";
|
||||
|
@ -321,7 +321,7 @@ public class OperationController extends BaseEditController {
|
|||
return "insert";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void notifyChangeListeners(EditProcessObject epo, String action) {
|
||||
List<ChangeListener> changeListeners = epo.getChangeListenerList();
|
||||
if (changeListeners != null){
|
||||
|
@ -340,10 +340,10 @@ public class OperationController extends BaseEditController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean SUCCESS = false;
|
||||
private boolean FAILURE = !SUCCESS;
|
||||
|
||||
|
||||
private boolean performEdit(EditProcessObject epo, Object newObj, String action) {
|
||||
/* do the actual edit operation */
|
||||
String partialClassName;
|
||||
|
@ -366,7 +366,7 @@ public class OperationController extends BaseEditController {
|
|||
Method meth=null;
|
||||
Method deleteMeth=null;
|
||||
Method insertMeth=null;
|
||||
|
||||
|
||||
// probably want to change this so it will walk up the class tree indefinitely looking for a good method to use
|
||||
if ("update".equals(action)){
|
||||
if (epo.getUpdateMethod() != null) {
|
||||
|
@ -475,7 +475,7 @@ public class OperationController extends BaseEditController {
|
|||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (result != null) {
|
||||
// need to put the result of the insert in the id of the newbean
|
||||
try {
|
||||
|
@ -504,9 +504,9 @@ public class OperationController extends BaseEditController {
|
|||
//log.error("doPost() could not set id of new bean.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,11 +33,11 @@ public class FormUtils {
|
|||
|
||||
protected static final Log log = LogFactory.getLog(FormUtils.class.getName());
|
||||
protected static final int BASE_10 = 10;
|
||||
protected static final Class[] SUPPORTED_TYPES = { String.class,
|
||||
int.class,
|
||||
Integer.class,
|
||||
boolean.class,
|
||||
Date.class
|
||||
protected static final Class[] SUPPORTED_TYPES = { String.class,
|
||||
int.class,
|
||||
Integer.class,
|
||||
boolean.class,
|
||||
Date.class
|
||||
};
|
||||
|
||||
protected static final List<Class> SUPPORTED_TYPE_LIST = Arrays
|
||||
|
@ -45,15 +45,15 @@ public class FormUtils {
|
|||
|
||||
/* this class needs to be reworked */
|
||||
|
||||
public static void populateFormFromBean (Object bean,
|
||||
String action,
|
||||
public static void populateFormFromBean (Object bean,
|
||||
String action,
|
||||
FormObject foo) {
|
||||
populateFormFromBean(bean,action,null,foo,new HashMap());
|
||||
}
|
||||
|
||||
public static void populateFormFromBean (Object bean,
|
||||
String action,
|
||||
FormObject foo,
|
||||
public static void populateFormFromBean (Object bean,
|
||||
String action,
|
||||
FormObject foo,
|
||||
Map<String, String> badValuesHash) {
|
||||
populateFormFromBean(bean,action,null,foo,badValuesHash);
|
||||
}
|
||||
|
@ -61,14 +61,14 @@ public class FormUtils {
|
|||
/**
|
||||
* Populates form objects with bean values
|
||||
*/
|
||||
public static void populateFormFromBean (Object bean,
|
||||
String action,
|
||||
EditProcessObject epo,
|
||||
FormObject foo,
|
||||
public static void populateFormFromBean (Object bean,
|
||||
String action,
|
||||
EditProcessObject epo,
|
||||
FormObject foo,
|
||||
Map<String, String> BadValuesHash) {
|
||||
Class beanClass =
|
||||
(epo != null && epo.getBeanClass() != null)
|
||||
? epo.getBeanClass()
|
||||
Class beanClass =
|
||||
(epo != null && epo.getBeanClass() != null)
|
||||
? epo.getBeanClass()
|
||||
: bean.getClass();
|
||||
|
||||
Method[] meths = beanClass.getMethods();
|
||||
|
@ -121,20 +121,20 @@ public class FormUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static List<Option> makeOptionListFromBeans (List beanList,
|
||||
String valueField,
|
||||
String bodyField,
|
||||
String selectedValue,
|
||||
public static List<Option> makeOptionListFromBeans (List beanList,
|
||||
String valueField,
|
||||
String bodyField,
|
||||
String selectedValue,
|
||||
String selectedBody) {
|
||||
return makeOptionListFromBeans (
|
||||
beanList, valueField, bodyField, selectedValue, selectedBody, true);
|
||||
}
|
||||
|
||||
public static List<Option> makeOptionListFromBeans(List beanList,
|
||||
String valueField,
|
||||
String bodyField,
|
||||
String selectedValue,
|
||||
String selectedBody,
|
||||
public static List<Option> makeOptionListFromBeans(List beanList,
|
||||
String valueField,
|
||||
String bodyField,
|
||||
String selectedValue,
|
||||
String selectedBody,
|
||||
boolean forceSelectedInclusion) {
|
||||
List<Option> optList = new LinkedList();
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class FormUtils {
|
|||
"get" + valueField, (Class[]) null);
|
||||
valueObj = valueMeth.invoke(bean, (Object[]) null);
|
||||
} catch (Exception e) {
|
||||
log.warn("Could not find method get" + valueField + " on " +
|
||||
log.warn("Could not find method get" + valueField + " on " +
|
||||
bean.getClass());
|
||||
}
|
||||
|
||||
|
@ -200,11 +200,11 @@ public class FormUtils {
|
|||
|
||||
}
|
||||
|
||||
// if the list of beans doesn't include the selected value/body,
|
||||
// if the list of beans doesn't include the selected value/body,
|
||||
// insert it anyway so we don't inadvertently change the value of the
|
||||
// field to the first thing that happens to be in the select list
|
||||
// field to the first thing that happens to be in the select list
|
||||
boolean skipThisStep = !forceSelectedInclusion;
|
||||
// For now, if the value is a negative integer, we won't try to
|
||||
// For now, if the value is a negative integer, we won't try to
|
||||
// preserve it, as the bean was probably just instantiated.
|
||||
// Should switch to a more robust way of handling inital bean values.
|
||||
if (selectedValue == null) {
|
||||
|
@ -231,8 +231,8 @@ public class FormUtils {
|
|||
return optList;
|
||||
|
||||
}
|
||||
|
||||
public static List<Option> makeVClassOptionList(WebappDaoFactory wadf,
|
||||
|
||||
public static List<Option> makeVClassOptionList(WebappDaoFactory wadf,
|
||||
String selectedVClassURI) {
|
||||
List<Option> vclassOptionList = new LinkedList<Option>();
|
||||
for (VClass vclass : wadf.getVClassDao().getAllVclasses()) {
|
||||
|
@ -246,15 +246,15 @@ public class FormUtils {
|
|||
}
|
||||
return vclassOptionList;
|
||||
}
|
||||
|
||||
|
||||
public static List<Option> makeOptionListOfSubVClasses(
|
||||
WebappDaoFactory wadf, String parentVClassUri,
|
||||
String selectedVClassURI) {
|
||||
VClassDao vClassDao = wadf.getVClassDao();
|
||||
|
||||
|
||||
Set<String> uris = new HashSet<>(vClassDao.getAllSubClassURIs(parentVClassUri));
|
||||
uris.add(parentVClassUri);
|
||||
|
||||
|
||||
List<Option> options = new LinkedList<>();
|
||||
for (String vclassUri: uris) {
|
||||
VClass vclass = vClassDao.getVClassByURI(vclassUri);
|
||||
|
@ -266,9 +266,9 @@ public class FormUtils {
|
|||
option.setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
options.sort((o1, o2) -> o1.getBody().compareTo(o2.getBody()));
|
||||
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -276,38 +276,38 @@ public class FormUtils {
|
|||
beanSet (newObj, field, value, null);
|
||||
}
|
||||
|
||||
public static void beanSet(Object newObj,
|
||||
String field,
|
||||
String value,
|
||||
public static void beanSet(Object newObj,
|
||||
String field,
|
||||
String value,
|
||||
EditProcessObject epo) {
|
||||
SimpleDateFormat standardDateFormat = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat minutesOnlyDateFormat = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm");
|
||||
Class cls =
|
||||
(epo != null && epo.getBeanClass() != null)
|
||||
? epo.getBeanClass()
|
||||
Class cls =
|
||||
(epo != null && epo.getBeanClass() != null)
|
||||
? epo.getBeanClass()
|
||||
: newObj.getClass();
|
||||
Class[] paramList = new Class[1];
|
||||
Method setterMethod = getSetterMethod(cls, field, SUPPORTED_TYPE_LIST);
|
||||
if (setterMethod == null) {
|
||||
log.debug("Could not find method set" + field + " on "
|
||||
log.debug("Could not find method set" + field + " on "
|
||||
+ cls.getName());
|
||||
return;
|
||||
}
|
||||
Class argumentType = setterMethod.getParameterTypes()[0];
|
||||
Class argumentType = setterMethod.getParameterTypes()[0];
|
||||
Object[] arglist = new Object[1];
|
||||
if (int.class.equals(argumentType)
|
||||
if (int.class.equals(argumentType)
|
||||
|| Integer.class.equals(argumentType)) {
|
||||
arglist[0] = (int.class.equals(argumentType)) ? -1 : null;
|
||||
if (!value.isEmpty()) {
|
||||
if (!value.isEmpty()) {
|
||||
int parsedInt = Integer.parseInt(value, BASE_10);
|
||||
if (parsedInt < 0) {
|
||||
throw new FormUtils.NegativeIntegerException();
|
||||
throw new FormUtils.NegativeIntegerException();
|
||||
} else {
|
||||
arglist[0] = parsedInt;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Date.class.equals(argumentType)) {
|
||||
// this isn't so great ; should probably be in a validator
|
||||
if (value != null && value.length() > 0 && value.indexOf(":") < 1) {
|
||||
|
@ -331,7 +331,7 @@ public class FormUtils {
|
|||
} else {
|
||||
arglist[0] = null;
|
||||
}
|
||||
} else if (boolean.class.equals(argumentType)) {
|
||||
} else if (boolean.class.equals(argumentType)) {
|
||||
arglist[0] = (value.equalsIgnoreCase("true"));
|
||||
} else {
|
||||
arglist[0] = value;
|
||||
|
@ -343,8 +343,8 @@ public class FormUtils {
|
|||
}
|
||||
}
|
||||
|
||||
private static Method getSetterMethod(Class beanClass,
|
||||
String fieldName,
|
||||
private static Method getSetterMethod(Class beanClass,
|
||||
String fieldName,
|
||||
List<Class> supportedTypes) {
|
||||
for (Class clazz : supportedTypes) {
|
||||
try {
|
||||
|
@ -354,12 +354,12 @@ public class FormUtils {
|
|||
} catch (NoSuchMethodException nsme) {
|
||||
// just try the next type
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a Base-64-encoded String of format
|
||||
* Decodes a Base-64-encoded String of format
|
||||
* key:value;key2:value2;key3:value, and puts the keys and values in a Map
|
||||
* @param params Parameters
|
||||
*/
|
||||
|
@ -372,7 +372,7 @@ public class FormUtils {
|
|||
}
|
||||
return beanParamMap;
|
||||
}
|
||||
|
||||
|
||||
public static class NegativeIntegerException extends RuntimeException {}
|
||||
|
||||
}
|
||||
|
|
|
@ -152,4 +152,4 @@ public class OperationUtils {
|
|||
return newBean;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ class Stemmer
|
|||
j, k;
|
||||
private static final int INC = 50;
|
||||
/* unit of size whereby b is increased */
|
||||
|
||||
|
||||
private static final Log log = LogFactory.getLog(Stemmer.class.getName());
|
||||
|
||||
|
||||
public Stemmer()
|
||||
{ b = new char[INC];
|
||||
i = 0;
|
||||
|
|
|
@ -48,7 +48,7 @@ public class IntValidator implements Validator {
|
|||
}
|
||||
|
||||
public IntValidator(){}
|
||||
|
||||
|
||||
public IntValidator (int minVal, int maxVal){
|
||||
this.minVal = minVal;
|
||||
this.maxVal = maxVal;
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
*/
|
||||
public class VitroHomeDirectory {
|
||||
private static final Log log = LogFactory.getLog(VitroHomeDirectory.class);
|
||||
|
||||
|
||||
public static VitroHomeDirectory find(ServletContext ctx) {
|
||||
HomeDirectoryFinder finder = new HomeDirectoryFinder(ctx);
|
||||
return new VitroHomeDirectory(ctx, finder.getPath(),
|
||||
|
@ -51,12 +51,12 @@ public class VitroHomeDirectory {
|
|||
public String getDiscoveryMessage() {
|
||||
return discoveryMessage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find something that specifies the location of the Vitro home directory.
|
||||
* Look in the JDNI environment, the system properties, and the
|
||||
* build.properties file.
|
||||
*
|
||||
*
|
||||
* If we don't find it, fail. If we find it more than once, use the first
|
||||
* one (with a warning). If it is not an existing, readable directory, fail.
|
||||
*/
|
||||
|
@ -90,7 +90,7 @@ public class VitroHomeDirectory {
|
|||
public Path getPath() {
|
||||
return foundLocations.get(0).getPath();
|
||||
}
|
||||
|
||||
|
||||
public void getVhdFromJndi() {
|
||||
try {
|
||||
String vhdPath = (String) new InitialContext()
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ActiveIdentifierBundleFactories {
|
|||
/**
|
||||
* Get the Identifiers from the list of factories. This might return an
|
||||
* empty bundle, but it never returns null.
|
||||
*
|
||||
*
|
||||
* This is package access, and should only be called by RequestIdentifiers.
|
||||
* Everyone else should ask RequestIdentifiers to fetch them from the
|
||||
* request.
|
||||
|
@ -94,7 +94,7 @@ public class ActiveIdentifierBundleFactories {
|
|||
if (req == null) {
|
||||
throw new NullPointerException("req may not be null.");
|
||||
}
|
||||
|
||||
|
||||
return getActiveFactories(req.getSession().getServletContext());
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ public class ArrayIdentifierBundle extends ArrayList<Identifier> implements
|
|||
public ArrayIdentifierBundle(Collection<? extends Identifier> ids) {
|
||||
super(ids);
|
||||
}
|
||||
|
||||
|
||||
public ArrayIdentifierBundle(Identifier... ids) {
|
||||
this(Arrays.asList(ids));
|
||||
}
|
||||
|
|
|
@ -2,27 +2,27 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.identifier;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Indicates who the user is and what roles/groups they belong to.
|
||||
* The objects returned by this could be anything. For example, RoleBacedPolicy
|
||||
* looks for RoleBacedPolicy.AuthRole objects.
|
||||
*
|
||||
*
|
||||
* This is a marker interface to indicate that a object is an identifier,
|
||||
* implementations of Identifier may provide any sort of identifying functionality or
|
||||
* methods.
|
||||
*
|
||||
* methods.
|
||||
*
|
||||
* <h3>Justification for a methodless interface</h3>
|
||||
* This is better than using Object since having method signatures that have
|
||||
* Identifier at least indicates the intent of the parameter, even if it is the
|
||||
* Identifier at least indicates the intent of the parameter, even if it is the
|
||||
* same to the compiler.
|
||||
*
|
||||
*
|
||||
* Policy objects are expected to examine the IdentiferBundle to find the
|
||||
* information needed to make a decision. There is no set pattern as to
|
||||
* what will and will not be a configuration of Identifiers that will create
|
||||
* a AUTHORIZED decision. Reflection, Pattern Matching or something similar
|
||||
* will be needed.
|
||||
*
|
||||
* We have no compile time information about what will structures will map
|
||||
* a AUTHORIZED decision. Reflection, Pattern Matching or something similar
|
||||
* will be needed.
|
||||
*
|
||||
* We have no compile time information about what will structures will map
|
||||
* to which Authorization, let's not pretend that we do.
|
||||
*/
|
||||
public interface Identifier {
|
||||
|
|
|
@ -4,7 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.identifier;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
/**
|
||||
* A group of Identifiers, very commonly used in method signatures
|
||||
* since a session will usually have more than one associated identifier.
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,7 @@ public class RequestIdentifiers {
|
|||
* If the currently applicable Identifiers have been cached in the request,
|
||||
* get them. If not, assemble them from the active factories, and cache them
|
||||
* in the request.
|
||||
*
|
||||
*
|
||||
* This method might return an empty bundle, but it never returns null.
|
||||
*/
|
||||
public static IdentifierBundle getIdBundleForRequest(ServletRequest request) {
|
||||
|
|
|
@ -5,7 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.identifier;
|
|||
public abstract class RoleIdentifier implements Identifier {
|
||||
public abstract String getRole();
|
||||
public abstract String getUri();
|
||||
|
||||
|
||||
public static String getUri( Identifier id){
|
||||
if( id == null ) return null;
|
||||
if( id instanceof RoleIdentifier ){
|
||||
|
@ -14,12 +14,12 @@ public abstract class RoleIdentifier implements Identifier {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String getUri( IdentifierBundle idb){
|
||||
for( Identifier id : idb ){
|
||||
if (id instanceof RoleIdentifier) {
|
||||
RoleIdentifier roleId = (RoleIdentifier) id;
|
||||
return roleId.getUri();
|
||||
return roleId.getUri();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -12,7 +12,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
|||
/**
|
||||
* The current user is associated with this Individual page, and has editing
|
||||
* rights relating to it.
|
||||
*
|
||||
*
|
||||
* Subclasses exist to indicate how that association is created, as either a
|
||||
* Self-Editor or a Proxy Editor. In some cases (e.g., the MyProfile link) the
|
||||
* distinction is important.
|
||||
|
|
|
@ -34,7 +34,7 @@ public class HasPermissionSet extends AbstractCommonIdentifier implements
|
|||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
|
||||
private final PermissionSet permissionSet; // never null
|
||||
|
||||
public HasPermissionSet(PermissionSet permissionSet) {
|
||||
|
|
|
@ -69,10 +69,10 @@ public class IsBlacklisted extends AbstractCommonIdentifier implements
|
|||
|
||||
/**
|
||||
* Runs through .sparql files in the BLACKLIST_SPARQL_DIR.
|
||||
*
|
||||
*
|
||||
* The first that returns one or more rows will be cause the user to be
|
||||
* blacklisted.
|
||||
*
|
||||
*
|
||||
* The first variable from the first solution set will be returned.
|
||||
*/
|
||||
private static String checkForBlacklisted(Individual ind,
|
||||
|
@ -113,10 +113,10 @@ public class IsBlacklisted extends AbstractCommonIdentifier implements
|
|||
/**
|
||||
* Runs the SPARQL query in the file with the uri of the individual
|
||||
* substituted in.
|
||||
*
|
||||
*
|
||||
* The URI of ind will be substituted into the query where ever the token
|
||||
* "?individualURI" is found.
|
||||
*
|
||||
*
|
||||
* If there are any solution sets, then the URI of the variable named
|
||||
* "cause" will be returned. Make sure that it is a resource with a URI.
|
||||
* Otherwise null will be returned.
|
||||
|
|
|
@ -65,4 +65,4 @@ public class HasProfileOrIsBlacklistedFactory extends
|
|||
|
||||
return individuals;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import edu.cornell.mannlib.vitro.webapp.startup.StartupStatus;
|
|||
/**
|
||||
* A collection of Permission objects, keyed by URI. Resides in the
|
||||
* ServletContext.
|
||||
*
|
||||
*
|
||||
* This is not thread-safe, so Permissions should be added only during context
|
||||
* initialization.
|
||||
*/
|
||||
|
@ -123,7 +123,7 @@ public class PermissionRegistry {
|
|||
/**
|
||||
* Get the permission that is registered with this URI. If there is no such
|
||||
* Permission, return a BrokenPermission that always denies authorization.
|
||||
*
|
||||
*
|
||||
* If you want to know whether an actual Permission has been registered at
|
||||
* this URI, call isPermission() instead.
|
||||
*/
|
||||
|
@ -183,7 +183,7 @@ public class PermissionRegistry {
|
|||
* property may be given an edit-level of "PUBLIC", but that may also
|
||||
* simply be the default assigned to it when editing, and we don't want
|
||||
* to recognize that.
|
||||
*
|
||||
*
|
||||
* Other permissions give self-editors their editing privileges.
|
||||
*/
|
||||
private Collection<Permission> createEditByRolePermissions() {
|
||||
|
|
|
@ -17,9 +17,9 @@ import edu.cornell.mannlib.vitro.webapp.startup.StartupStatus;
|
|||
|
||||
/**
|
||||
* Load the initial configuration of PermissionSets and Permissions.
|
||||
*
|
||||
*
|
||||
* The UserAccounts model must be created before this runs.
|
||||
*
|
||||
*
|
||||
* The PermissionRegistry must be created before this runs.
|
||||
*/
|
||||
public class PermissionSetsSmokeTest implements ServletContextListener {
|
||||
|
|
|
@ -109,8 +109,8 @@ public class SimplePermission extends Permission {
|
|||
NAMESPACE + "PageViewableEditor");
|
||||
public static final SimplePermission PAGE_VIEWABLE_PUBLIC = new SimplePermission(
|
||||
NAMESPACE + "PageViewablePublic");
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<SimplePermission> getAllInstances() {
|
||||
return new ArrayList<SimplePermission>(allInstances.values());
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class SimplePermission extends Permission {
|
|||
|
||||
public SimplePermission(String uri) {
|
||||
super(uri);
|
||||
|
||||
|
||||
if (uri == null) {
|
||||
throw new NullPointerException("uri may not be null.");
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ public class BasicPolicyDecision implements PolicyDecision{
|
|||
public void setStackTrace(String stackTrace) {
|
||||
StackTrace = stackTrace;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
|
||||
public String toString(){
|
||||
return authorized + ": " + message;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,16 +8,16 @@ import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
|
||||
|
||||
/**
|
||||
* Policy decision that is made from some analysis of a set of decisions.
|
||||
* Policy decision that is made from some analysis of a set of decisions.
|
||||
* @author bdc34
|
||||
*
|
||||
*/
|
||||
public class CompositPolicyDecision extends BasicPolicyDecision implements PolicyDecision {
|
||||
List<PolicyDecision> subDecisions;
|
||||
|
||||
|
||||
public CompositPolicyDecision(Authorization auth, String message, List<PolicyDecision> subDecisions){
|
||||
super( auth, message);
|
||||
this.subDecisions = subDecisions;
|
||||
this.subDecisions = subDecisions;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
|||
/**
|
||||
* Permit display of various data if it relates to the user's associated
|
||||
* individual.
|
||||
*
|
||||
*
|
||||
* This policy is only to handle the case where a user would not be able to see
|
||||
* data except for their self-editing status. If the data would be visible
|
||||
* without that status, we assume that some other policy will grant access.
|
||||
|
@ -176,4 +176,4 @@ public class DisplayRestrictedDataToSelfPolicy implements PolicyIface {
|
|||
return this.getClass().getSimpleName() + " - " + hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.developer.Key;
|
|||
/**
|
||||
* If enabled in the developer settings (and log levels), log each
|
||||
* PolicyDecision (subject to restrictions).
|
||||
*
|
||||
*
|
||||
* Some restrictions apply to the logger as a whole. Others apply to the
|
||||
* particular policy or the particular decision.
|
||||
*/
|
||||
|
@ -65,7 +65,7 @@ public class PolicyDecisionLogger {
|
|||
* The identifier bundle passes if there is no restriction, or if the
|
||||
* restriction pattern is found within concatenated string of the identifier
|
||||
* bundle.
|
||||
*
|
||||
*
|
||||
* If the restriction is invalid, the action fails.
|
||||
*/
|
||||
private boolean passesUserRestriction() {
|
||||
|
@ -77,7 +77,7 @@ public class PolicyDecisionLogger {
|
|||
/**
|
||||
* The requested action passes if there is no restriction, or if the
|
||||
* restriction pattern is found within the class name of the action.
|
||||
*
|
||||
*
|
||||
* If the restriction is invalid, the action fails.
|
||||
*/
|
||||
private boolean passesActionRestriction() {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class PolicyHelper {
|
|||
Iterable<? extends AuthorizationRequest> actions) {
|
||||
return isAuthorizedForActions(req, AuthorizationRequest.andAll(actions));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Are these actions authorized for the current user by the current
|
||||
* policies?
|
||||
|
@ -80,7 +80,7 @@ public class PolicyHelper {
|
|||
* Is the email/password authorized for these actions? This should be used
|
||||
* when a controller or something needs allow actions if the user passes in
|
||||
* their email and password.
|
||||
*
|
||||
*
|
||||
* It may be better to check this as part of a servlet Filter and add an
|
||||
* identifier bundle.
|
||||
*/
|
||||
|
@ -109,7 +109,7 @@ public class PolicyHelper {
|
|||
}
|
||||
log.debug(String.format("password accepted for %s, "
|
||||
+ "account URI: %s", email, uri));
|
||||
|
||||
|
||||
// figure out if that account can do the actions
|
||||
IdentifierBundle ids = ActiveIdentifierBundleFactories
|
||||
.getUserIdentifierBundle(req, user);
|
||||
|
@ -124,7 +124,7 @@ public class PolicyHelper {
|
|||
/**
|
||||
* Do the current policies authorize the current user to add this statement
|
||||
* to this model?
|
||||
*
|
||||
*
|
||||
* The statement is expected to be fully-populated, with no null fields.
|
||||
*/
|
||||
public static boolean isAuthorizedToAdd(HttpServletRequest req,
|
||||
|
@ -159,7 +159,7 @@ public class PolicyHelper {
|
|||
/**
|
||||
* Do the current policies authorize the current user to drop this statement
|
||||
* from this model?
|
||||
*
|
||||
*
|
||||
* The statement is expected to be fully-populated, with no null fields.
|
||||
*/
|
||||
public static boolean isAuthorizedToDrop(HttpServletRequest req,
|
||||
|
@ -195,11 +195,11 @@ public class PolicyHelper {
|
|||
* Do the current policies authorize the current user to modify this model
|
||||
* by adding all of the statments in the additions model and dropping all of
|
||||
* the statements in the retractions model?
|
||||
*
|
||||
*
|
||||
* This differs from the other calls to "isAuthorized..." because we always
|
||||
* expect the answer to be true. If the answer is false, it should be logged
|
||||
* as an error.
|
||||
*
|
||||
*
|
||||
* Even if a statement fails the test, continue to test the others, so the
|
||||
* log will contain a full record of all failures. This is no more expensive
|
||||
* than if all statements succeeded.
|
||||
|
@ -229,10 +229,10 @@ public class PolicyHelper {
|
|||
* authorized unless others are added first. The client code should not
|
||||
* need to know which sequence will be successful. The client code only
|
||||
* cares that such a sequence does exist.
|
||||
*
|
||||
*
|
||||
* There are 3 obvious ways to test this, ranging from the most rigorous
|
||||
* (and most costly) to the least costly (and least rigorous).
|
||||
*
|
||||
*
|
||||
* 1. Try all sequences to find one that works. First, try to add each
|
||||
* statement to the modelBeingModified. If any statement succeeds,
|
||||
* construct a temporary model that joins that statement to the
|
||||
|
@ -241,7 +241,7 @@ public class PolicyHelper {
|
|||
* we eventually find all of the statements authorized, declare success.
|
||||
* This is logically rigorous, but could become geometrically expensive
|
||||
* as statements are repeatedly tried against incremented models. O(n!).
|
||||
*
|
||||
*
|
||||
* 2. Try each statement on the assumption that all of the others have
|
||||
* already been added. So for each statement we create a temporary
|
||||
* modeol that joins the other additions to the JenaOntModel. If all
|
||||
|
@ -250,14 +250,14 @@ public class PolicyHelper {
|
|||
* each other, but that neither statement could be added first. However,
|
||||
* that seems like a small risk, and the algorithm is considerably less
|
||||
* expensive. O(n).
|
||||
*
|
||||
*
|
||||
* 3. Try each statement on the assumption that all of the statements
|
||||
* (including itself) have already been added. If all statements pass
|
||||
* this test, declare success. This has the additional minor flaw of
|
||||
* allowing a statement to authorize its own addition, but this seems
|
||||
* very unlikely. This is about as expensive as choice 2., but much
|
||||
* simpler to code.
|
||||
*
|
||||
*
|
||||
* For now, I am going with choice 3.
|
||||
*/
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.RequestedAction;
|
|||
|
||||
/**
|
||||
* This is a List of Policy Objects that implements PolciyIface. The intent
|
||||
* is to make it easy to query a list of policies for a PolicyDecision.
|
||||
*
|
||||
* is to make it easy to query a list of policies for a PolicyDecision.
|
||||
*
|
||||
* The Policy objects in the PolicyList are queried for authorization in order
|
||||
* and return the first AUTHORIZED or UNAUTHROIZED decision. INCONCLUSIVE
|
||||
* or null decisions will be ignored and the next policy on the list will
|
||||
* be queried.
|
||||
* be queried.
|
||||
*/
|
||||
public class PolicyList extends ArrayList<PolicyIface> implements PolicyIface{
|
||||
private static final Log log = LogFactory.getLog(PolicyList.class.getName());
|
||||
|
@ -38,7 +38,7 @@ public class PolicyList extends ArrayList<PolicyIface> implements PolicyIface{
|
|||
public PolicyDecision isAuthorized(IdentifierBundle whoToAuth, RequestedAction whatToAuth) {
|
||||
PolicyDecision pd = null;
|
||||
PolicyDecisionLogger logger = new PolicyDecisionLogger(whoToAuth, whatToAuth);
|
||||
for(PolicyIface policy : this){
|
||||
for(PolicyIface policy : this){
|
||||
try{
|
||||
pd = policy.isAuthorized(whoToAuth, whatToAuth);
|
||||
logger.log(policy, pd);
|
||||
|
@ -56,7 +56,7 @@ public class PolicyList extends ArrayList<PolicyIface> implements PolicyIface{
|
|||
log.error("ignoring exception in policy " + policy.toString(), th );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pd = new BasicPolicyDecision(Authorization.INCONCLUSIVE,
|
||||
"No policy returned a conclusive decision on " + whatToAuth);
|
||||
logger.logNoDecision(pd);
|
||||
|
|
|
@ -52,13 +52,13 @@ public class RequestPolicyList extends PolicyList {
|
|||
if (request == null) {
|
||||
throw new NullPointerException("request may not be null.");
|
||||
}
|
||||
|
||||
|
||||
Object obj = request.getAttribute(ATTRIBUTE_POLICY_ADDITIONS);
|
||||
if (obj == null) {
|
||||
obj = new PolicyList();
|
||||
request.setAttribute(ATTRIBUTE_POLICY_ADDITIONS, obj);
|
||||
}
|
||||
|
||||
|
||||
if (!(obj instanceof PolicyList)) {
|
||||
throw new IllegalStateException("Expected to find an instance of "
|
||||
+ PolicyList.class.getName()
|
||||
|
|
|
@ -27,10 +27,10 @@ import edu.cornell.mannlib.vitro.webapp.startup.StartupStatus;
|
|||
|
||||
/**
|
||||
* If the user has an IsRootUser identifier, they can do anything!
|
||||
*
|
||||
*
|
||||
* On setup, check to see that the specified root user exists. If not, create
|
||||
* it. If we can't create it, abort.
|
||||
*
|
||||
*
|
||||
* If any other root users exist, warn about them.
|
||||
*/
|
||||
public class RootUserPolicy implements PolicyIface {
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ServletPolicyList {
|
|||
if (policy == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PolicyList policies = getPolicyList(sc);
|
||||
if (!policies.contains(policy)) {
|
||||
policies.add(policy);
|
||||
|
@ -62,7 +62,7 @@ public class ServletPolicyList {
|
|||
if (policy == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PolicyList policies = getPolicyList(sc);
|
||||
if (!policies.contains(policy)) {
|
||||
policies.add(0, policy);
|
||||
|
|
|
@ -21,12 +21,12 @@ import edu.cornell.mannlib.vitro.webapp.startup.StartupStatus;
|
|||
/**
|
||||
* Assists the role-based policies in determining whether a property or resource
|
||||
* may be displayed, modified, or published in linked open data.
|
||||
*
|
||||
*
|
||||
* There is a singleton bean that holds the current threshold role levels for
|
||||
* displaying, modifying, or publishing restricted properties.
|
||||
*
|
||||
*
|
||||
* Create this bean after the context models are in place.
|
||||
*
|
||||
*
|
||||
* Add PropertyRestrictionListener to your EditProcessObject if you are editing
|
||||
* a property, to ensure that the bean stays current.
|
||||
*/
|
||||
|
@ -62,7 +62,7 @@ public abstract class PropertyRestrictionBean {
|
|||
|
||||
/**
|
||||
* Any resource can be displayed.
|
||||
*
|
||||
*
|
||||
* (Someday we may want to implement display restrictions based on VClass.)
|
||||
*/
|
||||
public abstract boolean canDisplayResource(String resourceUri,
|
||||
|
@ -71,7 +71,7 @@ public abstract class PropertyRestrictionBean {
|
|||
/**
|
||||
* A resource cannot be modified if its namespace is in the prohibited list
|
||||
* (but some exceptions are allowed).
|
||||
*
|
||||
*
|
||||
* (Someday we may want to implement modify restrictions based on VClass.)
|
||||
*/
|
||||
public abstract boolean canModifyResource(String resourceUri,
|
||||
|
@ -79,7 +79,7 @@ public abstract class PropertyRestrictionBean {
|
|||
|
||||
/**
|
||||
* Any resource can be published.
|
||||
*
|
||||
*
|
||||
* (Someday we may want to implement publish restrictions based on VClass.)
|
||||
*/
|
||||
public abstract boolean canPublishResource(String resourceUri,
|
||||
|
@ -95,7 +95,7 @@ public abstract class PropertyRestrictionBean {
|
|||
/**
|
||||
* A predicate cannot be modified if its namespace is in the prohibited list
|
||||
* (some exceptions are allowed).
|
||||
*
|
||||
*
|
||||
* If modification of a predicate is restricted, the user's role must be at
|
||||
* least as high as the restriction level.
|
||||
*/
|
||||
|
|
|
@ -33,37 +33,37 @@ import edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccess;
|
|||
|
||||
/**
|
||||
* On creation, populate a map of PropertyRestrictionLevels.
|
||||
*
|
||||
*
|
||||
* When a change is detected, update the map accordingly.
|
||||
*
|
||||
*
|
||||
* ------------------------------
|
||||
*
|
||||
*
|
||||
* How is authorization determined?
|
||||
*
|
||||
*
|
||||
* Resources are easy. If they aren't in a prohibited namespace, or are an
|
||||
* exception to the prohibition, they are accessible.
|
||||
*
|
||||
*
|
||||
* Properties are harder. The prohibited namespace and exceptions still apply,
|
||||
* but if we pass that test, then we check the threshold map.
|
||||
*
|
||||
*
|
||||
* When a test is made, we look for thresholds in the map. First we look for the
|
||||
* full key of domain-base-range, in case we are testing a faux property. Faux
|
||||
* properties are recorded in the map with the full key.
|
||||
*
|
||||
*
|
||||
* If we don't find the full key, then perhaps we are testing a faux property
|
||||
* that has no settings, or perhaps we are testing an object property. We look
|
||||
* for the partial key of null-base-null, which covers both of these cases,
|
||||
* since object properties (and data properties) are recorded the map with a
|
||||
* partial key.
|
||||
*
|
||||
*
|
||||
* Similarly, if we find a null threshold value in the full key, we look back to
|
||||
* the partial key for a threshold.
|
||||
*
|
||||
*
|
||||
* If we find no non-null threshold value then the property is unrestricted for
|
||||
* that feature.
|
||||
*
|
||||
*
|
||||
* -----------------------------
|
||||
*
|
||||
*
|
||||
* It would perhaps be a silly optimization, but if we find a key with 3 null
|
||||
* thresholds, we could remove it from the map without changing the behavior.
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.PropertyDao.FullPropertyKey;
|
|||
|
||||
/**
|
||||
* The threshold levels for operations on a given property.
|
||||
*
|
||||
*
|
||||
* This is based on the assumption that the FullPropertyKey is sufficient to
|
||||
* distinguish all properties. An object property and a data property may not
|
||||
* share the same key. A faux property must have a different key from any object
|
||||
|
|
|
@ -5,7 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces;
|
|||
/**
|
||||
* Object to represent a decision from a policy. The intent is
|
||||
* that the message would be presented to users to indicate why
|
||||
* they are not authorized for some action.
|
||||
* they are not authorized for some action.
|
||||
*/
|
||||
public interface PolicyDecision {
|
||||
public Authorization getAuthorized();
|
||||
|
|
|
@ -25,7 +25,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
|||
/**
|
||||
* Look for relationships within an OntModel. Types of resources, links between
|
||||
* resources, and links between resources via a context node.
|
||||
*
|
||||
*
|
||||
* Also provides some convenience methods for test lists of URIs and for
|
||||
* creating PolicyDecisions.
|
||||
*/
|
||||
|
@ -85,9 +85,9 @@ public class RelationshipChecker {
|
|||
|
||||
/**
|
||||
* Get a list of the object URIs that satisfy this statement:
|
||||
*
|
||||
*
|
||||
* {@code <resourceUri> <propertyUri> <objectUri> }
|
||||
*
|
||||
*
|
||||
* May return an empty list, but never returns null.
|
||||
*/
|
||||
public List<String> getObjectsOfProperty(String resourceUri,
|
||||
|
@ -116,11 +116,11 @@ public class RelationshipChecker {
|
|||
|
||||
/**
|
||||
* Get a list of the object URIs that satisfy these statements:
|
||||
*
|
||||
*
|
||||
* {@code <resourceUri> <linkUri> <contextNodeUri> }
|
||||
*
|
||||
*
|
||||
* {@code <contextNodeUri> <propertyUri> <objectUri> }
|
||||
*
|
||||
*
|
||||
* May return an empty list, but never returns null.
|
||||
*/
|
||||
public List<String> getObjectsOfLinkedProperty(String resourceUri,
|
||||
|
@ -158,13 +158,13 @@ public class RelationshipChecker {
|
|||
* Get a list of URIs for object that link to the specified resource, by
|
||||
* means of the specified properties, through a linking node of the
|
||||
* specified type.
|
||||
*
|
||||
*
|
||||
* So we're looking for object URIs that statisfy these statements:
|
||||
*
|
||||
*
|
||||
* {@code <resourceUri> <property1Uri> <linkNodeUri> }
|
||||
*
|
||||
*
|
||||
* {@code <linkNodeUri> rdfs:type <linkNodeTypeUri> }
|
||||
*
|
||||
*
|
||||
* {@code <linkNodeUri> <property2Uri> <objectUri> }
|
||||
*/
|
||||
public List<String> getObjectsThroughLinkingNode(String resourceUri,
|
||||
|
@ -176,7 +176,7 @@ public class RelationshipChecker {
|
|||
list.addAll(getObjectsOfProperty(linkNodeUri, property2Uri));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface;
|
|||
|
||||
/**
|
||||
* A base class for RequestedAction that permits boolean operations on them.
|
||||
*
|
||||
*
|
||||
* A null request is ignored, so in "and" it is equivalent to true, while in
|
||||
* "or" it is equivalent to false.
|
||||
*/
|
||||
|
|
|
@ -35,7 +35,7 @@ public class SimpleRequestedAction extends RequestedAction {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private boolean equivalent(Object o1, Object o2) {
|
||||
return (o1 == null) ? (o2 == null) : o1.equals(o2);
|
||||
}
|
||||
|
|
|
@ -6,31 +6,31 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationReques
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
||||
/**
|
||||
* Interface to objects that provide a list of Actions that are
|
||||
* Interface to objects that provide a list of Actions that are
|
||||
* required for the object to be used.
|
||||
*
|
||||
*
|
||||
* This is intended to provide a way to setup DataGetter
|
||||
* objects to be used with the FreemarkerHttpServlet.requiredActions()
|
||||
* method.
|
||||
*
|
||||
* @author bdc34
|
||||
*
|
||||
* @author bdc34
|
||||
*/
|
||||
public interface RequiresActions {
|
||||
|
||||
|
||||
/**
|
||||
* Returns Actions that are required to be authorized for
|
||||
* the object to be used.
|
||||
*
|
||||
* the object to be used.
|
||||
*
|
||||
* The code that is calling this method
|
||||
* could use methods from PolicyHelper to check if the
|
||||
* could use methods from PolicyHelper to check if the
|
||||
* request has authorization to do these Actions. The code
|
||||
* calling this method would then have the ability to
|
||||
* deny the action if it is not authorized.
|
||||
*
|
||||
* deny the action if it is not authorized.
|
||||
*
|
||||
* @param vreq Vitro request
|
||||
* @return Should not be null. Return Actions.AUTHORIZED
|
||||
* if no authorization is required to do use the object.
|
||||
*/
|
||||
public AuthorizationRequest requiredActions(VitroRequest vreq) ;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,6 @@ public abstract class SingleParameterAction extends RequestedAction {
|
|||
|
||||
@Override
|
||||
public String toString(){
|
||||
return this.getClass().getName() + " <"+subjectUri+">";
|
||||
return this.getClass().getName() + " <"+subjectUri+">";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public abstract class AbstractDataPropertyStatementAction extends
|
|||
public Property getPredicate() {
|
||||
return predicate;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPredicateUri() {
|
||||
return predicateUri;
|
||||
|
@ -59,7 +59,7 @@ public abstract class AbstractDataPropertyStatementAction extends
|
|||
public String[] getResourceUris() {
|
||||
return new String[] {subjectUri};
|
||||
}
|
||||
|
||||
|
||||
public String dataValue() {
|
||||
return dataValue;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,6 @@ public abstract class AbstractPropertyStatementAction extends RequestedAction {
|
|||
public abstract String[] getResourceUris();
|
||||
|
||||
public abstract Property getPredicate();
|
||||
|
||||
|
||||
public abstract String getPredicateUri();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
*/
|
||||
public class ApplicationBean {
|
||||
private static final Log log = LogFactory.getLog(ApplicationBean.class);
|
||||
|
||||
|
||||
public final static int CALS_SEARCHBOX_SIZE = 25;
|
||||
public final static int VIVO_SEARCHBOX_SIZE = 20;
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class ApplicationBean {
|
|||
private final static int DEFAULT_ROOT_LOGOTYPE_WIDTH = 0;
|
||||
private final static int DEFAULT_ROOT_LOGOTYPE_HEIGHT = 0;
|
||||
private final static String DEFAULT_ROOT_LOGOTYPE_TITLE = "";
|
||||
|
||||
|
||||
// Value gets set in default theme setup context listener at application startup
|
||||
public static ThemeInfo themeInfo = new ThemeInfo(null, "no_default_theme", new ArrayList<String>());
|
||||
|
||||
|
@ -33,12 +33,12 @@ public class ApplicationBean {
|
|||
private boolean initialized = false;
|
||||
private String sessionIdStr = null;
|
||||
private String applicationName = DEFAULT_APPLICATION_NAME;
|
||||
|
||||
|
||||
private String rootLogotypeImage = DEFAULT_ROOT_LOGOTYPE_IMAGE;
|
||||
private int rootLogotypeWidth = DEFAULT_ROOT_LOGOTYPE_WIDTH;
|
||||
private int rootLogotypeHeight = DEFAULT_ROOT_LOGOTYPE_HEIGHT;
|
||||
private String rootLogotypeTitle = DEFAULT_ROOT_LOGOTYPE_TITLE;
|
||||
|
||||
|
||||
private String aboutText;
|
||||
private String acknowledgeText;
|
||||
private String contactMail;
|
||||
|
@ -46,7 +46,7 @@ public class ApplicationBean {
|
|||
private String copyrightURL;
|
||||
private String copyrightAnchor;
|
||||
private String themeDir;
|
||||
|
||||
|
||||
public String toString() {
|
||||
String output = "Application Bean Contents:\n";
|
||||
output += " initialized from DB: [" + initialized + "]\n";
|
||||
|
@ -84,7 +84,7 @@ public class ApplicationBean {
|
|||
public void setRootLogotypeTitle(String string_val) {
|
||||
rootLogotypeTitle=string_val;
|
||||
}
|
||||
|
||||
|
||||
public void setAboutText(String string_val) {
|
||||
aboutText = string_val;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class ApplicationBean {
|
|||
public void setAcknowledgeText(String string_val) {
|
||||
acknowledgeText = string_val;
|
||||
}
|
||||
|
||||
|
||||
public void setContactMail(String string_val) {
|
||||
contactMail = string_val;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class ApplicationBean {
|
|||
public void setCorrectionMail(String string_val) {
|
||||
correctionMail = string_val;
|
||||
}
|
||||
|
||||
|
||||
public void setCopyrightURL(String string_val) {
|
||||
copyrightURL = string_val;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class ApplicationBean {
|
|||
public void setCopyrightAnchor(String string_val) {
|
||||
copyrightAnchor = string_val;
|
||||
}
|
||||
|
||||
|
||||
public void setThemeDir(String string_val) {
|
||||
themeDir = string_val;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class ApplicationBean {
|
|||
public String getRootLogotypeTitle() {
|
||||
return rootLogotypeTitle;
|
||||
}
|
||||
|
||||
|
||||
public String getAboutText() {
|
||||
return aboutText;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class ApplicationBean {
|
|||
public String getAcknowledgeText() {
|
||||
return acknowledgeText;
|
||||
}
|
||||
|
||||
|
||||
public String getContactMail() {
|
||||
return contactMail;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public class ApplicationBean {
|
|||
public String getCorrectionMail() {
|
||||
return correctionMail;
|
||||
}
|
||||
|
||||
|
||||
public String getCopyrightURL() {
|
||||
return copyrightURL;
|
||||
}
|
||||
|
@ -168,11 +168,11 @@ public class ApplicationBean {
|
|||
public String getRootBreadCrumbURL() {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public String getRootBreadCrumbAnchor() {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public String getShortHand() {
|
||||
return "";
|
||||
}
|
||||
|
@ -194,9 +194,9 @@ public class ApplicationBean {
|
|||
/**
|
||||
* Hold the names of the available themes, the name of the default theme,
|
||||
* and the base directory that contains the theme directories.
|
||||
*
|
||||
*
|
||||
* The theme names are stored as simple strings, like "wilma".
|
||||
*
|
||||
*
|
||||
* To be backwards compatible, we need to be able to test a string like
|
||||
* "themes/wilma/ to see whether it is available, or to return the default
|
||||
* directory in that form.
|
||||
|
@ -248,6 +248,6 @@ public class ApplicationBean {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -17,18 +17,18 @@ import edu.cornell.mannlib.vitro.webapp.auth.permissions.PermissionSets;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
|
||||
public class BaseResourceBean implements ResourceBean {
|
||||
|
||||
|
||||
private static final Log log = LogFactory.getLog(BaseResourceBean.class.getName());
|
||||
protected String URI = null;
|
||||
protected String namespace = null;
|
||||
protected String localName = null;
|
||||
protected String localNameWithPrefix = null;
|
||||
protected String pickListName = null;
|
||||
|
||||
|
||||
protected RoleLevel hiddenFromDisplayBelowRoleLevel = null;
|
||||
protected RoleLevel prohibitedFromUpdateBelowRoleLevel = null;
|
||||
protected RoleLevel hiddenFromPublishBelowRoleLevel = null;
|
||||
|
||||
|
||||
public enum RoleLevel {
|
||||
PUBLIC("http://vitro.mannlib.cornell.edu/ns/vitro/role#public",
|
||||
"all users, including public", "all users who can log in",
|
||||
|
@ -78,7 +78,7 @@ public class BaseResourceBean implements ResourceBean {
|
|||
public String getShorthand() {
|
||||
return shorthand;
|
||||
}
|
||||
|
||||
|
||||
// Never returns null.
|
||||
public static RoleLevel getRoleByUri(String uri2) {
|
||||
if (uri2 == null)
|
||||
|
@ -116,22 +116,22 @@ public class BaseResourceBean implements ResourceBean {
|
|||
public BaseResourceBean() {
|
||||
// default constructor
|
||||
}
|
||||
|
||||
|
||||
public BaseResourceBean(String uri) {
|
||||
buildLocalAndNS(uri);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAnonymous() {
|
||||
public boolean isAnonymous() {
|
||||
return (this.URI==null || VitroVocabulary.PSEUDO_BNODE_NS.equals(this.getNamespace()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getURI() {
|
||||
return URI;
|
||||
}
|
||||
@Override
|
||||
public void setURI(String URI) {
|
||||
public void setURI(String URI) {
|
||||
if( this.localName != null || this.namespace != null)
|
||||
buildLocalAndNS(URI);
|
||||
else
|
||||
|
@ -150,11 +150,11 @@ public class BaseResourceBean implements ResourceBean {
|
|||
this.localName = uri.getLocalName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getNamespace() {
|
||||
if( namespace == null && this.URI != null)
|
||||
buildLocalAndNS(this.URI);
|
||||
buildLocalAndNS(this.URI);
|
||||
return namespace;
|
||||
}
|
||||
@Override
|
||||
|
@ -164,7 +164,7 @@ public class BaseResourceBean implements ResourceBean {
|
|||
this.URI = namespace + localName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return getLocalName();
|
||||
|
@ -173,10 +173,10 @@ public class BaseResourceBean implements ResourceBean {
|
|||
@Override
|
||||
public String getLocalName() {
|
||||
if( localName == null && this.URI != null)
|
||||
buildLocalAndNS(this.URI);
|
||||
buildLocalAndNS(this.URI);
|
||||
return localName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setLocalName(String localName) {
|
||||
this.localName = localName;
|
||||
|
@ -186,33 +186,33 @@ public class BaseResourceBean implements ResourceBean {
|
|||
}
|
||||
|
||||
public String getLocalNameWithPrefix() {
|
||||
return localNameWithPrefix != null ? localNameWithPrefix :
|
||||
return localNameWithPrefix != null ? localNameWithPrefix :
|
||||
getLocalName() != null ? getLocalName() :
|
||||
URI != null ? URI : "(no name)" ;
|
||||
}
|
||||
public void setLocalNameWithPrefix(String prefixedLocalName) {
|
||||
this.localNameWithPrefix = prefixedLocalName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPickListName() {
|
||||
return pickListName==null ? getLocalName()==null ?
|
||||
return pickListName==null ? getLocalName()==null ?
|
||||
(URI==null ? "(no name)" : URI ): getLocalName() : pickListName;
|
||||
}
|
||||
public void setPickListName(String pickListName) {
|
||||
this.pickListName = pickListName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RoleLevel getHiddenFromDisplayBelowRoleLevel() {
|
||||
return hiddenFromDisplayBelowRoleLevel;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHiddenFromDisplayBelowRoleLevel(RoleLevel level) {
|
||||
hiddenFromDisplayBelowRoleLevel = level;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHiddenFromDisplayBelowRoleLevelUsingRoleUri(String roleUri) {
|
||||
hiddenFromDisplayBelowRoleLevel = RoleLevel.getRoleByUri(roleUri);
|
||||
|
@ -222,12 +222,12 @@ public class BaseResourceBean implements ResourceBean {
|
|||
public RoleLevel getProhibitedFromUpdateBelowRoleLevel() {
|
||||
return prohibitedFromUpdateBelowRoleLevel;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setProhibitedFromUpdateBelowRoleLevel(RoleLevel level) {
|
||||
prohibitedFromUpdateBelowRoleLevel = level;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setProhibitedFromUpdateBelowRoleLevelUsingRoleUri(String roleUri) {
|
||||
prohibitedFromUpdateBelowRoleLevel = RoleLevel.getRoleByUri(roleUri);
|
||||
|
@ -237,20 +237,20 @@ public class BaseResourceBean implements ResourceBean {
|
|||
public RoleLevel getHiddenFromPublishBelowRoleLevel() {
|
||||
return hiddenFromPublishBelowRoleLevel;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHiddenFromPublishBelowRoleLevel(RoleLevel level) {
|
||||
hiddenFromPublishBelowRoleLevel = level;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHiddenFromPublishBelowRoleLevelUsingRoleUri(String roleUri) {
|
||||
hiddenFromPublishBelowRoleLevel = BaseResourceBean.RoleLevel.getRoleByUri(roleUri);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj == null )
|
||||
if(obj == null )
|
||||
return false;
|
||||
else if (obj instanceof BaseResourceBean ){
|
||||
String thisURI = this.getURI();
|
||||
|
@ -259,9 +259,9 @@ public class BaseResourceBean implements ResourceBean {
|
|||
return thisURI.equals(thatURI);
|
||||
}
|
||||
}
|
||||
return obj.hashCode() == this.hashCode();
|
||||
return obj.hashCode() == this.hashCode();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if( getURI() != null )
|
||||
|
@ -270,5 +270,5 @@ public class BaseResourceBean implements ResourceBean {
|
|||
return super.hashCode();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -36,4 +36,4 @@ public class Classes2Classes {
|
|||
public String getSubclassLocalName(){ return subclassLocalName; }
|
||||
public void setSubclassLocalName(String subclassLocalName){ this.subclassLocalName=subclassLocalName;}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
|
||||
private String domainClassURI = null;
|
||||
private String rangeDatatypeURI = null;
|
||||
|
||||
|
||||
private String editing = null;
|
||||
|
||||
|
||||
private boolean functional = false;
|
||||
|
||||
private String example = null;
|
||||
|
@ -38,7 +38,7 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
private boolean externalId = false;
|
||||
|
||||
private List<DataPropertyStatement> dataPropertyStatements = null;
|
||||
|
||||
|
||||
public DataProperty() { //default constructor needed since Property has one
|
||||
super();
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
public void setPublicName(String publicName) {
|
||||
this.publicName = publicName;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel() {
|
||||
return getPublicName();
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
public String getDomainClassURI() {
|
||||
return domainClassURI;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDomainVClassURI() {
|
||||
return domainClassURI;
|
||||
|
@ -91,11 +91,11 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
public void setRangeDatatypeURI(String rangeDatatypeURI) {
|
||||
this.rangeDatatypeURI = rangeDatatypeURI;
|
||||
}
|
||||
|
||||
|
||||
public void setEditing(String editing) {
|
||||
this.editing = editing;
|
||||
}
|
||||
|
||||
|
||||
public String getEditing() {
|
||||
return this.editing;
|
||||
}
|
||||
|
@ -103,11 +103,11 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
public boolean getFunctional() {
|
||||
return this.functional;
|
||||
}
|
||||
|
||||
|
||||
public void setFunctional(boolean functional) {
|
||||
this.functional = functional;
|
||||
}
|
||||
|
||||
|
||||
public String getExample() {
|
||||
return example;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public String getPublicDescription() {
|
||||
return publicDescription;
|
||||
}
|
||||
|
@ -185,10 +185,10 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
|
|||
}
|
||||
|
||||
public String toString(){
|
||||
if( getURI() != null )
|
||||
if( getURI() != null )
|
||||
return getURI();
|
||||
else
|
||||
return "DataProperty without URI(" + hashCode() + ")";
|
||||
else
|
||||
return "DataProperty without URI(" + hashCode() + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ import org.apache.commons.logging.LogFactory;
|
|||
|
||||
import org.apache.jena.vocabulary.XSD;
|
||||
|
||||
/* This class is used to order authorships on the add author form. It should be removed in favor of using whatever
|
||||
* method is used to order authorships on the publication profile page instead. I've implemented this due to
|
||||
/* This class is used to order authorships on the add author form. It should be removed in favor of using whatever
|
||||
* method is used to order authorships on the publication profile page instead. I've implemented this due to
|
||||
* time constraints.
|
||||
*/
|
||||
public class DataPropertyComparator implements Comparator<Individual> {
|
||||
|
@ -18,7 +18,7 @@ public class DataPropertyComparator implements Comparator<Individual> {
|
|||
private static final Log log = LogFactory.getLog(DataPropertyComparator.class);
|
||||
|
||||
private String dataPropertyUri = null;
|
||||
|
||||
|
||||
public DataPropertyComparator(String dataPropertyUri) {
|
||||
this.dataPropertyUri = dataPropertyUri;
|
||||
}
|
||||
|
@ -28,16 +28,16 @@ public class DataPropertyComparator implements Comparator<Individual> {
|
|||
DataPropertyStatement dps2 = ind2.getDataPropertyStatement(dataPropertyUri);
|
||||
|
||||
int result;
|
||||
|
||||
|
||||
// Push null values to the end of the list.
|
||||
// Is this generally what's wanted? Or should this class be
|
||||
// Is this generally what's wanted? Or should this class be
|
||||
// NullLastDataPropertyComparator?
|
||||
if (dps1 == null) {
|
||||
result = (dps2 == null) ? 0 : 1;
|
||||
} else if (dps2 == null) {
|
||||
result = -1;
|
||||
} else {
|
||||
|
||||
|
||||
String datatype = dps1.getDatatypeURI();
|
||||
if (datatype == null) {
|
||||
datatype = dps2.getDatatypeURI();
|
||||
|
@ -47,14 +47,14 @@ public class DataPropertyComparator implements Comparator<Individual> {
|
|||
// Perhaps we should throw an error here, but for now we need it to set the datatype
|
||||
datatype = XSD.xint.toString();
|
||||
}
|
||||
|
||||
|
||||
if (XSD.xint.toString().equals(datatype)) {
|
||||
int i1 = Integer.valueOf(dps1.getData());
|
||||
int i2 = Integer.valueOf(dps2.getData());
|
||||
result = Integer.compare(i1, i2);
|
||||
}
|
||||
else if (XSD.xstring.toString().equals(datatype)) {
|
||||
result = dps1.getData().compareTo(dps2.getData());
|
||||
result = dps1.getData().compareTo(dps2.getData());
|
||||
}
|
||||
// Fill in other types here
|
||||
else {
|
||||
|
@ -65,7 +65,7 @@ public class DataPropertyComparator implements Comparator<Individual> {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@ package edu.cornell.mannlib.vitro.webapp.beans;
|
|||
*
|
||||
*/
|
||||
public interface DataPropertyStatement {
|
||||
|
||||
|
||||
public Individual getIndividual();
|
||||
|
||||
|
||||
public void setIndividual(Individual individual);
|
||||
|
||||
|
||||
public String getIndividualURI();
|
||||
|
||||
public void setIndividualURI(String individualURI);
|
||||
|
|
|
@ -14,7 +14,7 @@ public class DataPropertyStatementImpl implements DataPropertyStatement
|
|||
private String datapropURI = null;
|
||||
private String datatypeURI = null;
|
||||
private String language = null;
|
||||
|
||||
|
||||
public DataPropertyStatementImpl(){
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class DataPropertyStatementImpl implements DataPropertyStatement
|
|||
this.individualURI = individual.getURI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public DataPropertyStatementImpl(String individualUri, String propertyUri, String data){
|
||||
individualURI = individualUri;
|
||||
datapropURI = propertyUri;
|
||||
|
@ -33,11 +33,11 @@ public class DataPropertyStatementImpl implements DataPropertyStatement
|
|||
public Individual getIndividual() {
|
||||
return this.individual;
|
||||
}
|
||||
|
||||
|
||||
public void setIndividual(Individual individual) {
|
||||
this.individual = individual;
|
||||
}
|
||||
|
||||
|
||||
public String getIndividualURI() {
|
||||
return individualURI;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class DisplayMessage {
|
|||
/**
|
||||
* Get the current message from the session, and remove it from the session
|
||||
* so it won't be displayed again.
|
||||
*
|
||||
*
|
||||
* If there is no message, return the empty string.
|
||||
*/
|
||||
public static String getMessageAndClear(HttpServletRequest request) {
|
||||
|
@ -55,7 +55,7 @@ public class DisplayMessage {
|
|||
/**
|
||||
* Get the current message from the session, and remove it from the session
|
||||
* so it won't be displayed again.
|
||||
*
|
||||
*
|
||||
* If there is no message, return the empty string.
|
||||
*/
|
||||
public static String getMessageAndClear(HttpSession session) {
|
||||
|
@ -64,14 +64,14 @@ public class DisplayMessage {
|
|||
Object sessionMessage = session.getAttribute(ATTRIBUTE_NAME);
|
||||
if (sessionMessage != null) {
|
||||
if (sessionMessage instanceof String) {
|
||||
log.debug("Get message: '" + sessionMessage + "'");
|
||||
log.debug("Get message: '" + sessionMessage + "'");
|
||||
message = (String) sessionMessage;
|
||||
}
|
||||
session.removeAttribute(ATTRIBUTE_NAME);
|
||||
}
|
||||
session.removeAttribute(ATTRIBUTE_NAME);
|
||||
} else {
|
||||
log.debug("Get no message.");
|
||||
}
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class FauxProperty extends BaseResourceBean implements ResourceBean,
|
|||
/**
|
||||
* Arguments are in this order to mimic the relationship: subject ==>
|
||||
* property ==> object
|
||||
*
|
||||
*
|
||||
* @param domainURI
|
||||
* URI of the subject class. May be null.
|
||||
* @param baseURI
|
||||
|
|
|
@ -17,10 +17,10 @@ public interface Individual extends ResourceBean, Comparable<Individual> {
|
|||
String getName();
|
||||
void setName(String in);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an rdfs:label if there is one on the individual. Returns null
|
||||
* if none can be found. If more than one rdfs:label can be found for the individual
|
||||
* one of the labels will be returned, which one is undefined.
|
||||
* one of the labels will be returned, which one is undefined.
|
||||
*/
|
||||
String getRdfsLabel();
|
||||
void setRdfsLabel(String in);
|
||||
|
@ -43,44 +43,44 @@ public interface Individual extends ResourceBean, Comparable<Individual> {
|
|||
*/
|
||||
List<ObjectProperty> getPopulatedObjectPropertyList();
|
||||
void setPopulatedObjectPropertyList(List<ObjectProperty> propertyList);
|
||||
|
||||
|
||||
Map<String,ObjectProperty> getObjectPropertyMap();
|
||||
void setObjectPropertyMap(Map<String,ObjectProperty> propertyMap);
|
||||
|
||||
|
||||
List<DataProperty> getDataPropertyList();
|
||||
void setDatatypePropertyList(List<DataProperty> datatypePropertyList);
|
||||
|
||||
List<DataProperty> getPopulatedDataPropertyList();
|
||||
void setPopulatedDataPropertyList(List<DataProperty> dataPropertyList);
|
||||
|
||||
|
||||
Map<String,DataProperty> getDataPropertyMap();
|
||||
void setDataPropertyMap(Map<String,DataProperty> propertyMap);
|
||||
|
||||
|
||||
void setDataPropertyStatements(List<DataPropertyStatement> list);
|
||||
List<DataPropertyStatement> getDataPropertyStatements();
|
||||
List<DataPropertyStatement> getDataPropertyStatements(String propertyUri);
|
||||
DataPropertyStatement getDataPropertyStatement(String propertyUri);
|
||||
|
||||
|
||||
List<String> getDataValues(String propertyUri);
|
||||
String getDataValue(String propertyUri);
|
||||
|
||||
VClass getVClass();
|
||||
void setVClass(VClass class1);
|
||||
|
||||
|
||||
List<VClass> getVClasses();
|
||||
|
||||
|
||||
List<VClass> getVClasses(boolean direct);
|
||||
void setVClasses(List<VClass> vClassList, boolean direct);
|
||||
|
||||
|
||||
/** Does the individual belong to this class? */
|
||||
boolean isVClass(String uri);
|
||||
|
||||
|
||||
List<String> getMostSpecificTypeURIs();
|
||||
|
||||
void setObjectPropertyStatements(List<ObjectPropertyStatement> list);
|
||||
List<ObjectPropertyStatement> getObjectPropertyStatements();
|
||||
List<ObjectPropertyStatement> getObjectPropertyStatements(String propertyUri);
|
||||
|
||||
|
||||
List<Individual> getRelatedIndividuals(String propertyUri);
|
||||
Individual getRelatedIndividual(String propertyUri);
|
||||
|
||||
|
@ -89,7 +89,7 @@ public interface Individual extends ResourceBean, Comparable<Individual> {
|
|||
|
||||
void setMainImageUri(String mainImageUri);
|
||||
String getMainImageUri();
|
||||
|
||||
|
||||
String getImageUrl();
|
||||
String getThumbUrl();
|
||||
boolean hasThumb();
|
||||
|
@ -97,13 +97,13 @@ public interface Individual extends ResourceBean, Comparable<Individual> {
|
|||
void sortForDisplay();
|
||||
|
||||
JsonNode toJSON();
|
||||
|
||||
|
||||
Float getSearchBoost();
|
||||
void setSearchBoost( Float boost );
|
||||
|
||||
|
||||
String getSearchSnippet();
|
||||
void setSearchSnippet( String snippet );
|
||||
|
||||
|
||||
/**
|
||||
* This is crap. It was put in so IndividualFiltering could filter object properties properly,
|
||||
* but what we really need is either: filters have a reference to a webappDaoFactory, or
|
||||
|
|
|
@ -51,12 +51,12 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
protected ImageInfo imageInfo = null;
|
||||
protected Float searchBoost;
|
||||
protected String searchSnippet;
|
||||
|
||||
|
||||
/** indicates if sortForDisplay has been called */
|
||||
protected boolean sorted = false;
|
||||
protected boolean DIRECT = true;
|
||||
protected boolean ALL = false;
|
||||
|
||||
|
||||
public IndividualImpl() {
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
public void setName(String in){name=in;}
|
||||
|
||||
public String getRdfsLabel(){ return rdfsLabel; }
|
||||
public void setRdfsLabel(String s){ rdfsLabel = s; }
|
||||
public void setRdfsLabel(String s){ rdfsLabel = s; }
|
||||
|
||||
public String getVClassURI(){return vClassURI;}
|
||||
public void setVClassURI(String in){vClassURI=in;}
|
||||
|
@ -134,7 +134,7 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
public List<DataPropertyStatement> getDataPropertyStatements(){
|
||||
return dataPropertyStatements;
|
||||
}
|
||||
|
||||
|
||||
public List<DataPropertyStatement> getDataPropertyStatements(String propertyUri) {
|
||||
List<DataPropertyStatement> stmts = getDataPropertyStatements();
|
||||
List<DataPropertyStatement> stmtsForProp = new ArrayList<DataPropertyStatement>();
|
||||
|
@ -143,15 +143,15 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
stmtsForProp.add(stmt);
|
||||
}
|
||||
}
|
||||
return stmtsForProp;
|
||||
return stmtsForProp;
|
||||
}
|
||||
|
||||
public DataPropertyStatement getDataPropertyStatement(String propertyUri) {
|
||||
List<DataPropertyStatement> stmts = getDataPropertyStatements(propertyUri);
|
||||
return stmts.isEmpty() ? null : stmts.get(0);
|
||||
return stmts.isEmpty() ? null : stmts.get(0);
|
||||
}
|
||||
|
||||
public List<String> getDataValues(String propertyUri) {
|
||||
|
||||
public List<String> getDataValues(String propertyUri) {
|
||||
List<DataPropertyStatement> stmts = getDataPropertyStatements(propertyUri);
|
||||
List<String> dataValues = new ArrayList<String>(stmts.size());
|
||||
for (DataPropertyStatement stmt : stmts) {
|
||||
|
@ -159,7 +159,7 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
}
|
||||
return dataValues;
|
||||
}
|
||||
|
||||
|
||||
public String getDataValue(String propertyUri) {
|
||||
List<DataPropertyStatement> stmts = getDataPropertyStatements(propertyUri);
|
||||
return stmts.isEmpty() ? null : stmts.get(0).getData();
|
||||
|
@ -171,11 +171,11 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
public void setVClass(VClass class1) {
|
||||
vClass = class1;
|
||||
}
|
||||
|
||||
|
||||
public List<VClass> getVClasses() {
|
||||
return allVClasses;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isVClass(String uri) {
|
||||
if (uri == null) {
|
||||
|
@ -196,15 +196,15 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
return allVClasses;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setVClasses(List<VClass> vClassList, boolean direct) {
|
||||
if (direct) {
|
||||
this.directVClasses = vClassList;
|
||||
this.directVClasses = vClassList;
|
||||
} else {
|
||||
this.allVClasses = vClassList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getMostSpecificTypeURIs() {
|
||||
List<String> typeURIs = new ArrayList<String>();
|
||||
|
@ -226,7 +226,7 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
public List <ObjectPropertyStatement> getObjectPropertyStatements(){
|
||||
return objectPropertyStatements;
|
||||
}
|
||||
|
||||
|
||||
public List<ObjectPropertyStatement> getObjectPropertyStatements(String propertyUri) {
|
||||
List<ObjectPropertyStatement> stmts = getObjectPropertyStatements();
|
||||
List<ObjectPropertyStatement> stmtsForProp = new ArrayList<ObjectPropertyStatement>();
|
||||
|
@ -237,18 +237,18 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
}
|
||||
return stmtsForProp;
|
||||
}
|
||||
|
||||
|
||||
public List<Individual> getRelatedIndividuals(String propertyUri) {
|
||||
List<ObjectPropertyStatement> stmts = getObjectPropertyStatements(propertyUri);
|
||||
List<Individual> relatedIndividuals = new ArrayList<Individual>(stmts.size());
|
||||
for (ObjectPropertyStatement stmt : stmts) {
|
||||
relatedIndividuals.add(stmt.getObject());
|
||||
}
|
||||
return relatedIndividuals;
|
||||
return relatedIndividuals;
|
||||
}
|
||||
|
||||
|
||||
public Individual getRelatedIndividual(String propertyUri) {
|
||||
List<ObjectPropertyStatement> stmts = getObjectPropertyStatements(propertyUri);
|
||||
List<ObjectPropertyStatement> stmts = getObjectPropertyStatements(propertyUri);
|
||||
return stmts.isEmpty() ? null : stmts.get(0).getObject();
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
public void setExternalIds(List<DataPropertyStatement> externalIds){
|
||||
this.externalIds = externalIds;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getMainImageUri() {
|
||||
return (mainImageUri == NOT_INITIALIZED) ? null : mainImageUri;
|
||||
|
@ -280,12 +280,12 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
return "thumbUrl";
|
||||
}
|
||||
|
||||
public Float getSearchBoost() { return searchBoost; }
|
||||
public Float getSearchBoost() { return searchBoost; }
|
||||
public void setSearchBoost(Float boost) { searchBoost = boost; }
|
||||
|
||||
|
||||
public String getSearchSnippet() { return searchSnippet; }
|
||||
public void setSearchSnippet(String snippet) { searchSnippet = snippet; }
|
||||
|
||||
|
||||
/**
|
||||
* Sorts the ents2ents records into the proper order for display.
|
||||
*
|
||||
|
@ -335,11 +335,11 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
|||
return getURI() + " " + getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean hasThumb() {
|
||||
return getThumbUrl() != null && ! getThumbUrl().isEmpty();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void resolveAsFauxPropertyStatements(List<ObjectPropertyStatement> list) {
|
||||
// No webappDaoFactory, so nothing to do.
|
||||
|
|
|
@ -26,7 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.RoleRestrictedProperty;
|
|||
public class ObjectProperty extends Property implements Comparable<ObjectProperty>, ResourceBean, Cloneable, RoleRestrictedProperty
|
||||
{
|
||||
private static final Log log = LogFactory.getLog(ObjectProperty.class.getName());
|
||||
|
||||
|
||||
private String parentURI = null;
|
||||
|
||||
private String domainVClassURI = null;
|
||||
|
@ -43,7 +43,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
private boolean symmetric = false;
|
||||
private boolean functional = false;
|
||||
private boolean inverseFunctional = false;
|
||||
|
||||
|
||||
private List<ObjectPropertyStatement> objectPropertyStatements = null;
|
||||
private String example = null;
|
||||
private String description = null;
|
||||
|
@ -58,17 +58,17 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
private Integer domainDisplayLimit = null;
|
||||
|
||||
private String objectIndividualSortPropertyURI = null;
|
||||
|
||||
|
||||
private String rangeEntitySortDirection = null;
|
||||
private Integer rangeDisplayTier = null;
|
||||
private Integer rangeDisplayLimit = null;
|
||||
|
||||
|
||||
private boolean selectFromExisting = true;
|
||||
private boolean offerCreateNewOption = false;
|
||||
private boolean stubObjectRelation = false;
|
||||
|
||||
|
||||
private boolean collateBySubclass = false;
|
||||
|
||||
|
||||
public ObjectProperty() {
|
||||
super();
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
public String getDomainVClassURI() {
|
||||
return domainVClassURI;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setDomainVClassURI(String domainClassURI) {
|
||||
this.domainVClassURI = domainClassURI;
|
||||
|
@ -99,7 +99,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
public String getLabel() {
|
||||
return getDomainPublic();
|
||||
}
|
||||
|
||||
|
||||
public String getDomainPublic() {
|
||||
return domainPublic;
|
||||
}
|
||||
|
@ -118,12 +118,12 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
public void setParentURI(String parentURI) {
|
||||
this.parentURI = parentURI;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRangeVClassURI() {
|
||||
return rangeVClassURI;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRangeVClassURI(String rangeClassURI) {
|
||||
this.rangeVClassURI = rangeClassURI;
|
||||
|
@ -210,35 +210,35 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
this.URIInverse = namespaceInverse + localNameInverse;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean getTransitive() {
|
||||
return transitive;
|
||||
}
|
||||
|
||||
|
||||
public void setTransitive(boolean transitive) {
|
||||
this.transitive = transitive;
|
||||
}
|
||||
|
||||
|
||||
public boolean getSymmetric() {
|
||||
return symmetric;
|
||||
}
|
||||
|
||||
|
||||
public void setSymmetric(boolean symmetric) {
|
||||
this.symmetric = symmetric;
|
||||
}
|
||||
|
||||
|
||||
public boolean getFunctional() {
|
||||
return functional;
|
||||
}
|
||||
|
||||
|
||||
public void setFunctional(boolean functional) {
|
||||
this.functional = functional;
|
||||
}
|
||||
|
||||
|
||||
public boolean getInverseFunctional() {
|
||||
return inverseFunctional;
|
||||
}
|
||||
|
||||
|
||||
public void setInverseFunctional(boolean inverseFunctional) {
|
||||
this.inverseFunctional = inverseFunctional;
|
||||
}
|
||||
|
@ -246,11 +246,11 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
public void setCollateBySubclass(boolean collate) {
|
||||
collateBySubclass = collate;
|
||||
}
|
||||
|
||||
|
||||
public boolean getCollateBySubclass() {
|
||||
return collateBySubclass;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* adds a single ObjectPropertyStatement object to Property's object property statements List.
|
||||
*/
|
||||
|
@ -284,7 +284,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
}
|
||||
/**
|
||||
* @return display tier, or null for an unset value
|
||||
*/
|
||||
*/
|
||||
public Integer getDomainDisplayTierInteger() {
|
||||
return domainDisplayTier;
|
||||
}
|
||||
|
@ -342,27 +342,27 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
public boolean getSelectFromExisting() {
|
||||
return selectFromExisting;
|
||||
}
|
||||
|
||||
|
||||
public void setSelectFromExisting(boolean b) {
|
||||
this.selectFromExisting = b;
|
||||
}
|
||||
|
||||
|
||||
public boolean getOfferCreateNewOption() {
|
||||
return offerCreateNewOption;
|
||||
}
|
||||
|
||||
|
||||
public void setOfferCreateNewOption(boolean b) {
|
||||
this.offerCreateNewOption = b;
|
||||
}
|
||||
|
||||
|
||||
public boolean getStubObjectRelation() {
|
||||
return stubObjectRelation;
|
||||
}
|
||||
|
||||
|
||||
public void setStubObjectRelation(boolean b) {
|
||||
this.stubObjectRelation = b;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts alphabetically by public name
|
||||
*/
|
||||
|
@ -385,14 +385,14 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
tier2 = (tier2 == null) ? 0 : tier2;
|
||||
return tier1 - tier2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the object property statements taking into account the sort order.
|
||||
*/
|
||||
public static List<ObjectPropertyStatement> sortObjectPropertyStatementsForDisplay(
|
||||
ObjectProperty prop, List objPropStmtsList) {
|
||||
|
||||
|
||||
if (objPropStmtsList == null) {
|
||||
log.error("incoming object property statement list is null; " +
|
||||
"returning null");
|
||||
|
@ -401,27 +401,27 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
if (objPropStmtsList.size() < 2) { // no need to sort
|
||||
return objPropStmtsList;
|
||||
}
|
||||
|
||||
String tmpDirection = prop.getDomainEntitySortDirection();
|
||||
|
||||
String tmpDirection = prop.getDomainEntitySortDirection();
|
||||
// Valid values are "desc" and "asc";
|
||||
// anything else will default to ascending.
|
||||
final boolean ascending = !"desc".equalsIgnoreCase(tmpDirection);
|
||||
|
||||
String objIndivSortPropURI = prop.getObjectIndividualSortPropertyURI();
|
||||
if (prop.getObjectIndividualSortPropertyURI() == null
|
||||
if (prop.getObjectIndividualSortPropertyURI() == null
|
||||
|| prop.getObjectIndividualSortPropertyURI().length() == 0) {
|
||||
log.debug("objectIndividualSortPropertyURI is null or blank " +
|
||||
"so sorting by name ");
|
||||
|
||||
|
||||
Comparator fieldComp = new Comparator() {
|
||||
|
||||
|
||||
public final int compare(Object o1, Object o2) {
|
||||
ObjectPropertyStatement e2e1 = (ObjectPropertyStatement) o1,
|
||||
ObjectPropertyStatement e2e1 = (ObjectPropertyStatement) o1,
|
||||
e2e2 = (ObjectPropertyStatement) o2;
|
||||
Individual e1 , e2;
|
||||
e1 = e2e1 != null ? e2e1.getObject():null;
|
||||
e2 = e2e2 != null ? e2e2.getObject():null;
|
||||
|
||||
|
||||
Object val1 = null, val2 = null;
|
||||
if( e1 != null ) {
|
||||
val1 = e1.getName();
|
||||
|
@ -442,7 +442,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
rv = -1;
|
||||
} else {
|
||||
Collator collator = Collator.getInstance();
|
||||
rv = collator.compare( ((String)val1) , ((String)val2) );
|
||||
rv = collator.compare( ((String)val1) , ((String)val2) );
|
||||
}
|
||||
} else if( val1 instanceof Date ) {
|
||||
DateTime dt1 = new DateTime((Date)val1);
|
||||
|
@ -454,7 +454,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
if( ascending ) {
|
||||
return rv;
|
||||
} else {
|
||||
|
@ -472,13 +472,13 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
final String objIndSortPropURI = prop.getObjectIndividualSortPropertyURI();
|
||||
Comparator dpComp = new Comparator() {
|
||||
final String cDatapropURI = objIndSortPropURI;
|
||||
|
||||
|
||||
public final int compare(Object o1, Object o2){
|
||||
ObjectPropertyStatement e2e1= (ObjectPropertyStatement)o1, e2e2=(ObjectPropertyStatement)o2;
|
||||
Individual e1 , e2;
|
||||
e1 = e2e1 != null ? e2e1.getObject():null;
|
||||
e2 = e2e2 != null ? e2e2.getObject():null;
|
||||
|
||||
|
||||
Object val1 = null, val2 = null;
|
||||
if( e1 != null ){
|
||||
try {
|
||||
|
@ -499,7 +499,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
}
|
||||
} else
|
||||
log.debug( "PropertyWebapp.sortObjectPropertiesForDisplay passed object property statement with no range entity.");
|
||||
|
||||
|
||||
if( e2 != null ){
|
||||
try {
|
||||
List<DataPropertyStatement> dataPropertyStatements = e2.getDataPropertyStatements();
|
||||
|
@ -521,14 +521,14 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
log.debug( "PropertyWebapp.sortObjectPropertyStatementsForDisplay passed object property statement with no range entity.");
|
||||
}
|
||||
int rv = 0;
|
||||
try {
|
||||
try {
|
||||
if (val1 == null && val2 == null) {
|
||||
rv = 0;
|
||||
} else if (val1==null) {
|
||||
rv = 1;
|
||||
} else if (val2==null) {
|
||||
rv = -1;
|
||||
} else {
|
||||
} else {
|
||||
if( val1 instanceof String ) {
|
||||
Collator collator = Collator.getInstance();
|
||||
rv = collator.compare( ((String)val1) , ((String)val2) ); //was rv = ((String)val1).compareTo((String)val2);
|
||||
|
@ -545,19 +545,19 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( !ascending ) {
|
||||
rv = rv * -1;
|
||||
}
|
||||
|
||||
|
||||
// sort alphabetically by name if have same dataproperty value
|
||||
if ( rv == 0 ) {
|
||||
String nameValue1 = ( e1.getName() != null ) ? e1.getName() : "";
|
||||
String nameValue2 = ( e2.getName() != null ) ? e2.getName() : "";
|
||||
rv = Collator.getInstance().compare( nameValue1, nameValue2 );
|
||||
}
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
};
|
||||
|
@ -611,7 +611,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
"offerCreateNewOption" + getOfferCreateNewOption() + "\n\t" +
|
||||
"** object property statements: " + list + "\n";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ObjectProperty clone()
|
||||
{
|
||||
|
@ -660,6 +660,6 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
clone.setTransitive(this.getTransitive());
|
||||
clone.setURI(this.getURI());
|
||||
clone.setURIInverse(this.getURIInverse());
|
||||
return clone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,4 +32,4 @@ public interface ObjectPropertyStatement {
|
|||
|
||||
public PropertyInstance toPropertyInstance();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ public class ObjectPropertyStatementImpl implements ObjectPropertyStatement
|
|||
|
||||
private String propertyURI = null;
|
||||
private ObjectProperty property = null;
|
||||
private boolean subjectOriented = true; //is the range the item of interest?
|
||||
|
||||
private boolean subjectOriented = true; //is the range the item of interest?
|
||||
|
||||
public ObjectPropertyStatementImpl() { }
|
||||
|
||||
public ObjectPropertyStatementImpl(String subjectUri, String propertyUri, String objectUri) {
|
||||
subjectURI = subjectUri;
|
||||
propertyURI = propertyUri;
|
||||
objectURI = objectUri;
|
||||
objectURI = objectUri;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -82,7 +82,7 @@ public class ObjectPropertyStatementImpl implements ObjectPropertyStatement
|
|||
public void setSubject(Individual subject) {
|
||||
this.subject = subject;
|
||||
if (subject == null || subject.isAnonymous()) {
|
||||
setSubjectURI(null);
|
||||
setSubjectURI(null);
|
||||
} else {
|
||||
setSubjectURI(subject.getURI());
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class ObjectPropertyStatementImpl implements ObjectPropertyStatement
|
|||
public void setObject(Individual object) {
|
||||
this.object = object;
|
||||
if (object == null || object.isAnonymous()) {
|
||||
setObjectURI(null);
|
||||
setObjectURI(null);
|
||||
} else {
|
||||
setObjectURI(object.getURI());
|
||||
}
|
||||
|
@ -147,10 +147,10 @@ public class ObjectPropertyStatementImpl implements ObjectPropertyStatement
|
|||
* Sorts entity object for display presentation.
|
||||
* @author bdc34
|
||||
*/
|
||||
public static class DisplayComparator implements Comparator{
|
||||
public static class DisplayComparator implements Comparator{
|
||||
public int compare(Object o1, Object o2) {
|
||||
Individual ent1 = ((ObjectPropertyStatement) o1).getSubject();
|
||||
Individual ent2 = ((ObjectPropertyStatement) o2).getSubject();
|
||||
Individual ent2 = ((ObjectPropertyStatement) o2).getSubject();
|
||||
return ent1.getName().compareTo(ent2.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ import org.apache.commons.logging.LogFactory;
|
|||
*/
|
||||
public class Ontology implements Comparable<Ontology>
|
||||
{
|
||||
|
||||
|
||||
private static final Log log = LogFactory.getLog(Ontology.class.getName());
|
||||
|
||||
|
||||
private int myID = -1;
|
||||
public int getId() { return myID; }
|
||||
public void setId( int id ) { myID = id; }
|
||||
|
@ -28,7 +28,7 @@ public class Ontology implements Comparable<Ontology>
|
|||
private String myType = null;
|
||||
public String getType() { return myType; }
|
||||
public void setType( String type ) { myType = type; }
|
||||
|
||||
|
||||
private String myPrefix = null;
|
||||
public String getPrefix() { return myPrefix; }
|
||||
public void setPrefix( String prefix ) { myPrefix = prefix; }
|
||||
|
@ -52,7 +52,7 @@ public class Ontology implements Comparable<Ontology>
|
|||
private List myEntitiesList = null;
|
||||
public List getEntsList() { return myEntitiesList; }
|
||||
public void setEntsList( List entsList ) { myEntitiesList = entsList; }
|
||||
|
||||
|
||||
public int compareTo(Ontology o2) {
|
||||
Collator collator = Collator.getInstance();
|
||||
if (o2 == null) {
|
||||
|
@ -61,7 +61,7 @@ public class Ontology implements Comparable<Ontology>
|
|||
}
|
||||
return collator.compare(this.getName(), o2.getName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Ontology[myID=" + myID + ", myName=" + myName + ", myType="
|
||||
|
@ -70,5 +70,5 @@ public class Ontology implements Comparable<Ontology>
|
|||
+ myVClassesList + ", myPropsList=" + myPropsList
|
||||
+ ", myEntitiesList=" + myEntitiesList + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.apache.jena.rdf.model.ResourceFactory;
|
||||
|
||||
public class Property extends BaseResourceBean implements ResourceBean {
|
||||
|
||||
|
||||
private static Log log = LogFactory.getLog( Property.class );
|
||||
|
||||
private String customEntryForm = null;
|
||||
|
@ -22,12 +22,12 @@ public class Property extends BaseResourceBean implements ResourceBean {
|
|||
private boolean editLinkSuppressed = false;
|
||||
private boolean addLinkSuppressed = false;
|
||||
private boolean deleteLinkSuppressed = false;
|
||||
|
||||
|
||||
public Property() {
|
||||
this.groupURI = null;
|
||||
this.label = null;
|
||||
}
|
||||
|
||||
|
||||
public Property(String URI) {
|
||||
this.setURI(URI);
|
||||
}
|
||||
|
@ -35,81 +35,81 @@ public class Property extends BaseResourceBean implements ResourceBean {
|
|||
public String getCustomEntryForm() {
|
||||
return customEntryForm;
|
||||
}
|
||||
|
||||
|
||||
public void setCustomEntryForm(String s) {
|
||||
this.customEntryForm = s;
|
||||
}
|
||||
|
||||
public String getGroupURI() {
|
||||
|
||||
public String getGroupURI() {
|
||||
return groupURI;
|
||||
}
|
||||
public void setGroupURI(String in) {
|
||||
this.groupURI = in;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
public String getDomainVClassURI() {
|
||||
return this.domainVClassURI;
|
||||
}
|
||||
|
||||
|
||||
public void setDomainVClassURI(String domainVClassURI) {
|
||||
this.domainVClassURI = domainVClassURI;
|
||||
}
|
||||
|
||||
|
||||
public String getRangeVClassURI() {
|
||||
return this.rangeVClassURI;
|
||||
}
|
||||
|
||||
|
||||
public void setRangeVClassURI(String rangeVClassURI) {
|
||||
this.rangeVClassURI = rangeVClassURI;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSubjectSide() {
|
||||
return subjectSide;
|
||||
}
|
||||
|
||||
|
||||
public boolean isEditLinkSuppressed() {
|
||||
return editLinkSuppressed;
|
||||
}
|
||||
|
||||
|
||||
public boolean isAddLinkSuppressed() {
|
||||
return addLinkSuppressed;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDeleteLinkSuppressed() {
|
||||
return deleteLinkSuppressed;
|
||||
}
|
||||
|
||||
|
||||
public void setEditLinkSuppressed(boolean editLinkSuppressed) {
|
||||
this.editLinkSuppressed = editLinkSuppressed;
|
||||
}
|
||||
|
||||
|
||||
public void setAddLinkSuppressed(boolean addLinkSuppressed) {
|
||||
if (this.addLinkSuppressed) {
|
||||
throw new RuntimeException("addLinkSuppressed already true");
|
||||
}
|
||||
this.addLinkSuppressed = addLinkSuppressed;
|
||||
}
|
||||
|
||||
|
||||
public void setDeleteLinkSuppressed(boolean deleteLinkSuppressed) {
|
||||
this.deleteLinkSuppressed = deleteLinkSuppressed;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + "["
|
||||
return this.getClass().getSimpleName() + "["
|
||||
+ localNameFor(getURI())
|
||||
+ ", domain=" + localNameFor(getDomainVClassURI())
|
||||
+ ", range=" + localNameFor(getRangeVClassURI())
|
||||
+ ", domain=" + localNameFor(getDomainVClassURI())
|
||||
+ ", range=" + localNameFor(getRangeVClassURI())
|
||||
+ "]";
|
||||
}
|
||||
|
||||
|
||||
private String localNameFor(String uri) {
|
||||
try {
|
||||
return ResourceFactory.createResource(uri).getLocalName();
|
||||
|
@ -122,24 +122,24 @@ public class Property extends BaseResourceBean implements ResourceBean {
|
|||
* Sorts Property objects, by property rank, then alphanumeric.
|
||||
* @author bdc34
|
||||
*/
|
||||
public static class DisplayComparatorIgnoringPropertyGroup implements Comparator {
|
||||
public static class DisplayComparatorIgnoringPropertyGroup implements Comparator {
|
||||
public int compare(Object o1, Object o2) {
|
||||
//log.warn("starting property display comparator; ignoring group ");
|
||||
Property p1 = o1 == null ? null : (Property) o1;
|
||||
Property p2 = o2 == null ? null : (Property) o2;
|
||||
if (p1==null || p2==null) {
|
||||
if (p1==null || p2==null) {
|
||||
return 0;
|
||||
}
|
||||
//log.warn("comparing property "+p1.getLocalName()+" (rank "+determineDisplayRank(p1)+") to property "+p2.getLocalName()+" (rank "+determineDisplayRank(p2)+") ...");
|
||||
int diff = determineDisplayRank(p1) - determineDisplayRank(p2);
|
||||
if (diff==0) {
|
||||
String p1Str = p1.getLabel() == null ? p1.getURI() : p1.getLabel();
|
||||
String p2Str = p2.getLabel() == null ? p2.getURI() : p2.getLabel();
|
||||
String p1Str = p1.getLabel() == null ? p1.getURI() : p1.getLabel();
|
||||
String p2Str = p2.getLabel() == null ? p2.getURI() : p2.getLabel();
|
||||
return p1Str.compareTo(p2Str);
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
private int determineDisplayRank(Property p) {
|
||||
if (p instanceof DataProperty) {
|
||||
DataProperty dp = (DataProperty) p;
|
||||
|
@ -148,7 +148,7 @@ public class Property extends BaseResourceBean implements ResourceBean {
|
|||
ObjectProperty op = (ObjectProperty) p;
|
||||
return op.getDomainDisplayTier();
|
||||
} else {
|
||||
log.error("Property is of unknown class in PropertyRanker()");
|
||||
log.error("Property is of unknown class in PropertyRanker()");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -9,55 +9,55 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
public class PropertyGroup extends BaseResourceBean implements Comparable<PropertyGroup> {
|
||||
|
||||
|
||||
private static final Log log = LogFactory.getLog(PropertyGroup.class.getName());
|
||||
|
||||
|
||||
private int displayRank;
|
||||
private String name;
|
||||
private List<Property> propertyList;
|
||||
private int statementCount;
|
||||
private String publicDescription;
|
||||
|
||||
|
||||
public int getDisplayRank() {
|
||||
return this.displayRank;
|
||||
}
|
||||
|
||||
|
||||
public void setDisplayRank(int in) {
|
||||
this.displayRank = in;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String in) {
|
||||
this.name = in;
|
||||
}
|
||||
|
||||
|
||||
public List<Property> getPropertyList() {
|
||||
return this.propertyList;
|
||||
}
|
||||
|
||||
|
||||
public void setPropertyList(List<Property> in) {
|
||||
this.propertyList = in;
|
||||
}
|
||||
|
||||
|
||||
public int getStatementCount() {
|
||||
return statementCount;
|
||||
}
|
||||
|
||||
|
||||
public void setStatementCount(int count) {
|
||||
statementCount = count;
|
||||
}
|
||||
|
||||
|
||||
public String getPublicDescription() {
|
||||
return publicDescription;
|
||||
}
|
||||
|
||||
|
||||
public void setPublicDescription(String s) {
|
||||
publicDescription = s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -75,5 +75,5 @@ public class PropertyGroup extends BaseResourceBean implements Comparable<Proper
|
|||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ public class PropertyInstance implements PropertyInstanceIface, Comparable<Prope
|
|||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
public int compareTo(PropertyInstance pi) {
|
||||
|
||||
try {
|
||||
|
|
|
@ -10,9 +10,9 @@ import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
|||
* Time: 3:41:23 PM
|
||||
*/
|
||||
public interface ResourceBean {
|
||||
|
||||
|
||||
String getURI();
|
||||
|
||||
|
||||
boolean isAnonymous();
|
||||
|
||||
void setURI(String URI);
|
||||
|
@ -24,27 +24,27 @@ public interface ResourceBean {
|
|||
String getLocalName();
|
||||
|
||||
void setLocalName(String localName);
|
||||
|
||||
|
||||
String getLabel();
|
||||
|
||||
|
||||
public RoleLevel getHiddenFromDisplayBelowRoleLevel() ;
|
||||
|
||||
|
||||
public void setHiddenFromDisplayBelowRoleLevel(RoleLevel eR) ;
|
||||
|
||||
|
||||
public void setHiddenFromDisplayBelowRoleLevelUsingRoleUri(String roleUri) ;
|
||||
|
||||
public RoleLevel getProhibitedFromUpdateBelowRoleLevel() ;
|
||||
|
||||
|
||||
public void setProhibitedFromUpdateBelowRoleLevel(RoleLevel eR) ;
|
||||
|
||||
|
||||
public void setProhibitedFromUpdateBelowRoleLevelUsingRoleUri(String roleUri) ;
|
||||
|
||||
|
||||
public RoleLevel getHiddenFromPublishBelowRoleLevel() ;
|
||||
|
||||
|
||||
public void setHiddenFromPublishBelowRoleLevel(RoleLevel eR) ;
|
||||
|
||||
|
||||
public void setHiddenFromPublishBelowRoleLevelUsingRoleUri(String roleUri) ;
|
||||
|
||||
|
||||
public String getPickListName();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class SelfEditingConfiguration {
|
|||
/**
|
||||
* Get the bean from the context. If there no bean, create one on the fly
|
||||
* and store it in the context.
|
||||
*
|
||||
*
|
||||
* Never returns null.
|
||||
*/
|
||||
public static SelfEditingConfiguration getBean(ServletRequest request) {
|
||||
|
@ -61,7 +61,7 @@ public class SelfEditingConfiguration {
|
|||
/**
|
||||
* Get the bean from the context. If there no bean, create one on the fly
|
||||
* and store it in the context.
|
||||
*
|
||||
*
|
||||
* Never returns null.
|
||||
*/
|
||||
public static SelfEditingConfiguration getBean(ServletContext ctx) {
|
||||
|
@ -111,7 +111,7 @@ public class SelfEditingConfiguration {
|
|||
|
||||
/**
|
||||
* What is the matching property? (might be null).
|
||||
*
|
||||
*
|
||||
* TODO This seems to expose the property unnecessarily, but how else can I
|
||||
* do a SPARQL query for the Individual profiles that don't have matching
|
||||
* property values?
|
||||
|
@ -164,7 +164,7 @@ public class SelfEditingConfiguration {
|
|||
/**
|
||||
* This Individual, if it exists, should be associated with this
|
||||
* UserAccount.
|
||||
*
|
||||
*
|
||||
* No other Individual should be associated with this UserAccount.
|
||||
*/
|
||||
public void associateIndividualWithUserAccount(IndividualDao indDao,
|
||||
|
|
|
@ -11,7 +11,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator;
|
|||
|
||||
/**
|
||||
* Information about the account of a user. URI, email, password, etc.
|
||||
*
|
||||
*
|
||||
* The "password link expires hash" is just a string that is derived from the
|
||||
* value in the passwordLinkExpires field. It doesn't have to be a hash, and
|
||||
* there is no need for it to be cryptographic, but it seems embarrassing to
|
||||
|
@ -66,7 +66,7 @@ public class UserAccount {
|
|||
private Set<String> permissionSetUris = Collections.emptySet();
|
||||
|
||||
private boolean rootUser = false;
|
||||
|
||||
|
||||
/** This may be empty, but should never be null. */
|
||||
private Set<String> proxiedIndividualUris = Collections.emptySet();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
*/
|
||||
public class VClass extends BaseResourceBean implements Comparable<VClass>
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* What this VClass is called
|
||||
*/
|
||||
|
@ -44,11 +44,11 @@ public class VClass extends BaseResourceBean implements Comparable<VClass>
|
|||
// this type in the database. Is this the case?
|
||||
// [bjl23 2007-08-12] Yep. A count of individuals in the class.
|
||||
protected int myEntityCount = -1;
|
||||
|
||||
|
||||
// rjy7 Removing deprecation since currently we have no other means to get this value.
|
||||
// @Deprecated
|
||||
public int getEntityCount() { return myEntityCount; }
|
||||
|
||||
|
||||
public void setEntityCount( int ec ) { myEntityCount = ec; }
|
||||
|
||||
protected Integer displayLimit = null;
|
||||
|
@ -74,26 +74,26 @@ public class VClass extends BaseResourceBean implements Comparable<VClass>
|
|||
protected String customEntryForm = null;
|
||||
public String getCustomEntryForm() { return customEntryForm; }
|
||||
public void setCustomEntryForm(String s) { this.customEntryForm = s; }
|
||||
|
||||
|
||||
protected String customDisplayView = null;
|
||||
public String getCustomDisplayView() { return customDisplayView; }
|
||||
public void setCustomDisplayView(String s) { this.customDisplayView = s; }
|
||||
|
||||
|
||||
protected String customShortView = null;
|
||||
public String getCustomShortView() { return customShortView; }
|
||||
public void setCustomShortView(String s) { this.customShortView = s; }
|
||||
|
||||
|
||||
protected String customSearchView = null;
|
||||
public String getCustomSearchView() { return customSearchView; }
|
||||
public void setCustomSearchView(String s) { this.customSearchView = s; }
|
||||
public void setCustomSearchView(String s) { this.customSearchView = s; }
|
||||
|
||||
protected Float searchBoost = null;
|
||||
public Float getSearchBoost() { return searchBoost; }
|
||||
public void setSearchBoost( Float boost ){ searchBoost = boost;}
|
||||
|
||||
|
||||
public boolean isUnion() { return false; }
|
||||
public List<VClass> getUnionComponents() { return new ArrayList<VClass>(); }
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
|
@ -125,16 +125,16 @@ public class VClass extends BaseResourceBean implements Comparable<VClass>
|
|||
super(uriString);
|
||||
myName = getLocalName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the VClass as a deep copy of an existing VClass.
|
||||
* Constructs the VClass as a deep copy of an existing VClass.
|
||||
*/
|
||||
public VClass copy() {
|
||||
VClass that = new VClass();
|
||||
copyFields(that);
|
||||
return that;
|
||||
}
|
||||
|
||||
|
||||
protected void copyFields(VClass that) {
|
||||
that.myName = this.myName;
|
||||
that.namespace = this.namespace;
|
||||
|
@ -154,7 +154,7 @@ public class VClass extends BaseResourceBean implements Comparable<VClass>
|
|||
that.customShortView = this.customShortView;
|
||||
that.customSearchView = this.customSearchView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sorts alphabetically by name
|
||||
*/
|
||||
|
|
|
@ -14,20 +14,20 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
public class VClassGroup extends LinkedList <VClass> implements Comparable<VClassGroup> {
|
||||
|
||||
|
||||
private static final Log log = LogFactory.getLog(VClassGroup.class.getName());
|
||||
|
||||
|
||||
private String URI = null;
|
||||
private String namespace = null;
|
||||
private String localName = null;
|
||||
private String publicName = null;
|
||||
private int displayRank = -1;
|
||||
private int individualCount = -1;
|
||||
|
||||
|
||||
public boolean isIndividualCountSet(){
|
||||
return individualCount >= 0;
|
||||
}
|
||||
|
||||
|
||||
public int getIndividualCount() {
|
||||
return individualCount;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class VClassGroup extends LinkedList <VClass> implements Comparable<VClas
|
|||
this.displayRank = rank;
|
||||
this.publicName = name;
|
||||
}
|
||||
|
||||
|
||||
public VClassGroup(VClassGroup vcg) {
|
||||
this.URI = vcg.URI;
|
||||
this.namespace = vcg.namespace;
|
||||
|
@ -149,12 +149,12 @@ public class VClassGroup extends LinkedList <VClass> implements Comparable<VClas
|
|||
groups.remove(it.next());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sorts VClassGroup objects by group rank, then alphanumeric.
|
||||
* @return a negative integer, zero, or a positive integer as the
|
||||
* first argument is less than, equal to, or greater than the
|
||||
* second.
|
||||
* second.
|
||||
*/
|
||||
public int compareTo(VClassGroup o2) {
|
||||
Collator collator = Collator.getInstance();
|
||||
|
@ -164,7 +164,7 @@ public class VClassGroup extends LinkedList <VClass> implements Comparable<VClas
|
|||
}
|
||||
int diff = (this.getDisplayRank() - o2.getDisplayRank());
|
||||
if (diff == 0 ) {
|
||||
|
||||
|
||||
//put null public name classgrups at end of list
|
||||
if( this.getPublicName() == null ){
|
||||
if( o2.getPublicName() == null )
|
||||
|
@ -179,5 +179,5 @@ public class VClassGroup extends LinkedList <VClass> implements Comparable<VClas
|
|||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
/**
|
||||
* Provides an mechanism for modules to read the configuration properties that
|
||||
* are attached to the servlet context.
|
||||
*
|
||||
*
|
||||
* The customary behavior is for ConfigurationPropertiesSetup to create a
|
||||
* ConfigurationPropertiesImpl, which will obtain the properties from the
|
||||
* build.properties file and the runtime.properties file.
|
||||
|
|
|
@ -19,9 +19,9 @@ import org.apache.commons.logging.LogFactory;
|
|||
* also permits the caller to supply a map of "preemptive" properties that will
|
||||
* be included and will override any matching properties from the file, and a
|
||||
* map of "build" properties that may be overridden by the file.
|
||||
*
|
||||
*
|
||||
* Leading and trailing white space are trimmed from the property values.
|
||||
*
|
||||
*
|
||||
* Once the properties have been parsed and stored, they are immutable.
|
||||
*/
|
||||
public class ConfigurationPropertiesImpl extends ConfigurationProperties {
|
||||
|
@ -34,7 +34,7 @@ public class ConfigurationPropertiesImpl extends ConfigurationProperties {
|
|||
Map<String, String> preemptiveProperties,
|
||||
Map<String, String> buildProperties) throws IOException {
|
||||
Map<String, String> map = new HashMap<>(buildProperties);
|
||||
|
||||
|
||||
Properties props = loadFromPropertiesFile(stream);
|
||||
for (String key: props.stringPropertyNames()) {
|
||||
map.put(key, props.getProperty(key));
|
||||
|
|
|
@ -199,7 +199,7 @@ public class ConfigurationPropertiesSmokeTests implements
|
|||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to find language files", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fail if there are no config properties for the Argon2 encryption.
|
||||
|
|
|
@ -19,18 +19,18 @@ import com.ibm.icu.text.SimpleDateFormat;
|
|||
/**
|
||||
* Information about the provenance of this application: release, revision
|
||||
* level, build date, etc.
|
||||
*
|
||||
*
|
||||
* Except for the build date, the information is stored for all levels of the
|
||||
* application. So an instance of NIHVIVO might read:
|
||||
*
|
||||
*
|
||||
* date: 2010-11-09 12:15:44
|
||||
*
|
||||
*
|
||||
* level: vitro-core, trunk, 1234:1236M
|
||||
*
|
||||
*
|
||||
* level: vivo, branch rel_1.1_maint, 798
|
||||
*
|
||||
*
|
||||
* Note that the levels should be listed from inner to outer.
|
||||
*
|
||||
*
|
||||
* Instances of this class are immutable.
|
||||
*/
|
||||
public class RevisionInfoBean {
|
||||
|
|
|
@ -31,16 +31,16 @@ import edu.cornell.mannlib.vitro.webapp.startup.StartupStatus;
|
|||
/**
|
||||
* <pre>
|
||||
* Read the revision information, and store it in the servlet context.
|
||||
*
|
||||
* - The revision information is in a file in the classpath.
|
||||
*
|
||||
* - The revision information is in a file in the classpath.
|
||||
* - The name of the file is in RESOURCE_PATH, below.
|
||||
* - The first line is the build date, with a format as in DATE_FORMAT, below.
|
||||
* - Each additional non-blank line holds revision info for one application level:
|
||||
* - level info is from inner (vitro) to outer (top-level product).
|
||||
* - level info appears as product name, release name and revision level,
|
||||
* delimited by " ~ ".
|
||||
* - level info appears as product name, release name and revision level,
|
||||
* delimited by " ~ ".
|
||||
* - additional white space before and after info values is ignored.
|
||||
*
|
||||
*
|
||||
* Example file:
|
||||
* 2010-11-14 23:58:00
|
||||
* vitroCore ~ Release 1.1 ~ 6604
|
||||
|
@ -59,9 +59,9 @@ public class RevisionInfoSetup implements ServletContextListener {
|
|||
/**
|
||||
* On startup, read the revision info from the resource file in the
|
||||
* classpath.
|
||||
*
|
||||
*
|
||||
* If we can't find the file, or can't parse it, store an empty bean.
|
||||
*
|
||||
*
|
||||
* Don't allow any Exceptions to percolate up past this point.
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
|||
/**
|
||||
* A base class with some utility routines for page handler (created by
|
||||
* controller classes.
|
||||
*
|
||||
*
|
||||
* The controller logic is often complicated by the fact that the servlet must
|
||||
* be multi-threaded. If a "page handler" instance is created for each request,
|
||||
* it may share instance variables among its methods, which frequently makes for
|
||||
|
@ -113,7 +113,7 @@ public abstract class AbstractPageHandler {
|
|||
/**
|
||||
* Treat the presence of a certain parameter, with a desired value, as a
|
||||
* boolean flag.
|
||||
*
|
||||
*
|
||||
* An example would be radio buttons with values of "yes" and "no". The
|
||||
* expected value would be "yes".
|
||||
*/
|
||||
|
@ -150,7 +150,7 @@ public abstract class AbstractPageHandler {
|
|||
/**
|
||||
* Set one of these on the session, so it can be interpreted and displayed
|
||||
* at the next request. It will only be displayed once.
|
||||
*
|
||||
*
|
||||
* Allows one page handler to pass a message to another page handler through
|
||||
* a re-direct.
|
||||
*/
|
||||
|
|
|
@ -16,32 +16,32 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
public class Controllers {
|
||||
|
||||
|
||||
// Servlet urls
|
||||
|
||||
public static final String ABOUT = "/about";
|
||||
public static final String CONTACT_URL = "/comments";
|
||||
public static final String TERMS_OF_USE_URL = "/termsOfUse";
|
||||
public static final String SEARCH_URL = "/search";
|
||||
public static final String SEARCH_URL = "/search";
|
||||
public static final String ENTITY = "/entity";
|
||||
|
||||
public static final String RETRY_URL = "editForm";
|
||||
public static final String TAB_ENTITIES = "/TabEntitiesController";
|
||||
public static final String TAB_ENTITIES = "/TabEntitiesController";
|
||||
|
||||
public static final String SITE_ADMIN = "/siteAdmin";
|
||||
public static final String LOGIN = "/login";
|
||||
public static final String LOGOUT = "/logout";
|
||||
public static final String AUTHENTICATE = "/authenticate";
|
||||
|
||||
|
||||
public static final String EXPORT_RDF = "/export";
|
||||
|
||||
|
||||
// jsps go here:
|
||||
|
||||
|
||||
public static final String TAB = "/index.jsp";
|
||||
|
||||
public static final String DEBUG_JSP = "/templates/page/debug.jsp";
|
||||
public static final Object BODY_MSG = "/templates/page/bodyMsg.jsp";
|
||||
|
||||
|
||||
public static final String DASHBOARD_PROP_LIST_JSP = "edit/dashboardPropsList.jsp";
|
||||
|
||||
public static final String ENTITY_EDITABLE_JSP = "templates/entity/entityEditable.jsp";
|
||||
|
@ -57,14 +57,14 @@ public class Controllers {
|
|||
|
||||
public static final String HORIZONTAL_JSP = "/templates/edit/fetch/horizontal.jsp";
|
||||
public static final String VERTICAL_JSP = "/templates/edit/fetch/vertical.jsp";
|
||||
|
||||
|
||||
public static final String CHECK_DATATYPE_PROPERTIES = "/jsp/checkDatatypeProperties.jsp";
|
||||
public static final String EXPORT_SELECTION_JSP = "/jenaIngest/exportSelection.jsp";
|
||||
|
||||
public static final String VCLASS_RETRY_URL = "vclass_retry";
|
||||
|
||||
public static final String TOGGLE_SCRIPT_ELEMENT = "<script language='JavaScript' type='text/javascript' src='js/toggle.js'></script>";
|
||||
|
||||
|
||||
//public static final String TAB_ENTITIES_LIST_JSP = "templates/tab/tabEntities.jsp";
|
||||
|
||||
private static List<String> letters = null;
|
||||
|
|
|
@ -51,10 +51,10 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
* Expected Attributes:
|
||||
* entity - set to entity to display properties for.
|
||||
*/
|
||||
|
||||
|
||||
private static final Log log = LogFactory.getLog(DashboardPropertyListController.class.getName());
|
||||
private static final int MAX_GROUP_DISPLAY_RANK = 99;
|
||||
|
||||
|
||||
public void doGet( HttpServletRequest req, HttpServletResponse res )
|
||||
throws IOException, ServletException {
|
||||
try {
|
||||
|
@ -64,7 +64,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
throw new HelpException("EntityMergedPropertyListController requires request.attribute 'entity' to be of"
|
||||
+" type " + Individual.class.getName() );
|
||||
Individual subject =(Individual)obj;
|
||||
|
||||
|
||||
String groupForUngroupedProperties = null;
|
||||
String unassignedStr = req.getParameter("unassignedPropsGroupName");
|
||||
if (unassignedStr != null && unassignedStr.length()>0) {
|
||||
|
@ -73,13 +73,13 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
req.setAttribute("unassignedPropsGroupName", unassignedStr);
|
||||
log.debug("found temp group parameter \""+unassignedStr+"\" for unassigned properties");
|
||||
}
|
||||
|
||||
|
||||
boolean groupedMode = false;
|
||||
String groupedStr = req.getParameter("grouped");
|
||||
if (groupedStr != null && groupedStr.equalsIgnoreCase("true")) {
|
||||
groupedMode = true;
|
||||
}
|
||||
|
||||
|
||||
boolean onlyPopulatedProps = true;
|
||||
String allPossiblePropsStr = req.getParameter("allProps");
|
||||
if (allPossiblePropsStr != null && allPossiblePropsStr.length()>0) {
|
||||
|
@ -91,22 +91,22 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
|
||||
VitroRequest vreq = new VitroRequest(req);
|
||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
||||
|
||||
|
||||
PropertyGroupDao pgDao = null;
|
||||
List <PropertyGroup> groupsList = null;
|
||||
if (groupedMode) {
|
||||
pgDao = wdf.getPropertyGroupDao();
|
||||
groupsList = pgDao.getPublicGroups(false); // may be returned empty but not null
|
||||
}
|
||||
|
||||
|
||||
PropertyInstanceDao piDao = wdf.getPropertyInstanceDao();
|
||||
ObjectPropertyDao opDao = wdf.getObjectPropertyDao();
|
||||
|
||||
|
||||
// set up a new list for the combined object and data properties
|
||||
List<Property> mergedPropertyList = new ArrayList<Property>();
|
||||
|
||||
|
||||
if (onlyPopulatedProps) {
|
||||
// now first get the properties this entity actually has, presumably populated with statements
|
||||
// now first get the properties this entity actually has, presumably populated with statements
|
||||
List<ObjectProperty> objectPropertyList = subject.getObjectPropertyList();
|
||||
for (ObjectProperty op : objectPropertyList) {
|
||||
op.setLabel(op.getDomainPublic());
|
||||
|
@ -129,7 +129,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
log.error("a null Collection is returned from PropertyInstanceDao.getAllPossiblePropInstForIndividual()");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DataPropertyDao dpDao = wdf.getDataPropertyDao();
|
||||
if (onlyPopulatedProps) {
|
||||
// now do much the same with data properties: get the list of populated data properties, then add in placeholders for missing ones
|
||||
|
@ -137,7 +137,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
for (DataProperty dp : dataPropertyList) {
|
||||
dp.setLabel(dp.getPublicName());
|
||||
mergedPropertyList.add(dp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.debug("getting all possible data property choices");
|
||||
Collection <DataProperty> allDatapropColl = dpDao.getAllPossibleDatapropsForIndividual(subject.getURI());
|
||||
|
@ -154,7 +154,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
log.error("a null Collection is returned from DataPropertyDao.getAllPossibleDatapropsForIndividual())");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mergedPropertyList!=null) {
|
||||
try {
|
||||
mergedPropertyList.sort(new PropertyRanker(vreq));
|
||||
|
@ -220,7 +220,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
throws ServletException,IOException {
|
||||
doGet(request, response);
|
||||
}
|
||||
|
||||
|
||||
private boolean alreadyOnPropertyList(List<Property> propsList, Property p) {
|
||||
if (p.getURI() == null) {
|
||||
log.error("Property p has no propertyURI in alreadyOnPropertyList()");
|
||||
|
@ -305,7 +305,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class PropertyRanker implements Comparator {
|
||||
VitroRequest vreq;
|
||||
WebappDaoFactory wdf;
|
||||
|
@ -316,14 +316,14 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
this.wdf = vreq.getWebappDaoFactory();
|
||||
this.pgDao = wdf.getPropertyGroupDao();
|
||||
}
|
||||
|
||||
|
||||
public int compare (Object o1, Object o2) {
|
||||
Property p1 = (Property) o1;
|
||||
Property p2 = (Property) o2;
|
||||
|
||||
|
||||
// sort first by property group rank; if the same, then sort by property rank
|
||||
final int MAX_GROUP_RANK=99;
|
||||
|
||||
|
||||
int p1GroupRank=MAX_GROUP_RANK;
|
||||
if (p1.getGroupURI()!=null) {
|
||||
PropertyGroup pg1 = pgDao.getGroupByURI(p1.getGroupURI());
|
||||
|
@ -331,7 +331,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
p1GroupRank=pg1.getDisplayRank();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int p2GroupRank=MAX_GROUP_RANK;
|
||||
if (p2.getGroupURI()!=null) {
|
||||
PropertyGroup pg2 = pgDao.getGroupByURI(p2.getGroupURI());
|
||||
|
@ -339,7 +339,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
p2GroupRank=pg2.getDisplayRank();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// int diff = pgDao.getGroupByURI(p1.getGroupURI()).getDisplayRank() - pgDao.getGroupByURI(p2.getGroupURI()).getDisplayRank();
|
||||
int diff=p1GroupRank - p2GroupRank;
|
||||
if (diff==0) {
|
||||
|
@ -352,7 +352,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
private int determineDisplayRank(Property p) {
|
||||
if (p instanceof DataProperty) {
|
||||
DataProperty dp = (DataProperty)p;
|
||||
|
@ -361,7 +361,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
ObjectProperty op = (ObjectProperty)p;
|
||||
return op.getDomainDisplayTier();
|
||||
} else {
|
||||
log.error("Property is of unknown class in PropertyRanker()");
|
||||
log.error("Property is of unknown class in PropertyRanker()");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailFactory;
|
|||
@WebServlet(name = "mailusers", urlPatterns = {"/mailusers"}, loadOnStartup = 5)
|
||||
public class MailUsersServlet extends VitroHttpServlet {
|
||||
private static final Log log = LogFactory.getLog(MailUsersServlet.class);
|
||||
|
||||
|
||||
public static HttpServletRequest request;
|
||||
public static HttpServletRequest response;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
String confirmpage = "/confirmUserMail.jsp";
|
||||
String errpage = "/contact_err.jsp";
|
||||
String status = null; // holds the error status
|
||||
|
||||
|
||||
if (!FreemarkerEmailFactory.isConfigured(vreq)) {
|
||||
status = "This application has not yet been configured to send mail. "
|
||||
+ "Email properties must be specified in the configuration properties file.";
|
||||
|
@ -77,13 +77,13 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
List<String> deliverToArray = null;
|
||||
int recipientCount = 0;
|
||||
String deliveryfrom = null;
|
||||
|
||||
|
||||
// get Individuals that the User mayEditAs
|
||||
deliverToArray = getEmailsForAllUserAccounts(vreq);
|
||||
|
||||
|
||||
//Removed all form type stuff b/c recipients pre-configured
|
||||
recipientCount=(deliverToArray == null) ? 0 : deliverToArray.size();
|
||||
|
||||
|
||||
if (recipientCount == 0) {
|
||||
//log.error("recipientCount is 0 when DeliveryType specified as \""+formType+"\"");
|
||||
throw new Error(
|
||||
|
@ -98,9 +98,9 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
//webusername = "hjk54";
|
||||
//webuseremail = "hjk54@cornell.edu";
|
||||
//comments = "following are comments";
|
||||
|
||||
|
||||
webusername=webusername.trim();
|
||||
deliveryfrom = webuseremail;
|
||||
deliveryfrom = webuseremail;
|
||||
comments=comments.trim();
|
||||
//Removed spam filtering code
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
msg.setFrom( new InternetAddress( webuseremail ));
|
||||
|
||||
// Set the recipient address
|
||||
|
||||
|
||||
if (recipientCount>0){
|
||||
InternetAddress[] address=new InternetAddress[recipientCount];
|
||||
for (int i=0; i<recipientCount; i++){
|
||||
|
@ -208,10 +208,10 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<String> getEmailsForAllUserAccounts(VitroRequest vreq) {
|
||||
UserAccountsDao uaDao = vreq.getWebappDaoFactory().getUserAccountsDao();
|
||||
|
||||
|
||||
List<String> emails = new ArrayList<String>();
|
||||
for (UserAccount user : uaDao.getAllUserAccounts()) {
|
||||
emails.add(user.getEmailAddress());
|
||||
|
|
|
@ -30,22 +30,22 @@ import org.apache.commons.logging.LogFactory;
|
|||
/**
|
||||
* Wraps a multipart HTTP request, and pre-parses it for file uploads, without
|
||||
* losing the request parameters.
|
||||
*
|
||||
*
|
||||
* Parsing through the request with an Apache ServletFileUpload builds a list of
|
||||
* FileItems that includes the parameters and the file parts. After that,
|
||||
* however, the parameters are no longer accessible from the request. This
|
||||
* wrapper will see that they don't get lost.
|
||||
*
|
||||
*
|
||||
* The List of FileItems includes both "formField" items and "file" items. As
|
||||
* with the usual parameters on a request, we can have more than one value with
|
||||
* the same name. So this creates a map of <String, List<String>> to hold the
|
||||
* parameters, and a map of <String, List<FileItem>> to hold the files.
|
||||
*
|
||||
*
|
||||
* The parameters will be available to the wrapper through the normal methods.
|
||||
* The files will be available as an attribute that holds the map. Also, a
|
||||
* separate attribute will hold a Boolean to indicate that this was indeed a
|
||||
* multipart request.
|
||||
*
|
||||
*
|
||||
* Conveninence methods in VitroRequest will make these easy to handle, without
|
||||
* actually touching the attributes.
|
||||
*/
|
||||
|
@ -180,7 +180,7 @@ public class MultipartRequestWrapper extends HttpServletRequestWrapper {
|
|||
|
||||
/**
|
||||
* Parse the raw request into a list of parts.
|
||||
*
|
||||
*
|
||||
* If there is a parsing error, let the strategy handle it. If the strategy
|
||||
* throws it back, wrap it in an IOException and throw it on up.
|
||||
*/
|
||||
|
@ -289,7 +289,7 @@ public class MultipartRequestWrapper extends HttpServletRequestWrapper {
|
|||
|
||||
/**
|
||||
* Allows you to handle the exception in your code.
|
||||
*
|
||||
*
|
||||
* Be aware that the multipart parameters have been lost, and that may
|
||||
* include form fields.
|
||||
*/
|
||||
|
|
|
@ -34,66 +34,66 @@ import edu.cornell.mannlib.vitro.webapp.web.ContentType;
|
|||
@WebServlet(name = "ontology", urlPatterns = {"/ontology/*"})
|
||||
public class OntologyController extends VitroHttpServlet{
|
||||
private static final Log log = LogFactory.getLog(OntologyController.class.getName());
|
||||
|
||||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException,IOException{
|
||||
doGet(request, response);
|
||||
}
|
||||
|
||||
|
||||
public void doGet(HttpServletRequest req, HttpServletResponse res)
|
||||
throws ServletException,IOException{
|
||||
super.doGet(req, res);
|
||||
|
||||
super.doGet(req, res);
|
||||
|
||||
//get URL without hostname or servlet context
|
||||
String url = req.getRequestURI().substring(req.getContextPath().length());
|
||||
|
||||
String url = req.getRequestURI().substring(req.getContextPath().length());
|
||||
|
||||
String redirectURL = checkForRedirect ( url, req.getHeader("accept") );
|
||||
|
||||
|
||||
if( redirectURL != null ){
|
||||
doRedirect( req, res, redirectURL );
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ContentType rdfFormat = checkForLinkedDataRequest(url,req.getHeader("accept"));
|
||||
|
||||
|
||||
if( rdfFormat != null ){
|
||||
doRdf(req, res, rdfFormat );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Pattern RDF_REQUEST = Pattern.compile("^/ontology/([^/]*)/([^/]*).rdf$");
|
||||
private static Pattern N3_REQUEST = Pattern.compile("^/ontology/([^/]*)/([^/]*).n3$");
|
||||
private static Pattern TTL_REQUEST = Pattern.compile("^/ontology/([^/]*)/([^/]*).ttl$");
|
||||
private static Pattern HTML_REQUEST = Pattern.compile("^/ontology/([^/]*)$");
|
||||
|
||||
protected ContentType checkForLinkedDataRequest(String url, String acceptHeader) {
|
||||
|
||||
protected ContentType checkForLinkedDataRequest(String url, String acceptHeader) {
|
||||
try {
|
||||
//check the accept header
|
||||
//check the accept header
|
||||
if (acceptHeader != null) {
|
||||
List<ContentType> actualContentTypes = new ArrayList<ContentType>();
|
||||
List<ContentType> actualContentTypes = new ArrayList<ContentType>();
|
||||
actualContentTypes.add(new ContentType( XHTML_MIMETYPE ));
|
||||
actualContentTypes.add(new ContentType( HTML_MIMETYPE ));
|
||||
|
||||
actualContentTypes.add(new ContentType( HTML_MIMETYPE ));
|
||||
|
||||
actualContentTypes.add(new ContentType( RDFXML_MIMETYPE ));
|
||||
actualContentTypes.add(new ContentType( N3_MIMETYPE ));
|
||||
actualContentTypes.add(new ContentType( TTL_MIMETYPE ));
|
||||
|
||||
|
||||
|
||||
|
||||
ContentType best = ContentType.getBestContentType(acceptHeader,actualContentTypes);
|
||||
if (best!=null && (
|
||||
RDFXML_MIMETYPE.equals(best.getMediaType()) ||
|
||||
RDFXML_MIMETYPE.equals(best.getMediaType()) ||
|
||||
N3_MIMETYPE.equals(best.getMediaType()) ||
|
||||
TTL_MIMETYPE.equals(best.getMediaType()) ))
|
||||
return best;
|
||||
return best;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* check for parts of URL that indicate request for RDF
|
||||
http://vivo.cornell.edu/ontology/(ontologyname)/n23.rdf
|
||||
http://vivo.cornell.edu/ontology/(ontologyname)/n23.n3
|
||||
http://vivo.cornell.edu/ontology/(ontologyname)/n23.ttl
|
||||
*/
|
||||
|
||||
|
||||
Matcher m = RDF_REQUEST.matcher(url);
|
||||
if( m.matches() ){
|
||||
return new ContentType(RDFXML_MIMETYPE);}
|
||||
|
@ -103,20 +103,20 @@ public class OntologyController extends VitroHttpServlet{
|
|||
m = TTL_REQUEST.matcher(url);
|
||||
if( m.matches() ){
|
||||
return new ContentType(TTL_MIMETYPE);}
|
||||
|
||||
|
||||
} catch (Throwable th) {
|
||||
log.error("problem while checking accept header " , th);
|
||||
}
|
||||
}
|
||||
//return null;
|
||||
// Returning null would default to html in the calling method.
|
||||
// But since we don't have a useful html representation yet,
|
||||
// we're going to default to returning RDF/XML.
|
||||
return new ContentType(RDFXML_MIMETYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doRdf(HttpServletRequest req, HttpServletResponse res,
|
||||
ContentType rdfFormat) throws IOException, ServletException {
|
||||
|
||||
ContentType rdfFormat) throws IOException, ServletException {
|
||||
|
||||
VitroRequest vreq = new VitroRequest(req);
|
||||
int index = vreq.getRequestURL().lastIndexOf("/");
|
||||
String ontology = vreq.getRequestURL().substring(0, index);
|
||||
|
@ -126,12 +126,12 @@ public class OntologyController extends VitroHttpServlet{
|
|||
classOrProperty = classOrProperty.substring(0, indexx);
|
||||
}
|
||||
String url = ontology;
|
||||
|
||||
|
||||
|
||||
|
||||
OntModel ontModel = ModelAccess.on(getServletContext()).getOntModel();
|
||||
|
||||
boolean found = false;
|
||||
Model newModel = ModelFactory.createDefaultModel();
|
||||
Model newModel = ModelFactory.createDefaultModel();
|
||||
ontModel.enterCriticalSection(Lock.READ);
|
||||
try{
|
||||
OntResource ontResource = ontModel.getOntResource(url);
|
||||
|
@ -142,7 +142,7 @@ public class OntologyController extends VitroHttpServlet{
|
|||
Resource resource = (Resource)ontResource;
|
||||
QueryExecution qexec = null;
|
||||
try{
|
||||
String queryString = "Describe <" + resource.getURI() + ">";
|
||||
String queryString = "Describe <" + resource.getURI() + ">";
|
||||
qexec = QueryExecutionFactory.create(QueryFactory.create(queryString), ontModel);
|
||||
newModel = qexec.execDescribe();
|
||||
} finally{
|
||||
|
@ -161,57 +161,57 @@ public class OntologyController extends VitroHttpServlet{
|
|||
} else {
|
||||
JenaOutputUtils.setNameSpacePrefixes(newModel,vreq.getWebappDaoFactory());
|
||||
res.setContentType(rdfFormat.getMediaType());
|
||||
String format = "";
|
||||
String format = "";
|
||||
if ( RDFXML_MIMETYPE.equals(rdfFormat.getMediaType()))
|
||||
format = "RDF/XML";
|
||||
else if( N3_MIMETYPE.equals(rdfFormat.getMediaType()))
|
||||
format = "N3";
|
||||
else if ( TTL_MIMETYPE.equals(rdfFormat.getMediaType()))
|
||||
format ="TTL";
|
||||
|
||||
|
||||
newModel.write( res.getOutputStream(), format );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Pattern URI_PATTERN = Pattern.compile("^/ontology/([^/]*)/([^/]*)$");
|
||||
//Redirect if the request is for http://hostname/individual/localname
|
||||
// if accept is nothing or text/html redirect to ???
|
||||
// if accept is some RDF thing redirect to the URL for RDF
|
||||
private String checkForRedirect(String url, String acceptHeader) {
|
||||
ContentType c = checkForLinkedDataRequest(url, acceptHeader);
|
||||
ContentType c = checkForLinkedDataRequest(url, acceptHeader);
|
||||
Matcher m = URI_PATTERN.matcher(url);
|
||||
if( m.matches() && m.groupCount() <=2 ){
|
||||
String group2="";
|
||||
|
||||
|
||||
if(m.group(2).indexOf(".")!=-1){
|
||||
group2 = m.group(2).substring(0, m.group(2).indexOf("."));
|
||||
System.out.println("group2 " + group2);
|
||||
System.out.println("group1 " + m.group(1));}
|
||||
|
||||
|
||||
|
||||
|
||||
if( c != null && !group2.trim().equals(m.group(1).trim()) ){
|
||||
String redirectUrl = null;
|
||||
if(m.group(2).isEmpty() || m.group(2) == null){
|
||||
redirectUrl = "/ontology/" + m.group(1) + "/" + m.group(1); }
|
||||
else{
|
||||
redirectUrl = "/ontology/" + m.group(1) + "/" + m.group(2) + "/" + m.group(2) ; }
|
||||
|
||||
|
||||
|
||||
|
||||
if( RDFXML_MIMETYPE.equals( c.getMediaType()) ){
|
||||
return redirectUrl + ".rdf";
|
||||
}else if( N3_MIMETYPE.equals( c.getMediaType() )){
|
||||
return redirectUrl + ".n3";
|
||||
}else if( TTL_MIMETYPE.equals( c.getMediaType() )){
|
||||
return redirectUrl + ".ttl";
|
||||
}//else send them to html
|
||||
}//else send them to html
|
||||
}
|
||||
//else redirect to HTML representation
|
||||
return null;
|
||||
}else{
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void doRedirect(HttpServletRequest req, HttpServletResponse res,
|
||||
String redirectURL) throws IOException {
|
||||
//It seems like there must be a more standard way to do a redirect in tomcat.
|
||||
|
@ -227,12 +227,12 @@ public class OntologyController extends VitroHttpServlet{
|
|||
}
|
||||
res.setStatus(res.SC_SEE_OTHER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void doNotFound(HttpServletRequest req, HttpServletResponse res)
|
||||
throws IOException, ServletException {
|
||||
VitroRequest vreq = new VitroRequest(req);
|
||||
|
||||
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
|
||||
//set title before we do the highlighting so we don't get markup in it.
|
||||
|
@ -246,8 +246,8 @@ public class OntologyController extends VitroHttpServlet{
|
|||
|
||||
JSPPageHandler.renderBasicPage(req, res, "/"+Controllers.ENTITY_NOT_FOUND_JSP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class SparqlQueryBuilderServlet extends BaseEditController {
|
|||
private static final Log log = LogFactory.getLog(SparqlQueryBuilderServlet.class.getName());
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
|
||||
protected static HashMap<String,ResultsFormat>formatSymbols = new HashMap<String,ResultsFormat>();
|
||||
static{
|
||||
formatSymbols.put( ResultsFormat.FMT_RS_XML.getSymbol(), ResultsFormat.FMT_RS_XML);
|
||||
|
@ -42,7 +42,7 @@ public class SparqlQueryBuilderServlet extends BaseEditController {
|
|||
formatSymbols.put( ResultsFormat.FMT_RS_JSON.getSymbol() , ResultsFormat.FMT_RS_JSON);
|
||||
formatSymbols.put( "vitro:csv", null);
|
||||
}
|
||||
|
||||
|
||||
protected static HashMap<String,String> rdfFormatSymbols = new HashMap<String,String>();
|
||||
static {
|
||||
rdfFormatSymbols.put( "RDF/XML", "application/rdf+xml" );
|
||||
|
@ -68,18 +68,18 @@ public class SparqlQueryBuilderServlet extends BaseEditController {
|
|||
{
|
||||
this.doGet(request,response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
{
|
||||
if (!isAuthorizedToDisplayPage(request, response,
|
||||
SimplePermission.USE_ADVANCED_DATA_TOOLS_PAGES.ACTION)) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
|
||||
|
||||
Model model = vreq.getJenaOntModel(); // getModel()
|
||||
if( model == null ){
|
||||
doNoModelInContext(request,response);
|
||||
|
@ -88,7 +88,7 @@ public class SparqlQueryBuilderServlet extends BaseEditController {
|
|||
|
||||
doHelp(request,response);
|
||||
}
|
||||
|
||||
|
||||
private void doNoModelInContext(HttpServletRequest request, HttpServletResponse res){
|
||||
try {
|
||||
res.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
|
||||
|
|
|
@ -67,7 +67,7 @@ public class VitroHttpServlet extends HttpServlet implements MultipartRequestWra
|
|||
if (log.isTraceEnabled()) {
|
||||
dumpRequestHeaders(hreq);
|
||||
}
|
||||
|
||||
|
||||
super.service(hreq, resp);
|
||||
} else {
|
||||
super.service(req, resp);
|
||||
|
@ -82,7 +82,7 @@ public class VitroHttpServlet extends HttpServlet implements MultipartRequestWra
|
|||
public long maximumMultipartFileSize() {
|
||||
return 50 * 1024 * 1024; // default is 50 megabytes
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override this to change the way that exceptions are handled when parsing
|
||||
* a multipart request. Be aware that multipart parameters have been lost,
|
||||
|
@ -113,7 +113,7 @@ public class VitroHttpServlet extends HttpServlet implements MultipartRequestWra
|
|||
|
||||
/**
|
||||
* Don't display a page that the user isn't authorized to see.
|
||||
*
|
||||
*
|
||||
* @param actions
|
||||
* the combination of RequestedActions that must be authorized.
|
||||
*/
|
||||
|
@ -148,7 +148,7 @@ public class VitroHttpServlet extends HttpServlet implements MultipartRequestWra
|
|||
redirectToLoginPage(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logged in, but with insufficient authorization. Send them to the home page
|
||||
* with a message. They won't be coming back.
|
||||
|
@ -202,24 +202,24 @@ public class VitroHttpServlet extends HttpServlet implements MultipartRequestWra
|
|||
return request.getContextPath() + Controllers.AUTHENTICATE
|
||||
+ "?afterLogin=" + encodedAfterLoginUrl;
|
||||
}
|
||||
|
||||
protected void sortForPickList(List<? extends ResourceBean> beans,
|
||||
|
||||
protected void sortForPickList(List<? extends ResourceBean> beans,
|
||||
VitroRequest vreq) {
|
||||
beans.sort(new PickListSorter(vreq));
|
||||
}
|
||||
|
||||
|
||||
protected class PickListSorter implements Comparator<ResourceBean> {
|
||||
|
||||
|
||||
Collator collator;
|
||||
|
||||
|
||||
public PickListSorter(VitroRequest vreq) {
|
||||
this.collator = vreq.getCollator();
|
||||
}
|
||||
|
||||
|
||||
public int compare(ResourceBean b1, ResourceBean b2) {
|
||||
return collator.compare(b1.getPickListName(), b2.getPickListName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,10 +252,10 @@ public class VitroHttpServlet extends HttpServlet implements MultipartRequestWra
|
|||
*/
|
||||
protected void dumpRequestParameters(HttpServletRequest req) {
|
||||
Log subclassLog = LogFactory.getLog(this.getClass());
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String[]> map = req.getParameterMap();
|
||||
|
||||
|
||||
for (String key : map.keySet()) {
|
||||
String[] values = map.get(key);
|
||||
subclassLog.debug("Parameter '" + key + "' = "
|
||||
|
|
|
@ -37,17 +37,17 @@ import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames;
|
|||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
|
||||
public class VitroRequest extends HttpServletRequestWrapper {
|
||||
|
||||
|
||||
final static Log log = LogFactory.getLog(VitroRequest.class);
|
||||
|
||||
|
||||
//Attribute in case of special model editing such as display model editing
|
||||
public static final String SPECIAL_WRITE_MODEL = "specialWriteModel";
|
||||
public static final String SPECIAL_WRITE_MODEL = "specialWriteModel";
|
||||
|
||||
public static final String ID_FOR_WRITE_MODEL = "idForWriteModel";
|
||||
public static final String ID_FOR_TBOX_MODEL = "idForTboxModel";
|
||||
public static final String ID_FOR_ABOX_MODEL = "idForAboxModel";
|
||||
public static final String ID_FOR_DISPLAY_MODEL = "idForDisplayModel";
|
||||
|
||||
|
||||
private HttpServletRequest _req;
|
||||
|
||||
public VitroRequest(HttpServletRequest _req) {
|
||||
|
@ -58,96 +58,96 @@ public class VitroRequest extends HttpServletRequestWrapper {
|
|||
public RDFService getRDFService() {
|
||||
return ModelAccess.on(this).getRDFService();
|
||||
}
|
||||
|
||||
|
||||
public RDFService getUnfilteredRDFService() {
|
||||
return ModelAccess.on(this).getRDFService(CONTENT, LANGUAGE_NEUTRAL);
|
||||
}
|
||||
|
||||
|
||||
/** Gets WebappDaoFactory with appropriate filtering for the request */
|
||||
public WebappDaoFactory getWebappDaoFactory(){
|
||||
return ModelAccess.on(this).getWebappDaoFactory();
|
||||
}
|
||||
|
||||
|
||||
/** gets assertions+inference WebappDaoFactory with no policy filtering */
|
||||
public WebappDaoFactory getUnfilteredWebappDaoFactory() {
|
||||
return ModelAccess.on(this).getWebappDaoFactory(POLICY_NEUTRAL);
|
||||
}
|
||||
|
||||
|
||||
/** gets assertions-only WebappDaoFactory with no policy filtering */
|
||||
public WebappDaoFactory getUnfilteredAssertionsWebappDaoFactory() {
|
||||
return ModelAccess.on(this).getWebappDaoFactory(POLICY_NEUTRAL, ASSERTIONS_ONLY);
|
||||
}
|
||||
|
||||
|
||||
public Dataset getDataset() {
|
||||
return ModelAccess.on(this).getDataset(CONTENT);
|
||||
}
|
||||
|
||||
|
||||
public Dataset getUnfilteredDataset() {
|
||||
return ModelAccess.on(this).getDataset(CONTENT, LANGUAGE_NEUTRAL);
|
||||
}
|
||||
|
||||
|
||||
//Method that retrieves write model, returns special model in case of write model
|
||||
public OntModel getWriteModel() {
|
||||
//if special write model doesn't exist use get ont model
|
||||
//if special write model doesn't exist use get ont model
|
||||
if(this.getAttribute(SPECIAL_WRITE_MODEL) != null) {
|
||||
return (OntModel)this.getAttribute(SPECIAL_WRITE_MODEL);
|
||||
} else {
|
||||
return getJenaOntModel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public OntModelSelector getOntModelSelector() {
|
||||
return ModelAccess.on(this).getOntModelSelector();
|
||||
}
|
||||
|
||||
|
||||
public OntModel getJenaOntModel() {
|
||||
return ModelAccess.on(this).getOntModel(ModelNames.FULL_UNION);
|
||||
}
|
||||
|
||||
|
||||
public OntModel getDisplayModel(){
|
||||
return ModelAccess.on(this).getOntModel(DISPLAY);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets an identifier for the display model associated
|
||||
* Gets an identifier for the display model associated
|
||||
* with this request. It may have been switched from
|
||||
* the normal display model to a different one.
|
||||
* This could be a URI or a {@link ModelName}
|
||||
*/
|
||||
public String getIdForDisplayModel(){
|
||||
return (String)getAttribute(ID_FOR_DISPLAY_MODEL);
|
||||
return (String)getAttribute(ID_FOR_DISPLAY_MODEL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets an identifier for the a-box model associated
|
||||
* Gets an identifier for the a-box model associated
|
||||
* with this request. It may have been switched from
|
||||
* the standard one to a different one.
|
||||
* This could be a URI or a {@link ModelName}
|
||||
*/
|
||||
*/
|
||||
public String getNameForABOXModel(){
|
||||
return (String)getAttribute(ID_FOR_ABOX_MODEL);
|
||||
return (String)getAttribute(ID_FOR_ABOX_MODEL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets an identifier for the t-box model associated
|
||||
* Gets an identifier for the t-box model associated
|
||||
* with this request. It may have been switched from
|
||||
* the standard one to a different one.
|
||||
* This could be a URI or a {@link ModelName}
|
||||
*/
|
||||
*/
|
||||
public String getNameForTBOXModel(){
|
||||
return (String)getAttribute(ID_FOR_TBOX_MODEL);
|
||||
return (String)getAttribute(ID_FOR_TBOX_MODEL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets an identifier for the write model associated
|
||||
* Gets an identifier for the write model associated
|
||||
* with this request. It may have been switched from
|
||||
* the standard one to a different one.
|
||||
* This could be a URI or a {@link ModelName}
|
||||
*/
|
||||
*/
|
||||
public String getNameForWriteModel(){
|
||||
return (String)getAttribute(ID_FOR_WRITE_MODEL);
|
||||
return (String)getAttribute(ID_FOR_WRITE_MODEL);
|
||||
}
|
||||
|
||||
|
||||
public ApplicationBean getAppBean(){
|
||||
return getWebappDaoFactory().getApplicationDao().getApplicationBean();
|
||||
}
|
||||
|
@ -156,53 +156,53 @@ public class VitroRequest extends HttpServletRequestWrapper {
|
|||
* Gets the the ip of the client.
|
||||
* This will be X-forwarded-for header or, if that header is not
|
||||
* set, getRemoteAddr(). This still may not be the client's address
|
||||
* as they may be using a proxy.
|
||||
*
|
||||
* as they may be using a proxy.
|
||||
*
|
||||
*/
|
||||
public String getClientAddr(){
|
||||
String xff = getHeader("x-forwarded-for");
|
||||
return ( xff == null || xff.trim().isEmpty() ) ? getRemoteAddr() : xff;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Map<String, String[]> getParameterMap() {
|
||||
return _req.getParameterMap();
|
||||
public Map<String, String[]> getParameterMap() {
|
||||
return _req.getParameterMap();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getParameter(String name) {
|
||||
return _req.getParameter(name);
|
||||
public String getParameter(String name) {
|
||||
return _req.getParameter(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getParameterValues(String name) {
|
||||
return _req.getParameterValues(name);
|
||||
return _req.getParameterValues(name);
|
||||
}
|
||||
|
||||
public OntModel getLanguageNeutralUnionFullModel() {
|
||||
return ModelAccess.on(this).getOntModel(ModelNames.FULL_UNION, LANGUAGE_NEUTRAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setCollator(Collator collator) {
|
||||
setAttribute("collator", collator);
|
||||
}
|
||||
|
||||
|
||||
public Collator getCollator() {
|
||||
return (Collator) getAttribute("collator");
|
||||
}
|
||||
|
||||
|
||||
public WebappDaoFactory getLanguageNeutralWebappDaoFactory() {
|
||||
// It is also policy neutral, because that's how it was originally
|
||||
// implemented, and at least some of the client code expects it that
|
||||
// way.
|
||||
return ModelAccess.on(this).getWebappDaoFactory(LANGUAGE_NEUTRAL, POLICY_NEUTRAL);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Deal with parsed multipart requests.
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
||||
public boolean isMultipart() {
|
||||
return getAttribute(ATTRIBUTE_IS_MULTIPART) != null;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ public class VitroRequest extends HttpServletRequestWrapper {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If the uploaded file exceeded the maximum size, and if the strategy said
|
||||
* to stash the exception, it will be stored as a request attribute.
|
||||
|
@ -243,7 +243,7 @@ public class VitroRequest extends HttpServletRequestWrapper {
|
|||
public boolean hasFileSizeException() {
|
||||
return getFileSizeException() != null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Could be either FileSizeLimitExceededException or
|
||||
* SizeLimitExceededException, so return their common ancestor.
|
||||
|
|
|
@ -71,7 +71,7 @@ public abstract class UserAccountsPage extends AbstractPageHandler {
|
|||
|
||||
/**
|
||||
* Create a list of possible profile types.
|
||||
*
|
||||
*
|
||||
* TODO Right now, these are foaf:Person and it's sub-classes. What will it
|
||||
* be for Vitro?
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.accounts;
|
|||
|
||||
/**
|
||||
* On what basis are we selecting user accounts?
|
||||
*
|
||||
*
|
||||
* Search terms are matched against email, and against firstName combined with
|
||||
* lastName. Searches are case-insensitive.
|
||||
*/
|
||||
|
|
|
@ -206,16 +206,16 @@ public class UserAccountsAddPage extends UserAccountsPage {
|
|||
body.put(PARAMETER_LAST_NAME, "");
|
||||
body.put("selectedRoles", getDefaultRolesForNewUsers());
|
||||
}
|
||||
|
||||
|
||||
body.put("roles", buildListOfSelectableRoles());
|
||||
body.put("profileTypes", buildProfileTypesList());
|
||||
body.put(PARAMETER_NEW_PROFILE_CLASS_URI, newProfileClassUri);
|
||||
body.put("formUrls", buildUrlsMap());
|
||||
|
||||
|
||||
if (externalAuthOnly) {
|
||||
body.put(PARAMETER_EXTERNAL_AUTH_ONLY, Boolean.TRUE);
|
||||
}
|
||||
|
||||
|
||||
if (!associatedProfileUri.isEmpty()) {
|
||||
body.put("associatedProfileInfo",
|
||||
buildProfileInfo(associatedProfileUri));
|
||||
|
|
|
@ -37,7 +37,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
|
|||
|
||||
/**
|
||||
* Handle the List page.
|
||||
*
|
||||
*
|
||||
* TODO: auto-complete
|
||||
*/
|
||||
public class UserAccountsListPage extends UserAccountsPage {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class UserAccountsProfileCreator {
|
|||
|
||||
String label = account.getLastName() + ", " + account.getFirstName();
|
||||
addProp(dpsDao, indUri, VitroVocabulary.LABEL, label);
|
||||
|
||||
|
||||
return indUri;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,14 +22,14 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
|||
|
||||
/**
|
||||
* What is our reaction to this possible External Auth ID?
|
||||
*
|
||||
*
|
||||
* Is somebody already using it (other than ourselves)? Does it match an
|
||||
* existing Profile? Neither?
|
||||
*
|
||||
*
|
||||
* If we are creating a new account, the userAccountUri will be empty, so if
|
||||
* someone is using the externalAuthID, their URI won't match ours, which is
|
||||
* what we want.
|
||||
*
|
||||
*
|
||||
* If the externalAuthId is empty, or if there is any error, say "neither".
|
||||
*/
|
||||
class ExternalAuthChecker extends AbstractAjaxResponder {
|
||||
|
@ -123,4 +123,4 @@ class ExternalAuthChecker extends AbstractAjaxResponder {
|
|||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,9 +51,9 @@ import edu.cornell.mannlib.vitro.webapp.utils.searchengine.SearchResponseFilter;
|
|||
* that have no matching property, unless it matches the current externalAuthId.
|
||||
* (So a Profile that is currently associated with the user is not excluded from
|
||||
* the list.)
|
||||
*
|
||||
*
|
||||
* For each such Profile, return the label, the URL and the URI.
|
||||
*
|
||||
*
|
||||
* If the matching property is not defined, or if the search term is empty, or
|
||||
* if an error occurs, return an empty result.
|
||||
*/
|
||||
|
@ -168,7 +168,7 @@ class ProfileAutoCompleter extends AbstractAjaxResponder implements
|
|||
/**
|
||||
* To test whether a search result is acceptable, find the matching property
|
||||
* for the individual.
|
||||
*
|
||||
*
|
||||
* We will accept any individual without a matching property, or with a
|
||||
* matching property that matches the user we are editing.
|
||||
*/
|
||||
|
@ -223,4 +223,4 @@ class ProfileAutoCompleter extends AbstractAjaxResponder implements
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ManageProxiesController extends FreemarkerHttpServlet {
|
|||
String action = vreq.getPathInfo();
|
||||
log.debug("action = '" + action + "'");
|
||||
|
||||
|
||||
|
||||
if (ACTION_CREATE.equals(action)) {
|
||||
return handleCreateRequest(vreq);
|
||||
} else if (ACTION_EDIT.equals(action)) {
|
||||
|
@ -67,17 +67,17 @@ public class ManageProxiesController extends FreemarkerHttpServlet {
|
|||
|
||||
private ResponseValues handleEditRequest(VitroRequest vreq) {
|
||||
ManageProxiesEditPage page = new ManageProxiesEditPage(vreq);
|
||||
|
||||
|
||||
if (page.isValid()) {
|
||||
page.applyEdits();
|
||||
Message.setMessage(vreq, new SuccessMessage());
|
||||
} else {
|
||||
Message.setMessage(vreq, new FailureMessage());
|
||||
}
|
||||
|
||||
|
||||
return redirectToList();
|
||||
}
|
||||
|
||||
|
||||
private ResponseValues handleListRequest(VitroRequest vreq) {
|
||||
ManageProxiesListPage page = new ManageProxiesListPage(vreq);
|
||||
return page.showPage();
|
||||
|
@ -103,6 +103,6 @@ public class ManageProxiesController extends FreemarkerHttpServlet {
|
|||
public Map<String, Object> getMessageInfoMap() {
|
||||
return assembleMap("failure", Boolean.TRUE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,17 +20,17 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
|||
/**
|
||||
* Create a new relationship, or set of relationships, between zero or more
|
||||
* proxies and zero or more profiles.
|
||||
*
|
||||
*
|
||||
* Note that this is additive, so if a proxy already has some profiles, they
|
||||
* will be preserved, even if they are not listed here.
|
||||
*
|
||||
*
|
||||
* It is possible that one or more profiles might be the "self" pages of one or
|
||||
* more proxies, so as we do each proxy, we exclude any profile which is the
|
||||
* "self" for that proxy.
|
||||
*
|
||||
*
|
||||
* If there are zero proxies here, or zero profiles, it doesn't hurt anything,
|
||||
* it just doesn't accomplish anything either.
|
||||
*
|
||||
*
|
||||
* This is not really a page, in that it doesn't display anything. It's just a
|
||||
* way to separate out some of the logic of the ManageProxies list page.
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* An immutable relationship between Proxies and Profiles.
|
||||
*
|
||||
*
|
||||
* In most cases, this will either be between one Proxy and many Profiles (view
|
||||
* by Proxy), or between on Profile and many Proxies (view by Profile). However,
|
||||
* we can imagine it being a many-to-many relationship.
|
||||
|
|
|
@ -9,9 +9,9 @@ import java.util.List;
|
|||
* A mutable version of ProxyRelationshipSelection, that can be assembled
|
||||
* piecemeal as the info becomes available and then translated to an immutable
|
||||
* ProxyRelationshipSelection.
|
||||
*
|
||||
*
|
||||
* Uses mutable subclasses Relationship and ItemInfo.
|
||||
*
|
||||
*
|
||||
* ItemInfo contains a field for externalAuthId only because it is useful when
|
||||
* gathering the classLabel and imageUrl.
|
||||
*/
|
||||
|
|
|
@ -5,10 +5,10 @@ package edu.cornell.mannlib.vitro.webapp.controller.accounts.manageproxies;
|
|||
|
||||
/**
|
||||
* On what basis are we selecting proxy relationships?
|
||||
*
|
||||
*
|
||||
* Are we viewing by Proxy or by Profile? What is the search term, if any? How
|
||||
* many results per page, and what page are we on?
|
||||
*
|
||||
*
|
||||
* Search terms are matched against last name combined with first name, of
|
||||
* either UserAccount(Proxy) or Individual(Profile), depending on how we are
|
||||
* listing. Searches are case-insensitive.
|
||||
|
|
|
@ -35,7 +35,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.searchengine.SearchQueryUtils;
|
|||
|
||||
/**
|
||||
* Get the basic auto-complete info for the profile selection.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class BasicProfilesGetter extends AbstractAjaxResponder {
|
||||
private static final Log log = LogFactory.getLog(BasicProfilesGetter.class);
|
||||
|
|
|
@ -26,7 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
|
|||
|
||||
/**
|
||||
* Get more information (class label and image URL) about a selected proxy.
|
||||
*
|
||||
*
|
||||
* If there is no image URL, just omit it from the result. The proxy already has
|
||||
* a placeholder image.
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
|
|||
/**
|
||||
* Handle the first-time login of an Externally Authenticated user who has no
|
||||
* UserAccount - let's create one!
|
||||
*
|
||||
*
|
||||
* If they get here from the login, there should be an ExternalLoginInfo waiting
|
||||
* in the session. Otherwise, they should get here by submitting the form, which
|
||||
* will have the info in hidden fields.
|
||||
|
|
|
@ -16,7 +16,7 @@ import edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailMessage;
|
|||
/**
|
||||
* Handle the variations in the UserAccountsFirstTimeExternal page. If email is
|
||||
* available, inform the template, and send a notification to the user.
|
||||
*
|
||||
*
|
||||
* If not, then don't.
|
||||
*/
|
||||
public abstract class UserAccountsFirstTimeExternalPageStrategy extends
|
||||
|
|
|
@ -148,7 +148,7 @@ public class UserAccountsUserController extends FreemarkerHttpServlet {
|
|||
* TODO The LoginRedirector gives a URI that includes the context path. But
|
||||
* the RedirectResponseValues wants a URI that does not include the context
|
||||
* path.
|
||||
*
|
||||
*
|
||||
* Bridge the gap.
|
||||
*/
|
||||
private String stripContextPath(VitroRequest vreq, String uri) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue