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