* 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
* 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
* 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.
* 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.
public static final String PENDING = "pending";
public static final String DENIED = "denied";
public static final String APPROVED = "approved";
public static final String PENDING = "pending";
public static final String DENIED = "denied";
public static final String APPROVED = "approved";
private static final String TABLE = "approval";
private static final String TABLELOG = "approved";
private HistoryDAO historyDAO;
private static final String TABLE = "approval";
private static final String TABLELOG = "approved";
private HistoryDAO historyDAO;
public ApprovalDAO(AuthzTrans trans, Cluster cluster, String keyspace) {
super(trans, ApprovalDAO.class.getSimpleName(),cluster,keyspace,Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
historyDAO = new HistoryDAO(trans, this);
public ApprovalDAO(AuthzTrans trans, Cluster cluster, String keyspace) {
super(trans, ApprovalDAO.class.getSimpleName(),cluster,keyspace,Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
historyDAO = new HistoryDAO(trans, this);
private static class ApprovalLoader extends Loader<Data> {
public static final ApprovalLoader deflt = new ApprovalLoader(KEYLIMIT);
private static class ApprovalLoader extends Loader<Data> {
public static final ApprovalLoader deflt = new ApprovalLoader(KEYLIMIT);
@Override
public Data load(Data data, Row row) {
data.id = row.getUUID(0);
@Override
public Data load(Data data, Row row) {
data.id = row.getUUID(0);
data.status = row.getString(5);
data.memo = row.getString(6);
data.operation = row.getString(7);
data.status = row.getString(5);
data.memo = row.getString(6);
data.operation = row.getString(7);
-// data.last_notified = row.getTimestamp(8);
- // This is used to get "WRITETIME(STATUS)" from Approval, which gives us an "updated"
+ // This is used to get "WRITETIME(STATUS)" from Approval, which gives us an "updated"
if (row.getColumnDefinitions().size()>8) {
// Rows reported in MicroSeconds
data.updated = new Date(row.getLong(8)/1000);
if (row.getColumnDefinitions().size()>8) {
// Rows reported in MicroSeconds
data.updated = new Date(row.getLong(8)/1000);
private void init(AuthzTrans trans) {
String[] helpers = setCRUD(trans, TABLE, Data.class, ApprovalLoader.deflt,8);
private void init(AuthzTrans trans) {
String[] helpers = setCRUD(trans, TABLE, Data.class, ApprovalLoader.deflt,8);
- psByUser = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
+ psByUser = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
" WHERE user = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
obj[idx]=data.user;
}
}, readConsistency);
" WHERE user = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
obj[idx]=data.user;
}
}, readConsistency);
-
- psByApprover = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
+
+ psByApprover = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
" WHERE approver = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
" WHERE approver = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
- psByTicket = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
+ psByTicket = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
" WHERE ticket = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
" WHERE ticket = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
- psByStatus = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
+ psByStatus = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
" WHERE status = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
" WHERE status = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
public Result<List<ApprovalDAO.Data>> readByStatus(AuthzTrans trans, String status) {
return psByStatus.read(trans, R_TEXT, new Object[]{status});
public Result<List<ApprovalDAO.Data>> readByStatus(AuthzTrans trans, String status) {
return psByStatus.read(trans, R_TEXT, new Object[]{status});
/* (non-Javadoc)
* @see org.onap.aaf.auth.dao.CassDAOImpl#delete(com.att.inno.env.TransStore, java.lang.Object, boolean)
/* (non-Javadoc)
* @see org.onap.aaf.auth.dao.CassDAOImpl#delete(com.att.inno.env.TransStore, java.lang.Object, boolean)