Package org.dspace.content

Examples of org.dspace.content.Collection


    }

    public String createPolicies(EntityReference ref, Map<String, Object> inputVar, Context context) {

        try {
            Collection col = Collection.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, col, Constants.WRITE);
            int actionId = Constants.getActionID((String) inputVar.get("action"));
            String userId = (String) inputVar.get("userId");
            String groupId = (String) inputVar.get("groupId");
View Full Code Here


        }
    }

    public void removePolicies(EntityReference ref, Map<String, Object> inputVar, Context context) {
        try {
            Collection col = Collection.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, col, Constants.WRITE);
            if (col != null) {
                int eid = Integer.parseInt((String) inputVar.get("eid"));
                ResourcePolicy policy = ResourcePolicy.find(context, eid);
                if (policy != null) {
View Full Code Here

        }
    }

    public Object getPolicies(EntityReference ref, UserRequestParams uparams, Context context) {
        try {
            Collection res = Collection.find(context, Integer.parseInt(ref.getId()));
//            AuthorizeManager.authorizeAction(context, res, Constants.READ);
            List<Object> entities = new ArrayList<Object>();

            List<ResourcePolicy> policies = AuthorizeManager.getPolicies(context, res);
            for (ResourcePolicy policy : policies) {
View Full Code Here

        super(uid, context);

        boolean collections = uparams.getCollections();
        boolean trim = uparams.getTrim();

        Collection collection = res.getOwningCollection();
        if (collection != null) {
        this.collection = collections ? trim ? new CollectionEntityTrimC(collection) : new CollectionEntityC(collection)
                : new CollectionEntityId(collection);
        }
    }
View Full Code Here

        super(item, context);

        boolean collections = uparams.getCollections();
        boolean trim = uparams.getTrim();

        Collection collection = item.getOwningCollection();
        if (collection != null) {
            this.collection = collections ? trim ? new CollectionEntityTrimC(collection) : new CollectionEntityC(collection)
                    : new CollectionEntityId(collection);
        }
    }
View Full Code Here

        int collectionId;
        try {
            if (inputVar instanceof HashMap) { //xml
                collectionId = Integer.parseInt((String)((HashMap) inputVar).get("collectionId"));
                if (collectionId > 0) {
                    Collection col = Collection.find(context, collectionId);
                    if (col != null) {
                        Item item = prepareItem(context, col, (HashMap) inputVar);
                        return String.valueOf(item.getID());
                    } else {
                        throw new EntityException("Internal server error", "Could not create item", 500);
                    }
                } else {
                    throw new EntityException("Internal server error", "Could not create item", 500);
                }
            } else if(inputVar instanceof InputStream) { //zip
                Map<String, InputStream> fileMap = new HashMap<String, InputStream>();
                Map xmlMap = new HashMap();
                ZipInputStream zipInputStream = new ZipInputStream((InputStream) inputVar);
                ZipEntry zipEntry = zipInputStream.getNextEntry();
                while (zipEntry != null) {
                    if ("package.xml".equalsIgnoreCase(zipEntry.getName())) {
                        xmlMap = (Map) Utils.translateFormattedData("xml", zipInputStream);
                    } else {
                        InputStream nis = Utils.transferInputStream(zipInputStream);
                        fileMap.put(zipEntry.getName(), nis);
                    }
                    zipEntry = zipInputStream.getNextEntry();
                }

                collectionId = Integer.parseInt((String) xmlMap.get("collectionId"));
                if (collectionId > 0) {
                    Collection col = Collection.find(context, collectionId);
                    if (col != null) {
                        Item item = prepareItem(context, col, xmlMap);

                        List<Map> bundleList = getNodeList(xmlMap, "bundles", "bundle");
View Full Code Here

            HttpServletRequest request, HttpServletResponse response,
            SubmissionInfo subInfo) throws SQLException, ServletException,
            IOException
    {
        // determine collection
        Collection c = subInfo.getSubmissionItem().getCollection();

        try
        {
            // read configurable submissions forms data
            DCInputsReader inputsReader = new DCInputsReader();
            
            // load the proper submission inputs to be used by the JSP
            request.setAttribute("submission.inputs", inputsReader.getInputs(c
                    .getHandle()));
        }
        catch (DCInputsReaderException e)
        {
            throw new ServletException(e);
View Full Code Here

                doc1.addField("owningComm", comm.getID());
            }
        }
        else if (dso instanceof Collection)
        {
            Collection coll = (Collection) dso;
            for (int i = 0; i < coll.getCommunities().length; i++)
            {
                Community community = coll.getCommunities()[i];
                doc1.addField("owningComm", community.getID());
                storeParents(doc1, community);
            }
        }
        else if (dso instanceof Item)
        {
            Item item = (Item) dso;
            for (int i = 0; i < item.getCollections().length; i++)
            {
                Collection collection = item.getCollections()[i];
                doc1.addField("owningColl", collection.getID());
                storeParents(doc1, collection);
            }
        }
        else if (dso instanceof Bitstream)
        {
View Full Code Here

            AuthorizeException
    {
        // pass on the fileupload setting
        if (subInfo != null)
        {
            Collection c = subInfo.getSubmissionItem().getCollection();
            try
            {
                DCInputsReader inputsReader = new DCInputsReader();
                request.setAttribute("submission.inputs", inputsReader.getInputs(c
                        .getHandle()));
            }
            catch (DCInputsReaderException e)
            {
                throw new ServletException(e);
View Full Code Here

                    // We need to show the file upload error page
                    if (subInfo != null)
                    {
                        try
                        {
                            Collection c = subInfo.getSubmissionItem().getCollection();
                            DCInputsReader inputsReader = new DCInputsReader();
                            request.setAttribute("submission.inputs", inputsReader
                                    .getInputs(c.getHandle()));
                        }
                        catch (DCInputsReaderException e)
                        {
                            throw new ServletException(e);
                        }
View Full Code Here

TOP

Related Classes of org.dspace.content.Collection

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.