DATADOC-271 - Added license headers to cross-store files.
This commit is contained in:
@@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.springframework.data.mongodb.crossstore;
|
package org.springframework.data.mongodb.crossstore;
|
||||||
|
|
||||||
import org.springframework.data.persistence.ChangeSetBacked;
|
import org.springframework.data.persistence.ChangeSetBacked;
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.springframework.data.mongodb.crossstore;
|
package org.springframework.data.mongodb.crossstore;
|
||||||
|
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.springframework.data.mongodb.crossstore;
|
package org.springframework.data.mongodb.crossstore;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 by the original author(s).
|
* Copyright 2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.data.mongodb.crossstore;
|
package org.springframework.data.mongodb.crossstore;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.springframework.data.mongodb.crossstore;
|
package org.springframework.data.mongodb.crossstore;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
@@ -27,128 +42,128 @@ import com.mongodb.DBObject;
|
|||||||
@ContextConfiguration(locations = "classpath:/META-INF/spring/applicationContext.xml")
|
@ContextConfiguration(locations = "classpath:/META-INF/spring/applicationContext.xml")
|
||||||
public class CrossStoreMongoTests {
|
public class CrossStoreMongoTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MongoTemplate mongoTemplate;
|
private MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformTransactionManager transactionManager;
|
private PlatformTransactionManager transactionManager;
|
||||||
|
|
||||||
@PersistenceContext
|
|
||||||
public void setEntityManager(EntityManager entityManager) {
|
|
||||||
this.entityManager = entityManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearData(String collectionName) {
|
@PersistenceContext
|
||||||
DBCollection col = this.mongoTemplate.getCollection(collectionName);
|
public void setEntityManager(EntityManager entityManager) {
|
||||||
if (col != null) {
|
this.entityManager = entityManager;
|
||||||
this.mongoTemplate.dropCollection(collectionName);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
private void clearData(String collectionName) {
|
||||||
@Transactional
|
DBCollection col = this.mongoTemplate.getCollection(collectionName);
|
||||||
@Rollback(false)
|
if (col != null) {
|
||||||
public void testCreateJpaToMongoEntityRelationship() {
|
this.mongoTemplate.dropCollection(collectionName);
|
||||||
clearData(Person.class.getName());
|
}
|
||||||
Person p = new Person("Thomas", 20);
|
}
|
||||||
Address a = new Address(12, "MAin St.", "Boston", "MA", "02101");
|
|
||||||
p.setAddress(a);
|
|
||||||
Resume r = new Resume();
|
|
||||||
r.addEducation("Skanstulls High School, 1975");
|
|
||||||
r.addEducation("Univ. of Stockholm, 1980");
|
|
||||||
r.addJob("DiMark, DBA, 1990-2000");
|
|
||||||
r.addJob("VMware, Developer, 2007-");
|
|
||||||
p.setResume(r);
|
|
||||||
p.setId(1L);
|
|
||||||
entityManager.persist(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback(false)
|
@Rollback(false)
|
||||||
public void testReadJpaToMongoEntityRelationship() {
|
public void testCreateJpaToMongoEntityRelationship() {
|
||||||
Person found = entityManager.find(Person.class, 1L);
|
clearData(Person.class.getName());
|
||||||
Assert.assertNotNull(found);
|
Person p = new Person("Thomas", 20);
|
||||||
Assert.assertEquals(Long.valueOf(1), found.getId());
|
Address a = new Address(12, "MAin St.", "Boston", "MA", "02101");
|
||||||
Assert.assertNotNull(found);
|
p.setAddress(a);
|
||||||
Assert.assertEquals(Long.valueOf(1), found.getId());
|
Resume r = new Resume();
|
||||||
Assert.assertNotNull(found.getResume());
|
r.addEducation("Skanstulls High School, 1975");
|
||||||
Assert.assertEquals("DiMark, DBA, 1990-2000" + "; "
|
r.addEducation("Univ. of Stockholm, 1980");
|
||||||
+ "VMware, Developer, 2007-", found.getResume().getJobs());
|
r.addJob("DiMark, DBA, 1990-2000");
|
||||||
found.getResume().addJob("SpringDeveloper.com, Consultant, 2005-2006");
|
r.addJob("VMware, Developer, 2007-");
|
||||||
found.setAge(44);
|
p.setResume(r);
|
||||||
}
|
p.setId(1L);
|
||||||
|
entityManager.persist(p);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
@Rollback(false)
|
@Rollback(false)
|
||||||
public void testUpdatedJpaToMongoEntityRelationship() {
|
public void testReadJpaToMongoEntityRelationship() {
|
||||||
Person found = entityManager.find(Person.class, 1L);
|
Person found = entityManager.find(Person.class, 1L);
|
||||||
Assert.assertNotNull(found);
|
Assert.assertNotNull(found);
|
||||||
Assert.assertEquals(Long.valueOf(1), found.getId());
|
Assert.assertEquals(Long.valueOf(1), found.getId());
|
||||||
Assert.assertNotNull(found);
|
Assert.assertNotNull(found);
|
||||||
Assert.assertEquals(Long.valueOf(1), found.getId());
|
Assert.assertEquals(Long.valueOf(1), found.getId());
|
||||||
Assert.assertNotNull(found.getResume());
|
Assert.assertNotNull(found.getResume());
|
||||||
Assert.assertEquals("DiMark, DBA, 1990-2000" + "; "
|
Assert.assertEquals("DiMark, DBA, 1990-2000" + "; "
|
||||||
+ "VMware, Developer, 2007-" + "; "
|
+ "VMware, Developer, 2007-", found.getResume().getJobs());
|
||||||
+ "SpringDeveloper.com, Consultant, 2005-2006", found.getResume().getJobs());
|
found.getResume().addJob("SpringDeveloper.com, Consultant, 2005-2006");
|
||||||
}
|
found.setAge(44);
|
||||||
|
}
|
||||||
@Test
|
|
||||||
public void testMergeJpaEntityWithMongoDocument() {
|
@Test
|
||||||
TransactionTemplate txTemplate = new TransactionTemplate(transactionManager);
|
@Transactional
|
||||||
final Person detached = entityManager.find(Person.class, 1L);
|
@Rollback(false)
|
||||||
detached.getResume().addJob("TargetRx, Developer, 2000-2005");
|
public void testUpdatedJpaToMongoEntityRelationship() {
|
||||||
Person merged = txTemplate.execute(new TransactionCallback<Person>() {
|
Person found = entityManager.find(Person.class, 1L);
|
||||||
public Person doInTransaction(TransactionStatus status) {
|
Assert.assertNotNull(found);
|
||||||
return entityManager.merge(detached);
|
Assert.assertEquals(Long.valueOf(1), found.getId());
|
||||||
}
|
Assert.assertNotNull(found);
|
||||||
});
|
Assert.assertEquals(Long.valueOf(1), found.getId());
|
||||||
Assert.assertTrue(detached.getResume().getJobs().contains("TargetRx, Developer, 2000-2005"));
|
Assert.assertNotNull(found.getResume());
|
||||||
Assert.assertTrue(merged.getResume().getJobs().contains("TargetRx, Developer, 2000-2005"));
|
Assert.assertEquals("DiMark, DBA, 1990-2000" + "; "
|
||||||
final Person updated = entityManager.find(Person.class, 1L);
|
+ "VMware, Developer, 2007-" + "; "
|
||||||
Assert.assertTrue(updated.getResume().getJobs().contains("TargetRx, Developer, 2000-2005"));
|
+ "SpringDeveloper.com, Consultant, 2005-2006", found.getResume().getJobs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMergeJpaEntityWithMongoDocument() {
|
||||||
|
TransactionTemplate txTemplate = new TransactionTemplate(transactionManager);
|
||||||
|
final Person detached = entityManager.find(Person.class, 1L);
|
||||||
|
detached.getResume().addJob("TargetRx, Developer, 2000-2005");
|
||||||
|
Person merged = txTemplate.execute(new TransactionCallback<Person>() {
|
||||||
|
public Person doInTransaction(TransactionStatus status) {
|
||||||
|
return entityManager.merge(detached);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Assert.assertTrue(detached.getResume().getJobs().contains("TargetRx, Developer, 2000-2005"));
|
||||||
|
Assert.assertTrue(merged.getResume().getJobs().contains("TargetRx, Developer, 2000-2005"));
|
||||||
|
final Person updated = entityManager.find(Person.class, 1L);
|
||||||
|
Assert.assertTrue(updated.getResume().getJobs().contains("TargetRx, Developer, 2000-2005"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemoveJpaEntityWithMongoDocument() {
|
||||||
|
TransactionTemplate txTemplate = new TransactionTemplate(transactionManager);
|
||||||
|
txTemplate.execute(new TransactionCallback<Person>() {
|
||||||
|
public Person doInTransaction(TransactionStatus status) {
|
||||||
|
Person p2 = new Person("Thomas", 20);
|
||||||
|
Resume r2 = new Resume();
|
||||||
|
r2.addEducation("Skanstulls High School, 1975");
|
||||||
|
r2.addJob("DiMark, DBA, 1990-2000");
|
||||||
|
p2.setResume(r2);
|
||||||
|
p2.setId(2L);
|
||||||
|
entityManager.persist(p2);
|
||||||
|
Person p3 = new Person("Thomas", 20);
|
||||||
|
Resume r3 = new Resume();
|
||||||
|
r3.addEducation("Univ. of Stockholm, 1980");
|
||||||
|
r3.addJob("VMware, Developer, 2007-");
|
||||||
|
p3.setResume(r3);
|
||||||
|
p3.setId(3L);
|
||||||
|
entityManager.persist(p3);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
txTemplate.execute(new TransactionCallback<Person>() {
|
||||||
|
public Person doInTransaction(TransactionStatus status) {
|
||||||
|
final Person found2 = entityManager.find(Person.class, 2L);
|
||||||
|
entityManager.remove(found2);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
boolean weFound3 = false;
|
||||||
|
for (DBObject dbo : this.mongoTemplate.getCollection(Person.class.getName()).find()) {
|
||||||
|
Assert.assertTrue(!dbo.get("_entity_id").equals(2L));
|
||||||
|
if (dbo.get("_entity_id").equals(3L)) {
|
||||||
|
weFound3 = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Assert.assertTrue(weFound3);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testRemoveJpaEntityWithMongoDocument() {
|
|
||||||
TransactionTemplate txTemplate = new TransactionTemplate(transactionManager);
|
|
||||||
txTemplate.execute(new TransactionCallback<Person>() {
|
|
||||||
public Person doInTransaction(TransactionStatus status) {
|
|
||||||
Person p2 = new Person("Thomas", 20);
|
|
||||||
Resume r2 = new Resume();
|
|
||||||
r2.addEducation("Skanstulls High School, 1975");
|
|
||||||
r2.addJob("DiMark, DBA, 1990-2000");
|
|
||||||
p2.setResume(r2);
|
|
||||||
p2.setId(2L);
|
|
||||||
entityManager.persist(p2);
|
|
||||||
Person p3 = new Person("Thomas", 20);
|
|
||||||
Resume r3 = new Resume();
|
|
||||||
r3.addEducation("Univ. of Stockholm, 1980");
|
|
||||||
r3.addJob("VMware, Developer, 2007-");
|
|
||||||
p3.setResume(r3);
|
|
||||||
p3.setId(3L);
|
|
||||||
entityManager.persist(p3);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
txTemplate.execute(new TransactionCallback<Person>() {
|
|
||||||
public Person doInTransaction(TransactionStatus status) {
|
|
||||||
final Person found2 = entityManager.find(Person.class, 2L);
|
|
||||||
entityManager.remove(found2);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
boolean weFound3 = false;
|
|
||||||
for (DBObject dbo : this.mongoTemplate.getCollection(Person.class.getName()).find()) {
|
|
||||||
Assert.assertTrue(!dbo.get("_entity_id").equals(2L));
|
|
||||||
if (dbo.get("_entity_id").equals(3L)) {
|
|
||||||
weFound3 = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Assert.assertTrue(weFound3);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.springframework.data.mongodb.crossstore.test;
|
package org.springframework.data.mongodb.crossstore.test;
|
||||||
|
|
||||||
public class Address {
|
public class Address {
|
||||||
|
|
||||||
private Integer streetNumber;
|
private Integer streetNumber;
|
||||||
private String streetName;
|
private String streetName;
|
||||||
private String city;
|
private String city;
|
||||||
private String state;
|
private String state;
|
||||||
private String zip;
|
private String zip;
|
||||||
|
|
||||||
public Address(Integer streetNumber, String streetName, String city,
|
public Address(Integer streetNumber, String streetName, String city,
|
||||||
String state, String zip) {
|
String state, String zip) {
|
||||||
super();
|
super();
|
||||||
@@ -17,7 +32,7 @@ public class Address {
|
|||||||
this.state = state;
|
this.state = state;
|
||||||
this.zip = zip;
|
this.zip = zip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getStreetNumber() {
|
public Integer getStreetNumber() {
|
||||||
return streetNumber;
|
return streetNumber;
|
||||||
}
|
}
|
||||||
@@ -48,7 +63,7 @@ public class Address {
|
|||||||
public void setZip(String zip) {
|
public void setZip(String zip) {
|
||||||
this.zip = zip;
|
this.zip = zip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.springframework.data.mongodb.crossstore.test;
|
package org.springframework.data.mongodb.crossstore.test;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@@ -8,80 +23,80 @@ import org.springframework.data.mongodb.crossstore.RelatedDocument;
|
|||||||
@Entity
|
@Entity
|
||||||
public class Person {
|
public class Person {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
Long id;
|
Long id;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private int age;
|
private int age;
|
||||||
|
|
||||||
private java.util.Date birthDate;
|
private java.util.Date birthDate;
|
||||||
|
|
||||||
@RelatedDocument
|
@RelatedDocument
|
||||||
private Address address;
|
private Address address;
|
||||||
|
|
||||||
@RelatedDocument
|
@RelatedDocument
|
||||||
private Resume resume;
|
private Resume resume;
|
||||||
|
|
||||||
public Person() {
|
public Person() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Person(String name, int age) {
|
public Person(String name, int age) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.age = age;
|
this.age = age;
|
||||||
this.birthDate = new java.util.Date();
|
this.birthDate = new java.util.Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void birthday() {
|
public void birthday() {
|
||||||
++age;
|
++age;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return age;
|
return age;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAge(int age) {
|
public void setAge(int age) {
|
||||||
this.age = age;
|
this.age = age;
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.util.Date getBirthDate() {
|
public java.util.Date getBirthDate() {
|
||||||
return birthDate;
|
return birthDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBirthDate(java.util.Date birthDate) {
|
public void setBirthDate(java.util.Date birthDate) {
|
||||||
this.birthDate = birthDate;
|
this.birthDate = birthDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resume getResume() {
|
public Resume getResume() {
|
||||||
return resume;
|
return resume;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResume(Resume resume) {
|
public void setResume(Resume resume) {
|
||||||
this.resume = resume;
|
this.resume = resume;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Address getAddress() {
|
public Address getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddress(Address address) {
|
public void setAddress(Address address) {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.springframework.data.mongodb.crossstore.test;
|
package org.springframework.data.mongodb.crossstore.test;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@@ -9,40 +24,40 @@ import org.springframework.data.mongodb.core.mapping.Document;
|
|||||||
@Document
|
@Document
|
||||||
public class Resume {
|
public class Resume {
|
||||||
|
|
||||||
private static final Log LOGGER = LogFactory.getLog(Resume.class);
|
private static final Log LOGGER = LogFactory.getLog(Resume.class);
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private ObjectId id;
|
private ObjectId id;
|
||||||
|
|
||||||
private String education = "";
|
private String education = "";
|
||||||
|
|
||||||
private String jobs = "";
|
private String jobs = "";
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id.toString();
|
return id.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEducation() {
|
|
||||||
return education;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addEducation(String education) {
|
public String getEducation() {
|
||||||
LOGGER.debug("Adding education " + education);
|
return education;
|
||||||
this.education = this.education + (this.education.length() > 0 ? "; " : "") + education;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public String getJobs() {
|
public void addEducation(String education) {
|
||||||
return jobs;
|
LOGGER.debug("Adding education " + education);
|
||||||
}
|
this.education = this.education + (this.education.length() > 0 ? "; " : "") + education;
|
||||||
|
}
|
||||||
|
|
||||||
public void addJob(String job) {
|
public String getJobs() {
|
||||||
LOGGER.debug("Adding job " + job);
|
return jobs;
|
||||||
this.jobs = this.jobs + (this.jobs.length() > 0 ? "; " : "") + job;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public void addJob(String job) {
|
||||||
public String toString() {
|
LOGGER.debug("Adding job " + job);
|
||||||
return "Resume [education=" + education + ", jobs=" + jobs + "]";
|
this.jobs = this.jobs + (this.jobs.length() > 0 ? "; " : "") + job;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Resume [education=" + education + ", jobs=" + jobs + "]";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user