Package com.scooterframework.orm.activerecord

Examples of com.scooterframework.orm.activerecord.ActiveRecord


*/
public class OTest extends ScooterTestHelper {
 
  @Test
  public void test_allAssociatedRecordsOf() {
    ActiveRecord owner6 = Owner.where("id=6").getRecord();
    List<ActiveRecord> records = O.allAssociatedRecordsOf(owner6, "pets.visits");
    assertEquals("total visits of owner #6", 4, records.size());
  }
View Full Code Here


    assertEquals("total visits of owner #6", 4, records.size());
  }
 
  @Test
  public void test_allAssociatedRecordsOf_eager_loading() {
    ActiveRecord owner6 = Owner.where("owners.id=6").includes("pets=>visits").getRecord();
    List<ActiveRecord> records = O.allAssociatedRecordsOf(owner6, "pets.visits");
    assertEquals("total visits of owner #6", 4, records.size());
  }
View Full Code Here

    assertEquals("total visits of owner #6", 4, records.size());
  }
 
  @Test
  public void test_associatedRecordOf() {
    ActiveRecord visit1 = Visit.where("id=1").getRecord();
    String firstName = (String)O.associatedRecordOf(visit1, "pet.owner").getField("first_name");
    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
View Full Code Here

    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
 
  @Test
  public void test_associatedRecordOf_eager_loading() {
    ActiveRecord visit1 = Visit.where("visits.id=1").includes("pet=>owner").getRecord();
    String firstName = (String)O.associatedRecordOf(visit1, "pet.owner").getField("first_name");
    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
View Full Code Here

    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
 
  @Test
  public void test_property() {
    ActiveRecord visit1 = Visit.where("id=1").getRecord();
    String firstName = (String)O.property(visit1, "pet.owner.first_name");
    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
View Full Code Here

    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
 
  @Test
  public void test_property_eager_loading() {
    ActiveRecord visit1 = Visit.where("visits.id=1").includes("pet=>owner").getRecord();
    String firstName = (String)O.property(visit1, "pet.owner.first_name");
    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
View Full Code Here

    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
 
  @Test
  public void test_value() {
    ActiveRecord visit1 = Visit.where("id=1").getRecord();
    ACH.getAC().storeToRequest("visit1", visit1);
    String firstName = (String)O.value("visit1.pet.owner.first_name");
    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
View Full Code Here

    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
 
  @Test
  public void test_value_eager_loading() {
    ActiveRecord visit1 = Visit.where("visits.id=1").includes("pet=>owner").getRecord();
    ACH.getAC().storeToRequest("visit1", visit1);
    String firstName = (String)O.value("visit1.pet.owner.first_name");
    assertEquals("first name of owner of visit#1", "Jean", firstName);
  }
View Full Code Here

     
        Object userId = null;
        try {
            userId = ACH.getAC().getFromSessionData(SESSION_KEY_LOGIN_USER_ID);
            if (userId == null) {
                ActiveRecord user = loginUser();
                if (user != null) {
                    userId = user.getRestfulId();
                    if (userId != null) cacheLoggedInUserId(userId);
                }
            }
        }
        catch(Exception ex) {
View Full Code Here

    public static String loginPassword() {
        Object userPwd = null;
        try {
            userPwd = ACH.getAC().getFromSessionData(SESSION_KEY_LOGIN_PASSWORD);
            if (userPwd == null) {
                ActiveRecord user = loginUser();
                if (user != null) {
                    userPwd = user.getField("password");
                    if (userPwd != null) cacheLoggedInPassword(userPwd);
                }
            }
        }
        catch(Exception ex) {
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.