Merge branch 'develop' of git://github.com/vivo-project/Vitro into develop
This commit is contained in:
commit
db740807d5
511 changed files with 3886 additions and 9996 deletions
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
||||||
Copyright (c) ${year}, Cornell University
|
Copyright (c) 2017, Cornell University
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|
4
api/findbugs.sh
Executable file
4
api/findbugs.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
mvn -Dfindbugs.maxHeap=4096 -Dfindbugs.timeout=6000000 compile findbugs:findbugs findbugs:gui
|
||||||
|
|
29
api/pom.xml
29
api/pom.xml
|
@ -7,13 +7,13 @@
|
||||||
|
|
||||||
<groupId>org.vivoweb</groupId>
|
<groupId>org.vivoweb</groupId>
|
||||||
<artifactId>vitro-api</artifactId>
|
<artifactId>vitro-api</artifactId>
|
||||||
<version>1.10.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.vivoweb</groupId>
|
<groupId>org.vivoweb</groupId>
|
||||||
<artifactId>vitro-project</artifactId>
|
<artifactId>vitro-project</artifactId>
|
||||||
<version>1.10.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>..</relativePath>
|
<relativePath>..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -32,6 +32,23 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>findbugs-maven-plugin</artifactId>
|
||||||
|
<version>3.0.5</version>
|
||||||
|
<configuration>
|
||||||
|
<effort>Max</effort>
|
||||||
|
<threshold>Low</threshold>
|
||||||
|
<failOnError>true</failOnError>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.h3xstream.findsecbugs</groupId>
|
||||||
|
<artifactId>findsecbugs-plugin</artifactId>
|
||||||
|
<version>LATEST</version> <!-- Auto-update to the latest stable -->
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
@ -39,13 +56,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.vivoweb</groupId>
|
<groupId>org.vivoweb</groupId>
|
||||||
<artifactId>vitro-dependencies</artifactId>
|
<artifactId>vitro-dependencies</artifactId>
|
||||||
<version>1.10.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
<version>2.5</version>
|
<version>3.1.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -64,7 +81,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.easymock</groupId>
|
<groupId>org.easymock</groupId>
|
||||||
<artifactId>easymock</artifactId>
|
<artifactId>easymock</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.5</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -134,10 +134,7 @@ public class XMLUtils {
|
||||||
Transformer transformer = null;
|
Transformer transformer = null;
|
||||||
try {
|
try {
|
||||||
transformer = TransformerFactory.newInstance().newTransformer();
|
transformer = TransformerFactory.newInstance().newTransformer();
|
||||||
} catch (TransformerConfigurationException e) {
|
} catch (TransformerConfigurationException | TransformerFactoryConfigurationError e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (TransformerFactoryConfigurationError e) {
|
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -164,10 +161,7 @@ public class XMLUtils {
|
||||||
Transformer transformer = null;
|
Transformer transformer = null;
|
||||||
try {
|
try {
|
||||||
transformer = TransformerFactory.newInstance().newTransformer();
|
transformer = TransformerFactory.newInstance().newTransformer();
|
||||||
} catch (TransformerConfigurationException e) {
|
} catch (TransformerConfigurationException | TransformerFactoryConfigurationError e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (TransformerFactoryConfigurationError e) {
|
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package edu.cornell.mannlib.vedit.beans;
|
package edu.cornell.mannlib.vedit.beans;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class DynamicField {
|
public class DynamicField {
|
||||||
|
|
|
@ -32,7 +32,6 @@ import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
||||||
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.ReasoningOption;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
|
||||||
public class BaseEditController extends VitroHttpServlet {
|
public class BaseEditController extends VitroHttpServlet {
|
||||||
|
@ -137,10 +136,8 @@ public class BaseEditController extends VitroHttpServlet {
|
||||||
String value = "";
|
String value = "";
|
||||||
if (key.equals(MULTIPLEXED_PARAMETER_NAME)) {
|
if (key.equals(MULTIPLEXED_PARAMETER_NAME)) {
|
||||||
String multiplexedStr = request.getParameterValues(key)[0];
|
String multiplexedStr = request.getParameterValues(key)[0];
|
||||||
Map paramMap = FormUtils.beanParamMapFromString(multiplexedStr);
|
Map<String, String> paramMap = FormUtils.beanParamMapFromString(multiplexedStr);
|
||||||
Iterator paramIt = paramMap.keySet().iterator();
|
for (String param : paramMap.keySet()) {
|
||||||
while (paramIt.hasNext()) {
|
|
||||||
String param = (String) paramIt.next();
|
|
||||||
String demultiplexedValue = (String) paramMap.get(param);
|
String demultiplexedValue = (String) paramMap.get(param);
|
||||||
FormUtils.beanSet(bean, param, demultiplexedValue);
|
FormUtils.beanSet(bean, param, demultiplexedValue);
|
||||||
}
|
}
|
||||||
|
@ -179,19 +176,16 @@ public class BaseEditController extends VitroHttpServlet {
|
||||||
|
|
||||||
List<String> bodyVal = new ArrayList<String>();
|
List<String> bodyVal = new ArrayList<String>();
|
||||||
List<Option> options = new ArrayList<Option>();
|
List<Option> options = new ArrayList<Option>();
|
||||||
Iterator<Option> itr = optionList.iterator();
|
for (Option option : optionList) {
|
||||||
while(itr.hasNext()){
|
hashMap.put(option.getBody(), option);
|
||||||
Option option = itr.next();
|
bodyVal.add(option.getBody());
|
||||||
hashMap.put(option.getBody(),option);
|
|
||||||
bodyVal.add(option.getBody());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Collections.sort(bodyVal, new ListComparator(vreq.getCollator()));
|
bodyVal.sort(new ListComparator(vreq.getCollator()));
|
||||||
ListIterator<String> itrStr = bodyVal.listIterator();
|
for (String aBodyVal : bodyVal) {
|
||||||
while(itrStr.hasNext()){
|
options.add(hashMap.get(aBodyVal));
|
||||||
options.add(hashMap.get(itrStr.next()));
|
}
|
||||||
}
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
package edu.cornell.mannlib.vedit.controller;
|
package edu.cornell.mannlib.vedit.controller;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -21,6 +23,7 @@ import java.io.IOException;
|
||||||
* @author bjl23
|
* @author bjl23
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "EditFrontController", urlPatterns = {"/editForm"} )
|
||||||
public class EditFrontController extends VitroHttpServlet {
|
public class EditFrontController extends VitroHttpServlet {
|
||||||
private static final Log log = LogFactory.getLog(EditFrontController.class.getName());
|
private static final Log log = LogFactory.getLog(EditFrontController.class.getName());
|
||||||
private static final String CONTROLLER_PKG = "edu.cornell.mannlib.vitro.webapp.controller.edit";
|
private static final String CONTROLLER_PKG = "edu.cornell.mannlib.vitro.webapp.controller.edit";
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ import edu.cornell.mannlib.vedit.util.OperationUtils;
|
||||||
import edu.cornell.mannlib.vedit.validator.ValidationObject;
|
import edu.cornell.mannlib.vedit.validator.ValidationObject;
|
||||||
import edu.cornell.mannlib.vedit.validator.Validator;
|
import edu.cornell.mannlib.vedit.validator.Validator;
|
||||||
|
|
||||||
|
@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());
|
||||||
|
@ -127,27 +129,31 @@ public class OperationController extends BaseEditController {
|
||||||
notifyChangeListeners(epo, action);
|
notifyChangeListeners(epo, action);
|
||||||
|
|
||||||
/* send the user somewhere */
|
/* send the user somewhere */
|
||||||
if (action.equals("insert")){
|
switch (action) {
|
||||||
// Object[] args = new Object[1];
|
case "insert":
|
||||||
// args[0] = result;
|
// Object[] args = new Object[1];
|
||||||
// epo.setNewBean(epo.getGetMethod().invoke(facade,args));
|
// args[0] = result;
|
||||||
PageForwarder pipf = epo.getPostInsertPageForwarder();
|
// epo.setNewBean(epo.getGetMethod().invoke(facade,args));
|
||||||
if (pipf != null){
|
PageForwarder pipf = epo.getPostInsertPageForwarder();
|
||||||
pipf.doForward(request,response,epo);
|
if (pipf != null) {
|
||||||
return;
|
pipf.doForward(request, response, epo);
|
||||||
}
|
return;
|
||||||
} else if (action.equals("update")){
|
}
|
||||||
PageForwarder pupf = epo.getPostUpdatePageForwarder();
|
break;
|
||||||
if (pupf != null) {
|
case "update":
|
||||||
pupf.doForward(request,response,epo);
|
PageForwarder pupf = epo.getPostUpdatePageForwarder();
|
||||||
return;
|
if (pupf != null) {
|
||||||
}
|
pupf.doForward(request, response, epo);
|
||||||
} else if (action.equals("delete")){
|
return;
|
||||||
PageForwarder pdpf = epo.getPostDeletePageForwarder();
|
}
|
||||||
if (pdpf != null) {
|
break;
|
||||||
pdpf.doForward(request,response,epo);
|
case "delete":
|
||||||
return;
|
PageForwarder pdpf = epo.getPostDeletePageForwarder();
|
||||||
}
|
if (pdpf != null) {
|
||||||
|
pdpf.doForward(request, response, epo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if no page forwarder was set, just go back to referring page:
|
//if no page forwarder was set, just go back to referring page:
|
||||||
|
@ -168,7 +174,6 @@ public class OperationController extends BaseEditController {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
retry(request, response, epo);
|
retry(request, response, epo);
|
||||||
return;
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.error(this.getClass().getName() + " IOError on redirect: ", ioe);
|
log.error(this.getClass().getName() + " IOError on redirect: ", ioe);
|
||||||
}
|
}
|
||||||
|
@ -196,17 +201,12 @@ public class OperationController extends BaseEditController {
|
||||||
} else {
|
} else {
|
||||||
response.sendRedirect(getDefaultLandingPage(request));
|
response.sendRedirect(getDefaultLandingPage(request));
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
Iterator preIt = epo.getPreProcessorList().iterator();
|
for (EditPreProcessor epp : epo.getPreProcessorList()) {
|
||||||
while (preIt.hasNext()) {
|
epp.process(newObj, epo);
|
||||||
try {
|
|
||||||
EditPreProcessor epp = (EditPreProcessor) preIt.next();
|
|
||||||
epp.process(newObj, epo);
|
|
||||||
} catch (ClassCastException e) {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,14 +254,14 @@ public class OperationController extends BaseEditController {
|
||||||
List validatorList = (List) epo.getValidatorMap().get(currParam);
|
List validatorList = (List) epo.getValidatorMap().get(currParam);
|
||||||
if (validatorList != null) {
|
if (validatorList != null) {
|
||||||
Iterator valIt = validatorList.iterator();
|
Iterator valIt = validatorList.iterator();
|
||||||
String errMsg = "";
|
StringBuilder errMsg = new StringBuilder();
|
||||||
while (valIt.hasNext()){
|
while (valIt.hasNext()){
|
||||||
Validator val = (Validator)valIt.next();
|
Validator val = (Validator)valIt.next();
|
||||||
ValidationObject vo = val.validate(currValue);
|
ValidationObject vo = val.validate(currValue);
|
||||||
if (!vo.getValid()){
|
if (!vo.getValid()){
|
||||||
valid = false;
|
valid = false;
|
||||||
fieldValid = false;
|
fieldValid = false;
|
||||||
errMsg += vo.getMessage() + " ";
|
errMsg.append(vo.getMessage()).append(" ");
|
||||||
epo.getBadValueMap().put(currParam,currValue);
|
epo.getBadValueMap().put(currParam,currValue);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -271,7 +271,7 @@ public class OperationController extends BaseEditController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errMsg.length()>0) {
|
if (errMsg.length()>0) {
|
||||||
epo.getErrMsgMap().put(currParam,errMsg);
|
epo.getErrMsgMap().put(currParam, errMsg.toString());
|
||||||
log.info("doPost() putting error message "+errMsg+" for "+currParam);
|
log.info("doPost() putting error message "+errMsg+" for "+currParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,15 +325,18 @@ public class OperationController extends BaseEditController {
|
||||||
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){
|
||||||
Iterator<ChangeListener> changeIt = changeListeners.iterator();
|
for (ChangeListener cl : changeListeners) {
|
||||||
while (changeIt.hasNext()) {
|
switch (action) {
|
||||||
ChangeListener cl = changeIt.next();
|
case "insert":
|
||||||
if (action.equals("insert"))
|
cl.doInserted(epo.getNewBean(), epo);
|
||||||
cl.doInserted(epo.getNewBean(),epo);
|
break;
|
||||||
else if (action.equals("update"))
|
case "update":
|
||||||
cl.doUpdated(epo.getOriginalBean(),epo.getNewBean(),epo);
|
cl.doUpdated(epo.getOriginalBean(), epo.getNewBean(), epo);
|
||||||
else if (action.equals("delete"))
|
break;
|
||||||
cl.doDeleted(epo.getOriginalBean(),epo);
|
case "delete":
|
||||||
|
cl.doDeleted(epo.getOriginalBean(), epo);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,8 +500,6 @@ public class OperationController extends BaseEditController {
|
||||||
} catch (InvocationTargetException f) {
|
} catch (InvocationTargetException f) {
|
||||||
log.error(f.getTargetException().getMessage());
|
log.error(f.getTargetException().getMessage());
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
//log.error("doPost() could not find setId() method for "+partialClassName);
|
|
||||||
} catch (Exception f) {
|
} catch (Exception f) {
|
||||||
//log.error("doPost() could not set id of new bean.");
|
//log.error("doPost() could not set id of new bean.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,8 @@ package edu.cornell.mannlib.vedit.forwarder.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
|
import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
|
||||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.BufferedOutputStream;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
|
@ -16,18 +15,14 @@ import java.io.InputStreamReader;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
|
|
||||||
import javax.servlet.jsp.JspException;
|
import javax.servlet.jsp.JspException;
|
||||||
import javax.servlet.jsp.tagext.TagSupport;
|
|
||||||
import javax.servlet.jsp.JspWriter;
|
import javax.servlet.jsp.JspWriter;
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||||
import edu.cornell.mannlib.vedit.beans.DynamicField;
|
import edu.cornell.mannlib.vedit.beans.DynamicField;
|
||||||
import edu.cornell.mannlib.vedit.beans.DynamicFieldRow;
|
import edu.cornell.mannlib.vedit.beans.DynamicFieldRow;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
|
||||||
import edu.cornell.mannlib.vedit.tags.EditTag;
|
import edu.cornell.mannlib.vedit.tags.EditTag;
|
||||||
|
|
||||||
public class DynamicFieldsTag extends EditTag {
|
public class DynamicFieldsTag extends EditTag {
|
||||||
|
@ -63,7 +58,7 @@ public class DynamicFieldsTag extends EditTag {
|
||||||
int templateStart = -1;
|
int templateStart = -1;
|
||||||
int postStart = -1;
|
int postStart = -1;
|
||||||
|
|
||||||
InputStream fis = new FileInputStream (pageContext.getServletContext().getRealPath(new String())+PATH_SEP+MARKUP_FILE_PATH+usePage);
|
InputStream fis = new FileInputStream (pageContext.getServletContext().getRealPath("")+PATH_SEP+MARKUP_FILE_PATH+usePage);
|
||||||
InputStream bis = new BufferedInputStream(fis);
|
InputStream bis = new BufferedInputStream(fis);
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(bis));
|
BufferedReader in = new BufferedReader(new InputStreamReader(bis));
|
||||||
List<String> lines = new ArrayList<String>();
|
List<String> lines = new ArrayList<String>();
|
||||||
|
@ -83,9 +78,9 @@ public class DynamicFieldsTag extends EditTag {
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
StringBuffer preMarkupB = new StringBuffer();
|
StringBuilder preMarkupB = new StringBuilder();
|
||||||
StringBuffer postMarkupB = new StringBuffer();
|
StringBuilder postMarkupB = new StringBuilder();
|
||||||
StringBuffer templateMarkupB = new StringBuffer();
|
StringBuilder templateMarkupB = new StringBuilder();
|
||||||
|
|
||||||
if (templateStart>preStart && preStart>0) {
|
if (templateStart>preStart && preStart>0) {
|
||||||
for (int i=preStart+1; i<templateStart; i++) {
|
for (int i=preStart+1; i<templateStart; i++) {
|
||||||
|
@ -119,16 +114,16 @@ public class DynamicFieldsTag extends EditTag {
|
||||||
postMarkup = postMarkupB.toString();
|
postMarkup = postMarkupB.toString();
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
System.out.println("DynamicFieldsTag could not find markup file at "+pageContext.getServletContext().getRealPath(new String())+"\\"+MARKUP_FILE_PATH+usePage);
|
System.out.println("DynamicFieldsTag could not find markup file at "+pageContext.getServletContext().getRealPath("")+"\\"+MARKUP_FILE_PATH+usePage);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
System.out.println("DynamicFieldsTag encountered IOException reading "+pageContext.getServletContext().getRealPath(new String())+"\\"+MARKUP_FILE_PATH+usePage);
|
System.out.println("DynamicFieldsTag encountered IOException reading "+pageContext.getServletContext().getRealPath("")+"\\"+MARKUP_FILE_PATH+usePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String strReplace(String input, String pattern, String replacement) {
|
public String strReplace(String input, String pattern, String replacement) {
|
||||||
String[] piece = input.split(pattern);
|
String[] piece = input.split(pattern);
|
||||||
StringBuffer output = new StringBuffer();
|
StringBuilder output = new StringBuilder();
|
||||||
for (int i=0; i<piece.length; i++) {
|
for (int i=0; i<piece.length; i++) {
|
||||||
output.append(piece[i]);
|
output.append(piece[i]);
|
||||||
if (i<piece.length-1)
|
if (i<piece.length-1)
|
||||||
|
@ -149,7 +144,7 @@ public class DynamicFieldsTag extends EditTag {
|
||||||
int i = 9899;
|
int i = 9899;
|
||||||
while (dynIt.hasNext()) {
|
while (dynIt.hasNext()) {
|
||||||
DynamicField dynf = dynIt.next();
|
DynamicField dynf = dynIt.next();
|
||||||
StringBuffer genTaName = new StringBuffer().append("_").append(dynf.getTable()).append("_");
|
StringBuilder genTaName = new StringBuilder().append("_").append(dynf.getTable()).append("_");
|
||||||
genTaName.append("-1").append("_");
|
genTaName.append("-1").append("_");
|
||||||
Iterator pparamIt = dynf.getRowTemplate().getParameterMap().keySet().iterator();
|
Iterator pparamIt = dynf.getRowTemplate().getParameterMap().keySet().iterator();
|
||||||
while(pparamIt.hasNext()) {
|
while(pparamIt.hasNext()) {
|
||||||
|
@ -160,34 +155,33 @@ public class DynamicFieldsTag extends EditTag {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String preWithVars = new String(preMarkup);
|
String preWithVars = preMarkup;
|
||||||
preWithVars = strReplace(preWithVars,type+"NN",Integer.toString(i));
|
preWithVars = strReplace(preWithVars,type+"NN",Integer.toString(i));
|
||||||
preWithVars = strReplace(preWithVars,"\\$genTaName",genTaName.toString());
|
preWithVars = strReplace(preWithVars,"\\$genTaName",genTaName.toString());
|
||||||
preWithVars = strReplace(preWithVars,"\\$fieldName",dynf.getName());
|
preWithVars = strReplace(preWithVars,"\\$fieldName",dynf.getName());
|
||||||
|
|
||||||
out.print(preWithVars);
|
out.print(preWithVars);
|
||||||
|
|
||||||
Iterator<DynamicFieldRow> rowIt = dynf.getRowList().iterator();
|
for (DynamicFieldRow dynamicFieldRow : dynf.getRowList()) {
|
||||||
while (rowIt.hasNext()) {
|
|
||||||
++i;
|
++i;
|
||||||
DynamicFieldRow row = rowIt.next();
|
DynamicFieldRow row = dynamicFieldRow;
|
||||||
if (row.getValue()==null)
|
if (row.getValue() == null)
|
||||||
row.setValue("");
|
row.setValue("");
|
||||||
if (row.getValue().length()>0) {
|
if (row.getValue().length() > 0) {
|
||||||
StringBuffer taName = new StringBuffer().append("_").append(dynf.getTable()).append("_");
|
StringBuilder taName = new StringBuilder().append("_").append(dynf.getTable()).append("_");
|
||||||
taName.append(row.getId()).append("_");
|
taName.append(row.getId()).append("_");
|
||||||
Iterator paramIt = row.getParameterMap().keySet().iterator();
|
Iterator paramIt = row.getParameterMap().keySet().iterator();
|
||||||
while(paramIt.hasNext()) {
|
while (paramIt.hasNext()) {
|
||||||
String key = (String) paramIt.next();
|
String key = (String) paramIt.next();
|
||||||
String value = (String) row.getParameterMap().get(key);
|
String value = (String) row.getParameterMap().get(key);
|
||||||
byte[] valueInBase64 = Base64.encodeBase64(value.getBytes());
|
byte[] valueInBase64 = Base64.encodeBase64(value.getBytes());
|
||||||
taName.append(key).append(":").append(new String(valueInBase64)).append(";");
|
taName.append(key).append(":").append(new String(valueInBase64)).append(";");
|
||||||
}
|
}
|
||||||
if (row.getValue().length()>0) {
|
if (row.getValue().length() > 0) {
|
||||||
String templateWithVars = new String(templateMarkup);
|
String templateWithVars = templateMarkup;
|
||||||
templateWithVars = strReplace(templateWithVars,type+"NN",Integer.toString(i));
|
templateWithVars = strReplace(templateWithVars, type + "NN", Integer.toString(i));
|
||||||
templateWithVars = strReplace(templateWithVars,"\\$taName",taName.toString());
|
templateWithVars = strReplace(templateWithVars, "\\$taName", taName.toString());
|
||||||
templateWithVars = strReplace(templateWithVars,"\\$\\$",row.getValue());
|
templateWithVars = strReplace(templateWithVars, "\\$\\$", row.getValue());
|
||||||
out.print(templateWithVars);
|
out.print(templateWithVars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,14 +193,14 @@ public class DynamicFieldsTag extends EditTag {
|
||||||
// output the row template for the javascript to clone
|
// output the row template for the javascript to clone
|
||||||
|
|
||||||
out.println("<!-- row template inserted by DynamicFieldsTag -->");
|
out.println("<!-- row template inserted by DynamicFieldsTag -->");
|
||||||
String hiddenTemplatePreMarkup = new String(preMarkup);
|
String hiddenTemplatePreMarkup = preMarkup;
|
||||||
// bit of a hack to hide the template from the user:
|
// bit of a hack to hide the template from the user:
|
||||||
hiddenTemplatePreMarkup = strReplace(hiddenTemplatePreMarkup,"display\\:none\\;","");
|
hiddenTemplatePreMarkup = strReplace(hiddenTemplatePreMarkup,"display\\:none\\;","");
|
||||||
hiddenTemplatePreMarkup = strReplace(hiddenTemplatePreMarkup,"display\\:block\\;","");
|
hiddenTemplatePreMarkup = strReplace(hiddenTemplatePreMarkup,"display\\:block\\;","");
|
||||||
hiddenTemplatePreMarkup = strReplace(hiddenTemplatePreMarkup,"display\\:inline\\;","");
|
hiddenTemplatePreMarkup = strReplace(hiddenTemplatePreMarkup,"display\\:inline\\;","");
|
||||||
hiddenTemplatePreMarkup = strReplace(hiddenTemplatePreMarkup,"style\\=\\\"","style=\"display:none;");
|
hiddenTemplatePreMarkup = strReplace(hiddenTemplatePreMarkup,"style\\=\\\"","style=\"display:none;");
|
||||||
out.print(hiddenTemplatePreMarkup);
|
out.print(hiddenTemplatePreMarkup);
|
||||||
String hiddenTemplateTemplateMarkup = new String(templateMarkup);
|
String hiddenTemplateTemplateMarkup = templateMarkup;
|
||||||
hiddenTemplateTemplateMarkup = strReplace(hiddenTemplateTemplateMarkup, "\\$\\$", "");
|
hiddenTemplateTemplateMarkup = strReplace(hiddenTemplateTemplateMarkup, "\\$\\$", "");
|
||||||
out.print(hiddenTemplateTemplateMarkup);
|
out.print(hiddenTemplateTemplateMarkup);
|
||||||
out.print(postMarkup);
|
out.print(postMarkup);
|
||||||
|
|
|
@ -5,13 +5,10 @@ package edu.cornell.mannlib.vedit.tags;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import javax.servlet.jsp.JspException;
|
import javax.servlet.jsp.JspException;
|
||||||
import javax.servlet.jsp.PageContext;
|
|
||||||
import javax.servlet.jsp.tagext.TagSupport;
|
import javax.servlet.jsp.tagext.TagSupport;
|
||||||
import javax.servlet.jsp.JspWriter;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
|
||||||
|
|
||||||
public class EditTag extends TagSupport {
|
public class EditTag extends TagSupport {
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
package edu.cornell.mannlib.vedit.tags;
|
package edu.cornell.mannlib.vedit.tags;
|
||||||
|
|
||||||
import javax.servlet.jsp.JspException;
|
import javax.servlet.jsp.JspException;
|
||||||
import javax.servlet.jsp.tagext.TagSupport;
|
|
||||||
import javax.servlet.jsp.JspWriter;
|
import javax.servlet.jsp.JspWriter;
|
||||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
|
||||||
import edu.cornell.mannlib.vedit.tags.EditTag;
|
import edu.cornell.mannlib.vedit.tags.EditTag;
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vedit.tags;
|
package edu.cornell.mannlib.vedit.tags;
|
||||||
|
|
||||||
import org.apache.commons.collections.map.ListOrderedMap;
|
import org.apache.commons.collections4.map.ListOrderedMap;
|
||||||
import org.apache.commons.collections.OrderedMapIterator;
|
import org.apache.commons.collections4.OrderedMapIterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -51,7 +51,7 @@ public class OptionTag extends EditTag {
|
||||||
} catch (ClassCastException e){
|
} catch (ClassCastException e){
|
||||||
// maybe it's a ListOrderedMap of optgroups
|
// maybe it's a ListOrderedMap of optgroups
|
||||||
optGroups = (ListOrderedMap) getFormObject().getOptionLists().get(name);
|
optGroups = (ListOrderedMap) getFormObject().getOptionLists().get(name);
|
||||||
OrderedMapIterator ogKey = optGroups.orderedMapIterator();
|
OrderedMapIterator ogKey = optGroups.mapIterator();
|
||||||
while (ogKey.hasNext()) {
|
while (ogKey.hasNext()) {
|
||||||
String optGroupName = (String) ogKey.next();
|
String optGroupName = (String) ogKey.next();
|
||||||
out.println("<optgroup label=\""+StringEscapeUtils.ESCAPE_HTML4.translate(optGroupName)+"\">");
|
out.println("<optgroup label=\""+StringEscapeUtils.ESCAPE_HTML4.translate(optGroupName)+"\">");
|
||||||
|
|
|
@ -5,7 +5,6 @@ package edu.cornell.mannlib.vedit.tags;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import javax.servlet.jsp.JspException;
|
import javax.servlet.jsp.JspException;
|
||||||
import javax.servlet.jsp.tagext.TagSupport;
|
|
||||||
import javax.servlet.jsp.JspWriter;
|
import javax.servlet.jsp.JspWriter;
|
||||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
|
|
|
@ -73,43 +73,38 @@ public class FormUtils {
|
||||||
|
|
||||||
Method[] meths = beanClass.getMethods();
|
Method[] meths = beanClass.getMethods();
|
||||||
|
|
||||||
for (int i=0; i<meths.length; i++) {
|
for (Method currMeth : meths) {
|
||||||
|
|
||||||
if (meths[i].getName().indexOf("set") == 0) {
|
if (currMeth.getName().indexOf("set") == 0) {
|
||||||
|
|
||||||
// we have a setter method
|
// we have a setter method
|
||||||
Method currMeth = meths[i];
|
|
||||||
Class[] currMethParamTypes = currMeth.getParameterTypes();
|
Class[] currMethParamTypes = currMeth.getParameterTypes();
|
||||||
Class currMethType = currMethParamTypes[0];
|
Class currMethType = currMethParamTypes[0];
|
||||||
|
|
||||||
if (SUPPORTED_TYPE_LIST.contains(currMethType)) {
|
if (SUPPORTED_TYPE_LIST.contains(currMethType)) {
|
||||||
//we only want people directly to type in ints, strings, and dates
|
//we only want people directly to type in ints, strings, and dates
|
||||||
//of course, most of the ints are probably foreign keys anyway...
|
//of course, most of the ints are probably foreign keys anyway...
|
||||||
|
|
||||||
String elementName = currMeth.getName().substring(
|
String elementName = currMeth.getName().substring(
|
||||||
3,currMeth.getName().length());
|
3, currMeth.getName().length());
|
||||||
|
|
||||||
//see if there's something in the bean using
|
//see if there's something in the bean using
|
||||||
//the related getter method
|
//the related getter method
|
||||||
|
|
||||||
Class[] paramClass = new Class[1];
|
|
||||||
paramClass[0] = currMethType;
|
|
||||||
try {
|
try {
|
||||||
Method getter = beanClass.getMethod(
|
Method getter = beanClass.getMethod(
|
||||||
"get" + elementName, (Class[]) null);
|
"get" + elementName, (Class[]) null);
|
||||||
Object existingData = null;
|
Object existingData = null;
|
||||||
try {
|
try {
|
||||||
existingData = getter.invoke(bean, (Object[]) null);
|
existingData = getter.invoke(bean, (Object[]) null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error ("Exception invoking getter method");
|
log.error("Exception invoking getter method");
|
||||||
}
|
}
|
||||||
String value = "";
|
String value = "";
|
||||||
if (existingData != null){
|
if (existingData != null) {
|
||||||
if (existingData instanceof String){
|
if (existingData instanceof String) {
|
||||||
value += existingData;
|
value += existingData;
|
||||||
}
|
} else if (!(existingData instanceof Integer
|
||||||
else if (!(existingData instanceof Integer
|
&& (Integer) existingData < 0)) {
|
||||||
&& (Integer)existingData < 0)) {
|
|
||||||
value += existingData.toString();
|
value += existingData.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +221,7 @@ public class FormUtils {
|
||||||
Option sOpt = new Option();
|
Option sOpt = new Option();
|
||||||
sOpt.setValue(selectedValue);
|
sOpt.setValue(selectedValue);
|
||||||
if (selectedBody == null || selectedBody.length() == 0)
|
if (selectedBody == null || selectedBody.length() == 0)
|
||||||
sOpt.setBody(selectedValue.toString());
|
sOpt.setBody(selectedValue);
|
||||||
else
|
else
|
||||||
sOpt.setBody(selectedBody);
|
sOpt.setBody(selectedBody);
|
||||||
sOpt.setSelected(true);
|
sOpt.setSelected(true);
|
||||||
|
@ -272,11 +267,7 @@ public class FormUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(options, new Comparator<Option>() {
|
options.sort((o1, o2) -> o1.getBody().compareTo(o2.getBody()));
|
||||||
@Override
|
|
||||||
public int compare(Option o1, Option o2) {
|
|
||||||
return o1.getBody().compareTo(o2.getBody());
|
|
||||||
}});
|
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@ -372,12 +363,12 @@ public class FormUtils {
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
public static Map beanParamMapFromString(String params) {
|
public static Map<String, String> beanParamMapFromString(String params) {
|
||||||
String[] param = params.split(";");
|
String[] param = params.split(";");
|
||||||
Map beanParamMap = new HashMap();
|
Map<String, String> beanParamMap = new HashMap<String, String>();
|
||||||
for (int i=0; i<param.length; i++) {
|
for (String aParam : param) {
|
||||||
String[] p = param[i].split(":");
|
String[] p = aParam.split(":");
|
||||||
beanParamMap.put(p[0],new String(Base64.decodeBase64(p[1].getBytes())));
|
beanParamMap.put(p[0], new String(Base64.decodeBase64(p[1].getBytes())));
|
||||||
}
|
}
|
||||||
return beanParamMap;
|
return beanParamMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,19 +46,21 @@ public class OperationUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object[] arglist = new Object[1];
|
if (setterMethod != null) {
|
||||||
if (isInt)
|
Object[] arglist = new Object[1];
|
||||||
arglist[0] = Integer.decode(value);
|
if (isInt)
|
||||||
else if (isBoolean)
|
arglist[0] = Integer.decode(value);
|
||||||
arglist[0] = (value.equalsIgnoreCase("TRUE"));
|
else if (isBoolean)
|
||||||
else
|
arglist[0] = (value.equalsIgnoreCase("TRUE"));
|
||||||
arglist[0] = value;
|
else
|
||||||
try {
|
arglist[0] = value;
|
||||||
setterMethod.invoke(newObj, arglist);
|
try {
|
||||||
} catch (Exception e) {
|
setterMethod.invoke(newObj, arglist);
|
||||||
log.error("Couldn't invoke method");
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error("Couldn't invoke method");
|
||||||
log.error(field + " " + arglist[0]);
|
log.error(e.getMessage());
|
||||||
|
log.error(field + " " + arglist[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Stemmer
|
||||||
public void add(char ch)
|
public void add(char ch)
|
||||||
{ if (i == b.length)
|
{ if (i == b.length)
|
||||||
{ char[] new_b = new char[i+INC];
|
{ char[] new_b = new char[i+INC];
|
||||||
for (int c = 0; c < i; c++) new_b[c] = b[c];
|
System.arraycopy(b, 0, new_b, 0, i);
|
||||||
b = new_b;
|
b = new_b;
|
||||||
}
|
}
|
||||||
b[i++] = ch;
|
b[i++] = ch;
|
||||||
|
@ -86,7 +86,7 @@ class Stemmer
|
||||||
public void add(char[] w, int wLen)
|
public void add(char[] w, int wLen)
|
||||||
{ if (i+wLen >= b.length)
|
{ if (i+wLen >= b.length)
|
||||||
{ char[] new_b = new char[i+wLen+INC];
|
{ char[] new_b = new char[i+wLen+INC];
|
||||||
for (int c = 0; c < i; c++) new_b[c] = b[c];
|
System.arraycopy(b, 0, new_b, 0, i);
|
||||||
b = new_b;
|
b = new_b;
|
||||||
}
|
}
|
||||||
for (int c = 0; c < wLen; c++) b[i++] = w[c];
|
for (int c = 0; c < wLen; c++) b[i++] = w[c];
|
||||||
|
@ -116,7 +116,7 @@ class Stemmer
|
||||||
private final boolean cons(int i)
|
private final boolean cons(int i)
|
||||||
{ switch (b[i])
|
{ switch (b[i])
|
||||||
{ case 'a': case 'e': case 'i': case 'o': case 'u': return false;
|
{ case 'a': case 'e': case 'i': case 'o': case 'u': return false;
|
||||||
case 'y': return (i==0) ? true : !cons(i-1);
|
case 'y': return (i == 0) || !cons(i - 1);
|
||||||
default: return true;
|
default: return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ class Stemmer
|
||||||
|
|
||||||
public static String StemString( String inputStr, int maxLength )
|
public static String StemString( String inputStr, int maxLength )
|
||||||
{
|
{
|
||||||
String outputStr="";
|
StringBuilder outputStr= new StringBuilder();
|
||||||
|
|
||||||
int previousCh=0;
|
int previousCh=0;
|
||||||
char[] w = new char[maxLength];
|
char[] w = new char[maxLength];
|
||||||
|
@ -396,19 +396,19 @@ class Stemmer
|
||||||
{
|
{
|
||||||
String u;
|
String u;
|
||||||
u = s.toString();
|
u = s.toString();
|
||||||
outputStr += u;
|
outputStr.append(u);
|
||||||
if ( ch == '-' ) { // replace - with space
|
if ( ch == '-' ) { // replace - with space
|
||||||
outputStr += " ";
|
outputStr.append(" ");
|
||||||
} else if ( ch == '.' ) {
|
} else if ( ch == '.' ) {
|
||||||
if ( Character.isDigit( (char) previousCh )) {
|
if ( Character.isDigit( (char) previousCh )) {
|
||||||
outputStr += ".";
|
outputStr.append(".");
|
||||||
} else {
|
} else {
|
||||||
outputStr += " ";
|
outputStr.append(" ");
|
||||||
//previousCh = 32; // set to whitespace; extra spaces should be filtered out on next pass
|
//previousCh = 32; // set to whitespace; extra spaces should be filtered out on next pass
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Character Ch = new Character((char) ch);
|
Character Ch = new Character((char) ch);
|
||||||
outputStr += Ch.toString();
|
outputStr.append(Ch.toString());
|
||||||
}
|
}
|
||||||
stemmerInputBufferIndex=0; // to avoid repeats after )
|
stemmerInputBufferIndex=0; // to avoid repeats after )
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ class Stemmer
|
||||||
if ( !Character.isWhitespace((char) previousCh ) ) {
|
if ( !Character.isWhitespace((char) previousCh ) ) {
|
||||||
if ( previousCh != '.' ) {
|
if ( previousCh != '.' ) {
|
||||||
Character Ch = new Character((char) ch);
|
Character Ch = new Character((char) ch);
|
||||||
outputStr += Ch.toString();
|
outputStr.append(Ch.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ( ch == '(' ) { // open paren; copy all characters until close paren
|
} else if ( ch == '(' ) { // open paren; copy all characters until close paren
|
||||||
|
@ -449,21 +449,21 @@ class Stemmer
|
||||||
stemmerInputBufferIndex=0;
|
stemmerInputBufferIndex=0;
|
||||||
} else if ( ch == ')' ) { // when is last character of input string
|
} else if ( ch == ')' ) { // when is last character of input string
|
||||||
Character Ch = new Character((char) ch);
|
Character Ch = new Character((char) ch);
|
||||||
outputStr += Ch.toString();
|
outputStr.append(Ch.toString());
|
||||||
log.trace( Ch.toString() );
|
log.trace( Ch.toString() );
|
||||||
log.trace("found close paren at position: " + inputArrayIndex + " of input term " + inputStr );
|
log.trace("found close paren at position: " + inputArrayIndex + " of input term " + inputStr );
|
||||||
} else if ( ch == '-' ) { // replace - with space
|
} else if ( ch == '-' ) { // replace - with space
|
||||||
outputStr += " ";
|
outputStr.append(" ");
|
||||||
} else if ( ch == '.' ) {
|
} else if ( ch == '.' ) {
|
||||||
if ( Character.isDigit( (char) previousCh )) {
|
if ( Character.isDigit( (char) previousCh )) {
|
||||||
outputStr += ".";
|
outputStr.append(".");
|
||||||
} else {
|
} else {
|
||||||
outputStr += " ";
|
outputStr.append(" ");
|
||||||
//previousCh = 32; // set to whitespace; extra spaces should be filtered out on next pass
|
//previousCh = 32; // set to whitespace; extra spaces should be filtered out on next pass
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Character Ch = new Character((char) ch);
|
Character Ch = new Character((char) ch);
|
||||||
outputStr += Ch.toString();
|
outputStr.append(Ch.toString());
|
||||||
}
|
}
|
||||||
previousCh = ch;
|
previousCh = ch;
|
||||||
if (ch < 0) break;
|
if (ch < 0) break;
|
||||||
|
@ -477,10 +477,10 @@ class Stemmer
|
||||||
|
|
||||||
String u;
|
String u;
|
||||||
u = s.toString();
|
u = s.toString();
|
||||||
outputStr += u;
|
outputStr.append(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
return outputStr == null ? ( outputStr.equals("") ? null : outputStr.trim() ) : outputStr.trim();
|
return outputStr.length() == 0 ? null : outputStr.toString().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -549,8 +549,8 @@ class Stemmer
|
||||||
{
|
{
|
||||||
char[] w = new char[501];
|
char[] w = new char[501];
|
||||||
Stemmer s = new Stemmer();
|
Stemmer s = new Stemmer();
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (String arg : args) {
|
||||||
System.out.println( StemString( args[i], 100 ));
|
System.out.println(StemString(arg, 100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
package edu.cornell.mannlib.vedit.validator.impl;
|
package edu.cornell.mannlib.vedit.validator.impl;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.validator.*;
|
import edu.cornell.mannlib.vedit.validator.*;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@ -17,17 +19,17 @@ public class EnumValuesValidator implements Validator {
|
||||||
} else {
|
} else {
|
||||||
vo.setValid(false);
|
vo.setValid(false);
|
||||||
if (legalValues.size()<7){
|
if (legalValues.size()<7){
|
||||||
String msgString = "Please enter one of ";
|
StringBuilder msgString = new StringBuilder("Please enter one of ");
|
||||||
Iterator valuesIt = legalValues.iterator();
|
Iterator valuesIt = legalValues.iterator();
|
||||||
while (valuesIt.hasNext()) {
|
while (valuesIt.hasNext()) {
|
||||||
String legalValue = (String) valuesIt.next();
|
String legalValue = (String) valuesIt.next();
|
||||||
msgString += "'"+legalValue+"'";
|
msgString.append("'").append(legalValue).append("'");
|
||||||
if (valuesIt.hasNext())
|
if (valuesIt.hasNext())
|
||||||
msgString += ", ";
|
msgString.append(", ");
|
||||||
else
|
else
|
||||||
msgString += ".";
|
msgString.append(".");
|
||||||
}
|
}
|
||||||
vo.setMessage(msgString);
|
vo.setMessage(msgString.toString());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vo.setMessage("Please enter a legal value.");
|
vo.setMessage("Please enter a legal value.");
|
||||||
|
@ -38,7 +40,6 @@ public class EnumValuesValidator implements Validator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumValuesValidator (String[] legalValues){
|
public EnumValuesValidator (String[] legalValues){
|
||||||
for (int i=0; i<legalValues.length; i++)
|
Collections.addAll(this.legalValues, legalValues);
|
||||||
this.legalValues.add(legalValues[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ public class UrlValidator implements Validator {
|
||||||
IRIFactory factory = IRIFactory.jenaImplementation();
|
IRIFactory factory = IRIFactory.jenaImplementation();
|
||||||
IRI iri = factory.create((String) obj);
|
IRI iri = factory.create((String) obj);
|
||||||
if (iri.hasViolation(false) ) {
|
if (iri.hasViolation(false) ) {
|
||||||
String errorStr = "";
|
StringBuilder errorStr = new StringBuilder();
|
||||||
Iterator<Violation> violIt = iri.violations(false);
|
Iterator<Violation> violIt = iri.violations(false);
|
||||||
while(violIt.hasNext()) {
|
while(violIt.hasNext()) {
|
||||||
errorStr += violIt.next().getShortMessage() + " ";
|
errorStr.append(violIt.next().getShortMessage()).append(" ");
|
||||||
}
|
}
|
||||||
vo.setValid(false);
|
vo.setValid(false);
|
||||||
vo.setMessage("Please enter a valid URL. " + errorStr);
|
vo.setMessage("Please enter a valid URL. " + errorStr);
|
||||||
|
|
|
@ -171,14 +171,17 @@ public class ApplicationImpl implements Application {
|
||||||
ss.info(this, "Started the ContentTripleSource: "
|
ss.info(this, "Started the ContentTripleSource: "
|
||||||
+ contentTripleSource);
|
+ contentTripleSource);
|
||||||
|
|
||||||
ConfigurationTripleSource configurationTripleSource = app
|
// Ensure that we haven't failed setting up the content triple store before continuing
|
||||||
.getConfigurationTripleSource();
|
if (!ss.isStartupAborted()) {
|
||||||
configurationTripleSource.startup(app, css);
|
ConfigurationTripleSource configurationTripleSource = app
|
||||||
ss.info(this, "Started the ConfigurationTripleSource: "
|
.getConfigurationTripleSource();
|
||||||
+ configurationTripleSource);
|
configurationTripleSource.startup(app, css);
|
||||||
|
ss.info(this, "Started the ConfigurationTripleSource: "
|
||||||
|
+ configurationTripleSource);
|
||||||
|
|
||||||
configureJena();
|
configureJena();
|
||||||
prepareCombinedTripleSource(app, ctx);
|
prepareCombinedTripleSource(app, ctx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureJena() {
|
private void configureJena() {
|
||||||
|
|
|
@ -159,8 +159,8 @@ public class VitroHomeDirectory {
|
||||||
VHD_BUILD_PROPERTY);
|
VHD_BUILD_PROPERTY);
|
||||||
throw new IllegalStateException(message);
|
throw new IllegalStateException(message);
|
||||||
} else if (foundLocations.size() > 1) {
|
} else if (foundLocations.size() > 1) {
|
||||||
String message = String.format("Found multiple values for the "
|
String message = "Found multiple values for the "
|
||||||
+ "Vitro home directory: " + foundLocations);
|
+ "Vitro home directory: " + foundLocations;
|
||||||
log.warn(message);
|
log.warn(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,11 +145,8 @@ public class PropertyRestrictionBeanImpl extends PropertyRestrictionBean {
|
||||||
if (resourceUri == null || userRole == null) {
|
if (resourceUri == null || userRole == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (prohibitedNamespaces.contains(namespace(resourceUri))
|
return !prohibitedNamespaces.contains(namespace(resourceUri))
|
||||||
&& !permittedExceptions.contains(resourceUri)) {
|
|| permittedExceptions.contains(resourceUri);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -241,9 +238,7 @@ public class PropertyRestrictionBeanImpl extends PropertyRestrictionBean {
|
||||||
|
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
for (FullPropertyKey key : keys) {
|
for (FullPropertyKey key : keys) {
|
||||||
buffer.append(key + " " + thresholdMap.get(key).getLevel(DISPLAY)
|
buffer.append(key).append(" ").append(thresholdMap.get(key).getLevel(DISPLAY)).append(" ").append(thresholdMap.get(key).getLevel(MODIFY)).append(" ").append(thresholdMap.get(key).getLevel(PUBLISH)).append("\n");
|
||||||
+ " " + thresholdMap.get(key).getLevel(MODIFY) + " "
|
|
||||||
+ thresholdMap.get(key).getLevel(PUBLISH) + "\n");
|
|
||||||
}
|
}
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.RequestedAct
|
||||||
|
|
||||||
import org.apache.jena.ontology.OntModel;
|
import org.apache.jena.ontology.OntModel;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.RequestedAction;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AbstractObjectPropertyStatementAction;
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AbstractObjectPropertyStatementAction;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
|
|
@ -22,18 +22,18 @@ public class Classes2Classes {
|
||||||
public void setSuperclassURI(String in){ superclassURI=in;}
|
public void setSuperclassURI(String in){ superclassURI=in;}
|
||||||
|
|
||||||
public String getSuperclassNamespace(){ return superclassNamespace; }
|
public String getSuperclassNamespace(){ return superclassNamespace; }
|
||||||
public void setSuperclassNamespace(){ this.superclassNamespace=superclassNamespace;}
|
public void setSuperclassNamespace(String superclassNamespace){ this.superclassNamespace=superclassNamespace;}
|
||||||
|
|
||||||
public String getSuperclassLocalName(){ return superclassLocalName; }
|
public String getSuperclassLocalName(){ return superclassLocalName; }
|
||||||
public void setSuperclassLocalName(){ this.superclassLocalName=superclassLocalName;}
|
public void setSuperclassLocalName(String superclassLocalName){ this.superclassLocalName=superclassLocalName;}
|
||||||
|
|
||||||
public String getSubclassURI(){ return subclassURI;}
|
public String getSubclassURI(){ return subclassURI;}
|
||||||
public void setSubclassURI(String in){ subclassURI=in;}
|
public void setSubclassURI(String in){ subclassURI=in;}
|
||||||
|
|
||||||
public String getSubclassNamespace(){ return subclassNamespace; }
|
public String getSubclassNamespace(){ return subclassNamespace; }
|
||||||
public void setSubclassNamespace(){ this.subclassNamespace=subclassNamespace;}
|
public void setSubclassNamespace(String subclassNamespace){ this.subclassNamespace=subclassNamespace;}
|
||||||
|
|
||||||
public String getSubclassLocalName(){ return subclassLocalName; }
|
public String getSubclassLocalName(){ return subclassLocalName; }
|
||||||
public void setSubclassLocalName(){ this.subclassLocalName=subclassLocalName;}
|
public void setSubclassLocalName(String subclassLocalName){ this.subclassLocalName=subclassLocalName;}
|
||||||
|
|
||||||
}
|
}
|
|
@ -51,7 +51,7 @@ public class DataPropertyComparator implements Comparator<Individual> {
|
||||||
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) i1).compareTo(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());
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.beans;
|
package edu.cornell.mannlib.vitro.webapp.beans;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.apache.jena.rdf.model.Property;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a class representing a particular instance of a data property
|
* a class representing a particular instance of a data property
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.beans;
|
package edu.cornell.mannlib.vitro.webapp.beans;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a class representing an particular instance of a data property
|
* a class representing an particular instance of a data property
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,13 +2,12 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.beans;
|
package edu.cornell.mannlib.vitro.webapp.beans;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: bdc34
|
* User: bdc34
|
||||||
* Date: Oct 18, 2007
|
* Date: Oct 18, 2007
|
||||||
|
@ -97,7 +96,7 @@ public interface Individual extends ResourceBean, Comparable<Individual> {
|
||||||
|
|
||||||
void sortForDisplay();
|
void sortForDisplay();
|
||||||
|
|
||||||
JSONObject toJSON() throws JSONException;
|
JsonNode toJSON();
|
||||||
|
|
||||||
Float getSearchBoost();
|
Float getSearchBoost();
|
||||||
void setSearchBoost( Float boost );
|
void setSearchBoost( Float boost );
|
||||||
|
|
|
@ -11,9 +11,9 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import org.json.JSONObject;
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.filestorage.model.ImageInfo;
|
import edu.cornell.mannlib.vitro.webapp.filestorage.model.ImageInfo;
|
||||||
|
|
||||||
|
@ -301,27 +301,21 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp
|
||||||
protected void sortEnts2EntsForDisplay(){
|
protected void sortEnts2EntsForDisplay(){
|
||||||
if( getObjectPropertyList() == null ) return;
|
if( getObjectPropertyList() == null ) return;
|
||||||
|
|
||||||
Iterator it = getObjectPropertyList().iterator();
|
for (ObjectProperty prop : getObjectPropertyList()) {
|
||||||
while(it.hasNext()){
|
prop.sortObjectPropertyStatementsForDisplay(prop, prop.getObjectPropertyStatements());
|
||||||
ObjectProperty prop = (ObjectProperty)it.next();
|
|
||||||
prop.sortObjectPropertyStatementsForDisplay(prop,prop.getObjectPropertyStatements());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sortPropertiesForDisplay( ){
|
protected void sortPropertiesForDisplay( ){
|
||||||
//here we sort the Property objects
|
//here we sort the Property objects
|
||||||
Collections.sort(getObjectPropertyList(), new ObjectProperty.DisplayComparator());
|
getObjectPropertyList().sort(new ObjectProperty.DisplayComparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String [] INCLUDED_IN_JSON = {
|
public JsonNode toJSON() {
|
||||||
"URI",
|
ObjectNode jsonObj = JsonNodeFactory.instance.objectNode();
|
||||||
"name",
|
jsonObj.put("URI", this.URI);
|
||||||
"vClassId"
|
jsonObj.put("name", this.name);
|
||||||
};
|
jsonObj.put("vClassId", this.vClassURI);
|
||||||
|
|
||||||
|
|
||||||
public JSONObject toJSON() throws JSONException {
|
|
||||||
JSONObject jsonObj = new JSONObject(this, INCLUDED_IN_JSON);
|
|
||||||
return jsonObj;
|
return jsonObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -463,7 +463,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
Collections.sort(objPropStmtsList, fieldComp);
|
objPropStmtsList.sort(fieldComp);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception sorting object property statements for object property "+prop.getURI());
|
log.error("Exception sorting object property statements for object property "+prop.getURI());
|
||||||
}
|
}
|
||||||
|
@ -562,7 +562,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
Collections.sort(objPropStmtsList, dpComp);
|
objPropStmtsList.sort(dpComp);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception sorting object property statements " +
|
log.error("Exception sorting object property statements " +
|
||||||
"for object property " + prop.getURI(), e);
|
"for object property " + prop.getURI(), e);
|
||||||
|
@ -576,16 +576,16 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
||||||
* @return Readable text identifying this property's attributes
|
* @return Readable text identifying this property's attributes
|
||||||
*/
|
*/
|
||||||
public String toString(){
|
public String toString(){
|
||||||
String list = "null";
|
StringBuilder list = new StringBuilder("null");
|
||||||
if( getObjectPropertyStatements() != null ){
|
if( getObjectPropertyStatements() != null ){
|
||||||
Iterator it = getObjectPropertyStatements().iterator();
|
Iterator it = getObjectPropertyStatements().iterator();
|
||||||
if( !it.hasNext() ) list = " none";
|
if( !it.hasNext() ) list = new StringBuilder(" none");
|
||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
Object obj = it.next();
|
Object obj = it.next();
|
||||||
if( obj != null && obj instanceof ObjectPropertyStatement){
|
if( obj != null && obj instanceof ObjectPropertyStatement){
|
||||||
list += "\n\t\t" + ((ObjectPropertyStatement)obj).toString();
|
list.append("\n\t\t").append(((ObjectPropertyStatement) obj).toString());
|
||||||
}else{
|
}else{
|
||||||
list += "\n\t\t" + obj.toString();
|
list.append("\n\t\t").append(obj.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* $This file is distributed under the terms of the license in LICENSE$ */
|
/* $This file is distributed under the terms of the license in LICENSE$ */
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.beans;
|
package edu.cornell.mannlib.vitro.webapp.beans;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public interface ObjectPropertyStatement {
|
public interface ObjectPropertyStatement {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package edu.cornell.mannlib.vitro.webapp.beans;
|
package edu.cornell.mannlib.vitro.webapp.beans;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a class representing a particular instance of an object property
|
* a class representing a particular instance of an object property
|
||||||
|
|
|
@ -45,8 +45,7 @@ public class PermissionSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForNewUsers(Boolean forNewUsers) {
|
public void setForNewUsers(Boolean forNewUsers) {
|
||||||
this.forNewUsers = (forNewUsers == null) ? false
|
this.forNewUsers = (forNewUsers != null) && forNewUsers.booleanValue();
|
||||||
: forNewUsers.booleanValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isForPublic() {
|
public boolean isForPublic() {
|
||||||
|
@ -54,8 +53,7 @@ public class PermissionSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForPublic(Boolean forPublic) {
|
public void setForPublic(Boolean forPublic) {
|
||||||
this.forPublic = (forPublic == null) ? false
|
this.forPublic = (forPublic != null) && forPublic.booleanValue();
|
||||||
: forPublic.booleanValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getPermissionUris() {
|
public Set<String> getPermissionUris() {
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.beans;
|
package edu.cornell.mannlib.vitro.webapp.beans;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Represents a Vitro object property instance. It includes values
|
Represents a Vitro object property instance. It includes values
|
||||||
from the entities, object property statements, properties, and ent2relationships tables
|
from the entities, object property statements, properties, and ent2relationships tables
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.beans;
|
package edu.cornell.mannlib.vitro.webapp.beans;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public interface PropertyInstanceIface {
|
public interface PropertyInstanceIface {
|
||||||
//needed for PropertyInstance
|
//needed for PropertyInstance
|
||||||
//object property statements
|
//object property statements
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class VClassList extends VClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sort(){
|
public void sort(){
|
||||||
Collections.sort(getEntities(), getCompare() );
|
getEntities().sort(getCompare());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize(){
|
public int getSize(){
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.config;
|
package edu.cornell.mannlib.vitro.webapp.config;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,8 @@ public class Controllers {
|
||||||
if (Controllers.letters == null) {
|
if (Controllers.letters == null) {
|
||||||
char c[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
|
char c[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
|
||||||
Controllers.letters = new ArrayList<String>(c.length);
|
Controllers.letters = new ArrayList<String>(c.length);
|
||||||
for (int i = 0; i < c.length; i++) {
|
for (char aC : c) {
|
||||||
letters.add("" + c[i]);
|
letters.add("" + aC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Controllers.letters;
|
return Controllers.letters;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
* @author bdc34
|
* @author bdc34
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "DashboardPropertyListController", urlPatterns = {"/dashboardPropList"} )
|
||||||
public class DashboardPropertyListController extends VitroHttpServlet {
|
public class DashboardPropertyListController extends VitroHttpServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +157,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
||||||
|
|
||||||
if (mergedPropertyList!=null) {
|
if (mergedPropertyList!=null) {
|
||||||
try {
|
try {
|
||||||
Collections.sort(mergedPropertyList,new PropertyRanker(vreq));
|
mergedPropertyList.sort(new PropertyRanker(vreq));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.error("Exception sorting merged property list: " + ex.getMessage());
|
log.error("Exception sorting merged property list: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -274,7 +276,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
||||||
}
|
}
|
||||||
if (pg.getPropertyList().size()>1) {
|
if (pg.getPropertyList().size()>1) {
|
||||||
try {
|
try {
|
||||||
Collections.sort(pg.getPropertyList(),new Property.DisplayComparatorIgnoringPropertyGroup());
|
pg.getPropertyList().sort(new Property.DisplayComparatorIgnoringPropertyGroup());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.error("Exception sorting property group "+pg.getName()+" property list: "+ex.getMessage());
|
log.error("Exception sorting property group "+pg.getName()+" property list: "+ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceUtils;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.http.AcceptHeaderParsingException;
|
import edu.cornell.mannlib.vitro.webapp.utils.http.AcceptHeaderParsingException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.http.NotAcceptableException;
|
import edu.cornell.mannlib.vitro.webapp.utils.http.NotAcceptableException;
|
||||||
|
|
||||||
|
@WebServlet(name = "IndividualListRdf", urlPatterns = {"/listrdf/*"} )
|
||||||
public class IndividualListRdfController extends VitroApiServlet {
|
public class IndividualListRdfController extends VitroApiServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(IndividualListRdfController.class);
|
.getLog(IndividualListRdfController.class);
|
||||||
|
|
|
@ -17,6 +17,7 @@ import javax.mail.internet.AddressException;
|
||||||
import javax.mail.internet.InternetAddress;
|
import javax.mail.internet.InternetAddress;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailFactory;
|
import edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailFactory;
|
||||||
|
|
||||||
|
@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);
|
||||||
|
|
||||||
|
@ -102,30 +104,30 @@ public class MailUsersServlet extends VitroHttpServlet {
|
||||||
comments=comments.trim();
|
comments=comments.trim();
|
||||||
//Removed spam filtering code
|
//Removed spam filtering code
|
||||||
|
|
||||||
StringBuffer msgBuf = new StringBuffer(); // contains the intro copy for the body of the email message
|
StringBuilder msgBuf = new StringBuilder(); // contains the intro copy for the body of the email message
|
||||||
String lineSeparator = System.getProperty("line.separator"); // \r\n on windows, \n on unix
|
String lineSeparator = System.getProperty("line.separator"); // \r\n on windows, \n on unix
|
||||||
// from MyLibrary
|
// from MyLibrary
|
||||||
msgBuf.setLength(0);
|
msgBuf.setLength(0);
|
||||||
//msgBuf.append("Content-Type: text/html; charset='us-ascii'" + lineSeparator);
|
//msgBuf.append("Content-Type: text/html; charset='us-ascii'" + lineSeparator);
|
||||||
msgBuf.append("<html>" + lineSeparator );
|
msgBuf.append("<html>").append(lineSeparator);
|
||||||
msgBuf.append("<head>" + lineSeparator );
|
msgBuf.append("<head>").append(lineSeparator);
|
||||||
msgBuf.append("<style>a {text-decoration: none}</style>" + lineSeparator );
|
msgBuf.append("<style>a {text-decoration: none}</style>").append(lineSeparator);
|
||||||
msgBuf.append("<title>" + deliveryfrom + "</title>" + lineSeparator );
|
msgBuf.append("<title>").append(deliveryfrom).append("</title>").append(lineSeparator);
|
||||||
msgBuf.append("</head>" + lineSeparator );
|
msgBuf.append("</head>").append(lineSeparator);
|
||||||
msgBuf.append("<body>" + lineSeparator );
|
msgBuf.append("<body>").append(lineSeparator);
|
||||||
msgBuf.append("<h4>" + deliveryfrom + "</h4>" + lineSeparator );
|
msgBuf.append("<h4>").append(deliveryfrom).append("</h4>").append(lineSeparator);
|
||||||
msgBuf.append("<h4>From: "+webusername +" (" + webuseremail + ")"+" at IP address "+request.getRemoteAddr()+"</h4>"+lineSeparator);
|
msgBuf.append("<h4>From: ").append(webusername).append(" (").append(webuseremail).append(")").append(" at IP address ").append(request.getRemoteAddr()).append("</h4>").append(lineSeparator);
|
||||||
|
|
||||||
//Don't need any 'likely viewing page' portion to be emailed out to the others
|
//Don't need any 'likely viewing page' portion to be emailed out to the others
|
||||||
|
|
||||||
msgBuf.append(lineSeparator + "</i></p><h3>Comments:</h3>" + lineSeparator );
|
msgBuf.append(lineSeparator).append("</i></p><h3>Comments:</h3>").append(lineSeparator);
|
||||||
if (comments==null || comments.equals("")) {
|
if (comments==null || comments.equals("")) {
|
||||||
msgBuf.append("<p>BLANK MESSAGE</p>");
|
msgBuf.append("<p>BLANK MESSAGE</p>");
|
||||||
} else {
|
} else {
|
||||||
msgBuf.append("<p>"+comments+"</p>");
|
msgBuf.append("<p>").append(comments).append("</p>");
|
||||||
}
|
}
|
||||||
msgBuf.append("</body>" + lineSeparator );
|
msgBuf.append("</body>").append(lineSeparator);
|
||||||
msgBuf.append("</html>" + lineSeparator );
|
msgBuf.append("</html>").append(lineSeparator);
|
||||||
|
|
||||||
String msgText = msgBuf.toString();
|
String msgText = msgBuf.toString();
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.controller;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -190,6 +191,15 @@ public class MultipartRequestWrapper extends HttpServletRequestWrapper {
|
||||||
try {
|
try {
|
||||||
return upload.parseRequest(req);
|
return upload.parseRequest(req);
|
||||||
} catch (FileSizeLimitExceededException | SizeLimitExceededException e) {
|
} catch (FileSizeLimitExceededException | SizeLimitExceededException e) {
|
||||||
|
// Fully consume input stream, so that error message is displayed
|
||||||
|
try {
|
||||||
|
InputStream in = req.getInputStream();
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
while (in.read(buffer) != -1) ;
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
// Ignore any errors at this point
|
||||||
|
}
|
||||||
|
|
||||||
if (strategy.stashFileSizeException()) {
|
if (strategy.stashFileSizeException()) {
|
||||||
req.setAttribute(ATTRIBUTE_FILE_SIZE_EXCEPTION, e);
|
req.setAttribute(ATTRIBUTE_FILE_SIZE_EXCEPTION, e);
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -233,7 +243,7 @@ public class MultipartRequestWrapper extends HttpServletRequestWrapper {
|
||||||
* Look in the map of parsed parameters. Make a protective copy.
|
* Look in the map of parsed parameters. Make a protective copy.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Enumeration<?> getParameterNames() {
|
public Enumeration<String> getParameterNames() {
|
||||||
return Collections.enumeration(new HashSet<>(parameters.keySet()));
|
return Collections.enumeration(new HashSet<>(parameters.keySet()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.jena.JenaOutputUtils;
|
import edu.cornell.mannlib.vitro.webapp.utils.jena.JenaOutputUtils;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.ContentType;
|
import edu.cornell.mannlib.vitro.webapp.web.ContentType;
|
||||||
|
|
||||||
|
@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());
|
||||||
|
|
||||||
|
@ -56,8 +58,7 @@ public class OntologyController extends VitroHttpServlet{
|
||||||
|
|
||||||
if( rdfFormat != null ){
|
if( rdfFormat != null ){
|
||||||
doRdf(req, res, rdfFormat );
|
doRdf(req, res, rdfFormat );
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Pattern RDF_REQUEST = Pattern.compile("^/ontology/([^/]*)/([^/]*).rdf$");
|
private static Pattern RDF_REQUEST = Pattern.compile("^/ontology/([^/]*)/([^/]*).rdf$");
|
||||||
|
@ -157,8 +158,7 @@ public class OntologyController extends VitroHttpServlet{
|
||||||
if( ! found ){
|
if( ! found ){
|
||||||
//respond to HTTP outside of critical section
|
//respond to HTTP outside of critical section
|
||||||
doNotFound(req,res);
|
doNotFound(req,res);
|
||||||
return;
|
} else {
|
||||||
} else {
|
|
||||||
JenaOutputUtils.setNameSpacePrefixes(newModel,vreq.getWebappDaoFactory());
|
JenaOutputUtils.setNameSpacePrefixes(newModel,vreq.getWebappDaoFactory());
|
||||||
res.setContentType(rdfFormat.getMediaType());
|
res.setContentType(rdfFormat.getMediaType());
|
||||||
String format = "";
|
String format = "";
|
||||||
|
@ -169,8 +169,7 @@ public class OntologyController extends VitroHttpServlet{
|
||||||
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 );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.HashMap;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
|
||||||
* This servlet works as a RequestDispatcher to direct to the sparl query builder page.
|
* This servlet works as a RequestDispatcher to direct to the sparl query builder page.
|
||||||
* @author yuysun
|
* @author yuysun
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "SparlQueryBuilder", urlPatterns = {"/admin/sparqlquerybuilder"})
|
||||||
public class SparqlQueryBuilderServlet extends BaseEditController {
|
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());
|
||||||
|
@ -85,7 +87,6 @@ public class SparqlQueryBuilderServlet extends BaseEditController {
|
||||||
}
|
}
|
||||||
|
|
||||||
doHelp(request,response);
|
doHelp(request,response);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doNoModelInContext(HttpServletRequest request, HttpServletResponse res){
|
private void doNoModelInContext(HttpServletRequest request, HttpServletResponse res){
|
||||||
|
|
|
@ -205,7 +205,7 @@ public class VitroHttpServlet extends HttpServlet implements MultipartRequestWra
|
||||||
|
|
||||||
protected void sortForPickList(List<? extends ResourceBean> beans,
|
protected void sortForPickList(List<? extends ResourceBean> beans,
|
||||||
VitroRequest vreq) {
|
VitroRequest vreq) {
|
||||||
Collections.sort(beans, new PickListSorter(vreq));
|
beans.sort(new PickListSorter(vreq));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class PickListSorter implements Comparator<ResourceBean> {
|
protected class PickListSorter implements Comparator<ResourceBean> {
|
||||||
|
|
|
@ -60,12 +60,12 @@ public abstract class UserAccountsPage extends AbstractPageHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(list, new Comparator<PermissionSet>() {
|
list.sort(new Comparator<PermissionSet>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(PermissionSet ps1, PermissionSet ps2) {
|
public int compare(PermissionSet ps1, PermissionSet ps2) {
|
||||||
return ps1.getUri().compareTo(ps2.getUri());
|
return ps1.getUri().compareTo(ps2.getUri());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,13 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServ
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parcel out the different actions required of the Administrators portion of
|
* Parcel out the different actions required of the Administrators portion of
|
||||||
* the UserAccounts GUI.
|
* the UserAccounts GUI.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "AccountsAdmin", urlPatterns = {"/accountsAdmin/*"} )
|
||||||
public class UserAccountsAdminController extends FreemarkerHttpServlet {
|
public class UserAccountsAdminController extends FreemarkerHttpServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(UserAccountsAdminController.class);
|
.getLog(UserAccountsAdminController.class);
|
||||||
|
|
|
@ -127,8 +127,7 @@ public class UserAccountsEditPage extends UserAccountsPage {
|
||||||
+ "but is not authorized to do so. Logged in as: "
|
+ "but is not authorized to do so. Logged in as: "
|
||||||
+ LoginStatusBean.getCurrentUser(vreq));
|
+ LoginStatusBean.getCurrentUser(vreq));
|
||||||
bogusMessage = getBogusStandardMessage(vreq);
|
bogusMessage = getBogusStandardMessage(vreq);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@ import java.util.List;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
|
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
|
||||||
|
@ -56,7 +56,7 @@ class ExternalAuthChecker extends AbstractAjaxResponder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prepareResponse() throws IOException, JSONException {
|
public String prepareResponse() throws IOException {
|
||||||
if (someoneElseIsUsingThisExternalAuthId()) {
|
if (someoneElseIsUsingThisExternalAuthId()) {
|
||||||
return respondExternalAuthIdAlreadyUsed();
|
return respondExternalAuthIdAlreadyUsed();
|
||||||
}
|
}
|
||||||
|
@ -93,8 +93,8 @@ class ExternalAuthChecker extends AbstractAjaxResponder {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String respondExternalAuthIdAlreadyUsed() throws JSONException {
|
private String respondExternalAuthIdAlreadyUsed() {
|
||||||
JSONObject jsonObject = new JSONObject();
|
ObjectNode jsonObject = JsonNodeFactory.instance.objectNode();
|
||||||
jsonObject.put(RESPONSE_ID_IN_USE, true);
|
jsonObject.put(RESPONSE_ID_IN_USE, true);
|
||||||
return jsonObject.toString();
|
return jsonObject.toString();
|
||||||
}
|
}
|
||||||
|
@ -110,12 +110,12 @@ class ExternalAuthChecker extends AbstractAjaxResponder {
|
||||||
this.matchingProfile = inds.get(0);
|
this.matchingProfile = inds.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String respondWithMatchingProfile() throws JSONException {
|
private String respondWithMatchingProfile() {
|
||||||
String uri = matchingProfile.getURI();
|
String uri = matchingProfile.getURI();
|
||||||
String url = UrlBuilder.getIndividualProfileUrl(uri, vreq);
|
String url = UrlBuilder.getIndividualProfileUrl(uri, vreq);
|
||||||
String label = matchingProfile.getRdfsLabel();
|
String label = matchingProfile.getRdfsLabel();
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
ObjectNode jsonObject = JsonNodeFactory.instance.objectNode();
|
||||||
jsonObject.put(RESPONSE_MATCHES_PROFILE, true);
|
jsonObject.put(RESPONSE_MATCHES_PROFILE, true);
|
||||||
jsonObject.put(RESPONSE_PROFILE_URI, uri);
|
jsonObject.put(RESPONSE_PROFILE_URI, uri);
|
||||||
jsonObject.put(RESPONSE_PROFILE_URL, url);
|
jsonObject.put(RESPONSE_PROFILE_URL, url);
|
||||||
|
|
|
@ -20,7 +20,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import org.apache.jena.ontology.OntModel;
|
import org.apache.jena.ontology.OntModel;
|
||||||
import org.apache.jena.query.Query;
|
import org.apache.jena.query.Query;
|
||||||
|
@ -107,7 +106,7 @@ class ProfileAutoCompleter extends AbstractAjaxResponder implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prepareResponse() throws IOException, JSONException {
|
public String prepareResponse() throws IOException {
|
||||||
if (term.isEmpty()) {
|
if (term.isEmpty()) {
|
||||||
return EMPTY_RESPONSE;
|
return EMPTY_RESPONSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.accounts.admin.ajax;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -18,6 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.ajax.VitroAjaxController;
|
||||||
/**
|
/**
|
||||||
* Handle the AJAX functions that are specific to the UserAccounts pages.
|
* Handle the AJAX functions that are specific to the UserAccounts pages.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "AccountsAjax", urlPatterns = {"/accountsAjax/*"} )
|
||||||
public class UserAccountsAjaxController extends VitroAjaxController {
|
public class UserAccountsAjaxController extends VitroAjaxController {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(UserAccountsAjaxController.class);
|
.getLog(UserAccountsAjaxController.class);
|
||||||
|
|
|
@ -15,9 +15,12 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServ
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parcel out the different actions required of the ManageProxies GUI.
|
* Parcel out the different actions required of the ManageProxies GUI.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "ManageProxies", urlPatterns = {"/manageProxies/*"} )
|
||||||
public class ManageProxiesController extends FreemarkerHttpServlet {
|
public class ManageProxiesController extends FreemarkerHttpServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(ManageProxiesController.class);
|
.getLog(ManageProxiesController.class);
|
||||||
|
|
|
@ -19,7 +19,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
|
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
|
||||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||||
|
@ -80,7 +79,7 @@ public class BasicProfilesGetter extends AbstractAjaxResponder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prepareResponse() throws IOException, JSONException {
|
public String prepareResponse() throws IOException {
|
||||||
log.debug("search term is '" + term + "'");
|
log.debug("search term is '" + term + "'");
|
||||||
if (this.term.isEmpty() || this.profileTypes.isEmpty()) {
|
if (this.term.isEmpty() || this.profileTypes.isEmpty()) {
|
||||||
return EMPTY_RESPONSE;
|
return EMPTY_RESPONSE;
|
||||||
|
|
|
@ -11,10 +11,9 @@ import java.util.Map;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import org.apache.jena.ontology.OntModel;
|
import org.apache.jena.ontology.OntModel;
|
||||||
import org.apache.jena.query.QuerySolution;
|
import org.apache.jena.query.QuerySolution;
|
||||||
|
@ -68,7 +67,7 @@ public class BasicProxiesGetter extends AbstractAjaxResponder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prepareResponse() throws IOException, JSONException {
|
public String prepareResponse() throws IOException {
|
||||||
log.debug("search term is '" + term + "'");
|
log.debug("search term is '" + term + "'");
|
||||||
if (term.isEmpty()) {
|
if (term.isEmpty()) {
|
||||||
return EMPTY_RESPONSE;
|
return EMPTY_RESPONSE;
|
||||||
|
@ -76,7 +75,7 @@ public class BasicProxiesGetter extends AbstractAjaxResponder {
|
||||||
String cleanTerm = SparqlQueryUtils.escapeForRegex(term);
|
String cleanTerm = SparqlQueryUtils.escapeForRegex(term);
|
||||||
String queryStr = QUERY_BASIC_PROXIES.replace("%term%", cleanTerm);
|
String queryStr = QUERY_BASIC_PROXIES.replace("%term%", cleanTerm);
|
||||||
|
|
||||||
JSONArray jsonArray = SparqlQueryRunner
|
ArrayNode jsonArray = SparqlQueryRunner
|
||||||
.createSelectQueryContext(userAccountsModel, queryStr)
|
.createSelectQueryContext(userAccountsModel, queryStr)
|
||||||
.execute()
|
.execute()
|
||||||
.parse(new BasicProxyInfoParser(placeholderImageUrl));
|
.parse(new BasicProxyInfoParser(placeholderImageUrl));
|
||||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.accounts.manageproxies.ajax;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -18,6 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.ajax.VitroAjaxController;
|
||||||
/**
|
/**
|
||||||
* Handle the AJAX functions that are specific to the ManageProxies pages.
|
* Handle the AJAX functions that are specific to the ManageProxies pages.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "ProxiesAjax", urlPatterns = {"/proxiesAjax/*"} )
|
||||||
public class ManageProxiesAjaxController extends VitroAjaxController {
|
public class ManageProxiesAjaxController extends VitroAjaxController {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(ManageProxiesAjaxController.class);
|
.getLog(ManageProxiesAjaxController.class);
|
||||||
|
|
|
@ -9,10 +9,11 @@ import java.util.Map;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
@ -42,7 +43,7 @@ public class MoreProfileInfo extends AbstractAjaxResponder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prepareResponse() throws IOException, JSONException {
|
public String prepareResponse() throws IOException {
|
||||||
log.debug("profile URI is '" + profileUri + "'");
|
log.debug("profile URI is '" + profileUri + "'");
|
||||||
if (profileUri.isEmpty()) {
|
if (profileUri.isEmpty()) {
|
||||||
return EMPTY_RESPONSE;
|
return EMPTY_RESPONSE;
|
||||||
|
@ -58,8 +59,12 @@ public class MoreProfileInfo extends AbstractAjaxResponder {
|
||||||
map.put("imageUrl", getFullImageUrl(profileInd));
|
map.put("imageUrl", getFullImageUrl(profileInd));
|
||||||
map.put("classLabel", getMostSpecificTypeLabel(profileInd.getURI()));
|
map.put("classLabel", getMostSpecificTypeLabel(profileInd.getURI()));
|
||||||
|
|
||||||
JSONArray jsonArray = new JSONArray();
|
ArrayNode jsonArray = JsonNodeFactory.instance.arrayNode();
|
||||||
jsonArray.put(map);
|
ObjectNode jsonObj = JsonNodeFactory.instance.objectNode();
|
||||||
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
|
jsonObj.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
jsonArray.add(jsonObj);
|
||||||
String response = jsonArray.toString();
|
String response = jsonArray.toString();
|
||||||
|
|
||||||
log.debug("response is '" + response + "'");
|
log.debug("response is '" + response + "'");
|
||||||
|
|
|
@ -10,10 +10,11 @@ import java.util.Map;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
|
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
|
||||||
|
@ -47,7 +48,7 @@ public class MoreProxyInfo extends AbstractAjaxResponder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prepareResponse() throws IOException, JSONException {
|
public String prepareResponse() throws IOException {
|
||||||
log.debug("proxy URI is '" + proxyUri + "'");
|
log.debug("proxy URI is '" + proxyUri + "'");
|
||||||
if (proxyUri.isEmpty()) {
|
if (proxyUri.isEmpty()) {
|
||||||
return EMPTY_RESPONSE;
|
return EMPTY_RESPONSE;
|
||||||
|
@ -74,8 +75,12 @@ public class MoreProxyInfo extends AbstractAjaxResponder {
|
||||||
}
|
}
|
||||||
map.put("classLabel", getMostSpecificTypeLabel(profileInd.getURI()));
|
map.put("classLabel", getMostSpecificTypeLabel(profileInd.getURI()));
|
||||||
|
|
||||||
JSONArray jsonArray = new JSONArray();
|
ArrayNode jsonArray = JsonNodeFactory.instance.arrayNode();
|
||||||
jsonArray.put(map);
|
ObjectNode jsonObj = JsonNodeFactory.instance.objectNode();
|
||||||
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
|
jsonObj.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
jsonArray.add(jsonObj);
|
||||||
String response = jsonArray.toString();
|
String response = jsonArray.toString();
|
||||||
|
|
||||||
log.debug("response is '" + response + "'");
|
log.debug("response is '" + response + "'");
|
||||||
|
|
|
@ -126,8 +126,7 @@ public class UserAccountsFirstTimeExternalPage extends UserAccountsPage {
|
||||||
}
|
}
|
||||||
if (!Authenticator.getInstance(vreq).isUserPermittedToLogin(null)) {
|
if (!Authenticator.getInstance(vreq).isUserPermittedToLogin(null)) {
|
||||||
bogusMessage = i18n.text("logins_disabled_for_maintenance");
|
bogusMessage = i18n.text("logins_disabled_for_maintenance");
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBogus() {
|
public boolean isBogus() {
|
||||||
|
|
|
@ -121,8 +121,7 @@ public abstract class UserAccountsPasswordBasePage extends UserAccountsPage {
|
||||||
+ "' when already logged in as '" + currentUserEmail
|
+ "' when already logged in as '" + currentUserEmail
|
||||||
+ "'");
|
+ "'");
|
||||||
bogusMessage = alreadyLoggedInMessage(currentUserEmail);
|
bogusMessage = alreadyLoggedInMessage(currentUserEmail);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.accounts.user;
|
||||||
import static edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource.EXTERNAL;
|
import static edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource.EXTERNAL;
|
||||||
import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest.AUTHORIZED;
|
import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest.AUTHORIZED;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -26,6 +27,7 @@ import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||||
/**
|
/**
|
||||||
* Parcel out the different actions required of the UserAccounts GUI.
|
* Parcel out the different actions required of the UserAccounts GUI.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "AccountsUser", urlPatterns = {"/accounts/*"} )
|
||||||
public class UserAccountsUserController extends FreemarkerHttpServlet {
|
public class UserAccountsUserController extends FreemarkerHttpServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(UserAccountsUserController.class);
|
.getLog(UserAccountsUserController.class);
|
||||||
|
|
|
@ -18,10 +18,13 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Res
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offer the user the ability to apply a RestrictedAuthenticator or revert to a
|
* Offer the user the ability to apply a RestrictedAuthenticator or revert to a
|
||||||
* BasicAuthenticator.
|
* BasicAuthenticator.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "RestrictLogins", urlPatterns = {"/admin/restrictLogins"} )
|
||||||
public class RestrictLoginsController extends FreemarkerHttpServlet {
|
public class RestrictLoginsController extends FreemarkerHttpServlet {
|
||||||
public static final String PARAMETER_RESTRICT = "restrict";
|
public static final String PARAMETER_RESTRICT = "restrict";
|
||||||
public static final String PARAMETER_OPEN = "open";
|
public static final String PARAMETER_OPEN = "open";
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories;
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories;
|
||||||
|
@ -36,6 +37,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
|
||||||
* Show a summary of who is logged in and how they are to be treated by the
|
* Show a summary of who is logged in and how they are to be treated by the
|
||||||
* authorization system.
|
* authorization system.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "ShowAuth", urlPatterns = {"/admin/showAuth"} )
|
||||||
public class ShowAuthController extends FreemarkerHttpServlet {
|
public class ShowAuthController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,10 +17,13 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Res
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.threads.VitroBackgroundThread;
|
import edu.cornell.mannlib.vitro.webapp.utils.threads.VitroBackgroundThread;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the list of living background threads (instances of
|
* Show the list of living background threads (instances of
|
||||||
* VitroBackgroundThread), and their status.
|
* VitroBackgroundThread), and their status.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "ShowBackgroundThreads", urlPatterns = {"/admin/showThreads"} )
|
||||||
public class ShowBackgroundThreadsController extends FreemarkerHttpServlet {
|
public class ShowBackgroundThreadsController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
private static final String TEMPLATE_NAME = "admin-showThreads.ftl";
|
private static final String TEMPLATE_NAME = "admin-showThreads.ftl";
|
||||||
|
|
|
@ -16,9 +16,12 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServ
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the current ConfigurationProperties and the Java system properties.
|
* Show the current ConfigurationProperties and the Java system properties.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "ShowConfiguration", urlPatterns = {"/admin/showConfiguration"} )
|
||||||
public class ShowConfiguration extends FreemarkerHttpServlet {
|
public class ShowConfiguration extends FreemarkerHttpServlet {
|
||||||
@Override
|
@Override
|
||||||
protected AuthorizationRequest requiredActions(VitroRequest vreq) {
|
protected AuthorizationRequest requiredActions(VitroRequest vreq) {
|
||||||
|
|
|
@ -34,6 +34,8 @@ import edu.cornell.mannlib.vitro.webapp.modelaccess.RequestModelAccess;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.logging.ComplexStringFormatter;
|
import edu.cornell.mannlib.vitro.webapp.utils.logging.ComplexStringFormatter;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.logging.ToString;
|
import edu.cornell.mannlib.vitro.webapp.utils.logging.ToString;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the details of where our RDF data is coming from. What are the
|
* Show the details of where our RDF data is coming from. What are the
|
||||||
* structures that supply the triples?
|
* structures that supply the triples?
|
||||||
|
@ -103,6 +105,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.logging.ToString;
|
||||||
* At the same time, write these to the log as INFO messages, without the fancy formatting.
|
* At the same time, write these to the log as INFO messages, without the fancy formatting.
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "ShowRDFSources", urlPatterns = {"/admin/showSources"} )
|
||||||
public class ShowSourcesController extends FreemarkerHttpServlet {
|
public class ShowSourcesController extends FreemarkerHttpServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(ShowSourcesController.class);
|
.getLog(ShowSourcesController.class);
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.sparql.SparqlQueryUtils;
|
||||||
/**
|
/**
|
||||||
* Present the SPARQL Query form, and execute the queries.
|
* Present the SPARQL Query form, and execute the queries.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "SparqlQuery", urlPatterns = {"/admin/sparqlquery"})
|
||||||
public class SparqlQueryController extends FreemarkerHttpServlet {
|
public class SparqlQueryController extends FreemarkerHttpServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(SparqlQueryController.class);
|
.getLog(SparqlQueryController.class);
|
||||||
|
|
|
@ -14,9 +14,12 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
|
||||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||||
import edu.cornell.mannlib.vitro.webapp.startup.StartupStatus;
|
import edu.cornell.mannlib.vitro.webapp.startup.StartupStatus;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the startup status page.
|
* Display the startup status page.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "StartupStatus", urlPatterns = {"/startupStatus"} )
|
||||||
public class StartupStatusController extends FreemarkerHttpServlet {
|
public class StartupStatusController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.threads.VitroBackgroundThread.Work
|
||||||
*
|
*
|
||||||
* Otherwise, the result will be 200 (OK), with a brief message.
|
* Otherwise, the result will be 200 (OK), with a brief message.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "WaitForBackgroundThreads", urlPatterns = {"/admin/wait"} )
|
||||||
public class WaitForBackgroundThreadsController extends VitroHttpServlet {
|
public class WaitForBackgroundThreadsController extends VitroHttpServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(WaitForBackgroundThreadsController.class);
|
.getLog(WaitForBackgroundThreadsController.class);
|
||||||
|
|
|
@ -13,10 +13,11 @@ import java.util.Map;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import org.apache.jena.query.QuerySolution;
|
import org.apache.jena.query.QuerySolution;
|
||||||
import org.apache.jena.query.ResultSet;
|
import org.apache.jena.query.ResultSet;
|
||||||
|
@ -59,8 +60,7 @@ public abstract class AbstractAjaxResponder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract String prepareResponse() throws IOException,
|
protected abstract String prepareResponse() throws IOException;
|
||||||
JSONException;
|
|
||||||
|
|
||||||
protected String getStringParameter(String key, String defaultValue) {
|
protected String getStringParameter(String key, String defaultValue) {
|
||||||
String value = vreq.getParameter(key);
|
String value = vreq.getParameter(key);
|
||||||
|
@ -81,9 +81,13 @@ public abstract class AbstractAjaxResponder {
|
||||||
* objects with fields.
|
* objects with fields.
|
||||||
*/
|
*/
|
||||||
protected String assembleJsonResponse(List<Map<String, String>> maps) {
|
protected String assembleJsonResponse(List<Map<String, String>> maps) {
|
||||||
JSONArray jsonArray = new JSONArray();
|
ArrayNode jsonArray = JsonNodeFactory.instance.arrayNode();
|
||||||
for (Map<String, String> map : maps) {
|
for (Map<String, String> map : maps) {
|
||||||
jsonArray.put(map);
|
ObjectNode jsonObj = JsonNodeFactory.instance.objectNode();
|
||||||
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
|
jsonObj.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
jsonArray.add(jsonObj);
|
||||||
}
|
}
|
||||||
return jsonArray.toString();
|
return jsonArray.toString();
|
||||||
}
|
}
|
||||||
|
@ -93,19 +97,23 @@ public abstract class AbstractAjaxResponder {
|
||||||
* implement "parseSolutionRow()"
|
* implement "parseSolutionRow()"
|
||||||
*/
|
*/
|
||||||
protected abstract static class JsonArrayParser extends
|
protected abstract static class JsonArrayParser extends
|
||||||
ResultSetParser<JSONArray> {
|
ResultSetParser<ArrayNode> {
|
||||||
@Override
|
@Override
|
||||||
protected JSONArray defaultValue() {
|
protected ArrayNode defaultValue() {
|
||||||
return new JSONArray();
|
return JsonNodeFactory.instance.arrayNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected JSONArray parseResults(String queryStr, ResultSet results) {
|
protected ArrayNode parseResults(String queryStr, ResultSet results) {
|
||||||
JSONArray jsonArray = new JSONArray();
|
ArrayNode jsonArray = JsonNodeFactory.instance.arrayNode();
|
||||||
while (results.hasNext()) {
|
while (results.hasNext()) {
|
||||||
Map<String, String> map = parseSolutionRow(results.next());
|
Map<String, String> map = parseSolutionRow(results.next());
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
jsonArray.put(map);
|
ObjectNode jsonObj = JsonNodeFactory.instance.objectNode();
|
||||||
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
|
jsonObj.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
jsonArray.add(jsonObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return jsonArray;
|
return jsonArray;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
||||||
*
|
*
|
||||||
* The result is delivered in JSON format.
|
* The result is delivered in JSON format.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "ajaxSparqlQuery", urlPatterns = {"/ajax/sparqlQuery"} )
|
||||||
public class SparqlQueryAjaxController extends VitroAjaxController {
|
public class SparqlQueryAjaxController extends VitroAjaxController {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(SparqlQueryAjaxController.class);
|
.getLog(SparqlQueryAjaxController.class);
|
||||||
|
@ -59,8 +61,7 @@ public class SparqlQueryAjaxController extends VitroAjaxController {
|
||||||
String queryParam = locateQueryParam(vreq);
|
String queryParam = locateQueryParam(vreq);
|
||||||
Query query = SparqlUtils.createQuery(queryParam);
|
Query query = SparqlUtils.createQuery(queryParam);
|
||||||
SparqlUtils.executeQuery(response, query, model);
|
SparqlUtils.executeQuery(response, query, model);
|
||||||
return;
|
} catch (AjaxControllerException e) {
|
||||||
} catch (AjaxControllerException e) {
|
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
response.sendError(e.getStatusCode());
|
response.sendError(e.getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import static javax.servlet.http.HttpServletResponse.SC_NOT_ACCEPTABLE;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -40,6 +41,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.http.NotAcceptableException;
|
||||||
* 500 Unknown error
|
* 500 Unknown error
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "SparqlQueryApi", urlPatterns = {"/api/sparqlQuery"})
|
||||||
public class SparqlQueryApiController extends VitroApiServlet {
|
public class SparqlQueryApiController extends VitroApiServlet {
|
||||||
|
|
||||||
private static final AuthorizationRequest REQUIRED_ACTIONS = SimplePermission.USE_SPARQL_QUERY_API.ACTION;
|
private static final AuthorizationRequest REQUIRED_ACTIONS = SimplePermission.USE_SPARQL_QUERY_API.ACTION;
|
||||||
|
|
|
@ -9,8 +9,8 @@ import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ import edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer;
|
||||||
* 500 Unknown error
|
* 500 Unknown error
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "SparqlUpdateApi", urlPatterns = {"/api/sparqlUpdate"})
|
||||||
public class SparqlUpdateApiController extends VitroApiServlet {
|
public class SparqlUpdateApiController extends VitroApiServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(SparqlUpdateApiController.class);
|
.getLog(SparqlUpdateApiController.class);
|
||||||
|
@ -81,11 +82,11 @@ public class SparqlUpdateApiController extends VitroApiServlet {
|
||||||
throw new ParseException("No 'update' parameter.");
|
throw new ParseException("No 'update' parameter.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StringUtils.containsIgnoreCase(update, "GRAPH")) {
|
if (!StringUtils.containsIgnoreCase(update, "GRAPH") && !StringUtils.containsIgnoreCase(update, "WITH")) {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("No GRAPH uri in '" + update + "'");
|
log.debug("No GRAPH or WITH uri in '" + update + "'");
|
||||||
}
|
}
|
||||||
throw new ParseException("SPARQL update must specify a GRAPH URI.");
|
throw new ParseException("SPARQL update must specify a GRAPH ( or WITH) URI.");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -5,7 +5,6 @@ package edu.cornell.mannlib.vitro.webapp.controller.api.sparqlquery;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
|
@ -23,6 +23,8 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Red
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide a "hidden" login page for systems where the Login Widget has been
|
* Provide a "hidden" login page for systems where the Login Widget has been
|
||||||
* modified to only show the link to an External Authentication system.
|
* modified to only show the link to an External Authentication system.
|
||||||
|
@ -30,6 +32,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
|
||||||
* This page is only hidden because there is no link to it. Anyone who knows the
|
* This page is only hidden because there is no link to it. Anyone who knows the
|
||||||
* URL can come here, but they need to pass Internal Authentication to proceed.
|
* URL can come here, but they need to pass Internal Authentication to proceed.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "adminLogin", urlPatterns = {"/admin/login"})
|
||||||
public class AdminLoginController extends FreemarkerHttpServlet {
|
public class AdminLoginController extends FreemarkerHttpServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(AdminLoginController.class);
|
.getLog(AdminLoginController.class);
|
||||||
|
|
|
@ -197,11 +197,7 @@ public abstract class Authenticator {
|
||||||
|
|
||||||
// InternetAddress permits a localname without hostname.
|
// InternetAddress permits a localname without hostname.
|
||||||
// Guard against that.
|
// Guard against that.
|
||||||
if (emailAddress.indexOf('@') == -1) {
|
return emailAddress.indexOf('@') != -1;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (AddressException e) {
|
} catch (AddressException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.io.IOException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean.Messag
|
||||||
* Handle the return from the external authorization login server. If we are
|
* Handle the return from the external authorization login server. If we are
|
||||||
* successful, record the login. Otherwise, display the failure.
|
* successful, record the login. Otherwise, display the failure.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "loginExternalAuthReturn", urlPatterns = {"/loginExternalAuthReturn"})
|
||||||
public class LoginExternalAuthReturn extends BaseLoginServlet {
|
public class LoginExternalAuthReturn extends BaseLoginServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(LoginExternalAuthReturn.class);
|
.getLog(LoginExternalAuthReturn.class);
|
||||||
|
@ -102,14 +104,12 @@ public class LoginExternalAuthReturn extends BaseLoginServlet {
|
||||||
getAuthenticator(req).recordLoginAgainstUserAccount(userAccount,
|
getAuthenticator(req).recordLoginAgainstUserAccount(userAccount,
|
||||||
AuthenticationSource.EXTERNAL);
|
AuthenticationSource.EXTERNAL);
|
||||||
new LoginRedirector(req, afterLoginUrl).redirectLoggedInUser(resp);
|
new LoginRedirector(req, afterLoginUrl).redirectLoggedInUser(resp);
|
||||||
return;
|
} catch (LoginNotPermitted e) {
|
||||||
} catch (LoginNotPermitted e) {
|
|
||||||
// should have been caught by isUserPermittedToLogin()
|
// should have been caught by isUserPermittedToLogin()
|
||||||
log.debug("Logins disabled for " + userAccount);
|
log.debug("Logins disabled for " + userAccount);
|
||||||
complainAndReturnToReferrer(req, resp, ATTRIBUTE_REFERRER,
|
complainAndReturnToReferrer(req, resp, ATTRIBUTE_REFERRER,
|
||||||
messageLoginDisabled(req));
|
messageLoginDisabled(req));
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.io.IOException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean;
|
||||||
* Send a request to the external authorization server that will return us to
|
* Send a request to the external authorization server that will return us to
|
||||||
* the LoginExternalAuthReturn servlet for further processing.
|
* the LoginExternalAuthReturn servlet for further processing.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "loginExternalAuthSetup", urlPatterns = {"/loginExternalAuth"})
|
||||||
public class LoginExternalAuthSetup extends BaseLoginServlet {
|
public class LoginExternalAuthSetup extends BaseLoginServlet {
|
||||||
private static final Log log = LogFactory
|
private static final Log log = LogFactory
|
||||||
.getLog(LoginExternalAuthSetup.class);
|
.getLog(LoginExternalAuthSetup.class);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -24,6 +25,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator.Lo
|
||||||
* Provide a means for programmatic login If they provide the right parameters,
|
* Provide a means for programmatic login If they provide the right parameters,
|
||||||
* log them in and send 200. Otherwise, send 403 error.
|
* log them in and send 200. Otherwise, send 403 error.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "programLogin", urlPatterns = {"/programLogin"})
|
||||||
public class ProgramLogin extends HttpServlet {
|
public class ProgramLogin extends HttpServlet {
|
||||||
private static final Log log = LogFactory.getLog(ProgramLogin.class);
|
private static final Log log = LogFactory.getLog(ProgramLogin.class);
|
||||||
|
|
||||||
|
@ -142,8 +144,7 @@ public class ProgramLogin extends HttpServlet {
|
||||||
}
|
}
|
||||||
recordLoginWithPasswordChange();
|
recordLoginWithPasswordChange();
|
||||||
sendSuccess(MESSAGE_SUCCESS_FIRST_TIME);
|
sendSuccess(MESSAGE_SUCCESS_FIRST_TIME);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.datatools.dumprestore;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.json.JsonObject;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import javax.json.JsonString;
|
|
||||||
|
|
||||||
import org.apache.jena.atlas.lib.EscapeStr;
|
import org.apache.jena.atlas.lib.EscapeStr;
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ import org.apache.jena.atlas.lib.EscapeStr;
|
||||||
* able to write to a different format.
|
* able to write to a different format.
|
||||||
*/
|
*/
|
||||||
public abstract class DumpNode {
|
public abstract class DumpNode {
|
||||||
public static DumpNode fromJson(JsonObject json) throws BadNodeException {
|
public static DumpNode fromJson(JsonNode json) throws BadNodeException {
|
||||||
if (json == null) {
|
if (json == null) {
|
||||||
return new DumpNullNode();
|
return new DumpNullNode();
|
||||||
}
|
}
|
||||||
|
@ -74,9 +73,9 @@ public abstract class DumpNode {
|
||||||
return (s == null) ? null : EscapeStr.unescapeStr(s);
|
return (s == null) ? null : EscapeStr.unescapeStr(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getString(JsonObject json, String name) {
|
private static String getString(JsonNode json, String name) {
|
||||||
JsonString jsString = json.getJsonString(name);
|
JsonNode node = json.get(name);
|
||||||
return (jsString == null) ? null : json.getString(name);
|
return node == null ? null : node.asText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getValue();
|
public abstract String getValue();
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
package edu.cornell.mannlib.vitro.webapp.controller.datatools.dumprestore;
|
package edu.cornell.mannlib.vitro.webapp.controller.datatools.dumprestore;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServ
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService.ResultFormat;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
|
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +34,7 @@ import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
|
||||||
* The first request, the selection and the redirected dump should all be GET
|
* The first request, the selection and the redirected dump should all be GET
|
||||||
* requests. A restore should be a POST request.
|
* requests. A restore should be a POST request.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "DumpRestoreController", urlPatterns = {"/dumpRestore/*"} )
|
||||||
public class DumpRestoreController extends FreemarkerHttpServlet {
|
public class DumpRestoreController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
private static final RequestedAction REQUIRED_ACTION = SimplePermission.USE_ADVANCED_DATA_TOOLS_PAGES.ACTION;
|
private static final RequestedAction REQUIRED_ACTION = SimplePermission.USE_ADVANCED_DATA_TOOLS_PAGES.ACTION;
|
||||||
|
|
|
@ -95,11 +95,7 @@ class NQuadLineSplitter {
|
||||||
while (!atEnd() && isWhiteSpace()) {
|
while (!atEnd() && isWhiteSpace()) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (atEnd()) {
|
if (!atEnd() && line.charAt(i) != '#') {
|
||||||
return;
|
|
||||||
} else if (line.charAt(i) == '#') {
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
throw new BadNodeException(
|
throw new BadNodeException(
|
||||||
"Period was not followed by end of line: '" + line + "'");
|
"Period was not followed by end of line: '" + line + "'");
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
@ -42,6 +43,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean.State;
|
||||||
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.LoginLogoutEvent;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.LoginLogoutEvent;
|
||||||
|
|
||||||
|
@WebServlet(name = "authenticate", urlPatterns = {"/authenticate"})
|
||||||
public class Authenticate extends VitroHttpServlet {
|
public class Authenticate extends VitroHttpServlet {
|
||||||
private static final Log log = LogFactory.getLog(Authenticate.class
|
private static final Log log = LogFactory.getLog(Authenticate.class
|
||||||
.getName());
|
.getName());
|
||||||
|
@ -349,8 +351,7 @@ public class Authenticate extends VitroHttpServlet {
|
||||||
// This should have been caught by isUserPermittedToLogin()
|
// This should have been caught by isUserPermittedToLogin()
|
||||||
bean.setMessage(request, ERROR,
|
bean.setMessage(request, ERROR,
|
||||||
"logins_disabled_for_maintenance");
|
"logins_disabled_for_maintenance");
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,8 +412,7 @@ public class Authenticate extends VitroHttpServlet {
|
||||||
} catch (LoginNotPermitted e) {
|
} catch (LoginNotPermitted e) {
|
||||||
// This should have been caught by isUserPermittedToLogin()
|
// This should have been caught by isUserPermittedToLogin()
|
||||||
bean.setMessage(request, ERROR, "logins_disabled_for_maintenance");
|
bean.setMessage(request, ERROR, "logins_disabled_for_maintenance");
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -495,8 +495,7 @@ public class Authenticate extends VitroHttpServlet {
|
||||||
String loginProcessPage = LoginProcessBean.getBean(vreq)
|
String loginProcessPage = LoginProcessBean.getBean(vreq)
|
||||||
.getLoginPageUrl();
|
.getLoginPageUrl();
|
||||||
response.sendRedirect(loginProcessPage);
|
response.sendRedirect(loginProcessPage);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit: user has completed the login. Redirect appropriately and clear the
|
* Exit: user has completed the login. Redirect appropriately and clear the
|
||||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.Classes2Classes;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||||
|
|
||||||
|
@WebServlet(name = "Classes2ClassesOperationController", urlPatterns = {"/classes2ClassesOp"} )
|
||||||
public class Classes2ClassesOperationController extends BaseEditController {
|
public class Classes2ClassesOperationController extends BaseEditController {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(Classes2ClassesOperationController.class.getName());
|
private static final Log log = LogFactory.getLog(Classes2ClassesOperationController.class.getName());
|
||||||
|
@ -70,48 +72,60 @@ public class Classes2ClassesOperationController extends BaseEditController {
|
||||||
if ((subclassURIstrs != null) && (subclassURIstrs.length > 1)) {
|
if ((subclassURIstrs != null) && (subclassURIstrs.length > 1)) {
|
||||||
String superclassURIstr = request.getParameter("SuperclassURI");
|
String superclassURIstr = request.getParameter("SuperclassURI");
|
||||||
if (superclassURIstr != null) {
|
if (superclassURIstr != null) {
|
||||||
for (int i=0; i<subclassURIstrs.length; i++) {
|
for (String subclassURIstr : subclassURIstrs) {
|
||||||
if (modeStr.equals("disjointWith")) {
|
switch (modeStr) {
|
||||||
vcDao.removeDisjointWithClass(superclassURIstr, subclassURIstrs[i]);
|
case "disjointWith":
|
||||||
} else if (modeStr.equals("equivalentClass")) {
|
vcDao.removeDisjointWithClass(superclassURIstr, subclassURIstr);
|
||||||
vcDao.removeEquivalentClass(superclassURIstr, subclassURIstrs[i]);
|
break;
|
||||||
} else {
|
case "equivalentClass":
|
||||||
Classes2Classes c2c = new Classes2Classes();
|
vcDao.removeEquivalentClass(superclassURIstr, subclassURIstr);
|
||||||
c2c.setSubclassURI(subclassURIstrs[i]);
|
break;
|
||||||
c2c.setSuperclassURI(superclassURIstr);
|
default:
|
||||||
vcDao.deleteClasses2Classes(c2c);
|
Classes2Classes c2c = new Classes2Classes();
|
||||||
}
|
c2c.setSubclassURI(subclassURIstr);
|
||||||
}
|
c2c.setSuperclassURI(superclassURIstr);
|
||||||
|
vcDao.deleteClasses2Classes(c2c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String subclassURIstr = subclassURIstrs[0];
|
String subclassURIstr = subclassURIstrs[0];
|
||||||
String[] superclassURIstrs = request.getParameterValues("SuperclassURI");
|
String[] superclassURIstrs = request.getParameterValues("SuperclassURI");
|
||||||
if (superclassURIstrs != null) {
|
if (superclassURIstrs != null) {
|
||||||
for (int i=0; i<superclassURIstrs.length; i++) {
|
for (String superclassURIstr : superclassURIstrs) {
|
||||||
if (modeStr.equals("disjointWith")) {
|
switch (modeStr) {
|
||||||
vcDao.removeDisjointWithClass(superclassURIstrs[i],subclassURIstr);
|
case "disjointWith":
|
||||||
} else if (modeStr.equals("equivalentClass")) {
|
vcDao.removeDisjointWithClass(superclassURIstr, subclassURIstr);
|
||||||
vcDao.removeEquivalentClass(subclassURIstr,superclassURIstrs[i]);
|
break;
|
||||||
} else {
|
case "equivalentClass":
|
||||||
Classes2Classes c2c = new Classes2Classes();
|
vcDao.removeEquivalentClass(subclassURIstr, superclassURIstr);
|
||||||
c2c.setSuperclassURI(superclassURIstrs[i]);
|
break;
|
||||||
c2c.setSubclassURI(subclassURIstr);
|
default:
|
||||||
vcDao.deleteClasses2Classes(c2c);
|
Classes2Classes c2c = new Classes2Classes();
|
||||||
}
|
c2c.setSuperclassURI(superclassURIstr);
|
||||||
}
|
c2c.setSubclassURI(subclassURIstr);
|
||||||
|
vcDao.deleteClasses2Classes(c2c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (request.getParameter("operation").equals("add")) {
|
} else if (request.getParameter("operation").equals("add")) {
|
||||||
if (modeStr.equals("disjointWith")) {
|
switch (modeStr) {
|
||||||
vcDao.addDisjointWithClass(request.getParameter("SuperclassURI"), request.getParameter("SubclassURI"));
|
case "disjointWith":
|
||||||
} else if (modeStr.equals("equivalentClass")) {
|
vcDao.addDisjointWithClass(request.getParameter("SuperclassURI"), request.getParameter("SubclassURI"));
|
||||||
vcDao.addEquivalentClass(request.getParameter("SuperclassURI"), request.getParameter("SubclassURI"));
|
break;
|
||||||
} else {
|
case "equivalentClass":
|
||||||
Classes2Classes c2c = new Classes2Classes();
|
vcDao.addEquivalentClass(request.getParameter("SuperclassURI"), request.getParameter("SubclassURI"));
|
||||||
c2c.setSuperclassURI(request.getParameter("SuperclassURI"));
|
break;
|
||||||
c2c.setSubclassURI(request.getParameter("SubclassURI"));
|
default:
|
||||||
vcDao.insertNewClasses2Classes(c2c);
|
Classes2Classes c2c = new Classes2Classes();
|
||||||
}
|
c2c.setSuperclassURI(request.getParameter("SuperclassURI"));
|
||||||
|
c2c.setSubclassURI(request.getParameter("SubclassURI"));
|
||||||
|
vcDao.insertNewClasses2Classes(c2c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e, e);
|
log.error(e, e);
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ClassgroupRetryController extends BaseEditController {
|
||||||
}
|
}
|
||||||
if (vclassGroupForEditing == null) {
|
if (vclassGroupForEditing == null) {
|
||||||
//UTF-8 expected due to URIEncoding on Connector in server.xml
|
//UTF-8 expected due to URIEncoding on Connector in server.xml
|
||||||
String uriToFind = new String(request.getParameter("uri"));
|
String uriToFind = request.getParameter("uri");
|
||||||
vclassGroupForEditing = (VClassGroup)cgDao.getGroupByURI(uriToFind);
|
vclassGroupForEditing = (VClassGroup)cgDao.getGroupByURI(uriToFind);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||||
|
|
||||||
|
@WebServlet(name = "DatapropEditController", urlPatterns = {"/datapropEdit"} )
|
||||||
public class DatapropEditController extends BaseEditController {
|
public class DatapropEditController extends BaseEditController {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(DatapropEditController.class.getName());
|
private static final Log log = LogFactory.getLog(DatapropEditController.class.getName());
|
||||||
|
|
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao;
|
||||||
|
|
||||||
|
|
||||||
|
@WebServlet(name = "DatatypeRetryController", urlPatterns = {"/datatype_retry"} )
|
||||||
public class DatatypeRetryController extends BaseEditController {
|
public class DatatypeRetryController extends BaseEditController {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(DatatypeRetryController.class.getName());
|
private static final Log log = LogFactory.getLog(DatatypeRetryController.class.getName());
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.io.IOException;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
/**
|
/**
|
||||||
*Process deletions for page, deleting page, data getters and any associated menu items.
|
*Process deletions for page, deleting page, data getters and any associated menu items.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "DeletePageController", urlPatterns = {"/deletePageController"} )
|
||||||
public class DeletePageController extends VitroHttpServlet {
|
public class DeletePageController extends VitroHttpServlet {
|
||||||
|
|
||||||
private final static String REDIRECT_URL = "/pageList";
|
private final static String REDIRECT_URL = "/pageList";
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
||||||
|
|
||||||
|
@WebServlet(name = "EntityEditController", urlPatterns = {"/entityEdit"} )
|
||||||
public class EntityEditController extends BaseEditController {
|
public class EntityEditController extends BaseEditController {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(EntityEditController.class.getName());
|
private static final Log log = LogFactory.getLog(EntityEditController.class.getName());
|
||||||
|
@ -93,7 +95,7 @@ public class EntityEditController extends BaseEditController {
|
||||||
}
|
}
|
||||||
results.add(rName);
|
results.add(rName);
|
||||||
|
|
||||||
String classStr = "";
|
StringBuilder classStr = new StringBuilder();
|
||||||
List<VClass> classList = inferredEnt.getVClasses(false);
|
List<VClass> classList = inferredEnt.getVClasses(false);
|
||||||
sortForPickList(classList, vreq);
|
sortForPickList(classList, vreq);
|
||||||
if (classList != null) {
|
if (classList != null) {
|
||||||
|
@ -107,13 +109,13 @@ public class EntityEditController extends BaseEditController {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
rClassName = vc.getLocalNameWithPrefix();
|
rClassName = vc.getLocalNameWithPrefix();
|
||||||
}
|
}
|
||||||
classStr += rClassName;
|
classStr.append(rClassName);
|
||||||
if (classIt.hasNext()) {
|
if (classIt.hasNext()) {
|
||||||
classStr += ", ";
|
classStr.append(", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
results.add(classStr);
|
results.add(classStr.toString());
|
||||||
|
|
||||||
results.add(ent.getHiddenFromDisplayBelowRoleLevel() == null ? "unspecified"
|
results.add(ent.getHiddenFromDisplayBelowRoleLevel() == null ? "unspecified"
|
||||||
: ent.getHiddenFromDisplayBelowRoleLevel().getDisplayLabel());
|
: ent.getHiddenFromDisplayBelowRoleLevel().getDisplayLabel());
|
||||||
|
@ -142,10 +144,8 @@ public class EntityEditController extends BaseEditController {
|
||||||
try {
|
try {
|
||||||
List<Option> externalIdOptionList = new LinkedList<Option>();
|
List<Option> externalIdOptionList = new LinkedList<Option>();
|
||||||
if (ent.getExternalIds() != null) {
|
if (ent.getExternalIds() != null) {
|
||||||
Iterator<DataPropertyStatement> externalIdIt = ent.getExternalIds().iterator();
|
for (DataPropertyStatement eid : ent.getExternalIds()) {
|
||||||
while (externalIdIt.hasNext()) {
|
String multiplexedString = "DatapropURI:" + new String(Base64.encodeBase64(eid.getDatapropURI().getBytes())) + ";" + "Data:" + new String(Base64.encodeBase64(eid.getData().getBytes()));
|
||||||
DataPropertyStatement eid = externalIdIt.next();
|
|
||||||
String multiplexedString = new String ("DatapropURI:" + new String(Base64.encodeBase64(eid.getDatapropURI().getBytes())) + ";" + "Data:" + new String(Base64.encodeBase64(eid.getData().getBytes())));
|
|
||||||
externalIdOptionList.add(new Option(multiplexedString, eid.getData()));
|
externalIdOptionList.add(new Option(multiplexedString, eid.getData()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,11 +167,9 @@ public class EntityEditController extends BaseEditController {
|
||||||
try {
|
try {
|
||||||
List epiOptionList = new LinkedList();
|
List epiOptionList = new LinkedList();
|
||||||
Collection<PropertyInstance> epiColl = piDao.getExistingProperties(ent.getURI(),null);
|
Collection<PropertyInstance> epiColl = piDao.getExistingProperties(ent.getURI(),null);
|
||||||
Iterator<PropertyInstance> epiIt = epiColl.iterator();
|
for (PropertyInstance pi : epiColl) {
|
||||||
while (epiIt.hasNext()) {
|
String multiplexedString = "PropertyURI:" + new String(Base64.encodeBase64(pi.getPropertyURI().getBytes())) + ";" + "ObjectEntURI:" + new String(Base64.encodeBase64(pi.getObjectEntURI().getBytes()));
|
||||||
PropertyInstance pi = epiIt.next();
|
epiOptionList.add(new Option(multiplexedString, pi.getDomainPublic() + " " + pi.getObjectName()));
|
||||||
String multiplexedString = new String ("PropertyURI:" + new String(Base64.encodeBase64(pi.getPropertyURI().getBytes())) + ";" + "ObjectEntURI:" + new String(Base64.encodeBase64(pi.getObjectEntURI().getBytes())));
|
|
||||||
epiOptionList.add(new Option(multiplexedString, pi.getDomainPublic()+" "+pi.getObjectName()));
|
|
||||||
}
|
}
|
||||||
OptionMap.put("ExistingPropertyInstances", epiOptionList);
|
OptionMap.put("ExistingPropertyInstances", epiOptionList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -209,7 +207,7 @@ public class EntityEditController extends BaseEditController {
|
||||||
|
|
||||||
public void doPost (HttpServletRequest request, HttpServletResponse response) {
|
public void doPost (HttpServletRequest request, HttpServletResponse response) {
|
||||||
log.trace("Please don't POST to the "+this.getClass().getName()+". Use GET instead as there should be no change of state.");
|
log.trace("Please don't POST to the "+this.getClass().getName()+". Use GET instead as there should be no change of state.");
|
||||||
doPost(request,response);
|
doGet(request,response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,12 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.JSPPageHandler;
|
import edu.cornell.mannlib.vitro.webapp.utils.JSPPageHandler;
|
||||||
import org.apache.commons.collections.map.ListOrderedMap;
|
import org.apache.commons.collections4.map.ListOrderedMap;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.listener.impl.IndividualDataPropertyStatementProcessor;
|
import edu.cornell.mannlib.vitro.webapp.edit.listener.impl.IndividualDataPropertyStatementProcessor;
|
||||||
|
|
||||||
|
@WebServlet(name = "EntityRetryController", urlPatterns = {"/entity_retry"} )
|
||||||
public class EntityRetryController extends BaseEditController {
|
public class EntityRetryController extends BaseEditController {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(EntityRetryController.class.getName());
|
private static final Log log = LogFactory.getLog(EntityRetryController.class.getName());
|
||||||
|
@ -209,30 +211,26 @@ public class EntityRetryController extends BaseEditController {
|
||||||
Collections.sort(allApplicableDataprops);
|
Collections.sort(allApplicableDataprops);
|
||||||
|
|
||||||
if (allApplicableDataprops != null) {
|
if (allApplicableDataprops != null) {
|
||||||
Iterator<DataProperty> datapropsIt = allApplicableDataprops.iterator();
|
|
||||||
|
|
||||||
while (datapropsIt.hasNext()){
|
for (DataProperty d : allApplicableDataprops) {
|
||||||
DataProperty d = datapropsIt.next();
|
|
||||||
if (!dpMap.containsKey(d.getURI())) {
|
if (!dpMap.containsKey(d.getURI())) {
|
||||||
dpMap.put(d.getURI(),d);
|
dpMap.put(d.getURI(), d);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (individualForEditing.getDataPropertyList() != null) {
|
if (individualForEditing.getDataPropertyList() != null) {
|
||||||
Iterator<DataProperty> existingDps = individualForEditing.getDataPropertyList().iterator();
|
for (DataProperty existingDp : individualForEditing.getDataPropertyList()) {
|
||||||
while (existingDps.hasNext()) {
|
// Since the edit form begins with a "name" field, which gets saved as the rdfs:label,
|
||||||
DataProperty existingDp = existingDps.next();
|
// do not want to include the label as well.
|
||||||
// Since the edit form begins with a "name" field, which gets saved as the rdfs:label,
|
if (!existingDp.getPublicName().equals("label")) {
|
||||||
// do not want to include the label as well.
|
dpMap.put(existingDp.getURI(), existingDp);
|
||||||
if ( !existingDp.getPublicName().equals("label") ) {
|
}
|
||||||
dpMap.put(existingDp.getURI(),existingDp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DynamicField> dynamicFields = new ArrayList();
|
List<DynamicField> dynamicFields = new ArrayList();
|
||||||
Iterator<String> dpHashIt = dpMap.orderedMapIterator();
|
Iterator<String> dpHashIt = dpMap.mapIterator();
|
||||||
while (dpHashIt.hasNext()) {
|
while (dpHashIt.hasNext()) {
|
||||||
String uri = dpHashIt.next();
|
String uri = dpHashIt.next();
|
||||||
DataProperty dp = (DataProperty) dpMap.get(uri);
|
DataProperty dp = (DataProperty) dpMap.get(uri);
|
||||||
|
@ -247,9 +245,7 @@ public class EntityRetryController extends BaseEditController {
|
||||||
rowTemplate.setParameterMap(parameterMap);
|
rowTemplate.setParameterMap(parameterMap);
|
||||||
dynamo.setRowTemplate(rowTemplate);
|
dynamo.setRowTemplate(rowTemplate);
|
||||||
try {
|
try {
|
||||||
Iterator<DataPropertyStatement> existingValues = dp.getDataPropertyStatements().iterator();
|
for (DataPropertyStatement existingValue : dp.getDataPropertyStatements()) {
|
||||||
while (existingValues.hasNext()) {
|
|
||||||
DataPropertyStatement existingValue = existingValues.next();
|
|
||||||
DynamicFieldRow row = new DynamicFieldRow();
|
DynamicFieldRow row = new DynamicFieldRow();
|
||||||
//TODO: UGH
|
//TODO: UGH
|
||||||
//row.setId(existingValue.getId());
|
//row.setId(existingValue.getId());
|
||||||
|
|
|
@ -244,8 +244,7 @@ public class FauxPropertyRetryController extends BaseEditController {
|
||||||
private List<Option> createClassGroupOptionList() {
|
private List<Option> createClassGroupOptionList() {
|
||||||
List<Option> groupOptList = getGroupOptList(beanForEditing
|
List<Option> groupOptList = getGroupOptList(beanForEditing
|
||||||
.getGroupURI());
|
.getGroupURI());
|
||||||
Collections.sort(groupOptList,
|
groupOptList.sort(new OptionsBodyComparator(req.getCollator()));
|
||||||
new OptionsBodyComparator(req.getCollator()));
|
|
||||||
groupOptList.add(0, new Option("", "none"));
|
groupOptList.add(0, new Option("", "none"));
|
||||||
return groupOptList;
|
return groupOptList;
|
||||||
}
|
}
|
||||||
|
@ -322,12 +321,12 @@ public class FauxPropertyRetryController extends BaseEditController {
|
||||||
list.add(option);
|
list.add(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(list, new Comparator<Option>() {
|
list.sort(new Comparator<Option>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Option o1, Option o2) {
|
public int compare(Option o1, Option o2) {
|
||||||
return o1.getBody().compareTo(o2.getBody());
|
return o1.getBody().compareTo(o2.getBody());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class OptionsBodyComparator implements
|
private static class OptionsBodyComparator implements
|
||||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||||
|
|
||||||
|
@WebServlet(name = "IndividualTypeOperationController", urlPatterns = {"/individualTypeOp"} )
|
||||||
public class IndividualTypeOperationController extends BaseEditController {
|
public class IndividualTypeOperationController extends BaseEditController {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(IndividualTypeOperationController.class.getName());
|
private static final Log log = LogFactory.getLog(IndividualTypeOperationController.class.getName());
|
||||||
|
@ -65,9 +67,9 @@ public class IndividualTypeOperationController extends BaseEditController {
|
||||||
String[] typeURIstrs = request.getParameterValues("TypeURI");
|
String[] typeURIstrs = request.getParameterValues("TypeURI");
|
||||||
String individualURIstr = request.getParameter("individualURI");
|
String individualURIstr = request.getParameter("individualURI");
|
||||||
if (individualURIstr != null) {
|
if (individualURIstr != null) {
|
||||||
for (int i=0; i<typeURIstrs.length; i++) {
|
for (String typeURIstr : typeURIstrs) {
|
||||||
dao.removeVClass(individualURIstr, typeURIstrs[i]);
|
dao.removeVClass(individualURIstr, typeURIstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (request.getParameter("operation").equals("add")) {
|
} else if (request.getParameter("operation").equals("add")) {
|
||||||
dao.addVClass(request.getParameter("individualURI"),request.getParameter("TypeURI"));
|
dao.addVClass(request.getParameter("individualURI"),request.getParameter("TypeURI"));
|
||||||
|
|
|
@ -60,16 +60,12 @@ public class IndividualTypeRetryController extends BaseEditController {
|
||||||
sortForPickList(allVClasses, vreq);
|
sortForPickList(allVClasses, vreq);
|
||||||
|
|
||||||
Set<String> prohibitedURIset = new HashSet<String>();
|
Set<String> prohibitedURIset = new HashSet<String>();
|
||||||
for (Iterator<VClass> indClassIt = ind.getVClasses(false).iterator(); indClassIt.hasNext(); ) {
|
for (VClass vc : ind.getVClasses(false)) {
|
||||||
VClass vc = indClassIt.next();
|
if (vc.isAnonymous()) {
|
||||||
if(vc.isAnonymous()) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
prohibitedURIset.add(vc.getURI());
|
prohibitedURIset.add(vc.getURI());
|
||||||
for (Iterator<String> djURIIt = vcDao.getDisjointWithClassURIs(vc.getURI()).iterator(); djURIIt.hasNext(); ) {
|
prohibitedURIset.addAll(vcDao.getDisjointWithClassURIs(vc.getURI()));
|
||||||
String djURI = djURIIt.next();
|
|
||||||
prohibitedURIset.add(djURI);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<VClass> eligibleVClasses = new ArrayList<VClass>();
|
List<VClass> eligibleVClasses = new ArrayList<VClass>();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -17,6 +18,7 @@ import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||||
/**
|
/**
|
||||||
* Provide a means for programmatic logout.
|
* Provide a means for programmatic logout.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "logout", urlPatterns = {"/logout"})
|
||||||
public class Logout extends HttpServlet {
|
public class Logout extends HttpServlet {
|
||||||
private static final Log log = LogFactory.getLog(Logout.class.getName());
|
private static final Log log = LogFactory.getLog(Logout.class.getName());
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,14 @@ import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import org.apache.jena.ontology.OntModel;
|
import org.apache.jena.ontology.OntModel;
|
||||||
import org.apache.jena.rdf.model.Model;
|
import org.apache.jena.rdf.model.Model;
|
||||||
|
@ -31,6 +33,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
*Process edits from display model editing, so form should submit to this page which should
|
*Process edits from display model editing, so form should submit to this page which should
|
||||||
*then process the parameters and then make the necessary changes to the model.
|
*then process the parameters and then make the necessary changes to the model.
|
||||||
*/
|
*/
|
||||||
|
@WebServlet(name = "MenuManagementEdit", urlPatterns = {"/menuManagementEdit"} )
|
||||||
public class MenuManagementEdit extends VitroHttpServlet {
|
public class MenuManagementEdit extends VitroHttpServlet {
|
||||||
private static final String CMD_PARAM = "cmd";
|
private static final String CMD_PARAM = "cmd";
|
||||||
private final static String REORDER_PARAM_VALUE = "Reorder";
|
private final static String REORDER_PARAM_VALUE = "Reorder";
|
||||||
|
@ -137,7 +140,7 @@ public class MenuManagementEdit extends VitroHttpServlet {
|
||||||
|
|
||||||
private void sendReorderResponse(String errorMessage, HttpServletResponse resp) {
|
private void sendReorderResponse(String errorMessage, HttpServletResponse resp) {
|
||||||
try{
|
try{
|
||||||
JSONObject rObj = new JSONObject();
|
ObjectNode rObj = JsonNodeFactory.instance.objectNode();
|
||||||
resp.setCharacterEncoding("UTF-8");
|
resp.setCharacterEncoding("UTF-8");
|
||||||
resp.setContentType("application/json;charset=UTF-8");
|
resp.setContentType("application/json;charset=UTF-8");
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
|
||||||
|
@WebServlet(name = "NamespacePrefixOperationController", urlPatterns = {"/namespacePrefixOp"} )
|
||||||
public class NamespacePrefixOperationController extends BaseEditController {
|
public class NamespacePrefixOperationController extends BaseEditController {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(IndividualTypeOperationController.class.getName());
|
private static final Log log = LogFactory.getLog(IndividualTypeOperationController.class.getName());
|
||||||
|
|
|
@ -122,9 +122,7 @@ public class ObjectPropertyStatementRetryController extends BaseEditController {
|
||||||
indList.addAll(possIndSet);
|
indList.addAll(possIndSet);
|
||||||
sortForPickList(indList, vreq);
|
sortForPickList(indList, vreq);
|
||||||
List objectEntOptionList = new LinkedList();
|
List objectEntOptionList = new LinkedList();
|
||||||
Iterator<Individual> indIt = indList.iterator();
|
for (Individual objInd : indList) {
|
||||||
while (indIt.hasNext()) {
|
|
||||||
Individual objInd = indIt.next();
|
|
||||||
Option objIndOpt = new Option(objInd.getURI(), objInd.getName());
|
Option objIndOpt = new Option(objInd.getURI(), objInd.getName());
|
||||||
if (objectForEditing.getObjectEntURI() != null && objectForEditing.getObjectEntURI().equals(objInd.getURI())) {
|
if (objectForEditing.getObjectEntURI() != null && objectForEditing.getObjectEntURI().equals(objInd.getURI())) {
|
||||||
objIndOpt.setSelected(true);
|
objIndOpt.setSelected(true);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.OntologyDaoJena;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.OntologyDaoJena;
|
||||||
|
|
||||||
|
@WebServlet(name = "OntologyEditController", urlPatterns = {"/ontologyEdit"} )
|
||||||
public class OntologyEditController extends BaseEditController {
|
public class OntologyEditController extends BaseEditController {
|
||||||
private static final Log log = LogFactory.getLog(OntologyEditController.class.getName());
|
private static final Log log = LogFactory.getLog(OntologyEditController.class.getName());
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||||
|
|
||||||
import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
|
import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -18,6 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
|
||||||
|
|
||||||
|
@WebServlet(name = "primitiveDelete", urlPatterns = {"/edit/primitiveDelete"})
|
||||||
public class PrimitiveDelete extends VitroAjaxController {
|
public class PrimitiveDelete extends VitroAjaxController {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -30,6 +31,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.N3EditUtils;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.N3EditUtils;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.StandardModelSelector;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.StandardModelSelector;
|
||||||
|
|
||||||
|
@WebServlet(name = "primitiveRdfEdit", urlPatterns = {"/edit/primitiveRdfEdit"})
|
||||||
public class PrimitiveRdfEdit extends VitroAjaxController {
|
public class PrimitiveRdfEdit extends VitroAjaxController {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue