Permalink
Browse files

Improved code formatting

  • Loading branch information...
1 parent 0cbb4d9 commit f3d03dd8dbac62bc290aa60864a7564948b79f79 @lukaseder lukaseder committed May 18, 2012
Showing with 28 additions and 18 deletions.
  1. +28 −18 jOOQ-codegen-maven-example/src/test/java/org/jooq/test/util/spring/AuthorDaoImpl.java
@@ -29,8 +29,11 @@ public void setFactoryOperations(FactoryOperations factory) {
@Override
public Author findById(Integer id) {
- TAuthorRecord authorRecord = factory.selectFrom(T_AUTHOR)
- .where(T_AUTHOR.ID.equal(id)).fetchOne();
+ TAuthorRecord authorRecord = factory
+ .selectFrom(T_AUTHOR)
+ .where(T_AUTHOR.ID.equal(id))
+ .fetchOne();
+
return authorRecord == null ? null : authorRecord.into(Author.class);
}
@@ -42,40 +45,44 @@ public Author findById(Integer id) {
@Override
public Integer add(Author author) {
Integer id = factory.nextval(S_AUTHOR_ID);
+
factory.insertInto(T_AUTHOR)
- .set(T_AUTHOR.ID, id)
- .set(T_AUTHOR.FIRST_NAME, author.getFirstName())
- .set(T_AUTHOR.LAST_NAME, author.getLastName())
- .execute();
+ .set(T_AUTHOR.ID, id)
+ .set(T_AUTHOR.FIRST_NAME, author.getFirstName())
+ .set(T_AUTHOR.LAST_NAME, author.getLastName())
+ .execute();
+
return id;
}
@Override
public void addBatch(List<Author> authors) {
BatchBindStep step = factory.batch(
factory.insertInto(T_AUTHOR, T_AUTHOR.ID, T_AUTHOR.FIRST_NAME, T_AUTHOR.LAST_NAME)
- .values(param("id"), param("first"), param("last")));
+ .values(param("id"), param("first"), param("last")));
+
for (Author author : authors) {
Integer id = factory.nextval(S_AUTHOR_ID).intValue();
step = step.bind(id, author.getFirstName(), author.getLastName());
}
+
step.execute();
}
@Override
public void save(Author author) {
factory.update(T_AUTHOR)
- .set(T_AUTHOR.FIRST_NAME, author.getFirstName())
- .set(T_AUTHOR.LAST_NAME, author.getLastName())
- .where(T_AUTHOR.ID.equal(author.getId()))
- .execute();
+ .set(T_AUTHOR.FIRST_NAME, author.getFirstName())
+ .set(T_AUTHOR.LAST_NAME, author.getLastName())
+ .where(T_AUTHOR.ID.equal(author.getId()))
+ .execute();
}
@Override
public void delete(Author author) {
factory.delete(T_AUTHOR)
- .where(T_AUTHOR.ID.equal(author.getId()))
- .execute();
+ .where(T_AUTHOR.ID.equal(author.getId()))
+ .execute();
}
@Override
@@ -86,9 +93,11 @@ public long countAuthors() {
@Override
public long countDistinctForLastName(String name) {
- return factory.select(Factory.countDistinct(T_AUTHOR.LAST_NAME)).from(T_AUTHOR)
- .where(T_AUTHOR.LAST_NAME.like(name + "%"))
- .fetchOne().getValue(0, Long.class);
+ return factory.select(Factory.countDistinct(T_AUTHOR.LAST_NAME))
+ .from(T_AUTHOR)
+ .where(T_AUTHOR.LAST_NAME.like(name + "%"))
+ .fetchOne()
+ .getValue(0, Long.class);
}
@Override
@@ -98,7 +107,8 @@ public boolean authorExists(Integer id) {
@Override
public boolean authorExists(Author author) {
- return factory.selectFrom(T_AUTHOR).where(T_AUTHOR.ID.equal(author.getId()))
- .fetchOne() != null;
+ return factory.selectFrom(T_AUTHOR)
+ .where(T_AUTHOR.ID.equal(author.getId()))
+ .fetchOne() != null;
}
}

0 comments on commit f3d03dd

Please sign in to comment.