Minor fixes - indentation mostly

This commit is contained in:
Tomas Repel 2015-09-17 15:47:28 +02:00
parent 06be7eb5be
commit 66227140aa
33 changed files with 117 additions and 169 deletions

View file

@ -32,7 +32,6 @@ public class BaseEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
protected Integer id;
public void setId(Integer id) {
this.id = id;
}

View file

@ -18,7 +18,6 @@ package org.springframework.samples.petclinic.model;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
/**
* Simple JavaBean domain object adds a name property to <code>BaseEntity</code>. Used as a base class for objects
* needing these properties.
@ -32,7 +31,6 @@ public class NamedEntity extends BaseEntity {
@Column(name = "name")
private String name;
public void setName(String name) {
this.name = name;
}

View file

@ -60,7 +60,6 @@ public class Owner extends Person {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
private Set<Pet> pets;
public String getAddress() {
return this.address;
}

View file

@ -52,5 +52,4 @@ public class Person extends BaseEntity {
this.lastName = lastName;
}
}

View file

@ -63,7 +63,6 @@ public class Pet extends NamedEntity {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet", fetch = FetchType.EAGER)
private Set<Visit> visits;
public void setBirthDate(DateTime birthDate) {
this.birthDate = birthDate;
}

View file

@ -49,7 +49,6 @@ public class Vet extends Person {
inverseJoinColumns = @JoinColumn(name = "specialty_id"))
private Set<Specialty> specialties;
protected void setSpecialtiesInternal(Set<Specialty> specialties) {
this.specialties = specialties;
}

View file

@ -1,4 +1,3 @@
/*
/*
* Copyright 2002-2013 the original author or authors.
*

View file

@ -57,7 +57,6 @@ public class Visit extends BaseEntity {
@JoinColumn(name = "pet_id")
private Pet pet;
/**
* Creates a new instance of Visit for the current date
*/
@ -65,7 +64,6 @@ public class Visit extends BaseEntity {
this.date = new DateTime();
}
/**
* Getter for property date.
*

View file

@ -1,18 +1,3 @@
/*
* Copyright 2002-2013 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.
*/
/*
* Copyright 2002-2013 the original author or authors.
*

View file

@ -38,5 +38,4 @@ public interface VetRepository {
*/
Collection<Vet> findAll() throws DataAccessException;
}

View file

@ -65,7 +65,6 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository {
}
/**
* Loads {@link Owner Owners} from the data store by last name, returning all owners whose last name <i>starts</i> with
* the given name; also loads the {@link Pet Pets} and {@link Visit Visits} for the corresponding owners, if not
@ -109,7 +108,9 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository {
public void loadPetsAndVisits(final Owner owner) {
Map<String, Object> params = new HashMap<>();
params.put("id", owner.getId());
final List<JdbcPet> pets = this.namedParameterJdbcTemplate.query(
final List<JdbcPet> pets =
this.namedParameterJdbcTemplate
.query(
"SELECT pets.id, name, birth_date, type_id, owner_id, visits.id as visit_id, visit_date, description, pet_id FROM pets LEFT OUTER JOIN visits ON pets.id = pet_id WHERE owner_id=:id",
params,
new JdbcPetVisitExtractor()
@ -151,5 +152,4 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository {
}
}
}

View file

@ -29,7 +29,6 @@ class JdbcPet extends Pet {
private int ownerId;
public void setTypeId(int typeId) {
this.typeId = typeId;
}

View file

@ -58,7 +58,6 @@ public class JdbcPetRepositoryImpl implements PetRepository {
private VisitRepository visitRepository;
@Autowired
public JdbcPetRepositoryImpl(DataSource dataSource, OwnerRepository ownerRepository, VisitRepository visitRepository) {
this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);

View file

@ -54,7 +54,6 @@ public class JdbcVisitRepositoryImpl implements VisitRepository {
.usingGeneratedKeyColumns("id");
}
@Override
public void save(Visit visit) throws DataAccessException {
if (visit.isNew()) {
@ -66,7 +65,6 @@ public class JdbcVisitRepositoryImpl implements VisitRepository {
}
}
/**
* Creates a {@link MapSqlParameterSource} based on data values from the supplied {@link Visit} instance.
*/

View file

