Package models

Examples of models.RestResponse


        }
    }

    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());
View Full Code Here


        Logger.info("EDITFORM");
        User user = new User();
        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 {
View Full Code Here

            }

            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)) {
                Logger.info("Communities are equal, nothing to do");
                flash("success", "No changes to community detected");
                return redirect(routes.Communities.show(id));
            } else {
                editCommunity.id = originalCommunity.id;

                RestResponse restResponse = editCommunity.update(user.token());
                HttpResponse httpResponse = restResponse.httpResponse;
                if(httpResponse.getStatusLine().getStatusCode() == 200) {
                    Logger.info("ok");
                    flash("success", "Community has been updated.");
                    return redirect(routes.Communities.show(id));
View Full Code Here

    //TODO index

    public static Result show(Long id) throws IOException {
        User user = new User();
        user = user.getUserFromSession(session());
        RestResponse response = Collection.findByID(id, user.token());
        if(response.httpResponse.getStatusLine().getStatusCode() == 200) {
            return ok(views.html.collection.detail.render(user, (Collection)response.modelObject, "Single Collection", response.jsonString, response.endpoint));
        } else {
            return internalServerError();
        }
View Full Code Here

TOP

Related Classes of models.RestResponse

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.