Merge branch 'maint-rel-1.6' into develop
This commit is contained in:
commit
28f70897c8
2 changed files with 0 additions and 125 deletions
|
@ -1,120 +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.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
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.beans.Option;
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
|
||||
public class ExternalIdRetryController extends BaseEditController {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ExternalIdRetryController.class.getName());
|
||||
|
||||
public void doPost (HttpServletRequest request, HttpServletResponse response) {
|
||||
if (!isAuthorizedToDisplayPage(request, response,
|
||||
SimplePermission.DO_BACK_END_EDITING.ACTIONS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
|
||||
//create an EditProcessObject for this and put it in the session
|
||||
EditProcessObject epo = super.createEpo(request);
|
||||
|
||||
String action = "insert";
|
||||
|
||||
DataPropertyDao dpDao = vreq.getUnfilteredWebappDaoFactory().getDataPropertyDao();
|
||||
DataPropertyStatementDao edDao = vreq.getUnfilteredWebappDaoFactory().getDataPropertyStatementDao();
|
||||
epo.setDataAccessObject(edDao);
|
||||
epo.setBeanClass(DataPropertyStatement.class);
|
||||
|
||||
IndividualDao eDao = vreq.getUnfilteredWebappDaoFactory().getIndividualDao();
|
||||
|
||||
DataPropertyStatement eidForEditing = null;
|
||||
if (!epo.getUseRecycledBean()){
|
||||
eidForEditing = new DataPropertyStatementImpl();
|
||||
populateBeanFromParams(eidForEditing,vreq);
|
||||
if (vreq.getParameter(MULTIPLEXED_PARAMETER_NAME) != null) {
|
||||
action = "update";
|
||||
}
|
||||
epo.setOriginalBean(eidForEditing);
|
||||
} else {
|
||||
eidForEditing = (DataPropertyStatement) epo.getNewBean();
|
||||
}
|
||||
|
||||
//make a simple mask for the class's id
|
||||
Object[] simpleMaskPair = new Object[2];
|
||||
simpleMaskPair[0]="Id";
|
||||
//simpleMaskPair[1]=Integer.valueOf(eidForEditing.getId());
|
||||
epo.getSimpleMask().add(simpleMaskPair);
|
||||
|
||||
//set up any listeners
|
||||
|
||||
FormObject foo = new FormObject();
|
||||
HashMap OptionMap = new HashMap();
|
||||
List entityList = new LinkedList();
|
||||
if (eidForEditing.getIndividualURI() != null) {
|
||||
Individual individual = eDao.getIndividualByURI(eidForEditing.getIndividualURI());
|
||||
entityList.add(new Option(individual.getURI(),individual.getName(),true));
|
||||
} else {
|
||||
entityList.add(new Option ("-1", "Error: the entity must be specified", true));
|
||||
}
|
||||
OptionMap.put("IndividualURI",entityList);
|
||||
// TOOD change following DAO call to getAllExternalIdDataProperties once implemented
|
||||
List allExternalIdDataProperties = dpDao.getAllExternalIdDataProperties();
|
||||
Collections.sort(allExternalIdDataProperties);
|
||||
OptionMap.put("DatapropURI", FormUtils.makeOptionListFromBeans(allExternalIdDataProperties, "URI", "PublicName", eidForEditing.getDatapropURI(),""));
|
||||
foo.setOptionLists(OptionMap);
|
||||
foo.setErrorMap(epo.getErrMsgMap());
|
||||
|
||||
epo.setFormObject(foo);
|
||||
|
||||
FormUtils.populateFormFromBean(eidForEditing,action,foo,epo.getBadValueMap());
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
|
||||
request.setAttribute("formJsp","/templates/edit/specific/externalIds_retry.jsp");
|
||||
request.setAttribute("scripts","/templates/edit/formBasic.js");
|
||||
request.setAttribute("title","External Id Editing Form");
|
||||
request.setAttribute("_action",action);
|
||||
request.setAttribute("unqualifiedClassName","External Id");
|
||||
setRequestAttributes(request,epo);
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
log.error("ExternalIdRetryController could not forward to view.");
|
||||
log.error(e.getMessage());
|
||||
log.error(e.getStackTrace());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response) {
|
||||
doPost(request, response);
|
||||
}
|
||||
|
||||
}
|
|
@ -99,11 +99,6 @@
|
|||
<input type="hidden" name="controller" value="Entity"/>
|
||||
</form>
|
||||
<form action="editForm" method="get">
|
||||
<input type="submit" class="form-button" value="Add an External Identifier"/>
|
||||
<input type="hidden" name="IndividualURI" value="${individual.URI}"/>
|
||||
<input type="hidden" name="controller" value="ExternalId"/>
|
||||
</form>
|
||||
<form action="editForm" method="get">
|
||||
<input type="submit" class="form-button" value="Change URI"/>
|
||||
<input type="hidden" name="oldURI" value="${individual.URI}"/>
|
||||
<input type="hidden" name="mode" value="renameResource"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue