2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 * ===========================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END====================================================
22 package org.onap.aaf.auth.dao.cached;
24 import java.util.List;
26 import org.onap.aaf.auth.dao.CIDAO;
27 import org.onap.aaf.auth.dao.CachedDAO;
28 import org.onap.aaf.auth.dao.cass.CredDAO;
29 import org.onap.aaf.auth.dao.cass.Status;
30 import org.onap.aaf.auth.env.AuthzTrans;
31 import org.onap.aaf.auth.layer.Result;
33 public class CachedCredDAO extends CachedDAO<AuthzTrans, CredDAO, CredDAO.Data> {
34 public CachedCredDAO(CredDAO dao, CIDAO<AuthzTrans> info, long expiresIn) {
35 super(dao, info, CredDAO.CACHE_SEG, expiresIn);
39 * Pass through Cred Lookup
41 * Unlike Role and Perm, we don't need or want to cache these elements... Only used for NS Delete.
47 public Result<List<CredDAO.Data>> readNS(AuthzTrans trans, final String ns) {
49 return dao().readNS(trans, ns);
52 public Result<List<CredDAO.Data>> readID(AuthzTrans trans, final String id) {
53 DAOGetter getter = new DAOGetter(trans,dao()) {
54 public Result<List<CredDAO.Data>> call() {
55 return dao().readID(trans, id);
59 Result<List<CredDAO.Data>> lurd = get(trans, id, getter);
60 if(lurd.isOK() && lurd.isEmpty()) {
61 return Result.err(Status.ERR_UserNotFound,"No User Cred found");