@ -15,7 +15,6 @@
*/
package org.springframework.samples.petclinic.repository.jdbc;
import org.joda.time.DateTime;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.samples.petclinic.model.Visit;

View file

@ -41,7 +41,6 @@ public class JpaOwnerRepositoryImpl implements OwnerRepository {
@PersistenceContext
private EntityManager em;
/**
* Important: in the current version of this method, we load Owners with all their Pets and Visits while
* we do not need Visits at all and we only need one property from the Pet objects (the 'name' property).
@ -67,7 +66,6 @@ public class JpaOwnerRepositoryImpl implements OwnerRepository {
return (Owner) query.getSingleResult();
}
@Override
public void save(Owner owner) {
if (owner.getId() == null) {

View file

@ -40,7 +40,6 @@ public class JpaVetRepositoryImpl implements VetRepository {
@PersistenceContext
private EntityManager em;
@Override
@Cacheable(value = "vets")
@SuppressWarnings("unchecked")

View file

@ -42,7 +42,6 @@ public class JpaVisitRepositoryImpl implements VisitRepository {
@PersistenceContext
private EntityManager em;
@Override
public void save(Visit visit) {
if (visit.getId() == null) {
@ -53,7 +52,6 @@ public class JpaVisitRepositoryImpl implements VisitRepository {
}
}
@Override
@SuppressWarnings("unchecked")
public List<Visit> findByPetId(Integer petId) {

View file

@ -24,7 +24,6 @@ import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.model.Vet;
import org.springframework.samples.petclinic.model.Visit;
/**
* Mostly used as a facade so all controllers have a single point of entry
*

View file

@ -78,14 +78,12 @@ public class ClinicServiceImpl implements ClinicService {
ownerRepository.save(owner);
}
@Override
@Transactional
public void saveVisit(Visit visit) throws DataAccessException {
visitRepository.save(visit);
}
@Override
@Transactional(readOnly = true)
public Pet findPetById(int id) throws DataAccessException {
@ -105,5 +103,4 @@ public class ClinicServiceImpl implements ClinicService {
return vetRepository.findAll();
}
}

View file

@ -42,7 +42,6 @@ public class CallMonitoringAspect {
private long accumulatedCallTime = 0;
@ManagedAttribute
public void setEnabled(boolean enabled) {
this.enabled = enabled;
@ -72,7 +71,6 @@ public class CallMonitoringAspect {
return 0;
}
@Around("within(@org.springframework.stereotype.Repository *)")
public Object invoke(ProceedingJoinPoint joinPoint) throws Throwable {
if (this.enabled) {

View file

@ -36,5 +36,4 @@ public class CrashController {
"happens when an exception is thrown");
}
}

View file

@ -47,7 +47,6 @@ public class OwnerController {
private final ClinicService clinicService;
@Autowired
public OwnerController(ClinicService clinicService) {
this.clinicService = clinicService;
@ -101,8 +100,7 @@ public class OwnerController {
// 1 owner found
owner = results.iterator().next();
return "redirect:/owners/" + owner.getId();
}
else {
} else {
// multiple owners found
model.put("selections", results);
return "owners/ownersList";

View file

@ -47,7 +47,6 @@ public class PetController {
private final ClinicService clinicService;
@Autowired
public PetController(ClinicService clinicService) {
this.clinicService = clinicService;

View file

@ -15,7 +15,6 @@
*/
package org.springframework.samples.petclinic.web;
import java.text.ParseException;
import java.util.Collection;
import java.util.Locale;
@ -41,7 +40,6 @@ public class PetTypeFormatter implements Formatter<PetType> {
private final ClinicService clinicService;
@Autowired
public PetTypeFormatter(ClinicService clinicService) {
this.clinicService = clinicService;

View file

@ -61,5 +61,4 @@ public class PetValidator implements Validator {
return Pet.class.equals(clazz);
}
}

View file

@ -35,7 +35,6 @@ public class VetController {
private final ClinicService clinicService;
@Autowired
public VetController(ClinicService clinicService) {
this.clinicService = clinicService;
@ -60,5 +59,4 @@ public class VetController {
return vets;
}
}

View file

@ -43,7 +43,6 @@ public class VisitController {
private final ClinicService clinicService;
@Autowired
public VisitController(ClinicService clinicService) {
this.clinicService = clinicService;