remove obsolete classes

This commit is contained in:
brianjlowe 2011-11-15 19:57:59 +00:00
parent d3891fee3c
commit 2e7029b420
17 changed files with 3 additions and 790 deletions

View file

@ -1,45 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.beans;
/**
* TODO: jc55, Please put a description of this class and its intended use here.
*
*/
public class Flagpole {
private int index=0;
/**
* What is this the index of?
* @return
*/
public int getIndex() { return index;}
public void setIndex(int i) { index=i; }
private int numeric=0;
public int getNumeric() { return numeric; }
public void setNumeric(int i) { numeric=i; }
private String checkboxLabel=null;
public String getCheckboxLabel() { return checkboxLabel; }
public void setCheckboxLabel(String s) { checkboxLabel=s; }
/**
* What is this the status of?
*/
private String status="normal";
public String getStatus() { return status; }
public void setStatus(String s) { status=s; }
/**
* What is i, n and cLable?
* @param i
* @param n
* @param cLabel
*/
public Flagpole(int i, int n, String cLabel) {
index =i;
numeric =n;
checkboxLabel=cLabel;
}
}

View file

@ -1,62 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.beans;
// TODO bjl23 this is the link method, nothing to do here, just drawing your attention to it.
public class Link extends BaseResourceBean {
private String url = null;
private String anchor = null;
private String entityURI = null;
private String typeURI = null;
private String displayRank = "-1";
private ObjectPropertyStatement objectPropertyStatement = null;
public String getAnchor() {
return anchor;
}
public void setAnchor(String anchor) {
this.anchor = anchor;
}
public String getEntityURI() {
return entityURI;
}
public void setEntityURI(String entityURI) {
this.entityURI = entityURI;
}
public String getTypeURI() {
return typeURI;
}
public void setTypeURI(String typeURI) {
this.typeURI = typeURI;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDisplayRank() {
return displayRank;
}
public void setDisplayRank(int rank) {
this.displayRank = String.valueOf(rank);
}
public void setDisplayRank(String rank) {
this.displayRank = rank;
/* try {
this.displayRank = Integer.parseInt(rank);
} catch (NumberFormatException ex) {
this.displayRank = 10;
} */
}
public ObjectPropertyStatement getObjectPropertyStatement() {
return objectPropertyStatement;
}
public void setObjectPropertyStatement(ObjectPropertyStatement op) {
this.objectPropertyStatement = op;
}
}

View file

@ -1,24 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.beans;
public class Linktype extends BaseResourceBean {
private String type = null;
private String generic = null;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getGeneric() {
return generic;
}
public void setGeneric(String generic) {
this.generic = generic;
}
}

View file

@ -1,45 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.beans;
/**
* a class representing a namespace for URI construction
* @author bjl23
*
*/
public class Namespace {
private int id = -1;
private String name = null;
private String namespaceURI = null;
private String prefix = null;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNamespaceURI() {
return namespaceURI;
}
public void setNamespaceURI(String nsuri) {
this.namespaceURI = nsuri;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
}

View file

@ -1,173 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller.edit;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.DateTime;
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
import edu.cornell.mannlib.vedit.controller.BaseEditController;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditIndividuals;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstance;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
/**
* NOTE:does not work yet under semweb-align - gets tricky here
* Takes an entity and inserts a (nearly) identical entity with a matching properties list.
* NOTE (BJL23): This currently modifies the objects returned from the daos and calls inserts.
If we go to a system of persistent in-memory objects, this method will need to be updated.
* @author bjl23,jc55
* */
public class CloneEntityServlet extends BaseEditController {
private static final String NO_PROPERTY_RESTRICTION = null;
private static final int MIN_EDIT_ROLE=4;
private static final Log log = LogFactory.getLog(CloneEntityServlet.class.getName());
public void doPost(HttpServletRequest req, HttpServletResponse response) {
if (!isAuthorizedToDisplayPage(req, response, new Actions(new EditIndividuals()))) {
return;
}
VitroRequest request = new VitroRequest(req);
try {
//attempt to clone a tab but if we don't find the parameter 'tabId' the clone a entity
try{
int id = doCloneTab(request, response);
if( id >= 0){
response.sendRedirect("tabEdit?id=" + id);
return;
}
}catch(Exception ex){
log.error("Could not clone tab: " + ex);
getServletConfig().getServletContext().getRequestDispatcher(
"/index.jsp").forward(request,
response);
return;
}
String individualURI=request.getParameter("uri");
if (individualURI == null || individualURI.equals("")){
getServletConfig().getServletContext().getRequestDispatcher("/index.jsp").forward( request, response );
return;
}
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
WebappDaoFactory myWebappDaoFactory = request.getFullWebappDaoFactory().getUserAwareDaoFactory(loginBean.getUserURI());
IndividualDao individualDao = myWebappDaoFactory.getIndividualDao();
PropertyInstanceDao propertyInstanceDao = myWebappDaoFactory.getPropertyInstanceDao();
Individual ind = individualDao.getIndividualByURI(individualURI);
if (ind == null){ log.error("Error retrieving individual "+individualURI); return; }
String newName = request.getParameter("name");
if (newName != null && newName.length()>0) {
ind.setName(newName);
if (Character.isDigit(newName.charAt(0))) {
newName = "n"+newName;
}
if (ind.getNamespace() != null) {
ind.setURI(ind.getNamespace()+newName.replaceAll("\\W",""));
} else {
ind.setURI(VitroVocabulary.vitroURI + newName.replaceAll("\\W",""));
}
} else {
ind.setName("CLONE OF "+ind.getName());
}
String cloneURI=individualDao.insertNewIndividual(ind);
if (cloneURI == null){ log.error("Error inserting cloned individual"); return; }
Collection<PropertyInstance> PIColl=propertyInstanceDao.getExistingProperties(individualURI, NO_PROPERTY_RESTRICTION);
Iterator<PropertyInstance> it=PIColl.iterator();
while (it.hasNext()){
PropertyInstance currPI=(PropertyInstance)it.next();
currPI.setSubjectEntURI(cloneURI);
propertyInstanceDao.insertProp(currPI);
}
String encodedCloneURI = URLEncoder.encode(cloneURI, "UTF-8");
response.sendRedirect("entityEdit?uri="+encodedCloneURI);
//response.sendRedirect("entity?home="+portalIdStr+"&id="+newEntityId);
} catch (Exception ex) {
log.error( ex.getMessage() );
ex.printStackTrace();
}
}
public Date parseStringToDate(String str) {
if (str.trim() == "") return null;
int year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour;
try {
year = Integer.parseInt(str.substring(0,4));
monthOfYear = Integer.parseInt(str.substring(5,7));
dayOfMonth = Integer.parseInt(str.substring(8,10));
hourOfDay = Integer.parseInt(str.substring(11,13));
minuteOfHour = str.length()>13 ? Integer.parseInt(str.substring(14,16)) : 0;
if (str.length()>16) {
String suppStr = str.substring(17);
if (suppStr.equalsIgnoreCase("pm") || suppStr.equalsIgnoreCase("p.m.")) {
hourOfDay = hourOfDay < 12 ? hourOfDay + 12 : hourOfDay;
}
}
log.warn("parsed clone timekey ["+str+"] to year: "+year+", month: "+monthOfYear+", day: "+dayOfMonth+", hour: "+hourOfDay+", minute: "+minuteOfHour);
} catch (NumberFormatException ex) {
log.error("Could not parse string "+str+" based on expected format 'yyyy-mm-dd hh-mm'");
return null;
}
return new DateTime(year,monthOfYear,dayOfMonth,hourOfDay,minuteOfHour,0,0).toDate();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
/**
* Attempts to clone a tab.
* This will check for the parameter 'tabId' and if it exists
* this method will call cloneTabDb to do the actual database inserts.
* If no parameter is found then this method will return -1.
*
* @param request
* @param response
* @return tab id of newly cloned tab or -1 if no tabId parameter was found
* in the http request.
*/
private int doCloneTab(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String tabIdStr = request.getParameter("tabId");
if (tabIdStr == null)
return -1;
int tabId = -1;
try {
tabId = Integer.parseInt(tabIdStr);
} catch (NumberFormatException ex) {
throw new Exception("error doCloneTab()-- could not parse "
+ tabIdStr + " as an integer value");
}
return 1; // getFacade().cloneTab(tabId);
}
}

View file

@ -1,141 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller.edit;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
import edu.cornell.mannlib.vedit.beans.FormObject;
import edu.cornell.mannlib.vedit.controller.BaseEditController;
import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
import edu.cornell.mannlib.vedit.util.FormUtils;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousAdminPages;
import edu.cornell.mannlib.vitro.webapp.beans.Namespace;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.NamespaceDao;
public class NamespaceRetryController extends BaseEditController {
private static final Log log = LogFactory.getLog(NamespaceRetryController.class.getName());
public void doPost (HttpServletRequest req, HttpServletResponse response) {
if (!isAuthorizedToDisplayPage(req, response, new Actions(new UseMiscellaneousAdminPages()))) {
return;
}
VitroRequest request = new VitroRequest(req);
//create an EditProcessObject for this and put it in the session
EditProcessObject epo = super.createEpo(request);
/*for testing*/
Namespace testMask = new Namespace();
epo.setBeanClass(Namespace.class);
epo.setBeanMask(testMask);
String action = "insert";
if (request.getFullWebappDaoFactory() == null)
log.error("null CoreDaoFactory");
NamespaceDao namespaceDao = request.getFullWebappDaoFactory().getNamespaceDao();
//VitroFacade facade = getFacade();
//epo.setFacade(facade);
Namespace namespaceForEditing = null;
if (!epo.getUseRecycledBean()){
if (request.getParameter("id") != null) {
int id = Integer.parseInt(request.getParameter("id"));
if (id > 0) {
try {
namespaceForEditing = namespaceDao.getNamespaceById(id);
action = "update";
} catch (NullPointerException e) {
log.error("Need to implement 'record not found' error message.");
}
}
} else {
namespaceForEditing = new Namespace();
}
epo.setOriginalBean(namespaceForEditing);
} else {
namespaceForEditing = (Namespace) epo.getNewBean();
action = "update";
log.error("using newBean");
}
//make a simple mask for the class's id
Object[] simpleMaskPair = new Object[2];
simpleMaskPair[0]="Id";
simpleMaskPair[1]=Integer.valueOf(namespaceForEditing.getId());
epo.getSimpleMask().add(simpleMaskPair);
//set up any listeners
//make a postinsert pageforwarder that will send us to a new class's fetch screen
epo.setPostInsertPageForwarder(new NamespaceInsertPageForwarder());
//make a postdelete pageforwarder that will send us to the list of classes
//set the getMethod so we can retrieve a new bean after we've inserted it
try {
Class[] args = new Class[1];
args[0] = int.class;
epo.setGetMethod(namespaceDao.getClass().getDeclaredMethod("getNamespaceById",args));
} catch (NoSuchMethodException e) {
log.error("NamespaceRetryController could not find the namespaceById method in the facade");
}
FormObject foo = new FormObject();
foo.setErrorMap(epo.getErrMsgMap());
epo.setFormObject(foo);
FormUtils.populateFormFromBean(namespaceForEditing,action,foo,epo.getBadValueMap());
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/namespace_retry.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");
request.setAttribute("title","Namespace Editing Form");
request.setAttribute("_action",action);
request.setAttribute("unqualifiedClassName","Namespace");
setRequestAttributes(request,epo);
try {
rd.forward(request, response);
} catch (Exception e) {
log.error("NamespaceRetryController could not forward to view.");
log.error(e.getMessage());
log.error(e.getStackTrace());
}
}
public void doGet (HttpServletRequest request, HttpServletResponse response) {
doPost(request, response);
}
class NamespaceInsertPageForwarder implements PageForwarder {
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
String newNamespaceUrl = "fetch?queryspec=private_namespacev&postGenLimit=-1&linkwhere=namespaces.id=";
Namespace ns = (Namespace) epo.getNewBean();
newNamespaceUrl += ns.getId();
try {
response.sendRedirect(newNamespaceUrl);
} catch (IOException ioe) {
log.error("NamespaceInsertPageForwarder could not send redirect.");
}
}
}
}

View file

@ -4,8 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.controller.edit;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
@ -16,7 +14,6 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
import edu.cornell.mannlib.vedit.beans.FormObject;
import edu.cornell.mannlib.vedit.beans.Option;
import edu.cornell.mannlib.vedit.controller.BaseEditController;
import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder;
@ -26,7 +23,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntolo
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.NamespaceDao;
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
public class OntologyRetryController extends BaseEditController {
@ -52,7 +48,6 @@ public class OntologyRetryController extends BaseEditController {
OntologyDao oDao = request.getFullWebappDaoFactory().getOntologyDao();
epo.setDataAccessObject(oDao);
NamespaceDao nDao = request.getFullWebappDaoFactory().getNamespaceDao();
Ontology ontologyForEditing = null;
if (!epo.getUseRecycledBean()){
@ -98,17 +93,6 @@ public class OntologyRetryController extends BaseEditController {
FormObject foo = new FormObject();
HashMap optionMap = new HashMap();
try {
List namespaceIdList = FormUtils.makeOptionListFromBeans(nDao.getAllNamespaces(),"Id","Name",Integer.valueOf(ontologyForEditing.getNamespaceId()).toString(),null,false);
namespaceIdList.add(0,new Option("-1","none", false));
optionMap.put("NamespaceId", namespaceIdList);
} catch (Exception e) {
log.error(this.getClass().getName());
e.printStackTrace();
}
foo.setOptionLists(optionMap);
foo.setErrorMap(epo.getErrMsgMap());
epo.setFormObject(foo);

View file

@ -1,22 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.dao;
import edu.cornell.mannlib.vitro.webapp.beans.Namespace;
import java.util.List;
public interface NamespaceDao {
public abstract List<Namespace> getAllNamespaces();
public abstract Namespace getNamespaceById(int namespaceId);
int insertNewNamespace(Namespace namespace);
void updateNamespace(Namespace ont);
void deleteNamespace(int namespaceId);
void deleteNamespace(Namespace namespace);
}

View file

@ -127,8 +127,6 @@ public interface WebappDaoFactory {
public PropertyGroupDao getPropertyGroupDao();
public NamespaceDao getNamespaceDao();
public PropertyInstanceDao getPropertyInstanceDao();
public PageDao getPageDao();

View file

@ -14,7 +14,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao;
import edu.cornell.mannlib.vitro.webapp.dao.DisplayModelDao;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.MenuDao;
import edu.cornell.mannlib.vitro.webapp.dao.NamespaceDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
@ -177,10 +176,6 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory {
return innerWebappDaoFactory.getDatatypeDao();
}
public NamespaceDao getNamespaceDao() {
return innerWebappDaoFactory.getNamespaceDao();
}
public OntologyDao getOntologyDao() {
return innerWebappDaoFactory.getOntologyDao();
}

View file

@ -1,98 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.dao.jena;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.graph.GraphEvents;
import com.hp.hpl.jena.graph.GraphListener;
import com.hp.hpl.jena.graph.Triple;
public class GraphSynchronizer implements GraphListener {
private static final Log log = LogFactory.getLog(GraphSynchronizer.class.getName());
private Graph g;
public GraphSynchronizer (Graph synchronizee) {
g = synchronizee;
}
public void notifyAddArray(Graph arg0, Triple[] arg1) {
g.getBulkUpdateHandler().add(arg1);
}
public void notifyAddGraph(Graph arg0, Graph arg1) {
g.getBulkUpdateHandler().add(arg1);
}
public void notifyAddIterator(Graph arg0, Iterator arg1) {
g.getBulkUpdateHandler().add(arg1);
}
public void notifyAddList(Graph arg0, List arg1) {
g.getBulkUpdateHandler().add(arg1);
}
public void notifyAddTriple(Graph arg0, Triple arg1) {
g.add(arg1);
}
public void notifyDeleteArray(Graph arg0, Triple[] arg1) {
g.getBulkUpdateHandler().delete(arg1);
}
public void notifyDeleteGraph(Graph arg0, Graph arg1) {
g.getBulkUpdateHandler().delete(arg1);
}
public void notifyDeleteIterator(Graph arg0, Iterator arg1) {
g.getBulkUpdateHandler().delete(arg1);
}
public void notifyDeleteList(Graph arg0, List arg1) {
g.getBulkUpdateHandler().delete(arg1);
}
public void notifyDeleteTriple(Graph arg0, Triple arg1) {
g.delete(arg1);
log.trace("Delete triple");
if (arg1.getObject().isLiteral()) {
log.trace(arg1.getObject().getLiteralLexicalForm());
} else if (arg1.getObject().isVariable()) {
log.trace("Triple object is variable");
} else if (arg1.getObject().isURI()) {
log.trace(arg1.getObject().getURI());
} else if (arg1.getObject().isBlank()) {
log.trace("Triple object is blank");
} else if (arg1.getObject().isConcrete()) {
log.trace("Triple object is concrete");
}
log.trace(arg1.getObject().toString());
}
public void notifyEvent(Graph arg0, Object arg1) {
// ontModel.removeAll(s,p,o) doesn't trigger a notifyDeleteTriple() !?!
// So, I'm doing this silly thing to make sure we see the deletion.
// What else is lurking around the corner?
if (arg1 instanceof GraphEvents) {
GraphEvents ge = ((GraphEvents) arg1);
Object content = ge.getContent();
if (ge.getTitle().equals("remove") && content instanceof Triple) {
notifyDeleteTriple( arg0, (Triple) content );
}
}
}
}

View file

@ -9,6 +9,8 @@ import com.hp.hpl.jena.rdf.model.ModelChangedListener;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.CloseEvent;
/**
* Simple change listener to keep a model (the 'synchronizee') in synch with the model with which it is registered.
* @author bjl23

View file

@ -1,47 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.dao.jena;
import edu.cornell.mannlib.vitro.webapp.beans.Namespace;
import edu.cornell.mannlib.vitro.webapp.dao.NamespaceDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import java.util.HashSet;
import java.util.List;
import com.hp.hpl.jena.ontology.OntModel;
public class NamespaceDaoJena extends JenaBaseDao implements NamespaceDao {
public NamespaceDaoJena(WebappDaoFactoryJena wadf) {
super(wadf);
}
public void deleteNamespace(int namespaceId) {
// should be deprecated
}
public void deleteNamespace(Namespace namespace) {
// may not need/want to implement this
}
public List<Namespace> getAllNamespaces() {
// TODO Auto-generated method stub
return null;
}
public Namespace getNamespaceById(int namespaceId) {
// should be deprecated
return null;
}
public int insertNewNamespace(Namespace namespace) {
// may not need/want to implement this
return 0;
}
public void updateNamespace(Namespace ont) {
// may not need/want to implement this
}
}

View file

@ -37,7 +37,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao;
import edu.cornell.mannlib.vitro.webapp.dao.DisplayModelDao;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.MenuDao;
import edu.cornell.mannlib.vitro.webapp.dao.NamespaceDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
@ -349,13 +348,6 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
return individualDao;
}
NamespaceDao namespaceDao = null;
public NamespaceDao getNamespaceDao() {
if( namespaceDao == null )
namespaceDao = new NamespaceDaoJena(this);
return namespaceDao;
}
ObjectPropertyStatementDao objectPropertyStatementDao = null;
public ObjectPropertyStatementDao getObjectPropertyStatementDao() {
if( objectPropertyStatementDao == null )

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.dao.jena;
package edu.cornell.mannlib.vitro.webapp.dao.jena.event;
public class CloseEvent {
// used to close synchronized models via Jena's event system

View file

@ -1,94 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.utils;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Link;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* makes a cornell library openUrl for
* an entity using info found in DataProps.
*
* @author bdc34
*
*/
public class OpenUrlMaker {
//These are datapropIds that are acceptable values for the given field
private int atitle[] = {36};
private int spage[] = {39};
private int aulast[] = {};
private int issue[] = {53};
private int volume[] = {54};
private int auint[] = {};
private int doi[] = {55};
private int aufull[] = {44};
private Pattern spage_regex = Pattern.compile("[^0-9]*([0-9]+)[^0-9]*.*");
//private Pattern spage_regex = Pattern.compile("([0-9]*)[^0-9]*([0-9]*)[^0-9]*.*");
private Pattern aulast_regex = Pattern.compile("([^\\s]*)[\\s]*.*");
private Pattern firstNumer_regex = Pattern.compile("[^0-9]*([0-9]+)[^0-9]*.*");
/**
* Uses the DatatypeProperty objects for the Entity
* to make a OpenURL for the Cornell library resolver.
*
* @param ent
* @return returns Link object if one can be made, null otherwise.
*/
public Link makeOpenUrlForEntity(Individual ent){
Link oUrl = null;
String atitle = null;
String spage = null;
String aulast = null;
String issue = null;
String volume = null;
String auint = null;
String doi = null;
String aufull = null;
List <DataPropertyStatement> dataPropertyStmts = ent.getDataPropertyStatements();
for( DataPropertyStatement dataPropertyStmt : dataPropertyStmts){
if( found( this.atitle, dataPropertyStmt ) ){
atitle = escape(dataPropertyStmt.getData());
} else
if( found( this.spage, dataPropertyStmt ) ){
Matcher m = this.spage_regex.matcher(dataPropertyStmt.getData());
if( m.matches() && m.groupCount() > 0 )
spage = m.group(1);
} else
if( found( this.aulast, dataPropertyStmt ) ){
Matcher m = this.aulast_regex.matcher(dataPropertyStmt.getData());
if( m.matches() && m.groupCount() > 0 )
aulast = m.group(1);
} else
if( found( this.issue, dataPropertyStmt ) ){
Matcher m = this.firstNumer_regex.matcher(dataPropertyStmt.getData());
if( m.matches() && m.groupCount() > 0 )
issue = m.group(1);
} else
if( found( this.volume, dataPropertyStmt ) ){
} else if( found( this.auint, dataPropertyStmt ) ){
} else if( found( this.doi, dataPropertyStmt ) ){
} else if( found( this.aufull, dataPropertyStmt ) ){
}
}
return oUrl;
}
private boolean found( int[] ids, DataPropertyStatement dataPropertyStmt){
return true;
}
private String escape(String in){
return in;
}
}

View file

@ -14,7 +14,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao;
import edu.cornell.mannlib.vitro.webapp.dao.DisplayModelDao;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.MenuDao;
import edu.cornell.mannlib.vitro.webapp.dao.NamespaceDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
@ -200,12 +199,6 @@ public class WebappDaoFactoryStub implements WebappDaoFactory {
"WebappDaoFactory.getPropertyGroupDao() not implemented.");
}
@Override
public NamespaceDao getNamespaceDao() {
throw new RuntimeException(
"WebappDaoFactory.getNamespaceDao() not implemented.");
}
@Override
public PropertyInstanceDao getPropertyInstanceDao() {
throw new RuntimeException(