Package models

Examples of models.Community


            List<Community> communities = new ArrayList<Community>();

            if(jsonNode.size()>0) {
                for(JsonNode comm : jsonNode) {
                    Community community = Community.parseCommunityFromJSON(comm);
                    communities.add(community);
                }
            }

            String endpoint = conn.getURL().toString();
View Full Code Here


    public static Result show(Long id) {
        Logger.info("SHOW");
        RestResponse response = Community.findByID(id);
        if(response.modelObject instanceof Community) {
            Community community = (Community) response.modelObject;
            User user = new User();
            user = user.getUserFromSession(session());

            String flash = flash("success");
            return ok(views.html.community.detail.render(user, community, "Single Community", response.jsonString, response.endpoint, flash));
View Full Code Here

        user = user.getUserFromSession(session());
        Form<Community> communityForm = form(Community.class);

        RestResponse response = Community.findByID(id);
        if(response.modelObject instanceof Community) {
            Community community = (Community) response.modelObject;
            communityForm = communityForm.fill(community);
            return ok(views.html.community.edit.render(user, communityForm, "Edit Community", response.jsonString, response.endpoint));
        } else {
            return internalServerError();
        }
View Full Code Here

            Form<Community> filledForm = form(Community.class).bindFromRequest("name", "copyrightText", "introductoryText", "shortDescription", "sidebarText");
            if(filledForm.hasErrors()){
                return badRequest(views.html.community.edit.render(user, filledForm, "Edit Comm", "", ""));
            }

            Community editCommunity = filledForm.get();

            //Determine if the edited community is changed from original. i.e. don't update unless necessary
            RestResponse originalCommunityResponse = Community.findByID(id);
            Community originalCommunity = null;
            if(originalCommunityResponse.modelObject instanceof Community) {
                originalCommunity = (Community) originalCommunityResponse.modelObject;
            }

            if(editCommunity.equals(originalCommunity)) {
View Full Code Here

            request.addHeader("Content-Type", "application/json");
            String token = session("userToken");
            request.addHeader("rest-dspace-token", token);


            Community community = form(Community.class).bindFromRequest().get();

            StringEntity communityEntity = new StringEntity("{\"name\":\""+ community.name +"\"}");

            request.setEntity(communityEntity);
            Logger.info("ready");
            HttpResponse response = httpClient.execute(request);

            Logger.info("response: " + response.toString());
            if(response.getStatusLine().getStatusCode() == 200) {
                Logger.info("ok");
                Community parsedCommunity = Community.parseCommunityFromJSON(Json.parse(EntityUtils.toString(response.getEntity())));
                return redirect(routes.Communities.show(parsedCommunity.id));
            } else {
                Logger.info("not ok");
                return badRequest();
            }
View Full Code Here

TOP

Related Classes of models.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.