Mercurial > hg > ismi-richfaces
changeset 63:b530266402a3
Merge from remove_escidoc branch
bba950221e716657dee64b54ff07fc2fbf172590
author | casties |
---|---|
date | Wed, 09 Dec 2015 14:08:40 -0500 |
parents | 8d598e37d008 (current diff) bba950221e71 (diff) |
children | e8d7932e57f7 aa8a0578fbc6 |
files | src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/MisattributionDataTable.java src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/TargetMisattribution.java src/main/java/org/mpiwg/itgroup/escidoc/AbstractClient.java src/main/java/org/mpiwg/itgroup/escidoc/AbstractESciDocCache.java src/main/java/org/mpiwg/itgroup/escidoc/BootcampClient.java src/main/java/org/mpiwg/itgroup/escidoc/ESciDocCache.java src/main/java/org/mpiwg/itgroup/escidoc/ESciDocClient.java src/main/java/org/mpiwg/itgroup/escidoc/ESciDocException.java src/main/java/org/mpiwg/itgroup/escidoc/ESciDocHandler.java src/main/java/org/mpiwg/itgroup/escidoc/Test.java src/main/java/org/mpiwg/itgroup/escidoc/bo/Creator.java src/main/java/org/mpiwg/itgroup/escidoc/bo/ESciDocConstants.java src/main/java/org/mpiwg/itgroup/escidoc/bo/ESciDocItem.java src/main/java/org/mpiwg/itgroup/escidoc/bo/Publication.java src/main/java/org/mpiwg/itgroup/escidoc/bo/Publishing.java src/main/java/org/mpiwg/itgroup/escidoc/bo/utils/SortItemByCreator.java src/main/java/org/mpiwg/itgroup/escidoc/bo/utils/SortItemByTitle.java src/main/java/org/mpiwg/itgroup/escidoc/bo/utils/SortPublicationByCreator.java src/main/java/org/mpiwg/itgroup/escidoc/bo/utils/SortPublicationByTitle.java src/main/java/org/mpiwg/itgroup/escidoc/utils/ESciDocItemDataTable.java src/main/java/org/mpiwg/itgroup/escidoc/utils/SelectedESciDocItems.java src/main/java/org/mpiwg/itgroup/escidoc/web/ESciDocItemForm.java src/main/resources/hibernate.cfg.xml src/main/resources/log4j.properties src/main/resources/openmind.properties |
diffstat | 50 files changed, 151 insertions(+), 3657 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Wed Dec 09 14:08:40 2015 -0500 @@ -0,0 +1,17 @@ + +syntax: regexp +^\.classpath$ +syntax: regexp +^\.project$ +syntax: regexp +^target$ +syntax: regexp +^\.settings$ +syntax: regexp +^\.externalToolBuilders$ +syntax: regexp +^src/main/resources/hibernate\.cfg\.xml$ +syntax: regexp +^src/main/resources/log4j\.properties$ +syntax: regexp +^src/main/resources/openmind\.properties$ \ No newline at end of file
--- a/src/main/java/de/mpiwg/itgroup/ismi/admin/AdminBean.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/admin/AdminBean.java Wed Dec 09 14:08:40 2015 -0500 @@ -8,8 +8,6 @@ import org.apache.commons.lang.StringUtils; import org.mpi.openmind.security.bo.User; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; - import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; @@ -40,20 +38,6 @@ private String password2; private boolean changePassword; - private boolean showESciDocPanelControl = false; - - public void listenerOpenESciDocPanelControl(ActionEvent event){ - this.showESciDocPanelControl = true; - } - - public void listenerCloseESciDocPanelControl(ActionEvent event){ - this.showESciDocPanelControl = false; - } - - public boolean isShowESciDocPanelControl() { - return showESciDocPanelControl & getSessionBean().isAdmin(); - } - public void reset(){ this.user = null; this.password1 = new String();
--- a/src/main/java/de/mpiwg/itgroup/ismi/defs/AbstractDefinitionForm.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/defs/AbstractDefinitionForm.java Wed Dec 09 14:08:40 2015 -0500 @@ -41,7 +41,6 @@ contentTypeList.add(new SelectItem("", "-- select one --")); contentTypeList.add(new SelectItem("arabic")); contentTypeList.add(new SelectItem("date")); - contentTypeList.add(new SelectItem("escidoc-objid")); contentTypeList.add(new SelectItem("link")); contentTypeList.add(new SelectItem("json")); contentTypeList.add(new SelectItem("text"));
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java Wed Dec 09 14:08:40 2015 -0500 @@ -8,7 +8,6 @@ import java.util.Map; import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; @@ -21,10 +20,6 @@ import org.mpi.openmind.repository.bo.Relation; import org.mpi.openmind.security.SecurityService; import org.mpi.openmind.security.bo.User; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; -import org.mpiwg.itgroup.escidoc.bo.Publication; -import org.mpiwg.itgroup.escidoc.utils.ESciDocItemDataTable; -import org.mpiwg.itgroup.escidoc.utils.SelectedESciDocItems; import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; import de.mpiwg.itgroup.ismi.entry.dataBeans.SimpleSearchCache; @@ -258,95 +253,6 @@ return rs; } - //******************************** - //**** PUBLICATIONS ESciDOC ****** - //******************************** - - private ESciDocItemDataTable refDataTable = new ESciDocItemDataTable(this); - protected SelectedESciDocItems selectedItems = new SelectedESciDocItems(); - - public ESciDocItemDataTable getRefDataTable() { - return refDataTable; - } - - public void setRefDataTable(ESciDocItemDataTable refDataTable) { - this.refDataTable = refDataTable; - } - - public void listenerRemoveReference(ActionEvent event){ - List<String> pubIdList = new ArrayList<String>(); - for(String pubId : this.selectedItems.getMap().keySet()){ - if(this.selectedItems.getMap().get(pubId)){ - pubIdList.add(pubId); - } - } - for(String pubId : pubIdList){ - this.selectedItems.removeById(pubId); - } - } - - public void loadReferences(Entity currentEntity){ - this.loadReferences(currentEntity, new ArrayList<String>()); - } - - public void loadReferences(Entity currentEntity, List<String> idsNoFound){ - this.selectedItems.setList(new ArrayList<ESciDocItem>()); - boolean escidocRespondOK = true; - try{ - - for (Relation rel : currentEntity.getTargetRelations()) { - if (rel.getOwnValue().equals(rel_is_reference_of)) { - Entity source = getWrapper().getEntityByIdWithContent(rel.getSourceId()); - ESciDocItem item = getAppBean().getRefCache().getItem(source.getOwnValue()); - if(item == null){ - item = new ESciDocItem(source.getOwnValue()); - item.setErrorLoading(ESciDocItem.ESCIDOC_ERROR_ID_NO_FOUND); - idsNoFound.add(source.getOwnValue()); - } - - /*Publication pub = ESciDocHandler.getPublicationById(source.getOwnValue()); - if(pub == null){ - pub = new Publication(source.getOwnValue()); - pub.setErrorLoading(Publication.ESCIDOC_ERROR_ID_NO_FOUND); - idsNoFound.add(source.getOwnValue()); - } - */ - Attribute att = source.getAttributeByName("additional_information"); - if(att != null){ - item.getPublication().setAdditionalInformation(att.getOwnValue()); - } - item.getPublication().setEntity(source); - this.selectedItems.addESciDocItem(item); - } - } - }catch (Exception e) { - escidocRespondOK = false; - } - this.reportEscidocError(escidocRespondOK, idsNoFound); - } - - - - protected void reportEscidocError(boolean escidocRespondOK, List<String> idsNoFound){ - if(!escidocRespondOK){ - addGeneralMsg("The references could not be loaded. The server did not respond."); - addGeneralMsg("Exception connecting to http://escidoc.mpiwg-berlin.mpg.de:8080 "); - } - - if(!idsNoFound.isEmpty()){ - addGeneralMsg("The following references were not found in Pubman server:"); - StringBuilder sb = new StringBuilder(); - int count = 0; - for(String id : idsNoFound){ - if(count > 0){ - sb.append(", "); - } - sb.append(id); - } - addGeneralMsg(sb.toString()); - } - - } protected void prepareEndNoteRefs2Save() throws Exception{ //REFERENCE -> is_reference_of -> WITNESS @@ -362,32 +268,6 @@ } } - protected Entity prepareESciDocRefs2Save(Entity currentEntity) throws Exception{ - //REFERENCE -> is_reference_of -> WITNESS - currentEntity.removeAllTargetRelationsByName(rel_is_reference_of); - for(ESciDocItem item : this.selectedItems.getList()){ - Publication pub = item.getPublication(); - if(pub.getEntity() == null){ - Entity pubEntity = new Entity(Node.TYPE_ABOX, REFERENCE, false); - pubEntity.setOwnValue(pub.getObjid()); - pubEntity.addAttribute(new Attribute("id", "escidoc-objid", pub.getObjid())); - if(StringUtils.isNotEmpty(pub.getAdditionalInformation())){ - pubEntity.addAttribute(new Attribute("additional_information", "text", pub.getAdditionalInformation())); - } - pubEntity = getWrapper().saveEntity(pubEntity, getUserName()); - pub.setEntity(pubEntity); - }else{ - if(pub.getEntity().getAttributeByName("additional_information") != null){ - pub.getEntity().getAttributeByName("additional_information").setOwnValue(pub.getAdditionalInformation()); - }else{ - pub.getEntity().addAttribute(new Attribute("additional_information", "text", pub.getAdditionalInformation())); - } - pub.setEntity(getWrapper().saveEntity(pub.getEntity(), getUserName())); - } - Relation rel = new Relation(pub.getEntity(), currentEntity, rel_is_reference_of); - } - return currentEntity; - } public static de.mpiwg.itgroup.ismi.util.guiComponents.Calendar updateCalendar(Attribute att){ de.mpiwg.itgroup.ismi.util.guiComponents.Calendar calendar = null; @@ -421,7 +301,6 @@ this.setCurrentId(""); this.setCurrentIdMsg(""); this.setAttributes(new HashMap<String, String>()); - this.selectedItems = new SelectedESciDocItems(); this.displayUrl = null; this.endNoteRefTable = new ReferenceTable(); } @@ -1136,14 +1015,6 @@ this.currentIdMsg = currentIdMsg; } - public SelectedESciDocItems getSelectedItems() { - return selectedItems; - } - - public void setSelectedItems(SelectedESciDocItems selectedItems) { - this.selectedItems = selectedItems; - } - public String getDefObjectClass() { return defObjectClass; }
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/ApplicationBean.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/ApplicationBean.java Wed Dec 09 14:08:40 2015 -0500 @@ -17,7 +17,6 @@ import org.mpi.openmind.repository.services.ServiceRegistry; import org.mpi.openmind.search.SearchService; import org.mpi.openmind.security.SecurityService; -import org.mpiwg.itgroup.escidoc.ESciDocCache; import de.mpiwg.itgroup.ismi.entry.dataBeans.SimpleSearchCache; import de.mpiwg.itgroup.ismi.publicView.PublicCodexList; @@ -56,8 +55,6 @@ private PublicCodexList publicCodexList; - public ESciDocCache refCache = new ESciDocCache(); - public static String generateExportURL(String urlRoot, List<Long> list, String mode){ StringBuilder sb = new StringBuilder(urlRoot); @@ -201,10 +198,6 @@ this.suggestedSubjects = suggestedSubjects; } - public void listenerSynchronizeESciDocCacheWithServer(){ - this.refCache.synchronizeWithServer(); - } - static{ dateTypes.add(new SelectItem(FORMATED_DATE)); @@ -534,10 +527,6 @@ this.dirty = true; } - public ESciDocCache getRefCache() { - return refCache; - } - public String getJSConfirmationSave(){ return "if(!confirm('Do you really want to save the changes?')){ return false; };"; }
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentTextBean.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentTextBean.java Wed Dec 09 14:08:40 2015 -0500 @@ -22,17 +22,11 @@ import org.mpi.openmind.repository.utils.TransliterationUtil; import org.mpi.openmind.security.bo.User; - - - import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; -import de.mpiwg.itgroup.ismi.entry.utils.PrivacityUtils; import de.mpiwg.itgroup.ismi.util.guiComponents.Calendar; import de.mpiwg.itgroup.ismi.util.guiComponents.EndNoteMisattribution; import de.mpiwg.itgroup.ismi.util.guiComponents.EndNoteMisattributionTable; import de.mpiwg.itgroup.ismi.util.guiComponents.EntityList; -import de.mpiwg.itgroup.ismi.util.guiComponents.TargetMisattribution; -import de.mpiwg.itgroup.ismi.util.guiComponents.MisattributionDataTable; public class CurrentTextBean extends AbstractISMIBean implements Serializable{ private static final long serialVersionUID = 1017399812886455381L;
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/SessionBean.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/SessionBean.java Wed Dec 09 14:08:40 2015 -0500 @@ -12,13 +12,10 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.mpi.openmind.cache.WrapperService; import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; import org.mpi.openmind.security.SecurityService; import org.mpi.openmind.security.bo.User; -import org.mpiwg.itgroup.escidoc.utils.ESciDocItemDataTable; -import org.mpiwg.itgroup.escidoc.web.ESciDocItemForm; import org.mpiwg.itgroup.geonames.GeonameForm; import org.richfaces.event.ItemChangeEvent; @@ -32,7 +29,6 @@ import de.mpiwg.itgroup.ismi.merge.GeneralMerge; import de.mpiwg.itgroup.ismi.publicView.DynamicPageEditor; import de.mpiwg.itgroup.ismi.publicView.PublicCodexBean; -import de.mpiwg.itgroup.ismi.publicView.PublicCodexList; import de.mpiwg.itgroup.ismi.publicView.PublicCodexView; import de.mpiwg.itgroup.ismi.publicView.pages.DynamicPage; import de.mpiwg.itgroup.ismi.search.beans.AdvancedSearchBean; @@ -58,10 +54,6 @@ private DisplayAuthorBean displayAuthor = new DisplayAuthorBean(); private DisplayTitleBean displayTitle = new DisplayTitleBean(); - private ESciDocItemForm eSciDocForm = new ESciDocItemForm(); - - private ESciDocItemDataTable refDataTable = new ESciDocItemDataTable(null); - private DynamicPageEditor pageEditor = null; @@ -180,10 +172,6 @@ return null; } - public void listenerOpenESciDocForm(ActionEvent event){ - this.refDataTable.open(); - } - //************************************ //************************************ //************************************ @@ -1048,22 +1036,6 @@ this.entDetailsForm = entDetailsForm; } - public ESciDocItemForm geteSciDocForm() { - return eSciDocForm; - } - - public void seteSciDocForm(ESciDocItemForm eSciDocForm) { - this.eSciDocForm = eSciDocForm; - } - - public ESciDocItemDataTable getRefDataTable() { - return refDataTable; - } - - public void setRefDataTable(ESciDocItemDataTable refDataTable) { - this.refDataTable = refDataTable; - } - public GeonameForm getGeoForm() { return geoForm; }
--- a/src/main/java/de/mpiwg/itgroup/ismi/event/beans/AbstractEvent.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/event/beans/AbstractEvent.java Wed Dec 09 14:08:40 2015 -0500 @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; -import javax.faces.event.ActionEvent; import javax.faces.event.AjaxBehaviorEvent; import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem;
--- a/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java Wed Dec 09 14:08:40 2015 -0500 @@ -4,21 +4,14 @@ import java.util.List; import javax.faces.event.ActionEvent; -import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; -import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; -import org.mpiwg.itgroup.escidoc.ESciDocHandler; -import org.mpiwg.itgroup.escidoc.bo.Publication; import de.mpiwg.itgroup.ismi.auxObjects.SelectItem0; import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; -import de.mpiwg.itgroup.ismi.entry.beans.ApplicationBean; import de.mpiwg.itgroup.ismi.entry.utils.PrivacityUtils; -import de.mpiwg.itgroup.ismi.util.guiComponents.HtmlOption; import de.mpiwg.itgroup.ismi.utils.templates.TitleTemplate; import de.mpiwg.itgroup.ismi.utils.templates.WitnessTemplate;
--- a/src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/MisattributionDataTable.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -package de.mpiwg.itgroup.ismi.util.guiComponents; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.event.ActionEvent; -import javax.faces.event.ValueChangeEvent; - -import org.mpi.openmind.repository.bo.Entity; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; -import org.mpiwg.itgroup.escidoc.utils.ESciDocItemDataTable; - -import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; -import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; - -/** - * TEXT misattributed_to PERSON - * @author jurzua - * - */ -public class MisattributionDataTable extends AbstractISMIBean{ - - private List<TargetMisattribution> misattList = new ArrayList<TargetMisattribution>(); - private Map<Long, Boolean> selectionList = new HashMap<Long, Boolean>(); - - private ListenerObject lo = new ListenerObject(); - private String attName; - private String objectClass; - - private TargetMisattribution currentMisatt; - private ESciDocItemDataTable refDataTable; - - public MisattributionDataTable(String oc, String attName){ - this.attName = attName; - this.objectClass = oc; - this.refDataTable = new ESciDocItemDataTable(this); - } - - public void setESciDocItem(ESciDocItem item){ - if(this.currentMisatt != null){ - this.currentMisatt.setItem(item); - } - } - - public void listenerCloseRefDialog(ActionEvent event){ - this.currentMisatt = null; - this.refDataTable.listenerClose(event); - } - - public void listenerOpenRefDialog(ActionEvent event){ - this.currentMisatt = (TargetMisattribution)getRequestBean("misatt"); - this.refDataTable.listenerOpen(event); - } - - - public void listenerAdd(ActionEvent event){ - this.add(this.lo.entity); - } - - public void listenerRemoveSelection(ActionEvent event){ - for(Entity remove : getSelectedEntities()){ - this.remove(remove.getId()); - } - } - - public void listenerChanged(ValueChangeEvent event) { - this.lo = changeListener(event, lo, this.objectClass, this.attName); - if(lo.entity != null && lo.entity.isPersistent()){ - lo.statusImage.setStatus(StatusImage.STATUS_OK); - }else{ - lo.statusImage.setStatus(StatusImage.STATUS_UNSET); - } - } - - private List<Entity> getSelectedEntities(){ - List<Entity> list = new ArrayList<Entity>(); - for(TargetMisattribution misatt : this.misattList){ - Entity e = misatt.getPerson(); - if(selectionList.get(e.getId())){ - list.add(e); - } - } - return list; - } - - public void add(Entity e){ - if(e != null && e.isPersistent()){ - if(!selectionList.containsKey(e.getId())){ - this.misattList.add(new TargetMisattribution(e, null, null, getAppBean())); - this.selectionList.put(e.getId(), false); - //TODO sort - //Collections.sort(this.misattList); - } - } - } - - public void add(Entity person, String refId, String notes){ - this.misattList.add(new TargetMisattribution(person, refId, notes, getAppBean())); - this.selectionList.put(person.getId(), false); - } - - public void remove(Long id){ - this.selectionList.remove(id); - TargetMisattribution toDelete = null; - for(TargetMisattribution misatt : this.misattList){ - Entity ent = misatt.getPerson(); - if(ent.getId().intValue() == id){ - toDelete = misatt; - break; - } - } - this.misattList.remove(toDelete); - } - - - public List<TargetMisattribution> getMisattList() { - return misattList; - } - - public void setMisattList(List<TargetMisattribution> misattList) { - this.misattList = misattList; - } - - public Map<Long, Boolean> getSelectionList() { - return selectionList; - } - public void setSelectionList(Map<Long, Boolean> selectionList) { - this.selectionList = selectionList; - } - public ListenerObject getLo() { - return lo; - } - public void setLo(ListenerObject lo) { - this.lo = lo; - } - public String getAttName() { - return attName; - } - public void setAttName(String attName) { - this.attName = attName; - } - public String getObjectClass() { - return objectClass; - } - public void setObjectClass(String objectClass) { - this.objectClass = objectClass; - } - public TargetMisattribution getCurrentMisatt() { - return currentMisatt; - } - public void setCurrentMisatt(TargetMisattribution currentMisatt) { - this.currentMisatt = currentMisatt; - } - - public ESciDocItemDataTable getRefDataTable() { - return refDataTable; - } - - public void setRefDataTable(ESciDocItemDataTable refDataTable) { - this.refDataTable = refDataTable; - } -}
--- a/src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/Reference.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/Reference.java Wed Dec 09 14:08:40 2015 -0500 @@ -17,7 +17,6 @@ */ private static final long serialVersionUID = 8933033295341938974L; public static String ADD_INFORMATION = "additional_information"; - public static String ESCIDOC_ID = "id"; public static String ENDNOTE_ID = "endnote-id"; public static String ENDNOTE_CONTENT = "endnote-content"; @@ -28,7 +27,6 @@ private String endNoteId; private String endNoteContent; private String addInformation; - private String escidocId; //private int mode = CREATION; @Override @@ -43,8 +41,7 @@ Reference other = (Reference)o; if(StringUtils.equals(endNoteId, other.endNoteId) && StringUtils.equals(endNoteContent, other.endNoteContent) && - StringUtils.equals(addInformation, other.addInformation) && - StringUtils.equals(escidocId, other.escidocId)){ + StringUtils.equals(addInformation, other.addInformation)) { //@TODO compare entities return true; } @@ -64,9 +61,6 @@ if(ent.containsAttribute(ADD_INFORMATION)){ this.addInformation = ent.getAttributeByName(ADD_INFORMATION).getValue(); } - if(ent.containsAttribute(ESCIDOC_ID)){ - this.escidocId = ent.getAttributeByName(ESCIDOC_ID).getValue(); - } if(ent.containsAttribute(ENDNOTE_ID)){ this.endNoteId = ent.getAttributeByName(ENDNOTE_ID).getValue(); } @@ -82,8 +76,7 @@ if(ent == null && StringUtils.isEmpty(endNoteId) && StringUtils.isEmpty(endNoteContent) && - StringUtils.isEmpty(addInformation) && - StringUtils.isEmpty(escidocId)){ + StringUtils.isEmpty(addInformation)) { return true; } return false; @@ -97,9 +90,6 @@ if(!ent.containsAttribute(ADD_INFORMATION)){ ent.addAttribute(new Attribute(ADD_INFORMATION, "text", this.addInformation)); } - if(!ent.containsAttribute(ESCIDOC_ID)){ - ent.addAttribute(new Attribute(ESCIDOC_ID, "text", this.escidocId)); - } if(!ent.containsAttribute(ENDNOTE_ID)){ ent.addAttribute(new Attribute(ENDNOTE_ID, "text", this.endNoteId)); } @@ -111,9 +101,6 @@ if(StringUtils.isNotEmpty(addInformation)){ ent.getAttributeByName(ADD_INFORMATION).setValue(addInformation); } - if(StringUtils.isNotEmpty(escidocId)){ - ent.getAttributeByName(ESCIDOC_ID).setValue(escidocId); - } if(StringUtils.isNotEmpty(endNoteId)){ ent.getAttributeByName(ENDNOTE_ID).setValue(endNoteId); } @@ -148,14 +135,6 @@ this.addInformation = addInformation; } - public String getEscidocId() { - return escidocId; - } - - public void setEscidocId(String escidocId) { - this.escidocId = escidocId; - } - @Override public String toString(){ StringBuilder sb = new StringBuilder(); @@ -170,9 +149,6 @@ if(StringUtils.isNotEmpty(endNoteContent)){ sb.append(endNoteContent + "\n"); } - if(StringUtils.isNotEmpty(escidocId)){ - sb.append(escidocId); - } return sb.toString(); }
--- a/src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/TargetMisattribution.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -package de.mpiwg.itgroup.ismi.util.guiComponents; - -import org.mpi.openmind.repository.bo.Entity; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; - -import de.mpiwg.itgroup.ismi.entry.beans.ApplicationBean; - -public class TargetMisattribution{ - private Entity person; - //private Publication pub; - private ESciDocItem item; - - public TargetMisattribution(Entity person, String refId, String notes, ApplicationBean appBean){ - this.person = person; - - this.item = appBean.getRefCache().getItem(refId); - if(this.item == null){ - this.item = new ESciDocItem(refId); - this.item.setErrorLoading(ESciDocItem.ESCIDOC_ERROR_ID_NO_FOUND); - } - this.item.getPublication().setAdditionalInformation(notes); - - /* - try{ - this.pub = ESciDocHandler.getPublicationById(refId); - }catch (Exception e) { - System.err.println("The references could not be loaded. The server did not respond."); - } - - if(this.pub == null){ - this.pub = new Publication(refId); - this.pub.setErrorLoading(Publication.ESCIDOC_ERROR_ID_NO_FOUND); - } - this.pub.setAdditionalInformation(notes); - */ - } - - public Entity getPerson() { - return person; - } - public void setPerson(Entity person) { - this.person = person; - } - - public ESciDocItem getItem() { - return item; - } - - public void setItem(ESciDocItem item) { - this.item = item; - } -} \ No newline at end of file
--- a/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/AbstractTemplate.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/AbstractTemplate.java Wed Dec 09 14:08:40 2015 -0500 @@ -4,13 +4,7 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang.StringUtils; -import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; -import org.mpiwg.itgroup.escidoc.ESciDocHandler; -import org.mpiwg.itgroup.escidoc.bo.Publication; - -import de.mpiwg.itgroup.ismi.util.guiComponents.Reference; public abstract class AbstractTemplate implements Serializable{ @@ -34,38 +28,18 @@ private static final long serialVersionUID = -8257628538319156038L; - private String escidocLabel; private String additionalInf; private String endnoteId; private String endnoteContent; public ReferenceTemplate(Entity ent){ - Attribute att = ent.getAttributeByName(Reference.ESCIDOC_ID); - try { - if(att != null && StringUtils.isNotEmpty(att.getValue())){ - Publication pub = ESciDocHandler.getPublicationById(att.getValue()); - if(pub != null){ - this.escidocLabel = pub.getHTMLLabel(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - - this.additionalInf = (ent.getAttributeByName("additional_information") != null) ? ent.getAttributeByName("additional_information").getValue() : null; this.endnoteId = (ent.getAttributeByName("endnote-id") != null) ? ent.getAttributeByName("endnote-id").getValue() : null; this.endnoteContent = (ent.getAttributeByName("endnote-content") != null) ? ent.getAttributeByName("endnote-content").getValue() : null; } - public String getEscidocLabel() { - return escidocLabel; - } - public void setEscidocLabel(String escidocLabel) { - this.escidocLabel = escidocLabel; - } public String getAdditionalInf() { return additionalInf; }
--- a/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/AuthorTemplate.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/AuthorTemplate.java Wed Dec 09 14:08:40 2015 -0500 @@ -12,9 +12,6 @@ import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; import org.mpi.openmind.repository.bo.Relation; -import org.mpi.openmind.search.AbstractSearchService; -import org.mpiwg.itgroup.escidoc.ESciDocHandler; -import org.mpiwg.itgroup.escidoc.bo.Publication; import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; import de.mpiwg.itgroup.ismi.util.guiComponents.Calendar;
--- a/src/main/java/org/mpiwg/itgroup/escidoc/AbstractClient.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,376 +0,0 @@ -package org.mpiwg.itgroup.escidoc; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.client.params.ClientPNames; -import org.apache.http.client.params.CookiePolicy; -import org.apache.http.entity.InputStreamEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.jdom.Attribute; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; -import org.jdom.xpath.XPath; -import org.mpiwg.itgroup.escidoc.bo.Creator; -import org.mpiwg.itgroup.escidoc.bo.ESciDocConstants; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; -import org.mpiwg.itgroup.escidoc.bo.Publication; -import org.mpiwg.itgroup.escidoc.bo.Publishing; - -public class AbstractClient extends ESciDocConstants implements Serializable{ - - private static final long serialVersionUID = 8133780898394554218L; - - private String user; - private String password; - public String eScidocUrl; - private HttpClient httpclient = null; - - public AbstractClient(String eScidocServer, int eScidocPort, String user, - String password) { - this.user = user; - this.password = password; - this.eScidocUrl = "http://" + eScidocServer + ":" - + String.valueOf(eScidocPort); - } - - public HttpClient login() throws IOException { - httpclient = new DefaultHttpClient(); - - httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY, - CookiePolicy.BROWSER_COMPATIBILITY); - - HttpPost httppost = new HttpPost(eScidocUrl + "/aa/login?target=/"); - - HttpResponse response = httpclient.execute(httppost); - // HttpEntity entity = httppost.getRes - - System.out.println("----------------------------------------"); - System.out.println(response.getStatusLine()); - - HttpEntity entity = response.getEntity(); - if (entity != null) { - entity.consumeContent(); - } - - HttpGet httpget = new HttpGet(eScidocUrl - + "/aa/j_spring_security_check?j_username=" + user - + "&j_password=" + password); - - response = httpclient.execute(httpget); - // entity = response.getEntity(); - - System.out.println("----------------------------------------"); - System.out.println(response.getStatusLine()); - - entity = response.getEntity(); - if (entity != null) { - entity.consumeContent(); - } - - // entity.consumeContent(); - return httpclient; - } - - public HttpClient getHttpClient() throws IOException { - //if (httpclient == null) { - //how can be detected that the timeout of the session??? - this.login(); - //} - return httpclient; - } - - public ESciDocItem eScidocPut(String command, InputStream body) - throws IOException, JDOMException, ESciDocException, Exception { - //create PUT /ir/item return item - //update PUT /ir/item/<item-id> return item - System.out.println("PUT " + eScidocUrl + command); - HttpPut httpput = new HttpPut(eScidocUrl + command); - return getItemFromDoc(eScidocRequestBase(httpput, command, body)); - } - - public String eScidocPost(String command, InputStream body) - throws IOException, JDOMException, ESciDocException, Exception { - ///ir/item/<item-id>/submit last-modification-date - ///ir/item/<item-id>/release last-modification-date within XML (result.xsd) - System.out.println("----------------------"); - System.out.println("POST " + eScidocUrl + command); - HttpPost httppost = new HttpPost(eScidocUrl + command); - - return getLastModificationDate(eScidocRequestBase(httppost, command, body)); - } - - public void eScidocDelete(String command, InputStream body) - throws IOException, JDOMException, ESciDocException, Exception { - //DELETE /ir/item/<item-id> - System.out.println("----------------------"); - System.out.println("DELETE " + eScidocUrl + command); - HttpDelete httppost = new HttpDelete(eScidocUrl + command); - - eScidocRequestBase(httppost, command, body); - return; - } - - public ESciDocItem eScidocGet(String command) throws IOException, - JDOMException, ESciDocException, Exception { - System.out.println("GET " + eScidocUrl + command); - HttpGet httpget = new HttpGet(eScidocUrl + command); - Document doc = eScidocRequestBase(httpget, command, null); - //System.out.println(new XMLOutputter().outputString(doc)); - return getItemFromDoc(doc); - } - - private Document eScidocRequestBase(HttpRequestBase httpBase, String command, - InputStream body) throws Exception { - - if (HttpEntityEnclosingRequestBase.class.isInstance(httpBase)) { - if (body != null) { - HttpEntity entity = new InputStreamEntity(body, -1); - ((HttpEntityEnclosingRequestBase) httpBase).setEntity(entity); - } - } - - HttpResponse status = getHttpClient().execute(httpBase); - - InputStream in = status.getEntity().getContent(); - Document doc = new SAXBuilder().build(in); - - //System.out.println("Resonse output for " + command + ":"); - //System.out.println(new XMLOutputter().outputString(doc)); - - // the response can be an exception for the cases UPDATE and GET - // The response can be a Item for GET - - isReponseException(doc); - - return doc; - } - - public static ESciDocItem getItemFromDoc(Document doc) throws Exception { - List<ESciDocItem> list = getItemsFromDoc(doc); - if (!list.isEmpty()) - return list.get(0); - return null; - } - - public static List<ESciDocItem> getItemsFromDoc(Document doc) - throws Exception { - List<ESciDocItem> list = new ArrayList<ESciDocItem>(); - - XPath xp = XPath.newInstance(".//escidocItem:item"); - xp.addNamespace("escidocItem", "http://www.escidoc.de/schemas/item/0.9"); - - List<Object> inputList = xp.selectNodes(doc); - for (Object obj : inputList) { - if (obj instanceof Element) { - Element eItem = (Element) obj; - - - - ESciDocItem escidocItem = new ESciDocItem(); - // FIXME: sometimes this is not the last version, therefore.... - escidocItem.setLastModificationDate(eItem.getAttributeValue("last-modification-date")); - addVersionToItem(eItem, escidocItem); - addPublicStatusItem(eItem, escidocItem); - addLatestVersionToItem(eItem, escidocItem); - addLatestRelease(eItem, escidocItem); - - escidocItem.setPublication(getPubFromXMLElement(eItem)); - Attribute objIdAtt = eItem.getAttribute("objid"); - String objId = (objIdAtt != null) ? objIdAtt.getValue() : null; - - if(StringUtils.isEmpty(objId)){ - //xlink:href="/ir/item/escidoc:127561" - objIdAtt = eItem.getAttribute("href", NS_XLINK); - objId = (objIdAtt != null) ? objIdAtt.getValue() : ""; - objId = objId.replace("/ir/item/", ""); - } - escidocItem.getPublication().setObjid(objId); - - list.add(escidocItem); - } else { - System.out.println(obj); - } - } - - return list; - } - - public static void addPublicStatusItem(Element eItem, ESciDocItem item){ - Element props = eItem.getChild("properties", NS_ESCIDOC_ITEM); - Element publicStatus = props.getChild("public-status", NS_PROP); - - item.setPublicStatus((publicStatus != null) ? publicStatus.getValue() : null); - } - - public static void addVersionToItem(Element eItem, ESciDocItem item){ - Element props = eItem.getChild("properties", NS_ESCIDOC_ITEM); - Element version = props.getChild("version", NS_PROP); - - if(version != null){ - String value = (version.getChild("number", NS_VERSION) != null) ? version.getChild("number", NS_VERSION).getValue() : null; - item.setVersionNumber(value); - - value = (version.getChild("date", NS_VERSION) != null) ? version.getChild("date", NS_VERSION).getValue() : null; - item.setVersionDate(value); - - value = (version.getChild("status", NS_VERSION) != null) ? version.getChild("status", NS_VERSION).getValue() : null; - item.setVersionStatus(value); - } - } - - public static void addLatestVersionToItem(Element eItem, ESciDocItem item){ - Element props = eItem.getChild("properties", NS_ESCIDOC_ITEM); - Element latestVersion = props.getChild("latest-version", NS_PROP); - - //Attribute hrefAtt = latestVersion.getAttribute("href", NS_XLINK); - //putting into item - item.setLatestVersionNumber(latestVersion.getChild("number", NS_VERSION).getValue()); - item.setLatestVersionDate(latestVersion.getChild("date", NS_VERSION).getValue()); - //item.setLatestVersionHref(hrefAtt.getValue()); - } - - - - private static void addLatestRelease(Element eItem, ESciDocItem item){ - Element props = eItem.getChild("properties", NS_ESCIDOC_ITEM); - Element latestRelease = props.getChild("latest-release", NS_PROP); - - if(latestRelease != null){ - //Attribute hrefAtt = latestRelease.getAttribute("href", NS_XLINK); - - //putting into item - item.setLatestReleaseNumber(latestRelease.getChild("number", NS_RELEASE).getValue()); - item.setLatestReleaseDate(latestRelease.getChild("date", NS_RELEASE).getValue()); - //item.setLatestReleasePid(latestRelease.getChild("pid", NS_RELEASE).getValue()); - //item.setLatestReleaseHref(hrefAtt.getValue()); - } - } - - private void isReponseException(Document doc) - throws JDOMException, IOException, ESciDocException { - - XPath xp = XPath.newInstance(".//exception"); - xp.addNamespace("escidocItem", "http://www.escidoc.de/schemas/item/0.9"); - - List<Object> inputList = xp.selectNodes(doc); - if (!inputList.isEmpty()) { - throw new ESciDocException((Element) inputList.get(0)); - } - } - - private String getLastModificationDate(Document doc) throws JDOMException{ - - if(doc.getRootElement().getName().equals("result")){ - Attribute lastModif = doc.getRootElement().getAttribute("last-modification-date"); - if(lastModif != null){ - return lastModif.getValue(); - } - } - return null; - } - - protected static Publication getPubFromXMLElement(Element item) { - - Publication reference = new Publication(getObjId(item.getAttribute( - "href", NS_XLINK))); - - Element md_records = item.getChild("md-records", NS_ESCIDOC_MD_RECORDS); - Element md_record = md_records.getChild("md-record", NS_ESCIDOC_MD_RECORDS); - Element publication = md_record.getChild("publication", NS_PUBLICATION); - - List<Object> creatorList = publication.getChildren("creator", NS_ETERMS); - Element title = publication.getChild("title", NS_DC); - List<Object> alternativeList = publication.getChildren("alternative", NS_DCTERMS); - Element publishing_info = publication.getChild("publishing-info", NS_ETERMS); - Element issued = publication.getChild("issued", NS_DCTERMS); - Element totalNumberOfPages = publication.getChild("total-number-of-pages", NS_ETERMS); - - //<dcterms:subject xmlns:dcterms="http://purl.org/dc/terms/"> - Element subject = publication.getChild("subject", NS_DCTERMS); - - // Filling the reference - - for (Object object : creatorList) { - if (object instanceof Element) { - Element creator = (Element) object; - Element person = creator.getChild("person", NS_PERSON); - - if (person != null) { - Element complete_name = person.getChild("complete-name", - NS_ETERMS); - Element family_name = person.getChild("family-name", - NS_ETERMS); - Element given_name = person.getChild("given-name", - NS_ETERMS); - Element organization = person.getChild("organization", - NS_ORGANIZATION); - - reference.addCreator(new Creator( - (complete_name != null) ? complete_name.getText() - : "", (family_name != null) ? family_name - .getText() : "", - (given_name != null) ? given_name.getText() : "")); - } - } - } - - reference.setTitle((title != null) ? title.getText() : ""); - - for (Object object : alternativeList) { - if (object instanceof Element) { - Element alternative = (Element) object; - reference.addAlternative(alternative.getText()); - } - } - - if (publishing_info != null) { - Element publisher = publishing_info.getChild("publisher", NS_DC); - Element place = publishing_info.getChild("place", NS_ETERMS); - Element edition = publishing_info.getChild("edition", NS_ETERMS); - - reference.setPublishing(new Publishing( - (publisher != null) ? publisher.getText() : "", - (place != null) ? place.getText() : "", - (edition != null) ? edition.getText() : "")); - } - - reference.setIssued - ((issued != null) ? issued.getText() : ""); - reference.setNumberOfPages - ((totalNumberOfPages != null) ? totalNumberOfPages.getText() : ""); - reference.setSubject - ((subject != null) ? subject.getText() : ""); - - return reference; - } - - private static String getObjId(Attribute att) { - // new Attribute("href", "/ir/item/"+ publication.getObjid() - // +"/md-records", NS_XLINK) - if (att != null) { - String objId = att.getValue().replace("/ir/item/", ""); - String[] array = objId.split(":"); - if (array.length == 3) { - return array[0] + ":" + array[1]; - } - return objId; - } - return null; - } -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/AbstractESciDocCache.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -package org.mpiwg.itgroup.escidoc; - -import java.io.Serializable; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; - -public class AbstractESciDocCache implements Serializable{ - - private static final long serialVersionUID = 2093872792493279298L; - - private static Integer SERVER_STATUS_OK = 0; - private static Integer SERVER_STATUS_DOWN = 1; - - public static int SORT_NONE = -1; - public static int SORT_DEFAULT = 0; - public static int SORT_TITLE = 1; - public static int SORT_CREATOR = 2; - - - private int serverStatus = SERVER_STATUS_OK; - private Long lastSynchronizationTimeExec; - private Date lastSynchronization; - private int lastSynchronizationMaxRecords; - private final static DateFormat dateformater = new SimpleDateFormat("yyyy.MM.dd-HH:mm"); - - protected ESciDocClient client = new ESciDocClient("escidoc.mpiwg-berlin.mpg.de", 8080, "jurzua", "221082"); - - private Map<String,ESciDocItem> itemMap; - private Integer maxRecords = 50; - - public Map<String,ESciDocItem> getItemMap(){ - if(itemMap == null || SERVER_STATUS_DOWN.equals(serverStatus)){ - this.synchronizeWithServer(); - } - return itemMap; - } - - public int getItemsSize(){ - return this.getItemMap().size(); - } - - public void synchronizeWithServer(){ - - System.out.println("synchronizeWithServer Pubman"); - - long start = System.currentTimeMillis(); - this.itemMap = new HashMap<String, ESciDocItem>(); - this.lastSynchronizationMaxRecords = this.maxRecords; - try { - //List<ESciDocItem> list = new ArrayList<ESciDocItem>(); //ESciDocClient.getAllItems(); - - List<ESciDocItem> list = new ArrayList<ESciDocItem>(); //ESciDocClient.getAllItems(this.maxRecords); - for(ESciDocItem item : list){ - this.itemMap.put(item.getPublication().getObjid(), item); - } - this.serverStatus = SERVER_STATUS_OK; - } catch (Exception e) { - e.printStackTrace(); - this.serverStatus = SERVER_STATUS_DOWN; - } finally{ - this.lastSynchronization = new Date(); - } - this.lastSynchronizationTimeExec = System.currentTimeMillis() - start; - } - - public String getServerStatus(){ - if(SERVER_STATUS_OK.equals(serverStatus)){ - return new String("OK"); - }else{ - return new String("Server did not respond."); - } - } - - public String getLastSynchronization() { - return dateformater.format(lastSynchronization); - } - - public boolean isServerStatusOK(){ - if(SERVER_STATUS_OK.equals(SERVER_STATUS_OK)) - return true; - return false; - } - - public Long getLastSynchronizationTimeExec() { - return lastSynchronizationTimeExec; - } - - public Integer getMaxRecords() { - return maxRecords; - } - - public void setMaxRecords(Integer maxRecords) { - this.maxRecords = maxRecords; - } - - public int getLastSynchronizationMaxRecords() { - return lastSynchronizationMaxRecords; - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/BootcampClient.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -package org.mpiwg.itgroup.escidoc; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.entity.InputStreamEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.json.JSONException; -import org.json.JSONObject; - -public class BootcampClient { - - public static String url = "http://localhost:8080/"; - - - public static void testPost() throws JSONException, ClientProtocolException, IOException{ - HttpPost httpBase = new HttpPost("http://localhost:8080/"); - - JSONObject json = new JSONObject(); - json.put("name", "Jorge hahaha"); - json.put("text", "jhakjhskhjdsahjdsahjkdsa"); - - - - InputStream body = new ByteArrayInputStream(json.toString().getBytes()); - if (HttpEntityEnclosingRequestBase.class.isInstance(httpBase)) { - if (body != null) { - HttpEntity entity = new InputStreamEntity(body, -1); - ((HttpEntityEnclosingRequestBase) httpBase).setEntity(entity); - } - } - - HttpResponse status = (new DefaultHttpClient()).execute(httpBase); - } - - /** - * @param args - */ - public static void main(String[] args) { - try { - System.out.println("TESTING BEGINING*******"); - testPost(); - System.out.println("TESTING END************"); - } catch (Exception e) { - e.printStackTrace(); - } - - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/ESciDocCache.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -package org.mpiwg.itgroup.escidoc; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.faces.event.ActionEvent; - -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; -import org.jdom.JDOMException; -import org.mpi.openmind.repository.utils.NormalizerUtils; -import org.mpiwg.itgroup.escidoc.bo.Creator; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; -import org.mpiwg.itgroup.escidoc.bo.utils.SortItemByCreator; -import org.mpiwg.itgroup.escidoc.bo.utils.SortItemByTitle; - -public class ESciDocCache extends AbstractESciDocCache{ - - private static final long serialVersionUID = 2087364857910704625L; - - private static Logger logger = Logger.getLogger(ESciDocCache.class); - - public ESciDocCache(){ - this.synchronizeWithServer(); - } - - public ESciDocItem getItemFromServer(String id) throws IOException, JDOMException, ESciDocException, Exception{ - System.out.println("ESciDocCache.getItemFromServer " + id); - return this.client.getItemX(id); - } - - public ESciDocItem getItem(String id){ - System.out.println("ESciDocCache.getItem " + id); - return this.getItemMap().get(id); - } - - public void deleteItem(ESciDocItem item, String userName) throws Exception{ - logger.info("Deleting " + item.getObjId()); - - /* - if(item.getVersionStatus().equals("released")){ - //only doing a change, the update of the item will change its status to pending, - //otherwise I do not see a way to move from released to pending (in-revision would also work). - item.getPublication().setTitle(item.getPublication().getTitle() + "."); - item = this.client.updateItem(item); - item.setLastModificationDate(this.client.submitItem(item, userName)); - item.setLastModificationDate(this.client.reviseItem(item, userName)); - - }*/ - - if(item.getPublicStatus().equals("pending") || item.getPublicStatus().equals("in-revision")){ - this.client.deleteItem(item.getObjId()); - }else{ - this.client.withdrawItem(item, userName); - } - - - this.getItemMap().remove(item.getObjId()); - } - - public ESciDocItem saveItem(ESciDocItem item, String userName) throws Exception{ - - logger.info("Saving " + item.getObjId()); - - if(item != null && StringUtils.isNotEmpty(item.getObjId())){ - - item = this.client.updateItem(item); - - - }else if(StringUtils.isEmpty(item.getObjId())){ - - item = this.client.createItem(item); - - } - - if(item.getVersionStatus().equals("pending")){ - //Submitting - item.setLastModificationDate(this.client.submitItem(item, userName)); - item.setLastModificationDate(this.client.releaseItem(item, userName)); - } - - if(item.getVersionStatus().equals("submitted")){ - //Releasing - item.setLastModificationDate(this.client.releaseItem(item, userName)); - } - - this.getItemMap().put(item.getObjId(), item); - - return item; - } - - - public List<ESciDocItem> getAllItems(Integer sortBy){ - List<ESciDocItem> list = new ArrayList<ESciDocItem>(getItemMap().values()); - sort(sortBy, list); - return list; - } - - public static void sort(Integer sortBy, List<ESciDocItem> list){ - if(sortBy == null || sortBy.equals(SORT_NONE)){ - return; - }else if(sortBy.equals(SORT_DEFAULT)){ - Collections.sort(list); - }else if(sortBy.equals(SORT_TITLE)){ - Collections.sort(list, new SortItemByTitle()); - }else if(sortBy.equals(SORT_CREATOR)){ - Collections.sort(list, new SortItemByCreator()); - } - } - - public void listenerSynchronizeWithServer(ActionEvent event){ - this.synchronizeWithServer(); - } - - public List<ESciDocItem> searchItem(String term, Integer sortBy){ - List<ESciDocItem> rs = new ArrayList<ESciDocItem>(); - - if(StringUtils.isNotEmpty(term)){ - term = NormalizerUtils.normalize(term); - - for(ESciDocItem item : getItemMap().values()){ - if(itemContainsTerm(item, term)){ - rs.add(item); - } - } - sort(sortBy, rs); - } - return rs; - } - - private boolean itemContainsTerm(ESciDocItem item, String term){ - - if(item.getObjId().contains(term)) - return true; - - String secondTerm = item.getPublication().getNorTitle(); - if(secondTerm.contains(term)) - return true; - - secondTerm = item.getPublication().getNorSubject(); - if(secondTerm.contains(term)) - return true; - - for(String secondTerm0 : item.getPublication().getNorAlternativeList()){ - if(secondTerm0.contains(term)) - return true; - } - - for(Creator creator : item.getPublication().getCreatorList()){ - if(creator.containsTerm(term)) - return true; - } - - return false; - } - - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/ESciDocClient.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +0,0 @@ -package org.mpiwg.itgroup.escidoc; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.net.HttpURLConnection; -import java.net.URI; -import java.net.URL; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.params.ClientPNames; -import org.apache.http.client.params.CookiePolicy; -import org.apache.http.impl.client.DefaultHttpClient; -import org.jdom.Attribute; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; -import org.jdom.output.XMLOutputter; -import org.jdom.xpath.XPath; -import org.mpiwg.itgroup.escidoc.bo.Creator; -import org.mpiwg.itgroup.escidoc.bo.ESciDocConstants; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; -import org.mpiwg.itgroup.escidoc.bo.Publication; -import org.mpiwg.itgroup.escidoc.bo.Publishing; - -public class ESciDocClient extends AbstractClient implements Serializable{ - - private static final long serialVersionUID = 4982908578268938883L; - public static String GET_ITEM = "http://escidoc.mpiwg-berlin.mpg.de:8080/ir/item/"; - public static String GET_CONTEXT = "http://escidoc.mpiwg-berlin.mpg.de:8080/ir/context/"; - public static String PUT_ITEM = GET_ITEM; - public static String CREATE_ITEM = GET_ITEM; - - public static String ISMI_CONTEXT_ID = "escidoc:79281"; - private static String ENCODING = "UTF-8"; - - public static String host = - "http://escidoc.mpiwg-berlin.mpg.de:8080/srw/search/escidoc_all?operation=searchRetrieve&maximumRecords=MAX_RECORDS&query="; - - public static String queryGetAll = - "escidoc.content-model.objid=escidoc:persistent4 and escidoc.context.objid=" - + ISMI_CONTEXT_ID; - - public static String queryGetObjectById = "escidoc.content-model.objid=escidoc:persistent4 and escidoc.context.objid=" - + ISMI_CONTEXT_ID + " and escidoc.objid="; - - public static String queryByTitle = "escidoc.content-model.objid=escidoc:persistent4 and escidoc.context.objid=" - + ISMI_CONTEXT_ID + " and escidoc.any-title:="; - - static { - try { - // PUT_ITEM = URLEncoder.encode(PUT_ITEM, ENCODING); - queryGetAll = URLEncoder.encode(queryGetAll, ENCODING); - queryGetObjectById = URLEncoder - .encode(queryGetObjectById, ENCODING); - queryByTitle = URLEncoder.encode(queryByTitle, ENCODING); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - } - - public ESciDocClient(String eScidocServer, int eScidocPort, String user, - String password) { - super(eScidocServer, eScidocPort, user, password); - } - - public void deleteItem(String objId) throws Exception { - eScidocDelete("/ir/item/" + objId, null); - return; - } - - - - public ESciDocItem updateItem(ESciDocItem item) throws Exception { - String body = new XMLOutputter().outputString(item.toXMLESciDoc(UPDATE)); - byte[] data = body.getBytes("UTF-8"); - return this.eScidocPut("/ir/item/" + item.getObjId(), new ByteArrayInputStream(data)); - } - - public ESciDocItem createItem(ESciDocItem item) throws Exception { - if(item.getObjId() != null){ - throw new Exception("Trying to create a item that has already an object id."); - } - String body = new XMLOutputter().outputString(item.toXMLESciDoc(CREATE)); - //System.out.println("----------------- INPUT for CREATE"); - //System.out.println(body); - //System.out.println("-----------------"); - byte[] data = body.getBytes("UTF-8"); - return this.eScidocPut("/ir/item", new ByteArrayInputStream(data)); - } - - /** - * - * @param item - * @param comment - * @return the modification date of this action that should be updated in the cache - * @throws Exception - */ - public String releaseItem(ESciDocItem item, String comment) throws Exception { - return this.executeAction(item, comment, "release"); - } - - /** - * - * @param item - * @param comment - * @return the modification date of this action that should be updated in the cache - * @throws Exception - */ - public String submitItem(ESciDocItem item, String comment) throws Exception { - return this.executeAction(item, comment, "submit"); - } - - public String reviseItem(ESciDocItem item, String comment) throws Exception { - return this.executeAction(item, comment, "revise"); - } - - public String withdrawItem(ESciDocItem item, String comment) throws Exception { - return this.executeAction(item, comment, "withdraw"); - } - - private String executeAction(ESciDocItem item, String comment, String action) throws Exception{ - Element param = new Element("param"); - param.setAttribute(new Attribute("last-modification-date", item.getLastModificationDate())); - Document doc = new Document(param); - - Element eComment = new Element("comment"); - if(StringUtils.isNotEmpty(comment)){ - eComment.addContent(comment); - } - param.addContent(eComment); - - String body = new XMLOutputter().outputString(doc); - byte[] data = body.getBytes("UTF-8"); - return this.eScidocPost("/ir/item/" + item.getObjId() + "/" + action, new ByteArrayInputStream(data)); - } - - public static List<ESciDocItem> getAllItems(Integer maxRecords) throws Exception { - String host0 = host.replace("MAX_RECORDS", maxRecords.toString()); - System.out.println("getAllPublications=" + host0 + queryGetAll); - URI uri = new URI(host0 + queryGetAll); - URL url = uri.toURL(); - InputStream in = url.openStream(); - Document doc = new SAXBuilder().build(in); - return getItemsFromDoc(doc); - } - - public ESciDocItem getItemX(String objId) throws IOException, JDOMException, ESciDocException, Exception{ - return eScidocGet("/ir/item/" + objId); - - } - - public static ESciDocItem getItem(String escidocId) throws Exception { - return getItemFromDoc(getItem0(escidocId)); - } - - private static Document getItem0(String escidocId) throws Exception { - URL url = new URL(GET_ITEM + escidocId); - System.out.println("getItem0= " + GET_ITEM + escidocId); - - HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); - httpCon.setRequestMethod("GET"); - - InputStreamReader in = new InputStreamReader(httpCon.getInputStream(), ENCODING); - - Document doc = new SAXBuilder().build(in); - return doc; - } - - public static void testGet() { - try { - ESciDocItem item = getItem("escidoc:127561"); - System.out.println(new XMLOutputter().outputString(item - .toXMLESciDoc(null))); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void testGetAndSave() { - try { - - //ESciDocItem item = getItem("escidoc:127561"); - - //System.out.println(new XMLOutputter().outputString(item.toXMLESciDoc(UPDATE))); - - ESciDocClient client = new ESciDocClient("escidoc.mpiwg-berlin.mpg.de", 8080, "jurzua", "221082"); - - ESciDocItem item = client.getItemX("escidoc:127561"); - - System.out.println(item.getLastModificationDate()); - - //item.getPublication().setTitle(item.getPublication().getTitle() + " test"); - //item.getPublication().setTitle(item.getPublication().getTitle().replace(" test", "")); - - //client.updateItem(item); - //client.submitItem(item, "test"); - //item = client.getItemX("escidoc:127561"); - client.releaseItem(item, "test"); - - - - //System.out.println(new XMLOutputter().outputString(item0 - // .toElementXMLESciDoc(UPDATE))); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void main(String[] args) throws IOException { - ESciDocClient.testGetAndSave(); - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/ESciDocException.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -package org.mpiwg.itgroup.escidoc; - -import org.jdom.Element; -import org.jdom.output.XMLOutputter; - -public class ESciDocException extends Exception{ - private static final long serialVersionUID = 798105291785018910L; - - private String message; - private String title; - private String stackTrace; - private String cls; - private boolean internalException = false; - - public ESciDocException(Element input){ - try{ - Element etitle = input.getChild("title"); - Element emessage = input.getChild("message"); - Element eclass = input.getChild("class"); - Element estackTrace = input.getChild("stack-trace"); - - this.title = (etitle != null) ? etitle.getValue() : null; - this.message = (emessage != null) ? emessage.getValue() : null; - this.cls = (eclass != null) ? eclass.getValue() : null; - this.stackTrace = (estackTrace != null) ? estackTrace.getValue() : null; - }catch (Exception e) { - this.stackTrace = new XMLOutputter().outputString(input); - this.internalException = true; - } - } - - @Override - public void printStackTrace() { - printStackTrace(System.err); - if(!internalException){ - String tmp = "Exception comming from sSciDoc Server: \n"; - tmp += title + "\n"; - tmp += message + "\n"; - tmp += cls + "\n"; - System.err.println(tmp + stackTrace); - }else{ - System.err.println(stackTrace); - } - } - - @Override - public String getMessage() { - return message; - } - - public String getTitle(){ - return title; - } - - public String getCls(){ - return cls; - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/ESciDocHandler.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -package org.mpiwg.itgroup.escidoc; - -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URL; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.Namespace; -import org.jdom.input.SAXBuilder; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; -import org.jdom.xpath.XPath; -import org.mpiwg.itgroup.escidoc.bo.Creator; -import org.mpiwg.itgroup.escidoc.bo.Publication; -import org.mpiwg.itgroup.escidoc.bo.Publishing; -import org.mpiwg.itgroup.escidoc.bo.utils.SortPublicationByTitle; - -public class ESciDocHandler { - - public static String ISMI_CONTEXT_ID = "escidoc:79281"; - private static String ENCODING = "UTF-8"; - public static String host = "http://escidoc.mpiwg-berlin.mpg.de:8080/srw/search/escidoc_all?operation=searchRetrieve&maximumRecords=5000&query="; - public static String queryGetAll = "escidoc.content-model.objid=escidoc:persistent4 and escidoc.context.objid=" + ISMI_CONTEXT_ID; - - public static String queryGetObjectById = "escidoc.content-model.objid=escidoc:persistent4 and escidoc.context.objid=" + ISMI_CONTEXT_ID + " and escidoc.objid="; - - public static String queryByTitle = "escidoc.content-model.objid=escidoc:persistent4 and escidoc.context.objid=" + ISMI_CONTEXT_ID + " and escidoc.any-title:="; - - static{ - try { - queryGetAll = URLEncoder.encode(queryGetAll, ENCODING); - queryGetObjectById = URLEncoder.encode(queryGetObjectById, ENCODING); - queryByTitle = URLEncoder.encode(queryByTitle, ENCODING); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - } - - public static List<Publication> getAllPublications() throws Exception{ - List<Publication> list = null; - System.out.println("getAllPublications=" + host + queryGetAll); - URI uri = new URI(host + queryGetAll); - URL url = uri.toURL(); - - InputStream in = url.openStream(); - list = getPublicationsFromStream(new SAXBuilder().build(in)); - - Collections.sort(list, new SortPublicationByTitle()); - return list; - } - - public static List<Publication> searchPublicationByTitle(String title) throws Exception{ - List<Publication> list = new ArrayList<Publication>(); - URI uri = new URI(host + queryGetAll); - URL url = uri.toURL(); - InputStream in = url.openStream(); - List<Publication> pubList = getPublicationsFromStream(new SAXBuilder().build(in)); - - title = title.toLowerCase(); - - for(Publication pub : pubList){ - if(StringUtils.isNotEmpty(pub.getTitle())){ - String pubTitle = pub.getTitle().toLowerCase(); - if(pubTitle.contains(title)){ - list.add(pub); - } - } - } - return list; - } - - public static List<Publication> searchPublicationByAuthor(String author) throws Exception{ - List<Publication> list = new ArrayList<Publication>(); - - URI uri = new URI(host + queryGetAll); - URL url = uri.toURL(); - InputStream in = url.openStream(); - List<Publication> pubList = getPublicationsFromStream(new SAXBuilder().build(in)); - - //TODO - /* - author = author.toLowerCase(); - - for(Publication pub : pubList){ - if(pub.getCreator() != null && StringUtils.isNotEmpty(pub.getCreator().getCompleteName())){ - String pubAuthor = pub.getCreator().getCompleteName().toLowerCase(); - if(pubAuthor.contains(author)){ - list.add(pub); - } - } - } */ - return list; - } - - public static Publication getPublicationById(String objectId) throws Exception{ - List<Publication> list = null; - String urlString = host + queryGetObjectById + objectId; - System.out.println(urlString); - URI uri = new URI(urlString); - URL url = uri.toURL(); - InputStream in = url.openStream(); - list = getPublicationsFromStream(new SAXBuilder().build(in)); - if(list.size() > 0){ - return list.get(0); - } - return null; - } - - private static List<Publication> getPublicationsFromStream(Document doc) throws Exception { - - List<Publication> list = new ArrayList<Publication>(); - - XPath xp = XPath.newInstance(".//escidocItem:item"); - xp.addNamespace("escidocItem", "http://www.escidoc.de/schemas/item/0.9"); - - List<Object> inputList = xp.selectNodes(doc); - //System.out.println("inputList.size: " + inputList.size()); - for(Object obj : inputList){ - if(obj instanceof Element){ - Element item = (Element)obj; - Publication reference = new Publication(item.getAttributeValue("objid")); - //System.out.println(reference.getObjid()); - - Element md_records = item.getChild("md-records", Namespace.getNamespace("escidocMetadataRecords", "http://www.escidoc.de/schemas/metadatarecords/0.5")); - Element md_record = md_records.getChild("md-record", Namespace.getNamespace("escidocMetadataRecords", "http://www.escidoc.de/schemas/metadatarecords/0.5")); - Element publication = md_record.getChild("publication", Namespace.getNamespace("publication", "http://purl.org/escidoc/metadata/profiles/0.1/publication")); - - - - - Element title = publication.getChild("title", Namespace.getNamespace("dc", "http://purl.org/dc/elements/1.1/")); - Element publishing_info = publication.getChild("publishing-info", Namespace.getNamespace("eterms", "http://purl.org/escidoc/metadata/terms/0.1/")); - Element issued = publication.getChild("issued", Namespace.getNamespace("dcterms", "http://purl.org/dc/terms/")); - if(issued != null){ - reference.setIssued(issued.getText()); - } - Element subject = publication.getChild("subject", Namespace.getNamespace("dcterms", "http://purl.org/dc/terms/")); - - List<Object> creatorList = publication.getChildren("creator", Namespace.getNamespace("eterms", "http://purl.org/escidoc/metadata/terms/0.1/")); - for(Object object : creatorList){ - if(object instanceof Element){ - Element creator = (Element)object; - Element person = creator.getChild("person", Namespace.getNamespace("person", "http://purl.org/escidoc/metadata/profiles/0.1/person")); - - if(person != null){ - Element complete_name = person.getChild("complete-name", Namespace.getNamespace("eterms", "http://purl.org/escidoc/metadata/terms/0.1/")); - Element family_name = person.getChild("family-name", Namespace.getNamespace("eterms", "http://purl.org/escidoc/metadata/terms/0.1/")); - Element given_name = person.getChild("given-name", Namespace.getNamespace("eterms", "http://purl.org/escidoc/metadata/terms/0.1/")); - Element organization = person.getChild("organization", Namespace.getNamespace("organization", "http://purl.org/escidoc/metadata/profiles/0.1/organization")); - - reference.addCreator(new Creator( - (complete_name != null) ? complete_name.getText() : "", - (family_name != null) ? family_name.getText() : "", - (given_name != null) ? given_name.getText() : "")); - } - } - } - - - if(publishing_info != null){ - Element publisher = publishing_info.getChild("publisher", Namespace.getNamespace("dc", "http://purl.org/dc/elements/1.1/")); - Element place = publishing_info.getChild("place", Namespace.getNamespace("eterms", "http://purl.org/escidoc/metadata/terms/0.1/")); - Element edition = publishing_info.getChild("edition", Namespace.getNamespace("eterms", "http://purl.org/escidoc/metadata/terms/0.1/")); - - reference.setPublishing( - new Publishing( - (publisher != null) ? publisher.getText() : "", - (place != null) ? place.getText() : "", - (edition != null) ? edition.getText() : "")); - } - - reference.setSubject((subject != null) ? subject.getText() : ""); - reference.setTitle((title != null) ? title.getText() : ""); - //System.out.println(reference.toString()); - list.add(reference); - - }else{ - System.out.println(obj); - } - } - - return list; - } - - public static void main(String[] args) { - try { - //ESciDocHandler.getAllPublications(); - - Publication pub = ESciDocHandler.getPublicationById("escidoc:127561"); - XMLOutputter outputter1 = new XMLOutputter(Format.getPrettyFormat()); - outputter1.output(pub.toXMLESciDoc(null), System.out); - - } catch (Exception e) { - e.printStackTrace(); - } - } -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/Test.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -package org.mpiwg.itgroup.escidoc; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.client.params.ClientPNames; -import org.apache.http.client.params.CookiePolicy; -import org.apache.http.entity.InputStreamEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.jdom.Document; -import org.jdom.output.XMLOutputter; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; - -public class Test { - - //private String eScidocServer; - //private int eScidocPort; - private String user; - private String password; - public String eScidocUrl; - private HttpClient httpclient = null; - - public Test(String eScidocServer, int eScidocPort, String user, - String password) { - // this.eScidocServer=eScidocServer; - // this.eScidocPort=eScidocPort; - this.user = user; - this.password = password; - this.eScidocUrl = "http://" + eScidocServer + ":" + String.valueOf(eScidocPort); - } - - public HttpClient login() throws IOException { - httpclient = new DefaultHttpClient(); - - httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY, - CookiePolicy.BROWSER_COMPATIBILITY); - - HttpPost httppost = new HttpPost(eScidocUrl + "/aa/login?target=/"); - - HttpResponse response = httpclient.execute(httppost); - // HttpEntity entity = httppost.getRes - - System.out.println("----------------------------------------"); - System.out.println(response.getStatusLine()); - - HttpEntity entity = response.getEntity(); - if (entity != null) { - entity.consumeContent(); - } - - HttpGet httpget = new HttpGet(eScidocUrl - + "/aa/j_spring_security_check?j_username=" + user - + "&j_password=" + password); - - response = httpclient.execute(httpget); - // entity = response.getEntity(); - - System.out.println("----------------------------------------"); - System.out.println(response.getStatusLine()); - - entity = response.getEntity(); - if (entity != null) { - entity.consumeContent(); - } - - // entity.consumeContent(); - return httpclient; - } - - public HttpResponse eScidocPut(String command, InputStream body) - throws IOException { - HttpPut httpput = new HttpPut(eScidocUrl + command); - return eScidocRequestBase(httpput, command, body); - } - - private HttpResponse eScidocRequestBase(HttpRequestBase httpBase, String command, InputStream body) throws IOException { - if (httpclient == null) - login(); - - if (HttpEntityEnclosingRequestBase.class.isInstance(httpBase)) { - if (body != null) { - HttpEntity entity = new InputStreamEntity(body, -1); - ((HttpEntityEnclosingRequestBase) httpBase).setEntity(entity); - } - } - - HttpResponse status = httpclient.execute(httpBase); - return status; - } - - public static Document testGetAndSave(){ - try { - ESciDocItem item = ESciDocClient.getItem("escidoc:127561"); - //System.out.println(new XMLOutputter().outputString(item.toXMLESciDoc(null))); - - return item.toXMLESciDoc(ESciDocClient.UPDATE); - - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - - public static void main(String[] args) throws IOException { - /* - Document doc = Test.testGetAndSave(); - - String body = new XMLOutputter().outputString(doc); - byte[] data = body.getBytes("UTF-8"); - - Test test = new Test("escidoc-test.mpiwg-berlin.mpg.de", 8080, "jurzua", "221082"); - test.eScidocPut("/ir/item/escidoc:127561", new ByteArrayInputStream(data)); - */ - - String s = new String("CODEX:distinguishing_features&CODEX¬es_on_ownership&CODEX:notes"); - String[] array = s.split("&"); - System.out.println(array.length); - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/bo/Creator.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -package org.mpiwg.itgroup.escidoc.bo; - -import java.io.Serializable; - -import org.apache.commons.lang.StringUtils; -import org.jdom.Element; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; -import org.mpi.openmind.repository.utils.NormalizerUtils; - -public class Creator extends ESciDocConstants implements Serializable{ - private static final long serialVersionUID = 1L; - - - //completeName familyName givenName - - private String completeName; - private String familyName; - private String givenName; - - private String norCompleteName; - private String norFamilyName; - private String norGivenName; - - public Creator(String completeName, String familyName, String givenName){ - this.setCompleteName(completeName); - this.setFamilyName(familyName); - this.setGivenName(givenName); - } - - public String getCompleteName() { - return completeName; - } - public void setCompleteName(String completeName) { - this.completeName = completeName; - if(StringUtils.isEmpty(completeName)){ - this.norCompleteName = new String(); - }else{ - this.norCompleteName = NormalizerUtils.normalize(completeName); - } - - } - public String getFamilyName() { - return familyName; - } - public void setFamilyName(String familyName) { - this.familyName = familyName; - if(StringUtils.isEmpty(familyName)){ - this.norFamilyName = new String(); - }else{ - this.norFamilyName = NormalizerUtils.normalize(familyName); - } - } - public String getGivenName() { - return givenName; - } - public void setGivenName(String givenName) { - this.givenName = givenName; - if(StringUtils.isEmpty(givenName)){ - this.norGivenName = new String(); - }else{ - this.norGivenName = NormalizerUtils.normalize(givenName); - } - } - - public String getNorCompleteName() { - return norCompleteName; - } - - public String getNorFamilyName() { - return norFamilyName; - } - - public String getNorGivenName() { - return norGivenName; - } - - /** - * term must be normalized before calling this method - * @param term - * @return - */ - public boolean containsTerm(String term){ - String secondTerm = this.getNorCompleteName(); - - if(secondTerm.contains(term)) - return true; - - secondTerm = this.getNorFamilyName(); - if(secondTerm.contains(term)) - return true; - - secondTerm = this.getNorGivenName(); - if(secondTerm.contains(term)) - return true; - - return false; - - } - - @Override - public Element toElementXMLESciDoc(Integer mode){ - Element root = new Element("person", NS_PERSON); - - Element completeName = new Element("complete-name", NS_ETERMS); - Element familyName = new Element("family-name", NS_ETERMS); - Element givenName = new Element("given-name", NS_ETERMS); - - completeName.addContent(this.completeName); - familyName.addContent(this.familyName); - givenName.addContent(this.givenName); - - root.addContent(completeName); - root.addContent(familyName); - root.addContent(givenName); - - Element organization = new Element("organization", NS_ORGANIZATION); - - Element orgTitle = new Element("title", NS_DC); - orgTitle.addContent("Max Planck Society"); - Element orgIdentifier = new Element("identifier", NS_DC); - - organization.addContent(orgTitle); - organization.addContent(orgIdentifier); - - root.addContent(organization); - - return root; - } - - public static void main(String[] args){ - try{ - Creator c = new Creator("Jorge Urzua", "Urzua", "Jorge"); - XMLOutputter outputter1 = new XMLOutputter(Format.getPrettyFormat()); - outputter1.output(c.toXMLESciDoc(null), System.out); - }catch (Exception e) { - e.printStackTrace(); - } - } - - - @Override - public String toString(){ - - return "Creator [completeName="+ completeName +", familyName="+ familyName +", givenName=" + givenName + "]"; - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/bo/ESciDocConstants.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -package org.mpiwg.itgroup.escidoc.bo; - -import java.io.Serializable; - -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.Namespace; - -public class ESciDocConstants implements Serializable{ - - - - /** - * - */ - private static final long serialVersionUID = 7156928908863818464L; - public static Integer DEBUG = -1; - public static Integer CREATE = 0; - public static Integer UPDATE = 1; - - - public static Namespace NS_PERSON = Namespace.getNamespace("person", "http://purl.org/escidoc/metadata/profiles/0.1/person"); - public static Namespace NS_ORGANIZATION = Namespace.getNamespace("organization", "http://purl.org/escidoc/metadata/profiles/0.1/organization"); - - public static Namespace NS_DC = Namespace.getNamespace("dc", "http://purl.org/dc/elements/1.1/"); - public static Namespace NS_ETERMS = Namespace.getNamespace("eterms", "http://purl.org/escidoc/metadata/terms/0.1/"); - - public static Namespace NS_DCTERMS = Namespace.getNamespace("dcterms", "http://purl.org/dc/terms/"); - - //xmlns:publication="http://purl.org/escidoc/metadata/profiles/0.1/publication" - public static Namespace NS_PUBLICATION = Namespace.getNamespace("publication", "http://purl.org/escidoc/metadata/profiles/0.1/publication"); - - //xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - public static Namespace NS_XSI = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); - - //xsi:type="dcterms:W3CDTF" - //public static Namespace NS_XSI = Namespace.getNamespace("xsi", "dcterms:W3CDTF"); - - //xmlns:relations="http://www.escidoc.de/schemas/relations/0.3" - public static Namespace NS_RELATIONS = Namespace.getNamespace("relations", "http://www.escidoc.de/schemas/relations/0.3"); - - // xmlns:escidocMetadataRecords="http://www.escidoc.de/schemas/metadatarecords/0.5" - public static Namespace NS_ESCIDOC_MD_RECORDS = Namespace.getNamespace("escidocMetadataRecords", "http://www.escidoc.de/schemas/metadatarecords/0.5"); - - // xmlns:escidocContentStreams="http://www.escidoc.de/schemas/contentstreams/0.7" - public static Namespace NS_ESCIDOC_CONTENT_STREAMS = Namespace.getNamespace("escidocContentStreams", "http://www.escidoc.de/schemas/contentstreams/0.7"); - - // xmlns:escidocComponents="http://www.escidoc.de/schemas/components/0.9" - public static Namespace NS_ESCIDOC_COMPONENTS = Namespace.getNamespace("escidocComponents", "http://www.escidoc.de/schemas/components/0.9"); - - // xmlns:version="http://escidoc.de/core/01/properties/version/" - public static Namespace NS_VERSION = Namespace.getNamespace("version", "http://escidoc.de/core/01/properties/version/"); - - // xmlns:release="http://escidoc.de/core/01/properties/release/" - public static Namespace NS_RELEASE = Namespace.getNamespace("release", "http://escidoc.de/core/01/properties/release/"); - - // xmlns:escidocItem="http://www.escidoc.de/schemas/item/0.9" - public static Namespace NS_ESCIDOC_ITEM = Namespace.getNamespace("escidocItem", "http://www.escidoc.de/schemas/item/0.9"); - - // xmlns:prop="http://escidoc.de/core/01/properties/" - public static Namespace NS_PROP = Namespace.getNamespace("prop", "http://escidoc.de/core/01/properties/"); - - // xmlns:srel="http://escidoc.de/core/01/structural-relations/" - public static Namespace NS_SREL = Namespace.getNamespace("srel", "http://escidoc.de/core/01/structural-relations/"); - - // xmlns:xlink="http://www.w3.org/1999/xlink" - public static Namespace NS_XLINK = Namespace.getNamespace("xlink", "http://www.w3.org/1999/xlink"); - - // xml:base="http://escidoc.mpiwg-berlin.mpg.de:8080" - //public static Namespace NS_BASE = Namespace.getNamespace("base", "http://escidoc.mpiwg-berlin.mpg.de:8080"); - - // xlink:type="simple" - //public static Namespace NS_ = Namespace.getNamespace("", ""); - - // xlink:title="Max Planck Society" - //public static Namespace NS_ = Namespace.getNamespace("", ""); - - // xlink:href="/ir/item/escidoc:127561" - //public static Namespace NS_ = Namespace.getNamespace("", ""); - - public Element toElementXMLESciDoc(Integer mode){ - return null; - } - - public Document toXMLESciDoc(Integer mode){ - Document doc = new Document(); - - doc.setRootElement(this.toElementXMLESciDoc(mode)); - - return doc; - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/bo/ESciDocItem.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,366 +0,0 @@ -package org.mpiwg.itgroup.escidoc.bo; - -import org.apache.commons.lang.StringUtils; -import org.jdom.Attribute; -import org.jdom.Element; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; - -public class ESciDocItem extends ESciDocConstants implements Cloneable, Comparable<ESciDocItem>{ - - public static int ESCIDOC_ERROR_ID_NO_FOUND = 0; - public static int ESCIDOC_ERROR_SERVER_NO_RESPONDED = 1; - - private Integer errorLoading; - - private Publication publication = null; - - private String lastModificationDate; - - //Properties TODO: this should be configurable - private static String CONTEXT_ID = "escidoc:79281"; - private static String CONTENT_MODEL = "escidoc:persistent4"; - - private String publicStatus; - - //item/properties/latest-version - //private String latestVersionHref; - private String latestVersionNumber; - private String latestVersionDate; - - //item/properties/latest-release - private String latestReleaseNumber; - private String latestReleaseDate; - //private String latestReleasePid; - - //item/properties/version - private String versionNumber; - private String versionDate; - private String versionStatus; - - - public ESciDocItem(String id){ - publication = new Publication(id); - } - - public ESciDocItem(){ - publication = new Publication(null); - } - - @Override - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - return null; - } - - @Override - public Element toElementXMLESciDoc(Integer mode){ - Element root = new Element("item", NS_ESCIDOC_ITEM); - - root.addNamespaceDeclaration(NS_RELATIONS); - root.addNamespaceDeclaration(NS_ESCIDOC_MD_RECORDS); - root.addNamespaceDeclaration(NS_ESCIDOC_CONTENT_STREAMS); - root.addNamespaceDeclaration(NS_ESCIDOC_COMPONENTS); - root.addNamespaceDeclaration(NS_VERSION); - root.addNamespaceDeclaration(NS_RELEASE); - root.addNamespaceDeclaration(NS_PROP); - root.addNamespaceDeclaration(NS_SREL); - root.addNamespaceDeclaration(NS_XLINK); - //root.addNamespaceDeclaration(NS_BASE); - - if(UPDATE.equals(mode)){ - // discarded for UPDATE and CREATE - root.setAttribute(new Attribute("type", "simple", NS_XLINK)); - root.setAttribute(new Attribute("title", "Max Planck Society", NS_XLINK)); - root.setAttribute(new Attribute("href", "/ir/item/" + publication.getObjid(), NS_XLINK)); - - root.setAttribute(new Attribute("last-modification-date", this.lastModificationDate)); - } - - // CREATE=required, UPDATE=optional - //if(CREATE.equals(mode)) - root.addContent(getESciDocItemProperties(mode)); - - root.addContent(getESciDocMDRecords(mode)); - - //item/components UPDATE, CREATE = required - Element components = new Element("components", NS_ESCIDOC_COMPONENTS); - if(mode == null){ - components.setAttribute(new Attribute("type", "simple", NS_XLINK)); - components.setAttribute(new Attribute("title", "Components of Item " + publication.getObjid(), NS_XLINK)); - components.setAttribute(new Attribute("href", "/ir/item/"+ publication.getObjid() +"/components", NS_XLINK)); - } - - root.addContent(components); - - if(UPDATE.equals(mode)){ - //item/relations UPDATE, CREATE = optional - Element relations = new Element("relations", NS_RELATIONS); - relations.setAttribute(new Attribute("type", "simple", NS_XLINK)); - relations.setAttribute(new Attribute("title", "Relations of Item", NS_XLINK)); - relations.setAttribute(new Attribute("href", "/ir/item/"+this.publication.getObjid()+"/relations", NS_XLINK)); - - //item/resources UPDATE, CREATE = discarded - Element resources = new Element("resources", NS_ESCIDOC_ITEM); - resources.setAttribute(new Attribute("type", "simple", NS_XLINK)); - resources.setAttribute(new Attribute("title", "Resources", NS_XLINK)); - resources.setAttribute(new Attribute("href", "/ir/item/"+this.publication.getObjid()+"/resources", NS_XLINK)); - } - - return root; - } - - private Element getESciDocItemProperties(Integer mode){ - - Element root = new Element("properties", NS_ESCIDOC_ITEM); - - //CREATE, UPDATE discard = xlink:type, xlink:title, xlink:href, xml:base - //UPDATE requests = last-modification-date - - //item/properties - if(UPDATE.equals(mode)){ - root.setAttribute(new Attribute("type", "simple", NS_XLINK)); - root.setAttribute(new Attribute("title", "Properties", NS_XLINK)); - root.setAttribute(new Attribute("href", "/ir/item/" + this.publication.getObjid() + "/properties", NS_XLINK)); - } - - - //item/properties/context - Element context = new Element("context", NS_SREL); - context.setAttribute(new Attribute("type", "simple", NS_XLINK)); - context.setAttribute(new Attribute("title", "ISMI", NS_XLINK)); - context.setAttribute(new Attribute("href", "/ir/context/" + CONTEXT_ID, NS_XLINK)); - root.addContent(context); - - //item/properties/content-model - Element contentModel = new Element("content-model", NS_SREL); - if(UPDATE.equals(mode)){ - contentModel.setAttribute(new Attribute("type", "simple", NS_XLINK)); - contentModel.setAttribute(new Attribute("title", "ct", NS_XLINK)); - } - contentModel.setAttribute(new Attribute("href", "/cmm/content-model/" + CONTENT_MODEL, NS_XLINK)); - root.addContent(contentModel); - - - //item/properties/latest-version - if(mode == null){ - Element latestVersion = new Element("latest-version", NS_PROP); - //latestVersion.setAttribute(new Attribute("href", this.latestVersionHref, NS_XLINK)); - - Element eVersionNumber = new Element("number", NS_VERSION); - Element eVersionDate = new Element("date", NS_VERSION); - - eVersionNumber.addContent(this.latestVersionNumber); - eVersionDate.addContent(this.latestVersionDate); - - latestVersion.addContent(eVersionNumber); - latestVersion.addContent(eVersionDate); - - root.addContent(latestVersion); - } - - //item/properties/latest-release - if(mode == null){ - Element latestRelease = new Element("latest-release", NS_PROP); - //latestRelease.setAttribute(new Attribute("href", this.latestReleaseHref, NS_XLINK)); - - Element eReleaseNumber = new Element("number", NS_RELEASE); - Element eReleaseDate = new Element("date", NS_RELEASE); - //Element eReleasePid = new Element("pid", NS_RELEASE); - - eReleaseNumber.addContent(this.latestReleaseNumber); - eReleaseDate.addContent(this.latestReleaseDate); - //eReleasePid.addContent(this.latestReleasePid); - - latestRelease.addContent(eReleaseNumber); - latestRelease.addContent(eReleaseDate); - //latestRelease.addContent(eReleasePid); - - root.addContent(latestRelease); - } - - return root; - } - - private Element getESciDocMDRecords(Integer mode){ - Element root = new Element("md-records", NS_ESCIDOC_MD_RECORDS); - - if(UPDATE.equals(mode)){ - root.setAttribute(new Attribute("type", "simple", NS_XLINK)); - root.setAttribute(new Attribute("title", "Metadata Records of Item " + publication.getObjid(), NS_XLINK)); - root.setAttribute(new Attribute("href", "/ir/item/"+ publication.getObjid() +"/md-records", NS_XLINK)); - } - if(UPDATE.equals(mode)){ - //TODO last-modification-date - } - - Element record = new Element("md-record", NS_ESCIDOC_MD_RECORDS); - record.setAttribute(new Attribute("name", "escidoc")); - - if(UPDATE.equals(mode)){ - record.setAttribute(new Attribute("type", "simple", NS_XLINK)); - record.setAttribute(new Attribute("title", "escidoc", NS_XLINK)); - record.setAttribute(new Attribute("href", "/ir/item/"+ this.publication.getObjid() +"/md-records/md-record/escidoc", NS_XLINK)); - } - - record.addContent(this.publication.toElementXMLESciDoc(mode)); - - root.addContent(record); - - return root; - } - - public Publication getPublication() { - return publication; - } - - public void setPublication(Publication publication) { - this.publication = publication; - } - - public String getLastModificationDate() { - return lastModificationDate; - } - - public void setLastModificationDate(String lastModificationDate) { - this.lastModificationDate = lastModificationDate; - } - - public Integer getErrorLoading() { - return errorLoading; - } - - public void setErrorLoading(Integer errorLoading) { - this.errorLoading = errorLoading; - } - - public String getObjId(){ - if(publication != null) - return this.publication.getObjid(); - return null; - } - - public String getLatestVersionNumber() { - return latestVersionNumber; - } - - public void setLatestVersionNumber(String latestVersionNumber) { - this.latestVersionNumber = latestVersionNumber; - } - - public String getLatestVersionDate() { - return latestVersionDate; - } - - public void setLatestVersionDate(String latestVersionDate) { - this.latestVersionDate = latestVersionDate; - } - - public String getLatestReleaseNumber() { - return latestReleaseNumber; - } - - public void setLatestReleaseNumber(String latestReleaseNumber) { - this.latestReleaseNumber = latestReleaseNumber; - } - - public String getLatestReleaseDate() { - return latestReleaseDate; - } - - public void setLatestReleaseDate(String latestReleaseDate) { - this.latestReleaseDate = latestReleaseDate; - } - - @Override - public int compareTo(ESciDocItem arg0) { - if(this.publication != null && arg0.publication != null){ - if(StringUtils.isNotEmpty(this.publication.getObjid()) && StringUtils.isNotEmpty(arg0.publication.getObjid())){ - return this.getPublication().getObjid().compareTo(arg0.publication.getObjid()); - }else if(StringUtils.isNotEmpty(this.publication.getObjid())){ - return -1; - }else if(StringUtils.isNotEmpty(arg0.publication.getObjid())){ - return 1; - } - } - return 0; - } - - public static void main(String[] args){ - try{ - - Publication pub = new Publication(null); - - Publishing publishing = new Publishing("Jorge Urzua", "Chile", "JIJI"); - pub.setPublishing(publishing); - - Creator creator0 = new Creator("Jorge Urzua", "Urzua", "Jorge"); - Creator creator1 = new Creator("Valeria Mouzas", "Mouzas", "Valeria"); - pub.getCreatorList().add(creator0); - pub.getCreatorList().add(creator1); - - pub.setIssued("1982"); - pub.getAlternativeList().add("alternative01"); - pub.getAlternativeList().add("alternative02"); - pub.getAlternativeList().add("alternative03"); - - pub.setTitle("Por Dios..."); - - XMLOutputter outputter1 = new XMLOutputter(Format.getPrettyFormat()); - outputter1.output(pub.toXMLESciDoc(CREATE), System.out); - - }catch (Exception e) { - e.printStackTrace(); - } - } - - public String getVersionNumber() { - return versionNumber; - } - - public void setVersionNumber(String versionNumber) { - this.versionNumber = versionNumber; - } - - public String getVersionDate() { - return versionDate; - } - - public void setVersionDate(String versionDate) { - this.versionDate = versionDate; - } - - public String getVersionStatus() { - return versionStatus; - } - - public void setVersionStatus(String versionStatus) { - this.versionStatus = versionStatus; - } - - public String getPublicStatus() { - return publicStatus; - } - - public void setPublicStatus(String publicStatus) { - this.publicStatus = publicStatus; - } - - public String getInfo(){ - StringBuilder sb = new StringBuilder(); - - sb.append("publicStatus=" + this.publicStatus); - sb.append(", versionNumber=" + this.versionNumber); - sb.append(", versionStatus=" + this.versionStatus); - sb.append(", versionDate=" + this.versionDate); - sb.append(", releaseNumber=" + this.latestReleaseNumber); - sb.append(", releaseDate=" + this.latestReleaseDate); - - return sb.toString(); - - } -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/bo/Publication.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,311 +0,0 @@ -package org.mpiwg.itgroup.escidoc.bo; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.jdom.Attribute; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; -import org.mpi.openmind.repository.bo.Entity; -import org.mpi.openmind.repository.utils.NormalizerUtils; - -public class Publication extends ESciDocConstants implements Comparable<Publication>, Serializable, Cloneable{ - - private static final long serialVersionUID = 1L; - private String objid; - private List<Creator> creatorList = new ArrayList<Creator>(); - private String title; - private List<String> alternativeList = new ArrayList<String>(); - - private Publishing publishing = new Publishing(null, null, null); - private String subject; - private String issued; - private String numberOfPages; - - - private String norTitle; - private List<String> norAlternativeList = new ArrayList<String>(); - private String norSubject; - - - - private String additionalInformation; - private Entity entity; - - private static String HTML_LABEL = "<span style=\"font-family: Arial;\">" + - "<font size=\"2\">" + - "[ID]AUTHORDATE <i>TITLE</i>PUBLISHER" + - "</font></span>"; - - @Override - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - return null; - } - - - public String getHTMLLabel(){ - - String html = HTML_LABEL.replace("TITLE", (StringUtils.isNotEmpty(this.title) ? this.title : "")); - String creators = this.getCreatorsAsString(); - html = html.replace("AUTHOR", (creators != null) ? " " + creators + "." : ""); - html = html.replace("PUBLISHER", (publishing != null) ? " " + publishing.getPublisher() + "." : ""); - html = html.replace("DATE", (StringUtils.isNotEmpty(this.issued)? " (" + issued + ")." : "")); - html = html.replace("ID", (StringUtils.isNotEmpty(this.objid)? this.objid : "NO ID")); - return html; - } - - public String getCreatorsAsString(){ - StringBuilder sb = new StringBuilder(); - for(Creator c : creatorList){ - if(StringUtils.isNotEmpty(sb.toString())){ - sb.append(", "); - } - sb.append(c.getFamilyName() + " " + c.getGivenName()); - } - return sb.toString(); - } - - public void addCreator(Creator creator){ - this.creatorList.add(creator); - } - - public Publication(String objid){ - this.objid = objid; - } - - public List<Creator> getCreatorList() { - return creatorList; - } - - public void setCreatorList(List<Creator> creatorList) { - this.creatorList = creatorList; - } - - - public String getObjid() { - return objid; - } - - public void setObjid(String objid) { - this.objid = objid; - } - - public String getTitle() { - return title; - } - - public String getNorTitle(){ - return norTitle; - } - - public List<String> getNorAlternativeList() { - - return norAlternativeList; - } - - - public String getNorSubject() { - return norSubject; - } - - - public void setTitle(String title) { - this.title = title; - if(StringUtils.isEmpty(title)){ - this.norTitle = new String(); - }else{ - this.norTitle = NormalizerUtils.normalize(title); - } - } - - public Publishing getPublishing() { - return publishing; - } - - public void setPublishing(Publishing publishing) { - this.publishing = publishing; - } - - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - this.subject = subject; - if(StringUtils.isEmpty(subject)){ - this.norSubject = new String(); - }else{ - this.norSubject = NormalizerUtils.normalize(subject); - } - } - - public String getAdditionalInformation() { - return additionalInformation; - } - - public void setAdditionalInformation(String additionalInformation) { - this.additionalInformation = additionalInformation; - } - - public Entity getEntity() { - return entity; - } - - public void setEntity(Entity entity) { - this.entity = entity; - } - - public String getIssued() { - return issued; - } - - public void setIssued(String issued) { - this.issued = issued; - } - - public List<String> getAlternativeList() { - return alternativeList; - } - - - public void setAlternativeList(List<String> alternativeList) { - this.alternativeList = alternativeList; - for(String term : alternativeList){ - this.norAlternativeList.add(NormalizerUtils.normalize(term)); - } - } - - public void addAlternative(String alternative){ - this.alternativeList.add(alternative); - this.norAlternativeList.add(NormalizerUtils.normalize(alternative)); - } - - public String getNumberOfPages() { - return numberOfPages; - } - - - public void setNumberOfPages(String numberOfPages) { - this.numberOfPages = numberOfPages; - } - - @Override - public Element toElementXMLESciDoc(Integer mode){ - Element root = new Element("publication", NS_PUBLICATION); - root.setAttribute(new Attribute("type", "http://purl.org/eprint/type/Book")); - - Element creator = new Element("creator", NS_ETERMS); - creator.setAttribute(new Attribute("role", "http://www.loc.gov/loc.terms/relators/AUT")); - for(Creator person : this.creatorList){ - creator.addContent(person.toElementXMLESciDoc(mode)); - } - root.addContent(creator); - - Element title = new Element("title", NS_DC); - title.addContent(this.title); - root.addContent(title); - - for(String s : this.alternativeList){ - Element alternative = new Element("alternative", NS_DCTERMS); - alternative.addContent(s); - root.addContent(alternative); - } - - root.addContent(this.publishing.toElementXMLESciDoc(mode)); - - - //<dcterms:issued xmlns:dcterms="http://purl.org/dc/terms/" - // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="dcterms:W3CDTF"> - Element issued = new Element("issued", NS_DCTERMS); - issued.addNamespaceDeclaration(NS_XSI); - issued.setAttribute(new Attribute("type", "dcterms:W3CDTF", NS_XSI)); - issued.addContent(this.issued); - root.addContent(issued); - - - Element numberOfPages = new Element("total-number-of-pages", NS_ETERMS); - numberOfPages.addContent(this.numberOfPages); - root.addContent(numberOfPages); - - Element subject = new Element("subject", NS_DCTERMS); - subject.addContent(this.subject); - root.addContent(subject); - - return root; - } - - - @Override - public boolean equals(Object object) { - // TODO: Warning - this method won't work in the case the id fields are not set - if (!(object instanceof Publication)) { - return false; - } - Publication other = (Publication) object; - - if(this.objid != null && other.getObjid() != null && this.objid == other.objid) - return true; - - return false; - } - - - - @Override - public String toString(){ - return "Publication [objid="+objid+ - ", title="+ title + - ", subject="+ subject + - ", " + creatorList + - ", " + publishing + "]"; - } - - @Override - public int compareTo(Publication arg0) { - if(StringUtils.isNotEmpty(this.objid) && StringUtils.isNotEmpty(arg0.objid)){ - return this.objid.compareTo(arg0.objid); - }else if(StringUtils.isNotEmpty(this.objid)){ - return -1; - }else if(StringUtils.isNotEmpty(arg0.objid)){ - return 1; - } - return 0; - } - - public static void main(String[] args){ - try{ - - Publication pub = new Publication(null); - - Publishing publishing = new Publishing("Jorge Urzua", "Chile", "JIJI"); - pub.setPublishing(publishing); - - Creator creator0 = new Creator("Jorge Urzua", "Urzua", "Jorge"); - Creator creator1 = new Creator("Valeria Mouzas", "Mouzas", "Valeria"); - pub.getCreatorList().add(creator0); - pub.getCreatorList().add(creator1); - - pub.setIssued("1982"); - pub.getAlternativeList().add("alternative01"); - pub.getAlternativeList().add("alternative02"); - pub.getAlternativeList().add("alternative03"); - - pub.setTitle("Por Dios..."); - - XMLOutputter outputter1 = new XMLOutputter(Format.getPrettyFormat()); - outputter1.output(pub.toXMLESciDoc(null), System.out); - - }catch (Exception e) { - e.printStackTrace(); - } - } -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/bo/Publishing.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -package org.mpiwg.itgroup.escidoc.bo; - -import java.io.Serializable; - -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; - -public class Publishing extends ESciDocConstants implements Serializable{ - private static final long serialVersionUID = 1L; - - private String publisher; - private String place; - private String edition; - - public Publishing(String publisher, String place, String edition){ - this.publisher = publisher; - this.place = place; - this.edition = edition; - } - - public String getPublisher() { - return publisher; - } - public void setPublisher(String publisher) { - this.publisher = publisher; - } - public String getPlace() { - return place; - } - public void setPlace(String place) { - this.place = place; - } - public String getEdition() { - return edition; - } - public void setEdition(String edition) { - this.edition = edition; - } - - @Override - public Element toElementXMLESciDoc(Integer mode){ - Element root = new Element("publishing-info", NS_ETERMS); - Element publisher = new Element("publisher", NS_DC); - Element place = new Element("place", NS_ETERMS); - Element edition = new Element("edition", NS_ETERMS); - - publisher.addContent(this.publisher); - place.addContent(this.place); - edition.addContent(this.edition); - - root.addContent(publisher); - root.addContent(place); - root.addContent(edition); - - return root; - } - - @Override - public String toString(){ - return "Publishing [publisher="+ publisher +", place="+ place +", edition="+ edition +"]"; - } - - public static void main(String[] args){ - try{ - Publishing c = new Publishing("Jorge Urzua", "Chile", "JIJI"); - XMLOutputter outputter1 = new XMLOutputter(Format.getPrettyFormat()); - outputter1.output(c.toXMLESciDoc(null), System.out); - }catch (Exception e) { - e.printStackTrace(); - } - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/bo/utils/SortItemByCreator.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -package org.mpiwg.itgroup.escidoc.bo.utils; - -import java.util.Comparator; - -import org.apache.commons.lang.StringUtils; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; -import org.mpiwg.itgroup.escidoc.bo.Publication; - -public class SortItemByCreator implements Comparator<ESciDocItem> { - - - public int compare(ESciDocItem e1, ESciDocItem e2) { - Publication p1 = e1.getPublication(); - Publication p2 = e2.getPublication(); - - if(p1 != null && p2 != null){ - String c1 = replace(p1.getCreatorsAsString()); - String c2 = replace(p2.getCreatorsAsString()); - - if(StringUtils.isNotEmpty(c1) && StringUtils.isNotEmpty(c2)){ - return c1.compareTo(c2); - }else if(StringUtils.isNotEmpty(c1)){ - return -1; - }else if(StringUtils.isNotEmpty(c2)){ - return 1; - } - } - return 0; - } - - public static String replace(String s){ - if(StringUtils.isNotEmpty(s)){ - s = s.replace("(", ""); - s = s.replace(")", ""); - } - return s; - } -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/bo/utils/SortItemByTitle.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -package org.mpiwg.itgroup.escidoc.bo.utils; - -import java.util.Comparator; - -import org.apache.commons.lang.StringUtils; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; -import org.mpiwg.itgroup.escidoc.bo.Publication; - -public class SortItemByTitle implements Comparator<ESciDocItem>{ - - public int compare(ESciDocItem e1, ESciDocItem e2) { - Publication p1 = e1.getPublication(); - Publication p2 = e2.getPublication(); - - if(p1 != null && p2 != null){ - - String t1 = replace(p1.getNorTitle()); - String t2 = replace(p2.getNorTitle()); - - if (StringUtils.isNotEmpty(t1) && StringUtils.isNotEmpty(t2)) { - return t1.compareTo(t2); - } else if (StringUtils.isNotEmpty(t1)) { - return -1; - } else if (StringUtils.isNotEmpty(t2)) { - return 1; - } - } - System.out.println("equals titles"); - return 0; - } - - public static String replace(String s){ - if(StringUtils.isNotEmpty(s)){ - s = s.replace("(", ""); - s = s.replace(")", ""); - } - return s; - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/bo/utils/SortPublicationByCreator.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -package org.mpiwg.itgroup.escidoc.bo.utils; - -import java.util.Comparator; - -import org.apache.commons.lang.StringUtils; -import org.mpiwg.itgroup.escidoc.bo.Publication; - -public class SortPublicationByCreator implements Comparator<Publication> { - - - public int compare(Publication e1, Publication e2) { - String creators1 = e1.getCreatorsAsString(); - String creators2 = e2.getCreatorsAsString(); - - if(StringUtils.isNotEmpty(creators1) && StringUtils.isNotEmpty(creators2)){ - return creators1.compareTo(creators2); - }else if(StringUtils.isNotEmpty(creators1)){ - return -1; - }else if(StringUtils.isNotEmpty(creators2)){ - return 1; - } - return 0; - } - -} \ No newline at end of file
--- a/src/main/java/org/mpiwg/itgroup/escidoc/bo/utils/SortPublicationByTitle.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -package org.mpiwg.itgroup.escidoc.bo.utils; - -import java.util.Comparator; - -import org.apache.commons.lang.StringUtils; -import org.mpiwg.itgroup.escidoc.bo.Publication; - -public class SortPublicationByTitle implements Comparator<Publication> { - - public int compare(Publication e1, Publication e2) { - if (StringUtils.isNotEmpty(e1.getTitle()) && StringUtils.isNotEmpty(e2.getTitle())) { - return e1.getTitle().compareTo(e2.getTitle()); - } else if (StringUtils.isNotEmpty(e1.getTitle())) { - return -1; - } else if (StringUtils.isNotEmpty(e2.getTitle())) { - return 1; - } else { - return 0; - } - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/utils/ESciDocItemDataTable.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -package org.mpiwg.itgroup.escidoc.utils; - -import java.util.ArrayList; -import java.util.List; - -import javax.faces.event.ActionEvent; -import javax.faces.event.ValueChangeEvent; -import javax.faces.model.SelectItem; - -import org.mpiwg.itgroup.escidoc.ESciDocCache; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; - -import de.mpiwg.itgroup.ismi.entry.beans.AbstractBean; -import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; -import de.mpiwg.itgroup.ismi.util.guiComponents.MisattributionDataTable; - -public class ESciDocItemDataTable extends AbstractBean{ - - private List<ESciDocItem> items = new ArrayList<ESciDocItem>(); - private String term; - - private boolean showDialog = false; - private AbstractISMIBean entityForm; - private MisattributionDataTable misattDataTable; - - private int sortBy = ESciDocCache.SORT_DEFAULT; - - private static List<SelectItem> sortAlternatives; - - static{ - sortAlternatives = new ArrayList<SelectItem>(); - sortAlternatives.add(new SelectItem(ESciDocCache.SORT_DEFAULT, "Id")); - sortAlternatives.add(new SelectItem(ESciDocCache.SORT_TITLE, "Title")); - sortAlternatives.add(new SelectItem(ESciDocCache.SORT_CREATOR, "Authors")); - } - - public ESciDocItemDataTable(AbstractISMIBean entityForm){ - this.entityForm = entityForm; - this.reset(); - } - - public ESciDocItemDataTable(MisattributionDataTable misattDataTable){ - this.misattDataTable = misattDataTable; - this.reset(); - } - - public void listenerSort(ValueChangeEvent event){ - if(event.getNewValue() != null) - ESciDocCache.sort(new Integer(event.getNewValue().toString()), items); - } - - public void listenerSelectRefItem(ActionEvent event){ - ESciDocItem item = (ESciDocItem)getRequestBean("refItem"); - if(item != null){ - if(entityForm != null){ - SelectedESciDocItems selectedPubs = this.entityForm.getSelectedItems(); - if(selectedPubs != null){ - if(!selectedPubs.addESciDocItem((ESciDocItem)item.clone())){ - getSessionBean().addGeneralMsg("The reference was already selected."); - } - } - }else if(misattDataTable != null){ - misattDataTable.setESciDocItem(item); - } - this.showDialog = false; - } - } - - public void listenerEditItem(ActionEvent event){ - ESciDocItem item = (ESciDocItem)getRequestBean("refItem"); - getSessionBean().geteSciDocForm().setItem(item); - this.term = null; - this.items = null; - this.showDialog = false; - } - - public void listenerCreateReference(){ - getSessionBean().geteSciDocForm().createItem(); - this.close(); - } - - public void listenerReset(ActionEvent event){ - this.reset(); - } - - public void listenerFilter(ActionEvent event){ - this.filter(); - } - - public void listenerOpen(ActionEvent event){ - this.open(); - } - - public void open(){ - this.reset(); - this.showDialog = true; - } - - public void listenerClose(ActionEvent event){ - this.close(); - } - - public void close(){ - this.term = null; - this.items = null; - this.showDialog = false; - } - - public void reset(){ - /* - this.term = null; - List<ESciDocItem> list = this.getAppBean().getRefCache().getAllItems(sortBy); - if(list != null){ - this.items = new ArrayList<ESciDocItem>(list); - }else{ - this.items = new ArrayList<ESciDocItem>(); - }*/ - } - - public void filter(){ - this.items = this.getAppBean().getRefCache().searchItem(term, sortBy); - } - public int getItemsSize(){ - if(items == null) - return 0; - return items.size(); - } - - public List<ESciDocItem> getItems() { - return items; - } - - public void setItems(List<ESciDocItem> items) { - this.items = items; - } - - public String getTerm() { - return term; - } - - public void setTerm(String term) { - this.term = term; - } - - public boolean isShowDialog() { - return showDialog; - } - - public void setShowDialog(boolean showDialog) { - this.showDialog = showDialog; - } - public int getSortBy() { - return sortBy; - } - - public void setSortBy(int sortBy) { - this.sortBy = sortBy; - } - - public List<SelectItem> getSortAlternatives() { - return sortAlternatives; - } -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/utils/SelectedESciDocItems.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -package org.mpiwg.itgroup.escidoc.utils; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; - - -public class SelectedESciDocItems implements Serializable{ - - private static final long serialVersionUID = -756497439159524677L; - private transient List<ESciDocItem> list = new ArrayList<ESciDocItem>(); - private Map<String, Boolean> map = new HashMap<String, Boolean>(); - - public boolean addESciDocItem(ESciDocItem pub) { - if (!map.containsKey(pub.getPublication().getObjid())) { - this.list.add(pub); - this.map.put(pub.getPublication().getObjid(), false); - return true; - } - return false; - } - - public void removeById(String id) { - ESciDocItem pp = null; - for (ESciDocItem pub : this.list) { - if (id.equals(pub.getPublication().getObjid())) { - pp = pub; - break; - } - } - this.list.remove(pp); - this.map.remove(id); - } - - public List<ESciDocItem> getList() { - return list; - } - - public void setList(List<ESciDocItem> list) { - this.list = list; - } - - public Map<String, Boolean> getMap() { - return map; - } - - public void setMap(Map<String, Boolean> map) { - this.map = map; - } - -}
--- a/src/main/java/org/mpiwg/itgroup/escidoc/web/ESciDocItemForm.java Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ -package org.mpiwg.itgroup.escidoc.web; - -import java.util.ArrayList; -import java.util.List; - -import javax.faces.event.ActionEvent; -import javax.faces.model.SelectItem; - -import org.apache.commons.lang.StringUtils; -import org.mpiwg.itgroup.escidoc.bo.Creator; -import org.mpiwg.itgroup.escidoc.bo.ESciDocItem; - -import de.mpiwg.itgroup.ismi.entry.beans.AbstractBean; -import de.mpiwg.itgroup.ismi.utils.SelectableObject; - -public class ESciDocItemForm extends AbstractBean { - - private ESciDocItem item; - private String itemId; - - private List<SelectableObject> creatorList = new ArrayList<SelectableObject>(); - private List<SelectableObject> alternativeNameList = new ArrayList<SelectableObject>(); - - - private boolean visible; - - public ESciDocItemForm(){ - this.reset(); - } - - private void reset(){ - this.item = new ESciDocItem(); - this.itemId = null; - this.creatorList = new ArrayList<SelectableObject>(); - this.alternativeNameList = new ArrayList<SelectableObject>(); - } - - public void listenerCleanForm(ActionEvent event){ - this.reset(); - } - - public void listenerDelete(ActionEvent event){ - try { - - getAppBean().getRefCache().deleteItem(item, getSessionBean().getUsername()); - - addGeneralMsg("The publication has been deleted successfully."); - this.visible = false; - this.item = null; - } catch (Exception e) { - addErrorMsg(e.getMessage()); - e.printStackTrace(); - } - } - - public void listenerSave(ActionEvent event){ - - List<String> alternativeNames = new ArrayList<String>(); - for(SelectableObject so : this.alternativeNameList){ - alternativeNames.add((String)so.getObj()); - } - List<Creator> creators = new ArrayList<Creator>(); - for(SelectableObject so : this.creatorList){ - creators.add((Creator)so.getObj()); - } - this.item.getPublication().setAlternativeList(alternativeNames); - this.item.getPublication().setCreatorList(creators); - try { - - this.item = getAppBean().getRefCache().saveItem(item, getSessionBean().getUsername()); - - this.setItem(getAppBean().getRefCache().getItem(item.getObjId())); - addGeneralMsg("The publication has been saved successfully."); - } catch (Exception e) { - addErrorMsg(e.getMessage()); - e.printStackTrace(); - } - } - - public String getButtonSaveLabel(){ - if(StringUtils.isEmpty(item.getObjId())){ - return "Create"; - } - return "Save"; - } - - public boolean isDisplayDeleteBtn(){ - if(item == null || StringUtils.isEmpty(item.getObjId())){ - return false; - } - return true; - } - - public void listenerReloadItem(ActionEvent event){ - if(StringUtils.isNotEmpty(itemId)){ - this.item = getAppBean().getRefCache().getItem(itemId); - - if(item == null){ - addGeneralMsg("No item found " + itemId); - }else{ - this.item = (ESciDocItem)this.item.clone(); - } - }else{ - addGeneralMsg("Item id can not be empty"); - } - } - - public void listenerAddAlternativeName(ActionEvent event){ - this.alternativeNameList.add(new SelectableObject(new String("..."))); - } - - public void listenerRemoveAlternativeName(ActionEvent event){ - List<SelectableObject> toDelete = new ArrayList<SelectableObject>(); - for(SelectableObject so : this.alternativeNameList){ - if(so.isSelected()){ - toDelete.add(so); - } - } - for(SelectableObject so : toDelete){ - this.alternativeNameList.remove(so); - } - } - - public void listenerAddCreator(ActionEvent event){ - this.creatorList.add(new SelectableObject(new Creator("completeName", "familyName", "givenName"))); - } - - public void listenerRemoveCreator(ActionEvent event){ - List<SelectableObject> toDelete = new ArrayList<SelectableObject>(); - for(SelectableObject so : this.creatorList){ - if(so.isSelected()){ - toDelete.add(so); - } - } - for(SelectableObject so : toDelete){ - this.creatorList.remove(so); - } - } - - public void listenerClose(ActionEvent event){ - this.visible = false; - this.item = null; - } - - public ESciDocItem getItem() { - return item; - } - - public void createItem(){ - this.reset(); - this.visible = true; - } - - public void setItem(ESciDocItem item) { - this.reset(); - try { - - this.item = getAppBean().getRefCache().getItemFromServer(item.getObjId()); - this.visible = true; - - for(String s : this.item.getPublication().getAlternativeList()){ - this.alternativeNameList.add(new SelectableObject(s)); - } - - for(Creator creator : this.item.getPublication().getCreatorList()){ - this.creatorList.add(new SelectableObject(creator)); - } - - } catch (Exception e) { - e.printStackTrace(); - addGeneralMsg(e.getMessage()); - } - } - - public boolean isVisible() { - return visible; - } - - public void setVisible(boolean visible) { - this.visible = visible; - } - - public List<SelectableObject> getCreatorList() { - return creatorList; - } - - public void setCreatorList(List<SelectableObject> creatorList) { - this.creatorList = creatorList; - } - - public List<SelectableObject> getAlternativeNameList() { - return alternativeNameList; - } - - public void setAlternativeNameList(List<SelectableObject> alternativeNameList) { - this.alternativeNameList = alternativeNameList; - } - -}
--- a/src/main/java/org/mpiwg/itgroup/geonames/bo/Geoname.java Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/java/org/mpiwg/itgroup/geonames/bo/Geoname.java Wed Dec 09 14:08:40 2015 -0500 @@ -6,8 +6,6 @@ import java.util.List; import java.util.Queue; -import org.apache.commons.lang.StringUtils; - public class Geoname implements Serializable{ private static final long serialVersionUID = -3256085837090516807L;
--- a/src/main/resources/hibernate.cfg.xml Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> -<hibernate-configuration> - <session-factory> - - <!-- C3p0 --> - <property name="hibernate.c3p0.acquire_increment">1</property> - <property name="hibernate.c3p0.idle_test_period">300</property> - <property name="hibernate.c3p0.timeout">120</property> - <property name="hibernate.c3p0.max_size">25</property> - <property name="hibernate.c3p0.min_size">1</property> - <property name="hibernate.c3p0.max_statement">0</property> - <property name="hibernate.c3p0.preferredTestQuery">select 1;</property> - - <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> - - <!-- <property name="show_sql">true</property> --> - <!-- <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> --> - - <property name="hibernate.dialect">org.mpi.openmind.repository.utils.CustomMysqlDialect</property> - <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> - <property name="hibernate.connection.url">jdbc:mysql://localhost/openmind?characterEncoding=UTF-8</property> - <property name="hibernate.connection.charSet">UTF-8</property> - <property name="hibernate.connection.username">root</property> - <property name="hibernate.connection.password">e1nste1n</property> - <!-- <property name="hibernate.connection.password">fB79DCsT87</property> --> - <!-- <property name="hibernate.connection.password">e1nste1n</property> --> - - <!-- - <property name="hibernate.connection.username">ismi</property> - <property name="hibernate.connection.password">ismipw</property> - <property name="hibernate.connection.username">root</property> - <property name="hibernate.connection.password">e1nste1n</property> - <property name="hibernate.connection.username">root</property> - <property name="hibernate.connection.password">dm2eroot</property> - <property name="hibernate.connection.username">root</property> - <property name="hibernate.connection.password">admin</property> - --> - - <!-- <property name="show_sql">true</property> --> - <property name="current_session_context_class">thread</property> - <!-- <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> --> - <!-- <property name="hbm2ddl.auto">create</property> --> - <!-- <property name="hibernate.hbm2ddl.auto">validate</property> --> - - - <mapping class="org.mpi.openmind.repository.bo.Node" /> - <mapping class="org.mpi.openmind.repository.bo.Attribute" /> - <mapping class="org.mpi.openmind.repository.bo.Entity" /> - <mapping class="org.mpi.openmind.repository.bo.Relation" /> - <mapping class="org.mpi.openmind.repository.bo.View" /> - <mapping class="org.mpi.openmind.repository.bo.ViewerAttribute" /> - <mapping class="org.mpi.openmind.repository.bo.ViewerPage" /> - <mapping class="org.mpi.openmind.repository.bo.utils.Sequence" /> - <mapping class="org.mpi.openmind.security.bo.User" /> - <mapping class="org.mpi.openmind.security.bo.Group" /> - <mapping class="org.mpi.openmind.security.bo.Role" /> - <mapping class="org.mpi.openmind.security.bo.Permission" /> - <mapping class="org.mpi.openmind.security.bo.utils.UserRole" /> - <mapping class="org.mpi.openmind.security.bo.utils.GroupRole" /> - <mapping class="org.mpi.openmind.security.bo.utils.UserGroup" /> - <mapping class="org.mpi.openmind.security.bo.utils.RolePermission" /> - </session-factory> -</hibernate-configuration>
--- a/src/main/resources/hibernate.cfg.xml.template Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/resources/hibernate.cfg.xml.template Wed Dec 09 14:08:40 2015 -0500 @@ -2,30 +2,42 @@ <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> - <!-- second level cache configuration --> - <!-- Enable/Disable the second-level cache --> - <property name="cache.use_second_level_cache">true</property> - <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property> - <property name="cache.use_structured_entries">true</property> - <property name="cache.use_query_cache">false</property> - <property name="cache.use_minimal_puts">true</property> - - <!-- property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property--> + + <!-- C3p0 --> + <property name="hibernate.c3p0.acquire_increment">1</property> + <property name="hibernate.c3p0.idle_test_period">300</property> + <property name="hibernate.c3p0.timeout">120</property> + <property name="hibernate.c3p0.max_size">25</property> + <property name="hibernate.c3p0.min_size">1</property> + <property name="hibernate.c3p0.max_statement">0</property> + <property name="hibernate.c3p0.preferredTestQuery">select 1;</property> + + <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> + + <!-- <property name="show_sql">true</property> --> + <!-- <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> --> + <property name="hibernate.dialect">org.mpi.openmind.repository.utils.CustomMysqlDialect</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost/openmind?characterEncoding=UTF-8</property> - <property name="hibernate.connection.username">root</property> - <property name="hibernate.connection.password">admin</property> - <property name="hibernate.connection.charSet">UTF-8</property> - <!--property name="show_sql">true</property--> + <property name="hibernate.connection.charSet">UTF-8</property> + <property name="hibernate.connection.username">root</property> + <property name="hibernate.connection.password"></property> + + <!-- <property name="show_sql">true</property> --> <property name="current_session_context_class">thread</property> - <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> - <!--property name="hbm2ddl.auto">create</property--> + <!-- <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> --> + <!-- <property name="hbm2ddl.auto">create</property> --> + <!-- <property name="hibernate.hbm2ddl.auto">validate</property> --> + + <mapping class="org.mpi.openmind.repository.bo.Node" /> <mapping class="org.mpi.openmind.repository.bo.Attribute" /> <mapping class="org.mpi.openmind.repository.bo.Entity" /> <mapping class="org.mpi.openmind.repository.bo.Relation" /> <mapping class="org.mpi.openmind.repository.bo.View" /> + <mapping class="org.mpi.openmind.repository.bo.ViewerAttribute" /> + <mapping class="org.mpi.openmind.repository.bo.ViewerPage" /> <mapping class="org.mpi.openmind.repository.bo.utils.Sequence" /> <mapping class="org.mpi.openmind.security.bo.User" /> <mapping class="org.mpi.openmind.security.bo.Group" />
--- a/src/main/resources/log4j.properties Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -### direct log messages to stdout ### -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss,SSS} %5p %c{1}:%L - %m%n -#%d{dd MMM yyyy HH:mm:ss,SSS} -#%d{ABSOLUTE} -### direct messages to file hibernate.log ### -log4j.appender.file=org.apache.log4j.FileAppender -log4j.appender.file.File=${catalina.home}/logs/hibernate.log -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n - -log4j.appender.persistenceServiceFile=org.apache.log4j.FileAppender -log4j.appender.persistenceServiceFile.File=${catalina.home}/logs/persistenceService.log -log4j.appender.persistenceServiceFile.layout=org.apache.log4j.PatternLayout -log4j.appender.persistenceServiceFile.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n - -log4j.appender.ismiFile=org.apache.log4j.FileAppender -log4j.appender.ismiFile.File=${catalina.home}/logs/ismi.log -log4j.appender.ismiFile.layout=org.apache.log4j.PatternLayout -log4j.appender.ismiFile.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n - -### set log levels - for more verbose logging change 'info' to 'debug' ## - -log4j.rootLogger=warn, stdout, ismiFile - -#Others -log4j.logger.org.hibernate.connection.C3P0ConnectionProvider=error - -# Log JDBC bind parameter runtime arguments -#log4j.logger.org.hibernate.type=trace - -#OM -log4j.logger.org.mpi.openmind.repository.services.PersistenceService=info -log4j.logger.org.mpi.openmind.search.SearchService=info -log4j.logger.org.mpi.openmind.cache.CacheService=info -log4j.logger.org.mpi.openmind.cache.AbstractCacheService=info -log4j.logger.org.mpi.openmind.configuration.ConfigurationService=info -log4j.logger.org.mpi.openmind.cache.WrapperService=info -log4j.logger.org.mpi.openmind.repository.services.ServiceRegistry=info -log4j.logger.org.mpi.openmind.repository.bo.Entity=info -#ISMI -log4j.logger.de.mpiwg.itgroup.ismi.search.beans.SimpleSearchBean=info -log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.SessionBean=info -log4j.logger.de.mpiwg.itgroup.ismi.merge.GeneralMerge=info -log4j.logger.de.mpiwg.itgroup.ismi.servlets.JSONInterface=info -log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.CurrentTextBean=info -log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.CurrentPersonBean=info -log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.ApplicationBean=info -log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.CurrentWitnessBean=info -log4j.logger.de.mpiwg.itgroup.ismi.servlets.jsonmethods.JSONGetRels=info -log4j.logger.de.mpiwg.itgroup.ismi.json.utils.JSONUtils=info -log4j.logger.org.mpiwg.itgroup.escidoc.ESciDocCache=info - -log4j.logger.de.mpiwg.itgroup.ismi=info - -log4j.logger.org.mpi.openmind.search.AbstractSearchService=info -log4j.logger.org.mpi.openmind.repository.services.AbstractPersistenceService=info - -log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.CurrentWitnessBean=info -log4j.logger.de.mpiwg.itgroup.ismi.publicView.PublicCodexList=info; -#log4j.logger. -#log4j.logger. -#log4j.logger. - -#log4j.logger.net.sf.hibernate=debug, stdout -#Hibernate -#log4j.logger.org.hibernate.cfg=debug, file -#log4j.logger.org.hibernate.cfg.annotations.Version=info, stdout -#log4j.logger.org.hibernate.cfg.Environment=info, stdout -#log4j.logger.org.hibernate.cfg.AnnotationBinder=info, stdout - - -### enable the following line if you want to track down connection ### -### leakages when using DriverManagerConnectionProvider ### -#log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=trace - -### log JDBC bind parameters ### -#log4j.logger.net.sf.hibernate.type=debug - - - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/resources/log4j.properties.template Wed Dec 09 14:08:40 2015 -0500 @@ -0,0 +1,84 @@ +### direct log messages to stdout ### +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss,SSS} %5p %c{1}:%L - %m%n +#%d{dd MMM yyyy HH:mm:ss,SSS} +#%d{ABSOLUTE} +### direct messages to file hibernate.log ### +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.File=${catalina.home}/logs/hibernate.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n + +log4j.appender.persistenceServiceFile=org.apache.log4j.FileAppender +log4j.appender.persistenceServiceFile.File=${catalina.home}/logs/persistenceService.log +log4j.appender.persistenceServiceFile.layout=org.apache.log4j.PatternLayout +log4j.appender.persistenceServiceFile.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n + +log4j.appender.ismiFile=org.apache.log4j.FileAppender +log4j.appender.ismiFile.File=${catalina.home}/logs/ismi.log +log4j.appender.ismiFile.layout=org.apache.log4j.PatternLayout +log4j.appender.ismiFile.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n + +### set log levels - for more verbose logging change 'info' to 'debug' ## + +log4j.rootLogger=warn, stdout, ismiFile + +#Others +log4j.logger.org.hibernate.connection.C3P0ConnectionProvider=error + +# Log JDBC bind parameter runtime arguments +#log4j.logger.org.hibernate.type=trace + +#OM +log4j.logger.org.mpi.openmind.repository.services.PersistenceService=info +log4j.logger.org.mpi.openmind.search.SearchService=info +log4j.logger.org.mpi.openmind.cache.CacheService=info +log4j.logger.org.mpi.openmind.cache.AbstractCacheService=info +log4j.logger.org.mpi.openmind.configuration.ConfigurationService=info +log4j.logger.org.mpi.openmind.cache.WrapperService=info +log4j.logger.org.mpi.openmind.repository.services.ServiceRegistry=info +log4j.logger.org.mpi.openmind.repository.bo.Entity=info +#ISMI +log4j.logger.de.mpiwg.itgroup.ismi.search.beans.SimpleSearchBean=info +log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.SessionBean=info +log4j.logger.de.mpiwg.itgroup.ismi.merge.GeneralMerge=info +log4j.logger.de.mpiwg.itgroup.ismi.servlets.JSONInterface=info +log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.CurrentTextBean=info +log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.CurrentPersonBean=info +log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.ApplicationBean=info +log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.CurrentWitnessBean=info +log4j.logger.de.mpiwg.itgroup.ismi.servlets.jsonmethods.JSONGetRels=info +log4j.logger.de.mpiwg.itgroup.ismi.json.utils.JSONUtils=info +#log4j.logger.org.mpiwg.itgroup.escidoc.ESciDocCache=info + +log4j.logger.de.mpiwg.itgroup.ismi=info + +log4j.logger.org.mpi.openmind.search.AbstractSearchService=info +log4j.logger.org.mpi.openmind.repository.services.AbstractPersistenceService=info + +log4j.logger.de.mpiwg.itgroup.ismi.entry.beans.CurrentWitnessBean=info +log4j.logger.de.mpiwg.itgroup.ismi.publicView.PublicCodexList=info; +#log4j.logger. +#log4j.logger. +#log4j.logger. + +#log4j.logger.net.sf.hibernate=debug, stdout +#Hibernate +#log4j.logger.org.hibernate.cfg=debug, file +#log4j.logger.org.hibernate.cfg.annotations.Version=info, stdout +#log4j.logger.org.hibernate.cfg.Environment=info, stdout +#log4j.logger.org.hibernate.cfg.AnnotationBinder=info, stdout + + +### enable the following line if you want to track down connection ### +### leakages when using DriverManagerConnectionProvider ### +#log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=trace + +### log JDBC bind parameters ### +log4j.logger.net.sf.hibernate.type=debug + + + +
--- a/src/main/resources/openmind-context.xml Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/resources/openmind-context.xml Wed Dec 09 14:08:40 2015 -0500 @@ -41,35 +41,36 @@ </bean> - <!-- Scheduler for Date-Based Mailings --> + <!-- Scheduler for Date-Based Mailings - <bean id="scheduling" class="org.mpi.openmind.scheduling.utils.Scheduling"> <property name="persistenceService" ref="persistenceService"/> <property name="configurationService" ref="configurationService"/> - </bean> + </bean> --> - <bean id="schedulingJobs" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> + <!-- <bean id="schedulingJobs" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="scheduling"/> - <property name="targetMethod" value="dailyKickOff"/> - <!--property name="concurrent" value="false"/--> - </bean> + <property name="targetMethod" value="dailyKickOff"/> --> + <!-- property name="concurrent" value="false"/ --> + <!-- </bean> --> - <bean id="schedulingCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> - <property name="jobDetail" ref="schedulingJobs"/> + <!-- <bean id="schedulingCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> + <property name="jobDetail" ref="schedulingJobs"/> --> <!-- daily 6 AM --> - <property name="cronExpression" value="0 0 6 * * ?"/> + <!-- <property name="cronExpression" value="0 0 6 * * ?"/> --> <!-- every 5 minutes <property name="cronExpression" value="0 0/5 * * * ?"/> --> - </bean> + <!-- </bean> --> - <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> + <!-- <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="schedulingCronTrigger"/> </list> </property> - </bean> + </bean> + --> </beans> \ No newline at end of file
--- a/src/main/resources/openmind.properties Mon Nov 23 15:23:30 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -scheduling-path=/net/xserve02.mpiwg-berlin.mpg.de/Volumes/data/Users/jurzua/ismi/automatic-backup -#scheduling-path=/home/jurzua/ismi/automatic-backup -scheduling-enable=true -debug-modus=false \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/resources/openmind.properties.template Wed Dec 09 14:08:40 2015 -0500 @@ -0,0 +1,4 @@ +scheduling-path=/tmp/ +#scheduling-path=/home/jurzua/ismi/automatic-backup +scheduling-enable=false +debug-modus=false \ No newline at end of file
--- a/src/main/webapp/admin/admin.xhtml Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/webapp/admin/admin.xhtml Wed Dec 09 14:08:40 2015 -0500 @@ -26,8 +26,6 @@ actionListener="#{adminBean.actionCreateUser}" /> <h:commandButton value="Show all users" actionListener="#{adminBean.actionGetAllUsers}" /> - <h:commandButton value="Open ESciDoc Panel Control" - actionListener="#{adminBean.listenerOpenESciDocPanelControl}" /> </h:panelGrid> <h:panelGrid columns="2" @@ -105,71 +103,6 @@ </rich:dataTable> - <!-- Attribute Editor --> - <h:panelGroup rendered="#{adminBean.showESciDocPanelControl}"> - <div style="z-index: 100;" class="rf-pp-shade"> - <button class="rf-pp-btn" tabindex="-1" accesskey="" /> - </div> - - <h:panelGrid columns="1" class="rf-pp-cntr" - style="height: 100px; left: 100px; position: fixed; top: 50px; width: 500px; z-index: 100;"> - - <div class="rf-pp-shdw" - style="height: 100px; left: 100px; left: 5px; top: 5px; bottom: -5px; opacity: 0.1;"> - </div> - <div class="rf-pp-hdr " style="cursor: default;"> - <div class="rf-pp-hdr-cnt">ESciDoc Panel Control</div> - </div> - - <h:panelGrid columns="1" class="rf-pp-cnt-scrlr" - style="width: 500px; height: 329px;"> - <h:panelGrid columns="1" class="rf-pp-cnt"> - <h:panelGrid columns="2"> - <h:outputLabel value="Last sychronization:" /> - <h:outputLabel - value="#{ApplicationBean1.refCache.lastSynchronization}" /> - - <h:outputLabel value="Loading time [ms]:" /> - <h:outputLabel - value="#{ApplicationBean1.refCache.lastSynchronizationTimeExec}" /> - - <h:outputLabel value="Server Status" /> - <h:outputLabel - value="#{ApplicationBean1.refCache.serverStatus}" /> - - <h:outputLabel value="Items size" /> - <h:outputLabel value="#{ApplicationBean1.refCache.itemsSize}" /> - - <h:outputLabel value="Max records used for last sychronization" /> - <h:outputLabel - value="#{ApplicationBean1.refCache.lastSynchronizationMaxRecords}" /> - - <h:outputLabel value="Sychronize with Server" /> - <h:panelGrid columns="3"> - - <h:selectOneMenu - value="#{ApplicationBean1.refCache.maxRecords}"> - <f:selectItem itemLabel="50" itemValue="50" /> - <f:selectItem itemLabel="100" itemValue="100" /> - <f:selectItem itemLabel="1000" itemValue="1000" /> - <f:selectItem itemLabel="5000" itemValue="5000" /> - <f:selectItem itemLabel="10000" itemValue="10000" /> - </h:selectOneMenu> - - <h:commandButton value="submit" - actionListener="#{ApplicationBean1.refCache.listenerSynchronizeWithServer}" /> - - </h:panelGrid> - - <h:commandButton value="Close" - actionListener="#{adminBean.listenerCloseESciDocPanelControl}" /> - </h:panelGrid> - </h:panelGrid> - </h:panelGrid> - </h:panelGrid> - - </h:panelGroup> - </h:panelGrid> </ui:define>
--- a/src/main/webapp/entry/components/misattribution.xhtml Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/webapp/entry/components/misattribution.xhtml Wed Dec 09 14:08:40 2015 -0500 @@ -39,10 +39,6 @@ <h:inputText value="#{CurrentText.misattTable.misatt.ref.endNoteId}" /> - <h:outputLabel value="ESciDoc Id" /> - <h:inputText - value="#{CurrentText.misattTable.misatt.ref.escidocId}" /> - <h:outputLabel value="EndNote Content" /> <h:inputTextarea value="#{CurrentText.misattTable.misatt.ref.endNoteContent}" @@ -91,13 +87,6 @@ <rich:column> <f:facet name="header"> - <h:outputText value="Ref Pubman" /> - </f:facet> - <h:outputText value="#{item.obj.ref.escidocId}" /> - </rich:column> - - <rich:column> - <f:facet name="header"> <h:outputText value="Note" /> </f:facet> <h:outputText value="#{item.obj.ref.addInformation}" />
--- a/src/main/webapp/entry/digi.xhtml Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/webapp/entry/digi.xhtml Wed Dec 09 14:08:40 2015 -0500 @@ -17,7 +17,7 @@ rendered="#{!empty CurrentDigi.entity.ownValue}" style="font-size: 12pt;" styleClass="titlePanel" /> - <h:outputText value="Person" + <h:outputText value="Digitalization" rendered="#{empty CurrentDigi.entity.ownValue}" style="font-size: 12pt; " styleClass="titlePanel"/> <h:outputLink
--- a/src/main/webapp/imageServer/resources/js/init.js Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/webapp/imageServer/resources/js/init.js Wed Dec 09 14:08:40 2015 -0500 @@ -157,6 +157,7 @@ { var witnesses = {}; + /* // we could do this with an ajax request, but we have // the variables already here, we just need to get them // from Django and not JS. @@ -165,6 +166,7 @@ witnesses[{{ witness.ismi_id }}] = {{ witness.start_page }}; {% endif %} {% endfor %} + */ var urlParams = getURLParams(); if (urlParams.hasOwnProperty('witness'))
--- a/src/main/webapp/resources/components/ismi/refWidget.xhtml Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/webapp/resources/components/ismi/refWidget.xhtml Wed Dec 09 14:08:40 2015 -0500 @@ -46,13 +46,6 @@ <rich:column> <f:facet name="header"> - <h:outputText value="ESciDoc Id" /> - </f:facet> - <h:outputText value="#{item.obj.escidocId}" /> - </rich:column> - - <rich:column> - <f:facet name="header"> <h:outputText value="Additional Information" /> </f:facet> <h:outputText value="#{item.obj.addInformation}" /> @@ -113,9 +106,6 @@ <h:outputLabel value="EndNote Id" /> <h:inputText value="#{cc.attrs.entityForm.endNoteRefTable.ref.endNoteId}" /> - <h:outputLabel value="ESciDoc Id" /> - <h:inputText value="#{cc.attrs.entityForm.endNoteRefTable.ref.escidocId}" /> - <h:outputLabel value="EndNote Content" /> <h:inputTextarea value="#{cc.attrs.entityForm.endNoteRefTable.ref.endNoteContent}"
--- a/src/main/webapp/search/displayAuthor.xhtml Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/webapp/search/displayAuthor.xhtml Wed Dec 09 14:08:40 2015 -0500 @@ -125,13 +125,6 @@ <h:column> <f:facet name="header"> - <h:outputText value="escidoc label" /> - </f:facet> - <h:outputText value="#{item.escidocLabel}" escape="false" /> - </h:column> - - <h:column> - <f:facet name="header"> <h:outputText value="additional_information" /> </f:facet> <h:outputText value="#{item.additionalInf}" /> @@ -270,13 +263,6 @@ <h:column> <f:facet name="header"> - <h:outputText value="escidoc label" /> - </f:facet> - <h:outputText value="#{item.escidocLabel}" escape="false" /> - </h:column> - - <h:column> - <f:facet name="header"> <h:outputText value="additional_information" /> </f:facet> <h:outputText value="#{item.additionalInf}" /> @@ -448,13 +434,6 @@ <h:column> <f:facet name="header"> - <h:outputText value="escidoc label" /> - </f:facet> - <h:outputText value="#{item.escidocLabel}" escape="false" /> - </h:column> - - <h:column> - <f:facet name="header"> <h:outputText value="additional_information" /> </f:facet> <h:outputText value="#{item.additionalInf}" />
--- a/src/main/webapp/search/displayTitle.xhtml Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/webapp/search/displayTitle.xhtml Wed Dec 09 14:08:40 2015 -0500 @@ -131,13 +131,6 @@ <h:column> <f:facet name="header"> - <h:outputText value="escidoc label" /> - </f:facet> - <h:outputText value="#{item.escidocLabel}" escape="false" /> - </h:column> - - <h:column> - <f:facet name="header"> <h:outputText value="additional_information" /> </f:facet> <h:outputText value="#{item.additionalInf}" /> @@ -299,13 +292,6 @@ <h:column> <f:facet name="header"> - <h:outputText value="escidoc label" /> - </f:facet> - <h:outputText value="#{item.escidocLabel}" escape="false" /> - </h:column> - - <h:column> - <f:facet name="header"> <h:outputText value="additional_information" /> </f:facet> <h:outputText value="#{item.additionalInf}" />
--- a/src/main/webapp/templates/main_template.xhtml Mon Nov 23 15:23:30 2015 +0100 +++ b/src/main/webapp/templates/main_template.xhtml Wed Dec 09 14:08:40 2015 -0500 @@ -11,28 +11,7 @@ <h:outputStylesheet name="/css/ismi-db/default.css" /> <h:outputStylesheet name="/css/ismi-db/popupPanel.css" /> - <h:outputScript name="/js/autocomplete.js" /> - <h:outputScript name="/js/autocomplete.js" /> - - <!-- - <h:outputStylesheet name="/imageServer/css/diva.min.css" /> - <h:outputStylesheet name="/imageServer/css/bootstrap.css" /> - <h:outputStylesheet name="/imageServer/css/bootstrap-responsive.min.css" /> - <h:outputStylesheet name="/imageServer/css/style.css" /> - - <h:outputScript name="imageServer/js/jquery.min.js" /> - --> - <!-- <h:outputScript name="imageServer/js/diva.min.js" /> --> - - <!-- <script type="text/javascript" src="http://localhost:8080/ismi-richfaces/resources/imageServer/js/diva.min.js"/> --> - <!-- - <h:outputScript name="imageServer/js/diva.js" /> - <h:outputScript name="imageServer/js/bootstrap.min.js" /> - <h:outputScript name="imageServer/js/typeahead.js" /> - - <h:outputScript name="imageServer/js/jurzua/shared.js" /> - --> </h:head> @@ -120,15 +99,11 @@ <div id="iconContent"> <h:graphicImage url="/resources/images/ismi_icon.png" width="90"/> - <!-- - <h:graphicImage - url="http://www.mpiwg-berlin.mpg.de/en/images/logo.png" /> - --> </div> </div> <div id="headerContent"> <h1> - <a href="#{ApplicationBean1.root}">ISMI Lab</a> + <a href="#{ApplicationBean1.root}">#{ApplicationBean1.confService.instanceName}</a> </h1> <p>Islamic Scientific Manuscripts Initiative</p> </div>