mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 13:05:49 +00:00
just cosmetic changes - comments etc...
This commit is contained in:
parent
7b310b1a6e
commit
056c1dfb94
30 changed files with 564 additions and 20 deletions
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -5,6 +21,11 @@ import java.util.Collection;
|
|||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.samples.petclinic.model.Owner;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public interface OwnerRepositoryExt extends OwnerRepository {
|
||||
|
||||
Collection<Owner> findAll() throws DataAccessException;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -5,6 +21,11 @@ import java.util.Collection;
|
|||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.samples.petclinic.model.Pet;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public interface PetRepositoryExt extends PetRepository {
|
||||
|
||||
Collection<Pet> findAll() throws DataAccessException;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -5,6 +21,11 @@ import java.util.Collection;
|
|||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.samples.petclinic.model.PetType;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public interface PetTypeRepositoryExt {
|
||||
|
||||
PetType findById(int id) throws DataAccessException;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -5,6 +21,11 @@ import java.util.Collection;
|
|||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.samples.petclinic.model.Specialty;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public interface SpecialtyRepositoryExt {
|
||||
|
||||
Specialty findById(int id) throws DataAccessException;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -5,6 +21,11 @@ import java.util.Collection;
|
|||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.samples.petclinic.model.Vet;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public interface VetRepositoryExt extends VetRepository {
|
||||
|
||||
Vet findById(int id) throws DataAccessException;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -5,6 +21,11 @@ import java.util.Collection;
|
|||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.samples.petclinic.model.Visit;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public interface VisitRepositoryExt extends VisitRepository {
|
||||
|
||||
Visit findById(int id) throws DataAccessException;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.jdbc;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -19,6 +35,11 @@ import org.springframework.samples.petclinic.model.Specialty;
|
|||
import org.springframework.samples.petclinic.repository.SpecialtyRepositoryExt;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@Repository
|
||||
@Qualifier("SpecialtyRepositoryExt")
|
||||
public class JdbcSpecialtyRepositoryExtImpl implements SpecialtyRepositoryExt {
|
||||
|
@ -77,6 +98,7 @@ public class JdbcSpecialtyRepositoryExtImpl implements SpecialtyRepositoryExt {
|
|||
public void delete(Specialty specialty) throws DataAccessException {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", specialty.getId());
|
||||
this.namedParameterJdbcTemplate.update("DELETE FROM vet_specialties WHERE specialty_id=:id", params);
|
||||
this.namedParameterJdbcTemplate.update("DELETE FROM specialties WHERE id=:id", params);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.jdbc;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
|
@ -20,6 +36,11 @@ import org.springframework.samples.petclinic.model.Visit;
|
|||
import org.springframework.samples.petclinic.repository.VisitRepositoryExt;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@Repository
|
||||
@Qualifier("VisitRepositoryExt")
|
||||
public class JdbcVisitRepositoryExtImpl extends JdbcVisitRepositoryImpl implements VisitRepositoryExt {
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.jpa;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -12,6 +28,11 @@ import org.springframework.samples.petclinic.model.Owner;
|
|||
import org.springframework.samples.petclinic.repository.OwnerRepositoryExt;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@Repository
|
||||
@Qualifier("OwnerRepositoryExt")
|
||||
public class JpaOwnerRepositoryExtImpl extends JpaOwnerRepositoryImpl implements OwnerRepositoryExt {
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.jpa;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -11,6 +27,11 @@ import org.springframework.samples.petclinic.model.Vet;
|
|||
import org.springframework.samples.petclinic.repository.VetRepositoryExt;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@Repository
|
||||
@Qualifier("VetRepositoryExt")
|
||||
public class JpaVetRepositoryExtImpl extends JpaVetRepositoryImpl implements VetRepositoryExt {
|
||||
|
|
|
@ -1,7 +1,28 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.springdatajpa;
|
||||
|
||||
import org.springframework.samples.petclinic.model.Pet;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public interface PetRepositoryExtOverride {
|
||||
|
||||
public void delete(Pet pet);
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.springdatajpa;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -9,6 +25,11 @@ import org.springframework.data.repository.query.Param;
|
|||
import org.springframework.samples.petclinic.model.Owner;
|
||||
import org.springframework.samples.petclinic.repository.OwnerRepositoryExt;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@Qualifier("OwnerRepositoryExt")
|
||||
public interface SpringDataOwnerRepositoryExt extends OwnerRepositoryExt, Repository<Owner, Integer> {
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.springdatajpa;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -10,6 +26,11 @@ import org.springframework.samples.petclinic.model.Pet;
|
|||
import org.springframework.samples.petclinic.model.PetType;
|
||||
import org.springframework.samples.petclinic.repository.PetRepositoryExt;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@Qualifier("PetRepositoryExt")
|
||||
public interface SpringDataPetRepositoryExt extends PetRepositoryExt, Repository<Pet, Integer>, PetRepositoryExtOverride {
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.springdatajpa;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
@ -5,6 +21,11 @@ import javax.persistence.PersistenceContext;
|
|||
|
||||
import org.springframework.samples.petclinic.model.Pet;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public class SpringDataPetRepositoryExtImpl implements PetRepositoryExtOverride {
|
||||
|
||||
@PersistenceContext
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.springdatajpa;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
@ -5,6 +21,11 @@ import org.springframework.data.repository.Repository;
|
|||
import org.springframework.samples.petclinic.model.Vet;
|
||||
import org.springframework.samples.petclinic.repository.VetRepositoryExt;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@Qualifier("VetRepositoryExt")
|
||||
public interface SpringDataVetRepositoryExt extends VetRepositoryExt, Repository<Vet, Integer> {
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.springdatajpa;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
@ -5,6 +21,11 @@ import org.springframework.data.repository.Repository;
|
|||
import org.springframework.samples.petclinic.model.Visit;
|
||||
import org.springframework.samples.petclinic.repository.VisitRepositoryExt;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@Qualifier("VisitRepositoryExt")
|
||||
public interface SpringDataVisitRepositoryExt extends VisitRepositoryExt, Repository<Visit, Integer>, VisitRepositoryExtOverride {
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.springdatajpa;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
@ -6,6 +22,11 @@ import javax.persistence.PersistenceContext;
|
|||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.samples.petclinic.model.Visit;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public class SpringDataVisitRepositoryExtImpl implements VisitRepositoryExtOverride {
|
||||
|
||||
@PersistenceContext
|
||||
|
|
|
@ -1,7 +1,28 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.repository.springdatajpa;
|
||||
|
||||
import org.springframework.samples.petclinic.model.Visit;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
public interface VisitRepositoryExtOverride {
|
||||
|
||||
public void delete(Visit visit);
|
||||
|
|
|
@ -1,9 +1,30 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.rest;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@ControllerAdvice
|
||||
public class ExceptionControllerAdvice {
|
||||
|
||||
|
|
|
@ -71,7 +71,8 @@ public class OwnerRestController {
|
|||
|
||||
@RequestMapping(value = "/{ownerId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResponseEntity<Owner> getOwner(@PathVariable("ownerId") int ownerId){
|
||||
Owner owner = this.clinicService.findOwnerById(ownerId);
|
||||
Owner owner = null;
|
||||
owner = this.clinicService.findOwnerById(ownerId);
|
||||
if(owner == null){
|
||||
return new ResponseEntity<Owner>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
@ -115,7 +116,6 @@ public class OwnerRestController {
|
|||
return new ResponseEntity<Void>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
this.clinicService.deleteOwner(owner);
|
||||
// TODO delete error - FK etc.
|
||||
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ public class PetTypeRestController {
|
|||
return new ResponseEntity<Void>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
this.clinicService.deletePetType(petType);
|
||||
// TODO delete error - FK etc.
|
||||
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.rest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -21,6 +37,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/specialties")
|
||||
public class SpecialtyRestController {
|
||||
|
@ -81,7 +102,6 @@ public class SpecialtyRestController {
|
|||
return new ResponseEntity<Void>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
this.clinicService.deleteSpecialty(specialty);
|
||||
// TODO delete error - FK etc.
|
||||
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,6 @@ public class VetRestController {
|
|||
return new ResponseEntity<Void>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
this.clinicService.deleteVet(vet);
|
||||
// TODO delete error - FK etc.
|
||||
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.rest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -21,6 +37,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
/**
|
||||
* @author Vitaliy Fedoriv
|
||||
*
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/visits")
|
||||
public class VisitRestController {
|
||||
|
@ -83,7 +104,6 @@ public class VisitRestController {
|
|||
return new ResponseEntity<Void>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
this.clinicService.deleteVisit(visit);
|
||||
// TODO delete error - FK etc.
|
||||
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -10,37 +26,49 @@ import org.springframework.samples.petclinic.model.Specialty;
|
|||
import org.springframework.samples.petclinic.model.Vet;
|
||||
import org.springframework.samples.petclinic.model.Visit;
|
||||
|
||||
/**
|
||||
* Used as a facade so all (incl.extended) controllers have a single point of entry
|
||||
*
|
||||
* @author Vitaliy Fedoriv
|
||||
*/
|
||||
|
||||
public interface ClinicServiceExt extends ClinicService {
|
||||
|
||||
// Pet findPetById(int id) throws DataAccessException;
|
||||
// ----- Pet -----
|
||||
// (in ClinicService) Pet findPetById(int id) throws DataAccessException;
|
||||
Collection<Pet> findAllPets() throws DataAccessException;
|
||||
// void savePet(Pet pet) throws DataAccessException;
|
||||
// (in ClinicService) void savePet(Pet pet) throws DataAccessException;
|
||||
void deletePet(Pet pet) throws DataAccessException;
|
||||
|
||||
// Collection<Visit> findVisitsByPetId(int petId);
|
||||
// ----- Visit -----
|
||||
// (in ClinicService) Collection<Visit> findVisitsByPetId(int petId);
|
||||
Visit findVisitById(int visitId) throws DataAccessException;
|
||||
Collection<Visit> findAllVisits() throws DataAccessException;
|
||||
// void saveVisit(Visit visit) throws DataAccessException;
|
||||
// (in ClinicService) void saveVisit(Visit visit) throws DataAccessException;
|
||||
void deleteVisit(Visit visit) throws DataAccessException;
|
||||
|
||||
// ----- Vet -----
|
||||
Vet findVetById(int id) throws DataAccessException;
|
||||
// Collection<Vet> findVets() throws DataAccessException;
|
||||
// (in ClinicService) Collection<Vet> findVets() throws DataAccessException;
|
||||
Collection<Vet> findAllVets() throws DataAccessException;
|
||||
void saveVet(Vet vet) throws DataAccessException;
|
||||
void deleteVet(Vet vet) throws DataAccessException;
|
||||
|
||||
// Owner findOwnerById(int id) throws DataAccessException;
|
||||
|
||||
// ----- Owner -----
|
||||
// (in ClinicService) Owner findOwnerById(int id) throws DataAccessException;
|
||||
Collection<Owner> findAllOwners() throws DataAccessException;
|
||||
// void saveOwner(Owner owner) throws DataAccessException;
|
||||
// (in ClinicService) void saveOwner(Owner owner) throws DataAccessException;
|
||||
void deleteOwner(Owner owner) throws DataAccessException;
|
||||
// Collection<Owner> findOwnerByLastName(String lastName) throws DataAccessException;
|
||||
// (in ClinicService) Collection<Owner> findOwnerByLastName(String lastName) throws DataAccessException;
|
||||
|
||||
// ----- PetType -----
|
||||
PetType findPetTypeById(int petTypeId);
|
||||
Collection<PetType> findAllPetTypes() throws DataAccessException;
|
||||
// Collection<PetType> findPetTypes() throws DataAccessException;
|
||||
// (in ClinicService) Collection<PetType> findPetTypes() throws DataAccessException;
|
||||
void savePetType(PetType petType) throws DataAccessException;
|
||||
void deletePetType(PetType petType) throws DataAccessException;
|
||||
|
||||
// ----- Specialty -----
|
||||
Specialty findSpecialtyById(int specialtyId);
|
||||
Collection<Specialty> findAllSpecialties() throws DataAccessException;
|
||||
void saveSpecialty(Specialty specialty) throws DataAccessException;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.rest;
|
||||
|
||||
import static org.mockito.BDDMockito.given;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.rest;
|
||||
|
||||
import static org.mockito.BDDMockito.given;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.rest;
|
||||
|
||||
import static org.mockito.BDDMockito.given;
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.rest;
|
||||
|
||||
import static org.mockito.BDDMockito.given;
|
||||
|
@ -27,12 +43,12 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
|
||||
/**
|
||||
* Test class for {@link VetRestController}
|
||||
*
|
||||
* @author Vitaliy Fedoriv
|
||||
*/
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration({"classpath:spring/mvc-test-config.xml", "classpath:spring/mvc-core-config.xml"})
|
||||
@WebAppConfiguration
|
||||
|
@ -94,8 +110,6 @@ public class VetRestControllerTests {
|
|||
|
||||
@Test
|
||||
public void testGetAllVetsSuccess() throws Exception {
|
||||
//vets.remove(2);
|
||||
//vets.remove(1);
|
||||
given(this.clinicService.findAllVets()).willReturn(vets);
|
||||
this.mockMvc.perform(get("/api/vets/")
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2016 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.samples.petclinic.rest;
|
||||
|
||||
import static org.mockito.BDDMockito.given;
|
||||
|
@ -31,12 +47,12 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
|
||||
/**
|
||||
* Test class for {@link VisitRestController}
|
||||
*
|
||||
* @author Vitaliy Fedoriv
|
||||
*/
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration({"classpath:spring/mvc-test-config.xml", "classpath:spring/mvc-core-config.xml"})
|
||||
@WebAppConfiguration
|
||||
|
|
Loading…
Reference in a new issue