org.dspace.app.itemmarking.ItemMarkingCollectionStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dspace-api Show documentation
Show all versions of dspace-api Show documentation
DSpace core data model and service APIs.
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.itemmarking;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import org.dspace.content.Collection;
import org.dspace.content.Item;
import org.dspace.core.Context;
/**
* This is an item marking Strategy class that tries to mark an item
* based on the collection the items belong to
*
* @author Kostas Stamatis
*/
public class ItemMarkingCollectionStrategy implements ItemMarkingExtractor {
Map mapping = new HashMap();
public ItemMarkingCollectionStrategy() {
}
@Override
public ItemMarkingInfo getItemMarkingInfo(Context context, Item item)
throws SQLException {
if (mapping != null) {
for (Collection collection : item.getCollections()) {
if (mapping.containsKey(collection.getHandle())) {
return mapping.get(collection.getHandle());
}
}
}
return null;
}
public void setMapping(Map mapping) {
this.mapping = mapping;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy