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.* import eu.dnetlib.hope.domains.visual.* class IISHParadiso 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 = 'geheugen5' def String collectionPID = 'http://hdl.handle.net/10622/E8045781-0808-469C-9F1D-0D1BA3420A02' /** * 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="Around 1995, in addition to their archives, De Melkweg and Paradiso began to hand over a large part of their collections of posters to the International Institute of Social History (IISG). "+ "The selection on view here includes 5,069 posters advertising concerts, festivals, movies, demonstrations and other events that took place in the years 1970-1999."+ "Though all the posters are not equally spectacular, many are beautifully designed and all convey a faithful picture of a fascinating period, which De Melkweg patrons and Paradiso-goers of the day will remember with pleasure and, perhaps, some nostalgia."+ "The extensive information the posters give on the programs in the weeks and months to come is only summarized in the accompanying description. "+ "Whereas posters always mention the day(s) and the month a band is going to perform, mentioning the year was (and still is) not common practice. "+ "As a result, the year some events took place is not clear and must be guessed." def OAIHeader collOaiheader = new OAIHeader(repositoryId:repositoryId, identifier:collectionID, objIdentifier:repositoryId+"::"+collectionID) def LIDOCollection coll = new LIDOCollection(collectionID:collectionID,collectionPID:collectionPID, langCode:'nld', collItemLanguages:['nld'], titles:[ new LidoTitle(langCode:'eng', value:'De Melkweg and Paradiso posters') ], abstractSummaries:[ new LidoDescription(langCode:'eng', value:abstractSum, type:'abstract') ], creationDates:['1970-1999'], accumulationDates:[], owners:[cpCompleteName], sizeItems:'5069', itemType:'IMAGE', itemFormatStm:'posters', associatedPub:'', subjects:[], typedSubjects:[ new TypedSubjects(type:'association', dates:['1970-1999'], 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" } }