Package org.dspace.content

Examples of org.dspace.content.Item$MetadataCache


    /**
     * @return true if this dissemination is available for the item.
     */
    public boolean isAvailableFor(Object nativeItem)
    {
        Item item = ((HarvestedItemInfo) nativeItem).item;
        return xwalk.canDisseminate(item);
    }
View Full Code Here


     * Do the crosswalk.  Returns serialized XML in a string.
     */
    public String createMetadata(Object nativeItem)
            throws CannotDisseminateFormatException
    {
        Item item = ((HarvestedItemInfo) nativeItem).item;
        try
        {
            log.debug("OAI plugin, schema="+schemaLabel+", preferList="+String.valueOf(xwalk.preferList()));
            if (xwalk.preferList())
                return outputUgly.outputString(xwalk.disseminateList(item));
View Full Code Here

      ProcessingException {
    try {
      // Grab the context.
      Context context = ContextUtil.obtainContext(objectModel);
     
      Item item = getItem(context);
            if (item == null)
              throw new ResourceNotFoundException("Unable to locate object.");
           
           
            // Instantiate and execute the ORE plugin
View Full Code Here

             String type = parts[0];
             int id = Integer.valueOf(parts[1]);
            
             if ("item".equals(type))
             {
               Item item = Item.find(context,id);
               return item;
             }
             else
                 throw new CrosswalkException("ORE dissemination only available for DSpace Items.");
            
View Full Code Here

    }

    public String createMetadata(Object nativeItem)
            throws CannotDisseminateFormatException
    {
        Item item = ((HarvestedItemInfo) nativeItem).item;

        StringBuffer metadata = new StringBuffer();

        metadata
                .append(
                        "<oai_dc:dc xmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\" ")
                .append("xmlns:dc=\"http://purl.org/dc/elements/1.1/\" ")
                .append(
                        "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ")
                .append(
                        "xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd\">");

        for (String element : oaidcElement)
        {
            Set<String> itemMetadata = config.get(element);

            if (itemMetadata != null && itemMetadata.size() > 0)
            {
                for (String mdString : itemMetadata)
                {
                    String converterName = null;
                    IConverter converter = null;
                    Matcher converterMatcher = converterPattern.matcher(mdString);
                    if (converterMatcher.matches())
                    {
                        converterName = converterMatcher.group(1);
                        converter = (IConverter) PluginManager.getNamedPlugin(
                                IConverter.class, converterName);
                        if (converter == null)
                        {
                            log.warn(LogManager.getHeader(null,
                                    "createMetadata",
                                    "no converter plugin found with name "
                                            + converterName + " for metadata "
                                            + mdString));
                        }
                    }

                    DCValue[] dcValues;
                    if (converterName != null)
                    {
                        dcValues = item.getMetadata(mdString.replaceAll("\\("
                                + converterName + "\\)", ""));
                    }
                    else
                    {
                        dcValues = item.getMetadata(mdString);
                    }

                    try
                    {
                    for (DCValue dcValue : dcValues)
View Full Code Here

            this.add(collection.getLogo());
           
        }
        else if (dso instanceof Item)
        {
            Item item = (Item) dso;
           
            validityKey.append("Item:");
            validityKey.append(item.getHandle());           
            validityKey.append(item.getOwningCollection());
            validityKey.append(item.getLastModified());
            // Include all metadata values in the validity key.
            DCValue[] dcvs = item.getDC(Item.ANY,Item.ANY,Item.ANY);
            for (DCValue dcv : dcvs)
            {
                validityKey.append(dcv.schema + ".");
                validityKey.append(dcv.element + ".");
                validityKey.append(dcv.qualifier + ".");
                validityKey.append(dcv.language + "=");
                validityKey.append(dcv.value);
            }
           
            for(Bundle bundle : item.getBundles())
            {
                // Add each of the items bundles & bitstreams.
                this.add(bundle);
            }
        }
View Full Code Here

    {

        DSpaceObject dspaceObject = HandleUtil.obtainHandle(objectModel);
        if (!(dspaceObject instanceof Item))
            return;
        Item item = (Item) dspaceObject;

        try {
            performSearch(item);
        } catch (SearchServiceException e) {
            log.error(e.getMessage(),e);
        }

        // Build the collection viewer division.


        if (this.queryResults != null) {

            NamedList nList = this.queryResults.getResponse();

            SimpleOrderedMap<SolrDocumentList> mlt = (SimpleOrderedMap<SolrDocumentList>)nList.get("moreLikeThis");

            //home.addPara(nList.toString());
           
            if(mlt != null && 0 < mlt.size())
            {
                //TODO: also make sure if an item is unresolved we do not end up with an empty referenceset !
                List<DSpaceObject> dsos = new ArrayList<DSpaceObject>();
                for(Map.Entry<String,SolrDocumentList> entry : mlt)
                {
                    String key = entry.getKey();

                    //org.dspace.app.xmlui.wing.element.List mltList = mltDiv.addList(key);

                    //mltList.setHead(key);

                    for(SolrDocument doc : entry.getValue())
                    {
                        try{
                            dsos.add(SearchUtils.findDSpaceObject(context, doc));
                        }catch(Exception e){
                            log.error(LogManager.getHeader(context, "Error while resolving related item doc to dso", "Main item: " + item.getID()));
                        }
                        //mltList.addItem().addContent(doc.toString());
                    }
        
View Full Code Here

        try
        {
//            Request request = ObjectModelHelper.getRequest(objectModel);
            DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
            if (dso.getType() == Constants.ITEM) {
                Item item = (Item) dso;
                Bundle[] bundles = item.getBundles("ORIGINAL");
                for (Bundle bundle : bundles) {
//                    log.debug("bundle.name: " + bundle.getName());
//                    log.debug("bundle.priID: " + bundle.getPrimaryBitstreamID());
                    for (Bitstream bitstream : bundle.getBitstreams()) {
//                        log.debug("bitstream.name: " + bitstream.getName());
View Full Code Here

        }

        try {
            switch (dso.getType()) {
                case Constants.ITEM:
                    Item item = (Item) dso;
                    if (item.isArchived() && !item.isWithdrawn()) {
                        /**
                         * If the item is in the repository now, add it to the index
                         */
                        if (requiresIndexing(handle, ((Item) dso).getLastModified())
                                || force) {
View Full Code Here

    public void updateIndex(Context context, boolean force) {
        try {
            ItemIterator items = null;
            try {
                for (items = Item.findAll(context); items.hasNext();) {
                    Item item = (Item) items.next();
                    indexContent(context, item, force);
                    item.decache();
                }
            } finally {
                if (items != null) {
                    items.close();
                }
View Full Code Here

TOP

Related Classes of org.dspace.content.Item$MetadataCache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.