import java.util.concurrent.BlockingQueue import org.antlr.stringtemplate.StringTemplate import org.antlr.stringtemplate.StringTemplateGroup import org.antlr.stringtemplate.language.DefaultTemplateLexer import eu.dnetlib.enabling.manager.msro.hope.groovy.RunnableGroovy import eu.dnetlib.hope.domains.common.LandingPage import eu.dnetlib.hope.domains.common.OAIHeader import eu.dnetlib.hope.domains.visual.LIDOCollection import eu.dnetlib.hope.domains.visual.LidoDescription import eu.dnetlib.hope.domains.visual.LidoPlace import eu.dnetlib.hope.domains.visual.LidoTitle import eu.dnetlib.hope.domains.visual.TypedSubjects class IISHDutchLabourMovement implements RunnableGroovy { def String cpCompleteName = "International Institute of Social History" def BlockingQueue resultsQueue, inputQueue; def String templatePath = "/var/lib/hope-scripts/templates" def String repositoryId def String collectionID = 'geheugen1' def String collectionPID = 'http://hdl.handle.net/10622/7659CAEF-BEF9-4020-9F74-09CFBDF1F303' /** * Driver namespace for elements in the OAI header. */ def dri = new groovy.xml.Namespace("http://www.driver-repository.eu/namespace/dri", 'dri') @Override public void run() { try{ def StringTemplateGroup group = new StringTemplateGroup("visualGroup", templatePath, DefaultTemplateLexer.class); def StringTemplate template = group.getInstanceOf("visualTemplate"); def coll = generateCollectionRecord(template) def OAIHeader oaiHeader = new OAIHeader(dateOfCollection:'', repositoryId:repositoryId, identifier:collectionID, objIdentifier:repositoryId+'::'+collectionID) def String collXML = coll.getXML(template, oaiHeader, cpCompleteName, coll) this.resultsQueue.put(collXML) template.reset() def IISHLido iishLido = new IISHLido(resultsQueue:resultsQueue, inputQueue:inputQueue) iishLido.enqueueResults(template, coll.getCollectionPID()) this.resultsQueue.put("END") println "closedQueue" }catch(Exception e){ this.resultsQueue.put("FAIL") println "closedQueue after exception in groovy execution"+e throw new RuntimeException(e) } } def generateCollectionRecord = { template -> def String lPageURL = collectionPID def String abstractSum="Working conditions, the position of the woman, social legislation, voting rights, birth control, education, the temperance movement, war and peace... "+ "Around 1900 the Netherlands were the scene of enormous social conflict and change. "+ "The debates from those years have left their impact on society today. "+ "In this collection the organized labour movement comes to life in images: the trade unions, the cooperatives and the political parties and groups, beginning with the Social-Democratic Confederation of 1881."+ "There is also a great deal of material on the numerous committees and associations having to do with care for the poor and unemployed, ethics and free thinking, the temperance movement and anti-militarism."+ "The photos show the meetings and parades held by political parties and organizations, such as the big May Day demonstrations and the demonstrations for universal suffrage. "+ "There are also numerous portraits of movement leaders. "+ "The prints are taken from magazines such as De Notenkraker and De Amsterdammer and were made by artists who were famous in their day, such as Albert Hahn, Johan Braakensiek and Louis Raemaekers. "+ "Their drawings often had to do with the same events but from different points of view."+ "The posters are quite diverse, from text posters to splendid lithographs, and from notices about meetings to the first illustrated election posters from 1913."+ "Banners were the pride of every trade union. They were made of heavy velvet, were decorated with mottos and symbols and were carried along in parades."+ "This collection contains almost six thousand photographs, prints, posters, banners and objects that provide a picture of the Dutch labour movement from 1860 through 1918. " def LIDOCollection coll = new LIDOCollection(collectionID:collectionID,collectionPID:collectionPID, langCode:'nld', collItemLanguages:['nld'], titles:[ new LidoTitle(langCode:'eng', value:'Dutch Labour Movements until 1918 ') ], abstractSummaries:[ new LidoDescription(langCode:'eng', value:abstractSum, type:'abstract') ], creationDates:['1860-1918'], accumulationDates:[], owners:[cpCompleteName], sizeItems:'5749', itemType:'IMAGE', itemFormatStm:'photographs, prints, posters, banners and objects', associatedPub:'', subjects:[], typedSubjects:[ new TypedSubjects(type:'association', dates:['1860-1918'], places:[ new LidoPlace(preferredName:'NL') ]) ],repository:cpCompleteName, useRights:'', accessRights:'Rights reserved - Free access', europeanaType:'IMAGE', europeanaRights:'Rights reserved - Free access', landingPage:new LandingPage(href:lPageURL, localID:lPageURL)) return coll } @Override public void setRepositoryId(String repoId) { repositoryId = repoId; } @Override public void setResultsQueue(BlockingQueue queue) { this.resultsQueue = queue } @Override public void setInputQueue(BlockingQueue queue) { this.inputQueue = queue } @Override public void closeResultQueue() { this.resultsQueue.put("END") println "closedQueue" } }