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