Package org.dspace.content

Examples of org.dspace.content.Community


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

        try {
            Integer id = Integer.parseInt(ref.getId());
            Community community = Community.find(context, id);

            String name = (String) inputVar.get("name");
            String shortDescription = (String) inputVar.get("shortDescription");
            String copyrightText = (String) inputVar.get("copyrightText");
            String sidebarText = (String) inputVar.get("sidebarText");
            String introductoryText = (String) inputVar.get("introductoryText");

            if (community != null) {
                community.setMetadata("name", name);
                community.setMetadata("short_description", shortDescription);
                community.setMetadata("copyright_text", copyrightText);
                community.setMetadata("side_bar_text", sidebarText);
                community.setMetadata("introductory_text", introductoryText);
                community.update();
            } else {
                throw new EntityException("Internal server error", "Could not update community", 500);
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
View Full Code Here


        }
    }

    public void removeCommunity(EntityReference ref, Map<String, Object> inputVar, Context context) {
        try {
            Community com = Community.find(context, Integer.parseInt(ref.getId()));
            if ((com != null)) {
                com.delete();
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } catch (AuthorizeException ae) {
            throw new EntityException("Forbidden", "Forbidden", 403);
View Full Code Here

    }

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

        try {
            Community com = Community.find(context, Integer.parseInt(ref.getId()));
            if (com != null) {
                com.createAdministrators();
                com.update();
                Group group = com.getAdministrators();
                return String.valueOf(group.getID());
            } else {
                throw new EntityException("Not found", "Entity not found", 404);
            }
        } catch (SQLException ex) {
View Full Code Here

        }
    }

    public void removeAdministrators(EntityReference ref, Map<String, Object> inputVar, Context context) {
        try {
            Community com = Community.find(context, Integer.parseInt(ref.getId()));
            if ((com != null)) {
                com.removeAdministrators();
                com.update();
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } catch (AuthorizeException ae) {
            throw new EntityException("Forbidden", "Forbidden", 403);
View Full Code Here

    }

    public Object getAdministrators(EntityReference ref, UserRequestParams uparams, Context context) {

        try {
            Community res = Community.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, res, Constants.READ);
            Group administrators = res.getAdministrators();

            if (administrators != null) {
                return new GroupEntity(administrators);
            }
        } catch (SQLException ex) {
View Full Code Here

    }

    public String createLogo(EntityReference ref, Object inputVar, Context context) {

        try {
            Community com = Community.find(context, Integer.parseInt(ref.getId()));
            if (com != null) {
                Bitstream bitstream = com.setLogo((InputStream) inputVar);
                com.update();
                return String.valueOf(bitstream.getID());
            } else {
                throw new EntityException("Not found", "Entity not found", 404);
            }
        } catch (SQLException ex) {
View Full Code Here

        }
    }

    public void removeLogo(EntityReference ref, Map<String, Object> inputVar, Context context) {
        try {
            Community com = Community.find(context, Integer.parseInt(ref.getId()));
            if ((com != null)) {
                com.setLogo(null);
                com.update();
            }
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
        } catch (AuthorizeException ae) {
            throw new EntityException("Forbidden", "Forbidden", 403);
View Full Code Here

        }
    }

    public Object getLogo(EntityReference ref, UserRequestParams uparams, Context context) {
        try {
            Community res = Community.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, res, Constants.READ);
            Bitstream logo = res.getLogo();

            if (logo != null) {
                return new BitstreamEntityId(logo);
            }
        } catch (SQLException ex) {
View Full Code Here

    }

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

        try {
            Community com = Community.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, com, 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 {
            Community com = Community.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, com, Constants.WRITE);
            if ((com != null)) {
                int eid = Integer.parseInt((String) inputVar.get("eid"));
                ResourcePolicy policy = ResourcePolicy.find(context, eid);
                if (policy != null) {
View Full Code Here

TOP

Related Classes of org.dspace.content.Community

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.