View Javadoc
1   /*
2    * Copyright 2010 James Pether Sörling
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   *	$Id$
17   *  $HeadURL$
18  */
19  package com.hack23.cia.service.impl;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  
24  import javax.persistence.metamodel.SingularAttribute;
25  
26  import org.springframework.beans.factory.annotation.Autowired;
27  import org.springframework.security.access.annotation.Secured;
28  import org.springframework.stereotype.Component;
29  import org.springframework.transaction.annotation.Propagation;
30  import org.springframework.transaction.annotation.Transactional;
31  
32  import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee;
33  import com.hack23.cia.service.api.DataContainer;
34  import com.hack23.cia.service.data.api.ViewRiksdagenCommitteeDAO;
35  
36  /**
37   * The Class ViewRiksdagenCommitteeDataContainer.
38   */
39  @Component("ViewRiksdagenCommitteeDataContainer")
40  @Transactional(propagation=Propagation.REQUIRED)
41  @Secured({"ROLE_ANONYMOUS","ROLE_USER", "ROLE_ADMIN" })
42  public final class ViewRiksdagenCommitteeDataContainer implements DataContainer<ViewRiksdagenCommittee,String>{
43  
44  	/** The view riksdagen committee dao. */
45  	@Autowired
46  	private ViewRiksdagenCommitteeDAO viewRiksdagenCommitteeDAO;
47  
48  	/**
49  	 * Instantiates a new view riksdagen committee data container.
50  	 */
51  	public ViewRiksdagenCommitteeDataContainer() {
52  		super();
53  	}
54  
55  	@Override
56  	public <T, V> T findByQueryProperty(final Class<T> clazz,
57  			final SingularAttribute<T, ? extends Object> property, final Class<V> clazz2,
58  			final SingularAttribute<V, ? extends Object> property2, final Object value) {
59  		return null;
60  	}
61  
62  	@Override
63  	public <T, V> List<T> findListByEmbeddedProperty(final Class<T> clazz,
64  			final SingularAttribute<T, V> property, final Class<V> clazz2,
65  			final SingularAttribute<V, ? extends Object> property2, final Object value) {
66  		return new ArrayList<>();
67  	}
68  
69  	@Override
70  	public List<ViewRiksdagenCommittee> findListByProperty(
71  			final Object[] values,
72  			final SingularAttribute<ViewRiksdagenCommittee, ? extends Object>... properties) {
73  		return viewRiksdagenCommitteeDAO.findListByProperty(values, properties);
74  	}
75  
76  	@Override
77  	public <T, V> List<T> findOrderedByPropertyListByEmbeddedProperty(final Class<T> clazz, final SingularAttribute<T, V> property,
78  			final Class<V> clazz2, final SingularAttribute<V, ? extends Object> property2, final Object value,
79  			final SingularAttribute<T, ? extends Object> orderByProperty) {
80  		return new ArrayList<>();
81  	}
82  
83  	@Override
84  	public <T, V> List<T> findOrderedListByEmbeddedProperty(final Class<T> clazz, final SingularAttribute<T, V> property,
85  			final Class<V> clazz2, final SingularAttribute<V, ? extends Object> property2, final Object value,
86  			final SingularAttribute<V, ? extends Object> orderByProperty) {
87  		return new ArrayList<>();
88  	}
89  
90  	@Override
91  	public List<ViewRiksdagenCommittee> findOrderedListByProperty(
92  			final SingularAttribute<ViewRiksdagenCommittee, ? extends Object> property, final Object value,
93  			final SingularAttribute<ViewRiksdagenCommittee, ? extends Object> orderByProperty) {
94  		return new ArrayList<>();
95  	}
96  
97  	@Override
98  	public List<ViewRiksdagenCommittee> findOrderedListByProperty(
99  			final SingularAttribute<ViewRiksdagenCommittee, ? extends Object> orderByProperty, final Object[] values,
100 			final SingularAttribute<ViewRiksdagenCommittee, ? extends Object>... properties) {
101 		return null;
102 	}
103 
104 	@Override
105 	public List<ViewRiksdagenCommittee> getAll() {
106 		return viewRiksdagenCommitteeDAO.getAll();
107 	}
108 
109 	@Override
110 	public List<ViewRiksdagenCommittee> getAllBy(
111 			final SingularAttribute<ViewRiksdagenCommittee, ? extends Object> property,
112 			final Object value) {
113 		return viewRiksdagenCommitteeDAO.findListByProperty(property, value);
114 	}
115 
116 	@Override
117 	public List<ViewRiksdagenCommittee> getAllOrderBy(
118 			final SingularAttribute<ViewRiksdagenCommittee, ? extends Object> property) {
119 		return viewRiksdagenCommitteeDAO.getAllOrderBy(property);
120 	}
121 
122 	@Override
123 	public ViewRiksdagenCommittee load(final String id) {
124 		for (final ViewRiksdagenCommittee riksdagenCommittee : viewRiksdagenCommitteeDAO.getAll()) {
125 			if (id.equals(riksdagenCommittee.getEmbeddedId().getOrgCode())) {
126 				return riksdagenCommittee;
127 			}
128 
129 		}
130 
131 		return null;
132 	}
133 
134 	@Override
135 	public List<ViewRiksdagenCommittee> getPage(final int pageNr, final int resultPerPage) {
136 		return viewRiksdagenCommitteeDAO.getPage(pageNr, resultPerPage);
137 	}
138 
139 	@Override
140 	public List<ViewRiksdagenCommittee> getPageOrderBy(final int pageNr, final int resultPerPage,
141 			final SingularAttribute<ViewRiksdagenCommittee, ? extends Object> orderBy) {
142 		return viewRiksdagenCommitteeDAO.getPageOrderBy(pageNr, resultPerPage, orderBy);
143 	}
144 
145 	@Override
146 	public Long getSize() {
147 		return viewRiksdagenCommitteeDAO.getSize();
148 	}
149 }