Package com.scooterframework.orm.activerecord

Examples of com.scooterframework.orm.activerecord.ActiveRecord


     */
    public String authenticate() {
        String username = p("username");
        String password = p("password");

        ActiveRecord user = Account.findFirst("username='" + username + "' and password='" + password + "'");
        if (user != null) {
            LoginHelper.cacheLoggedInUser(user);//Save the login user to session
            LoginHelper.cacheLoggedInUserId(username);//Save the login user id to session
            return redirectTo("/tweets/followings_tweets");
        }
View Full Code Here


    /**
     * followers method
     */
    public String followers() {
      String username = p("username");
      ActiveRecord user = Account.findFirst("username='" + username + "'");
      storeToRequest("followers", user.allAssociated("followers").getRecords());
        storeToRequest("username", username);
        storeToRequest("user", user);
        return null;
    }
View Full Code Here

    /**
     * followings method
     */
    public String followings() {
      String username = p("username");
      ActiveRecord user = Account.findFirst("username='" + username + "'");
      storeToRequest("followings", user.allAssociated("followings").getRecords());
        storeToRequest("username", username);
        storeToRequest("user", user);
        return null;
    }
View Full Code Here

    /**
     * addFollowing method
     */
    public String addFollowing() {
        String username = p("username");
      ActiveRecord user = Account.findFirst("username='" + username + "'");

        ActiveRecord loginUser = LoginHelper.loginUser();
        loginUser.reload();
        loginUser.allAssociated("followings").add(user);

        return redirectTo("/" + loginUser.getField("username"));
    }
View Full Code Here

    /**
     * <tt>show</tt> method returns a <tt>entry</tt> record.
     */
    public String show() {
        ActiveRecord entry = Entry.findById(p("id"));
        if (entry == null) {
            flash("notice", "There is no entry record with primary key id as " + p("id") + ".");
        }
        else {
            setViewData("entry", entry);
View Full Code Here

    /**
     * <tt>create</tt> method creates a new <tt>entry</tt> record.
     */
    public String create() {
        ActiveRecord newEntry = null;
        try {
            newEntry = Entry.newRecord();
            newEntry.setData(params());
            newEntry.save();
            flash("notice", "Entry was successfully created.");

            return redirectTo(R.resourcePath("entries"));
        }
        catch(Exception ex) {
View Full Code Here

    /**
     * <tt>update</tt> method updates an existing <tt>entry</tt> record.
     */
    public String update() {
        ActiveRecord entry = null;
        try {
            entry = Entry.findById(p("id"));
            if (entry != null) {
                entry.setData(params());
                entry.update();
                flash("notice", "Entry was successfully updated.");

                return redirectTo(R.resourceRecordPath("entries", entry));
            }
            else {
View Full Code Here

    /**
     * <tt>delete</tt> method deletes a <tt>entry</tt> record.
     */
    public String delete() {
        ActiveRecord entry = Entry.findById(p("id"));
        if (entry != null) {
            entry.delete();
            flash("notice", "Entry was successfully deleted.");
        }
        else {
            flash("notice", "There is no entry record with primary key id as " + p("id") + ".");
        }
View Full Code Here

   
    /**
     * <tt>show</tt> method returns a <tt>entry</tt> record.
     */
    public String show() {
        ActiveRecord entry = Entry.findById(p("id"));
        if (entry == null) {
            flash("notice", "There is no entry record with primary key id as " + p("id") + ".");
        }
        else {
            setViewData("entry", entry);
View Full Code Here

   
    /**
     * <tt>create</tt> method creates a new <tt>entry</tt> record.
     */
    public String create() {
        ActiveRecord newEntry = null;
        try {
            newEntry = Entry.newRecord();
            newEntry.setData(params());
            newEntry.save();
            flash("notice", "Entry was successfully created.");
        }
        catch(Exception ex) {
            log.error("Error in create() caused by " + ex.getMessage());
            flash("error", "There was a problem creating the entry record.");
View Full Code Here

TOP

Related Classes of com.scooterframework.orm.activerecord.ActiveRecord

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.