1+ // Licensed to the Apache Software Foundation (ASF) under one
2+ // or more contributor license agreements. See the NOTICE file
3+ // distributed with this work for additional information
4+ // regarding copyright ownership. The ASF licenses this file
5+ // to you under the Apache License, Version 2.0 (the
6+ // "License"); you may not use this file except in compliance
7+ // with the License. You may obtain a copy of the License at
8+ //
9+ // http://www.apache.org/licenses/LICENSE-2.0
10+ //
11+ // Unless required by applicable law or agreed to in writing,
12+ // software distributed under the License is distributed on an
13+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ // KIND, either express or implied. See the License for the
15+ // specific language governing permissions and limitations
16+ // under the License.
17+
18+
19+
20+ package com .cloud .network .dao ;
21+
22+ import com .cloud .utils .db .GenericDaoBase ;
23+ import com .cloud .utils .db .SearchBuilder ;
24+ import com .cloud .utils .db .SearchCriteria ;
25+ import org .springframework .stereotype .Component ;
26+
27+ import javax .ejb .Local ;
28+ import java .util .List ;
29+
30+ @ Component
31+ @ Local (value =MonitoringServiceDao .class )
32+ public class MonitoringServiceDaoImpl extends GenericDaoBase <MonitoringServiceVO , Long > implements MonitoringServiceDao {
33+ private final SearchBuilder <MonitoringServiceVO > AllFieldsSearch ;
34+
35+ public MonitoringServiceDaoImpl () {
36+ super ();
37+ AllFieldsSearch = createSearchBuilder ();
38+ AllFieldsSearch .and ("isDefault" , AllFieldsSearch .entity ().getDefault (), SearchCriteria .Op .EQ );
39+ AllFieldsSearch .and ("service" , AllFieldsSearch .entity ().getService (), SearchCriteria .Op .EQ );
40+ AllFieldsSearch .and ("processname" , AllFieldsSearch .entity ().getProcessname (), SearchCriteria .Op .EQ );
41+ AllFieldsSearch .and ("servicename" , AllFieldsSearch .entity ().getServiceName (), SearchCriteria .Op .EQ );
42+ AllFieldsSearch .and ("servicepath" , AllFieldsSearch .entity ().getServicePath (), SearchCriteria .Op .EQ );
43+ AllFieldsSearch .and ("servicePidFile" , AllFieldsSearch .entity ().getPidFile (), SearchCriteria .Op .EQ );
44+
45+ AllFieldsSearch .done ();
46+ }
47+
48+
49+
50+ @ Override
51+ public List <MonitoringServiceVO > listAllServices () {
52+ return null ;
53+ }
54+
55+ @ Override
56+ public List <MonitoringServiceVO > listDefaultServices (boolean isDefault ) {
57+ SearchCriteria <MonitoringServiceVO > sc = AllFieldsSearch .create ();
58+ sc .setParameters ("isDefault" , isDefault );
59+ return listBy (sc );
60+ }
61+
62+ @ Override
63+ public MonitoringServiceVO getServiceByName (String service ) {
64+ SearchCriteria <MonitoringServiceVO > sc = AllFieldsSearch .create ();
65+ sc .setParameters ("service" , service );
66+ return findOneBy (sc );
67+ }
68+ }
0 commit comments