Skip to content

Instantly share code, notes, and snippets.

View aschweer's full-sized avatar

Andrea Schweer aschweer

  • Hamilton, New Zealand
View GitHub Profile
@aschweer
aschweer / MessageItem.java
Created June 29, 2017 03:59
DSpace event consumer that sends JMS message on item install
package net.schweerelos.dspace.event;
import org.dspace.content.Item;
import org.dspace.core.Context;
import org.dspace.handle.service.HandleService;
import java.io.Serializable;
import java.sql.SQLException;
/**
@aschweer
aschweer / AgSciteReviewActionScreen.java
Last active June 15, 2017 03:55
Enabling collaborative review with the DSpace configurable workflow
package nz.ac.waikato.its.irr.dspace.app.xmlui.aspect.xmlworkflow.actions.processingaction;
import com.google.common.collect.Collections2;
import nz.ac.waikato.its.irr.dspace.app.xmlui.aspect.xmlworkflow.actions.AgSciteWorkflowScreenUtils;
import nz.ac.waikato.its.irr.dspace.xmlworkflow.state.actions.processingaction.AgsciteReviewActionLogic;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
import org.apache.commons.lang.StringUtils;
import org.dspace.app.xmlui.aspect.administrative.CurateForm;
import org.dspace.app.xmlui.aspect.administrative.FlowCurationUtils;
@aschweer
aschweer / curation-email.diff
Last active April 9, 2017 22:29
DSpace 5.x patch for e-mailing curation reports of queued tasks. Code changes and e-mail template.
commit fa122611f2551d418f6ed92aacdd5a30bedca88e
Author: Andrea Schweer <schweer@waikato.ac.nz>
Date: Tue May 5 17:13:10 2015 +1200
|#6120 Send curation report when queue is worked off (configurable)
diff --git a/dspace-api/src/main/java/org/dspace/curate/CurationCli.java b/dspace-api/src/main/java/org/dspace/curate/CurationCli.java
index af9f8e0..8af7c89 100644
--- a/dspace-api/src/main/java/org/dspace/curate/CurationCli.java
+++ b/dspace-api/src/main/java/org/dspace/curate/CurationCli.java
@aschweer
aschweer / changes.patch
Created November 17, 2016 23:01
Changes to vagrant-dspace
diff --git a/Vagrantfile b/Vagrantfile
index 344d84d..5d696a7 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -67,6 +67,14 @@ Vagrant.configure("2") do |config|
# configure a private network and set this guest's IP to 192.168.50.2
config.vm.network "private_network", ip: CONF['ip_address']
+ # Bugfix for "Cable connected: off"
+ config.vm.provider :virtualbox do |vm|
@aschweer
aschweer / RetrospectivelyRegisterIdentifier.java
Created August 22, 2016 03:34
Retrospectively assign DOIs to DSpace items (DSpace 5.x)
package nz.co.lernz.db.curation;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.curate.AbstractCurationTask;
import org.dspace.curate.Curator;
import org.dspace.curate.Distributive;
@aschweer
aschweer / pre-commit
Created February 14, 2016 20:14
git pre-commit hook to check XML files for well-formedness, using 'file' and 'xmllint' commands
#!/bin/bash
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
@aschweer
aschweer / author-template.xsl
Last active September 22, 2015 22:46
Template for Mirage 2 that links author names to "author" browse index
<xsl:stylesheet
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:dri="http://di.tamu.edu/DRI/1.0/"
xmlns:mets="http://www.loc.gov/METS/"
xmlns:dim="http://www.dspace.org/xmlns/dspace/dim"
xmlns:xlink="http://www.w3.org/TR/xlink/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:ore="http://www.openarchives.org/ore/terms/"
xmlns:oreatom="http://www.openarchives.org/ore/atom/"
@aschweer
aschweer / ReindexSolr.java
Created March 10, 2015 23:22
Re-index DSpace solr documents
package org.dspace.util;
import org.apache.commons.cli.*;
import org.apache.commons.lang.StringUtils;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.util.ClientUtils;
import org.apache.solr.common.SolrDocument;
@aschweer
aschweer / README.md
Last active August 29, 2015 14:16 — forked from terrywbrady/README.md

We found that 5M of our 12M statistics records did not have a uid. The absence of this field caused the sharding process to fail.

  • To check how many of your stats records don't have a uid, run a query like so:

    curl --globoff 'http://localhost:8080/solr/statistics/select?q=-uid:[*+TO+*]&rows=0&indent=true' | grep numFound

  • Add the following to solr.xml

      <core name="tstatistics" instanceDir="tstatistics" />
    
  • Actually create that instance directory and copy over the conf subdirectory from the statistics core

@aschweer
aschweer / 0001-LCoNZ-Show-browse-indexes-only-where-configured.patch
Created July 20, 2014 21:13
DSpace show browse index only where configured
From e5c7214d3f908c72c3ce2b86c608a1eb1252ac42 Mon Sep 17 00:00:00 2001
From: Andrea Schweer <schweer@waikato.ac.nz>
Date: Fri, 11 May 2012 15:10:45 +1200
Subject: [PATCH] [LCoNZ] Show browse indexes only where configured
---
.../aspect/browseArtifacts/CollectionBrowse.java | 45 ++++++++-
.../aspect/browseArtifacts/CommunityBrowse.java | 44 +++++++-
.../xmlui/aspect/browseArtifacts/Navigation.java | 111 ++++++++++++++++++++-
3 files changed, 193 insertions(+), 7 deletions(-)