Examples of Person


Examples of org.springbyexample.web.orm.entity.Person

    }

    @Override
    @Transactional
    public Person saveAddress(Integer id, Address address) {
        Person person = findById(id);

        if (person.getAddresses().contains(address)) {
            person.getAddresses().remove(address);
        }

        person.getAddresses().add(address);       

        return save(person);
    }
View Full Code Here

Examples of org.springframework.beans.Person

    pf.addAdvice(new SerializableNopInterceptor());
    // Try various advice types
    pf.addAdvice(new CountingBeforeAdvice());
    pf.addAdvice(new CountingAfterReturningAdvice());
    pf.addAdvice(cta);
    Person p = (Person) createAopProxy(pf).getProxy();

    p.echo(null);
    assertEquals(0, cta.getCalls());
    try {
      p.echo(new ServletException());
    }
    catch (ServletException ex) {

    }
    assertEquals(1, cta.getCalls());

    // Will throw exception if it fails
    Person p2 = (Person) SerializationTestUtils.serializeAndDeserialize(p);
    assertNotSame(p, p2);
    assertEquals(p.getName(), p2.getName());
    assertEquals(p.getAge(), p2.getAge());
    assertTrue("Deserialized object is an AOP proxy", AopUtils.isAopProxy(p2));

    Advised a1 = (Advised) p;
    Advised a2 = (Advised) p2;
    // Check we can manipulate state of p2
    assertEquals(a1.getAdvisors().length, a2.getAdvisors().length);

    // This should work as SerializablePerson is equal
    assertEquals("Proxies should be equal, even after one was serialized", p, p2);
    assertEquals("Proxies should be equal, even after one was serialized", p2, p);

    // Check we can add a new advisor to the target
    NopInterceptor ni = new NopInterceptor();
    p2.getAge();
    assertEquals(0, ni.getCount());
    a2.addAdvice(ni);
    p2.getAge();
    assertEquals(1, ni.getCount());

    cta = (CountingThrowsAdvice) a2.getAdvisors()[3].getAdvice();
    p2.echo(null);
    assertEquals(1, cta.getCalls());
    try {
      p2.echo(new ServletException());
    }
    catch (ServletException ex) {

    }
    assertEquals(2, cta.getCalls());
View Full Code Here

Examples of org.springframework.data.gemfire.repository.sample.Person

  PersonRepository repository;

  @Before
  public void setUp() {

    dave = new Person(1L, "Dave", "Matthews");
    carter = new Person(2L, "Carter", "Beauford");
    boyd = new Person(3L, "Boyd", "Tinsley");
    stefan = new Person(4L, "Stefan", "Lessard");
    leroi = new Person(5L, "Leroi", "Moore");
    jeff = new Person(6L, "Jeff", "Coffin");
    oliverAugust = new Person(7L, "Oliver August", "Matthews");

    GemfireMappingContext context = new GemfireMappingContext();

    Regions regions = new Regions(this.regions, context);
    GemfireTemplate template = new GemfireTemplate(regions.getRegion(Person.class));
View Full Code Here

Examples of org.springframework.data.keyvalue.redis.Person

  private int counter = 0;

  @Override
  public Person instance() {
    String uuid = UUID.randomUUID().toString();
    return new Person(uuid, uuid, ++counter, new Address(uuid, counter));
  }
View Full Code Here

Examples of org.springframework.data.mongodb.core.Person

  @Test
  public void handlesAllPropertiesIfDBObject() {

    DBObject query = new BasicDBObject();
    query.put("foo", new BasicDBObject("$in", Arrays.asList(1, 2)));
    query.put("bar", new Person());

    DBObject result = mapper.getMappedObject(query, null);
    assertThat(result.get("bar"), is(notNullValue()));
  }
View Full Code Here

Examples of org.springframework.data.mongodb.core.convert.MappingMongoConverterUnitTests.Person

   * @see DATAMONGO-347
   */
  @Test
  public void createsSimpleDBRefCorrectly() {

    Person person = new Person();
    person.id = "foo";

    DBRef dbRef = converter.toDBRef(person, null);
    assertThat(dbRef.getId(), is((Object) "foo"));
    assertThat(dbRef.getRef(), is("person"));
View Full Code Here

Examples of org.springframework.data.mongodb.crossstore.test.Person

    resume.addEducation("Skanstulls High School, 1975");
    resume.addEducation("Univ. of Stockholm, 1980");
    resume.addJob("DiMark, DBA, 1990-2000");
    resume.addJob("VMware, Developer, 2007-");

    final Person person = new Person("Thomas", 20);
    person.setAddress(address);
    person.setResume(resume);
    person.setId(1L);

    txTemplate.execute(new TransactionCallback<Void>() {
      public Void doInTransaction(TransactionStatus status) {
        entityManager.persist(person);
        return null;
View Full Code Here

Examples of org.springframework.data.mongodb.repository.Person

  @Test
  public void shouldSupportReturningCurrentAggregationRoot() {

    assumeTrue(mongoVersion.isGreaterThanOrEqualTo(TWO_DOT_SIX));

    mongoTemplate.save(new Person("p1_first", "p1_last", 25));
    mongoTemplate.save(new Person("p2_first", "p2_last", 32));
    mongoTemplate.save(new Person("p3_first", "p3_last", 25));
    mongoTemplate.save(new Person("p4_first", "p4_last", 15));

    List<DBObject> personsWithAge25 = mongoTemplate.find(Query.query(where("age").is(25)), DBObject.class,
        mongoTemplate.getCollectionName(Person.class));

    Aggregation agg = newAggregation(group("age").push(Aggregation.ROOT).as("users"));
View Full Code Here

Examples of org.springframework.data.neo4j.Person

    @Name( "person")
    @PluginTarget(GraphDatabaseService.class)
    public Node person(@Source GraphDatabaseService graphDb, @Parameter(name="name") String name) {
        context(graphDb);
        final Person result = personRepository.findByPropertyValue(Person.NAME_INDEX, "name",name);
        return result!=null ? result.getPersistentState() : null;
    }
View Full Code Here

Examples of org.springframework.data.neo4j.aspects.Person

* @since 25.03.11
*/
public class PersonCreator implements StateBackedCreator<Person,Node> {
    @Override
    public Person create(Node n, Class<Person> c) throws Exception {
        return new Person(n);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.