Skip to content

Commit 1194c01

Browse files
committed
Add interface for Dao classes
1 parent 3f0ecf3 commit 1194c01

File tree

7 files changed

+98
-14
lines changed

7 files changed

+98
-14
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
// 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+
package org.apache.cloudstack.gui.theme.dao;
18+
19+
import com.cloud.utils.db.GenericDao;
20+
import org.apache.cloudstack.gui.theme.GuiThemeVO;
21+
22+
public interface GuiThemeDao extends GenericDao<GuiThemeVO, Long> {
23+
24+
}

engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDaoImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
// under the License.
1717
package org.apache.cloudstack.gui.theme.dao;
1818

19-
import com.cloud.utils.db.GenericDao;
2019
import com.cloud.utils.db.GenericDaoBase;
2120
import org.apache.cloudstack.gui.theme.GuiThemeVO;
2221
import org.springframework.stereotype.Component;
2322

2423
@Component
25-
public class GuiThemeDaoImpl extends GenericDaoBase<GuiThemeVO, Long> implements GenericDao<GuiThemeVO, Long> {
24+
public class GuiThemeDaoImpl extends GenericDaoBase<GuiThemeVO, Long> implements GuiThemeDao {
2625
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
package org.apache.cloudstack.gui.theme.dao;
18+
19+
import com.cloud.utils.db.GenericDao;
20+
import org.apache.cloudstack.gui.theme.GuiThemeDetailsVO;
21+
22+
import java.util.List;
23+
24+
public interface GuiThemeDetailsDao extends GenericDao<GuiThemeDetailsVO, Long> {
25+
List<Long> listGuiThemeIdsByCommonName(String commonName);
26+
27+
List<Long> listGuiThemeIdsByDomainUuids(String domainUuid);
28+
29+
void expungeByGuiThemeId(long guiThemeId);
30+
}

engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDetailsDaoImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.cloud.domain.DomainVO;
2020
import com.cloud.domain.dao.DomainDao;
21-
import com.cloud.utils.db.GenericDao;
2221
import com.cloud.utils.db.GenericDaoBase;
2322
import com.cloud.utils.db.GenericSearchBuilder;
2423
import com.cloud.utils.db.JoinBuilder;
@@ -33,13 +32,13 @@
3332
import java.util.List;
3433

3534
@Component
36-
public class GuiThemeDetailsDaoImpl extends GenericDaoBase<GuiThemeDetailsVO, Long> implements GenericDao<GuiThemeDetailsVO, Long> {
35+
public class GuiThemeDetailsDaoImpl extends GenericDaoBase<GuiThemeDetailsVO, Long> implements GuiThemeDetailsDao {
3736

3837
@Inject
3938
DomainDao domainDao;
4039

4140
@Inject
42-
GuiThemeDaoImpl guiThemeDao;
41+
GuiThemeDao guiThemeDao;
4342

4443
public List<Long> listGuiThemeIdsByCommonName(String commonName) {
4544
GenericSearchBuilder<GuiThemeDetailsVO, Long> detailsDaoSearchBuilder = createSearchBuilder(Long.class);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
package org.apache.cloudstack.gui.theme.dao;
18+
19+
import com.cloud.utils.Pair;
20+
import com.cloud.utils.db.GenericDao;
21+
import org.apache.cloudstack.gui.theme.GuiThemeJoinVO;
22+
23+
import java.util.List;
24+
25+
public interface GuiThemeJoinDao extends GenericDao<GuiThemeJoinVO, Long> {
26+
GuiThemeJoinVO findDefaultTheme();
27+
28+
Pair<List<GuiThemeJoinVO>, Integer> listGuiThemesWithNoAuthentication(String commonName);
29+
30+
Pair<List<GuiThemeJoinVO>, Integer> listGuiThemes(Long id, String name, String commonName, String domainUuid, String accountUuid, boolean listAll, boolean showRemoved, Boolean showPublic);
31+
}

engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeJoinDaoImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.cloud.utils.Pair;
2020
import com.cloud.utils.db.Filter;
21-
import com.cloud.utils.db.GenericDao;
2221
import com.cloud.utils.db.GenericDaoBase;
2322
import com.cloud.utils.db.SearchBuilder;
2423
import com.cloud.utils.db.SearchCriteria;
@@ -33,9 +32,9 @@
3332
import java.util.List;
3433

3534
@Component
36-
public class GuiThemeJoinDaoImpl extends GenericDaoBase<GuiThemeJoinVO, Long> implements GenericDao<GuiThemeJoinVO, Long> {
35+
public class GuiThemeJoinDaoImpl extends GenericDaoBase<GuiThemeJoinVO, Long> implements GuiThemeJoinDao {
3736
@Inject
38-
GuiThemeDetailsDaoImpl guiThemeDetailsDao;
37+
GuiThemeDetailsDao guiThemeDetailsDao;
3938

4039
public static final Long INVALID_ID = -1L;
4140

server/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeServiceImpl.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@
4040
import org.apache.cloudstack.api.response.GuiThemeResponse;
4141
import org.apache.cloudstack.api.response.ListResponse;
4242
import org.apache.cloudstack.context.CallContext;
43-
import org.apache.cloudstack.gui.theme.dao.GuiThemeDaoImpl;
44-
import org.apache.cloudstack.gui.theme.dao.GuiThemeDetailsDaoImpl;
45-
import org.apache.cloudstack.gui.theme.dao.GuiThemeJoinDaoImpl;
43+
import org.apache.cloudstack.gui.theme.dao.GuiThemeDao;
44+
import org.apache.cloudstack.gui.theme.dao.GuiThemeDetailsDao;
45+
import org.apache.cloudstack.gui.theme.dao.GuiThemeJoinDao;
4646
import org.apache.commons.lang3.StringUtils;
4747
import org.apache.logging.log4j.LogManager;
4848
import org.apache.logging.log4j.Logger;
49+
import org.springframework.stereotype.Component;
4950

5051
import javax.inject.Inject;
5152
import java.util.ArrayList;
@@ -54,6 +55,7 @@
5455
import java.util.Map;
5556
import java.util.Set;
5657

58+
@Component
5759
public class GuiThemeServiceImpl implements GuiThemeService {
5860

5961
protected Logger logger = LogManager.getLogger(getClass());
@@ -69,13 +71,13 @@ public class GuiThemeServiceImpl implements GuiThemeService {
6971
private static final String PLUGINS = "plugins";
7072

7173
@Inject
72-
GuiThemeDaoImpl guiThemeDao;
74+
GuiThemeDao guiThemeDao;
7375

7476
@Inject
75-
GuiThemeDetailsDaoImpl guiThemeDetailsDao;
77+
GuiThemeDetailsDao guiThemeDetailsDao;
7678

7779
@Inject
78-
GuiThemeJoinDaoImpl guiThemeJoinDao;
80+
GuiThemeJoinDao guiThemeJoinDao;
7981

8082
@Inject
8183
ResponseGenerator responseGenerator;

0 commit comments

Comments
 (0)