summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java37
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java25
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java21
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java95
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java82
6 files changed, 117 insertions, 151 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java
index e80eada1..4ebb3a94 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java
@@ -60,9 +60,13 @@ public abstract class CassBatch extends Batch {
public ResultSet executeQuery(String cql, String extra) {
if (isDryRun() && !cql.startsWith("SELECT")) {
- if (extra!=null)env.info().log("Would query" + extra + ": " + cql);
+ if (extra!=null) {
+ env.info().log("Would query" + extra + ": " + cql);
+ }
} else {
- if (extra!=null)env.info().log("query" + extra + ": " + cql);
+ if (extra!=null) {
+ env.info().log("query" + extra + ": " + cql);
+ }
try {
return session.execute(cql);
} catch (InvalidQueryException e) {
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java
index 58c4386b..72444c99 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java
@@ -48,10 +48,14 @@ import com.datastax.driver.core.ResultSetFuture;
*/
public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS, DATA> implements DAO<TRANS,DATA> {
public static final String USER_NAME = "__USER_NAME__";
+ public static final String CASS_READ_CONSISTENCY="cassandra.readConsistency";
+ public static final String CASS_WRITE_CONSISTENCY="cassandra.writeConsistency";
protected static final String CREATE_SP = "CREATE ";
protected static final String UPDATE_SP = "UPDATE ";
protected static final String DELETE_SP = "DELETE ";
protected static final String SELECT_SP = "SELECT ";
+ private static final String WHERE = " WHERE ";
+ private static final String READ_IS_DISABLED = "Read is disabled for %s";
protected final String C_TEXT = getClass().getSimpleName() + " CREATE";
protected final String R_TEXT = getClass().getSimpleName() + " READ";
@@ -59,7 +63,14 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
protected final String D_TEXT = getClass().getSimpleName() + " DELETE";
private String table;
- protected final ConsistencyLevel readConsistency,writeConsistency;
+ protected final ConsistencyLevel readConsistency;
+ protected final ConsistencyLevel writeConsistency;
+
+ protected PSInfo createPS;
+ protected PSInfo readPS;
+ protected PSInfo updatePS;
+ protected PSInfo deletePS;
+ protected boolean async=false;
// Setteable only by CachedDAO
protected Cached<?, ?> cache;
@@ -95,12 +106,6 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
writeConsistency = write;
}
- protected PSInfo createPS;
- protected PSInfo readPS;
- protected PSInfo updatePS;
- protected PSInfo deletePS;
- protected boolean async=false;
-
public void async(boolean bool) {
async = bool;
}
@@ -111,7 +116,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
public final String[] setCRUD(TRANS trans, String table, Class<?> dc,Loader<DATA> loader, int max) {
Field[] fields = dc.getDeclaredFields();
- int end = max>=0 & max<fields.length?max:fields.length;
+ int end = max>=0 && max<fields.length?max:fields.length;
// get keylimit from a non-null Loader
int keylimit = loader.keylimit();
@@ -146,16 +151,16 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
createPS = new PSInfo(trans, "INSERT INTO " + table + " ("+ sbfc +") VALUES ("+ sbq +");",loader,writeConsistency);
- readPS = new PSInfo(trans, "SELECT " + sbfc + " FROM " + table + " WHERE " + sbwc + ';',loader,readConsistency);
+ readPS = new PSInfo(trans, SELECT_SP + sbfc + " FROM " + table + WHERE + sbwc + ';',loader,readConsistency);
// Note: UPDATES can't compile if there are no fields besides keys... Use "Insert"
if (sbup.length()==0) {
updatePS = createPS; // the same as an insert
} else {
- updatePS = new PSInfo(trans, "UPDATE " + table + " SET " + sbup + " WHERE " + sbwc + ';',loader,writeConsistency);
+ updatePS = new PSInfo(trans, UPDATE_SP + table + " SET " + sbup + WHERE + sbwc + ';',loader,writeConsistency);
}
- deletePS = new PSInfo(trans, "DELETE FROM " + table + " WHERE " + sbwc + ';',loader,writeConsistency);
+ deletePS = new PSInfo(trans, "DELETE FROM " + table + WHERE + sbwc + ';',loader,writeConsistency);
}
return new String[] {sbfc.toString(), sbq.toString(), sbup.toString(), sbwc.toString()};
}
@@ -207,21 +212,21 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
*/
public Result<List<DATA>> read(TRANS trans, DATA data) {
if (readPS==null) {
- return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName());
+ return Result.err(Result.ERR_NotImplemented,READ_IS_DISABLED,getClass().getSimpleName());
}
return readPS.read(trans, R_TEXT, data);
}
public Result<List<DATA>> read(TRANS trans, Object ... key) {
if (readPS==null) {
- return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName());
+ return Result.err(Result.ERR_NotImplemented,READ_IS_DISABLED,getClass().getSimpleName());
}
return readPS.read(trans, R_TEXT, key);
}
public Result<DATA> readPrimKey(TRANS trans, Object ... key) {
if (readPS==null) {
- return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName());
+ return Result.err(Result.ERR_NotImplemented,READ_IS_DISABLED,getClass().getSimpleName());
}
Result<List<DATA>> rld = readPS.read(trans, R_TEXT, key);
if (rld.isOK()) {
@@ -312,9 +317,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
public String table() {
return table;
}
-
- public static final String CASS_READ_CONSISTENCY="cassandra.readConsistency";
- public static final String CASS_WRITE_CONSISTENCY="cassandra.writeConsistency";
+
protected static ConsistencyLevel readConsistency(AuthzTrans trans, String table) {
String prop = trans.getProperty(CASS_READ_CONSISTENCY+'.'+table);
if (prop==null) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
index 8fc79401..3dae0fa5 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
@@ -38,6 +38,11 @@ import aaf.v2_0.Users.User;
public class List extends BaseCmd<NS> {
+ private static final String cformat = " %-30s %-6s %-24s\n";
+ private static final String pformat = " %-30s %-24s %-15s\n";
+ private static final String sformat = " %-72s\n";
+ protected static final String kformat = " %-72s\n";
+
public List(NS parent) {
super(parent,"list");
cmds.add(new ListByName(this));
@@ -51,10 +56,6 @@ public class List extends BaseCmd<NS> {
cmds.add(new ListChildren(this));
cmds.add(new ListNsKeysByAttrib(this));
}
-
- private static final String sformat = " %-72s\n";
- protected static final String kformat = " %-72s\n";
-
public void report(Future<Nss> fp, String ... str) {
reportHead(str);
@@ -69,19 +70,19 @@ public class List extends BaseCmd<NS> {
pw().println(" Description");
pw().format(sformat,ns.getDescription()==null?"":ns.getDescription());
}
- if (ns.getAdmin().size()>0) {
+ if (!(ns.getAdmin().isEmpty())) {
pw().println(" Administrators");
for (String admin : ns.getAdmin()) {
pw().format(sformat,admin);
}
}
- if (ns.getResponsible().size()>0) {
+ if (!(ns.getResponsible().isEmpty())) {
pw().println(" Owners (Responsible for Namespace)");
for (String responsible : ns.getResponsible()) {
pw().format(sformat,responsible);
}
}
- if (ns.getAttrib().size()>0) {
+ if (!(ns.getAttrib().isEmpty())) {
pw().println(" Namespace Attributes");
for ( Ns.Attrib attr : ns.getAttrib()) {
StringBuilder sb = new StringBuilder(attr.getKey());
@@ -118,7 +119,7 @@ public class List extends BaseCmd<NS> {
}
public void reportRole(Future<Roles> fr) {
- if (fr!=null && fr.value!=null && fr.value.getRole().size()>0) {
+ if (fr!=null && fr.value!=null && !(fr.value.getRole().isEmpty())) {
pw().println(" Roles");
for (aaf.v2_0.Role r : fr.value.getRole()) {
pw().format(sformat,r.getName());
@@ -126,9 +127,8 @@ public class List extends BaseCmd<NS> {
}
}
- private static final String pformat = " %-30s %-24s %-15s\n";
public void reportPerm(Future<Perms> fp) {
- if (fp!=null && fp.value!=null && fp.value.getPerm().size()>0) {
+ if (fp!=null && fp.value!=null && !(fp.value.getPerm().isEmpty())) {
pw().println(" Permissions");
for (aaf.v2_0.Perm p : fp.value.getPerm()) {
pw().format(pformat,p.getType(),p.getInstance(),p.getAction());
@@ -136,10 +136,9 @@ public class List extends BaseCmd<NS> {
}
}
-
- private static final String cformat = " %-30s %-6s %-24s\n";
+
public void reportCred(Future<Users> fc) {
- if (fc!=null && fc.value!=null && fc.value.getUser().size()>0) {
+ if (fc!=null && fc.value!=null && !(fc.value.getUser().isEmpty())) {
pw().println(" Credentials");
java.util.List<User> users = fc.value.getUser();
Collections.sort(users, new Comparator<User>() {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
index 3074ab86..6733989e 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
@@ -50,14 +50,11 @@ public class List extends BaseCmd<User> {
reportHead(str);
int idx = 0;
java.util.List<aaf.v2_0.Users.User> sorted = users.getUser();
- Collections.sort(sorted, new Comparator<aaf.v2_0.Users.User>() {
- @Override
- public int compare(aaf.v2_0.Users.User u1, aaf.v2_0.Users.User u2) {
- if (u1==null || u2 == null) {
- return -1;
- }
- return u1.getId().compareTo(u2.getId());
+ Collections.sort(sorted, (Comparator<aaf.v2_0.Users.User>) (u1, u2) -> {
+ if (u1==null || u2 == null) {
+ return -1;
}
+ return u1.getId().compareTo(u2.getId());
});
String format = reportColHead("%-40s %-10s %-30s\n","User","Type","Expires");
String date = "XXXX-XX-XX";
@@ -77,13 +74,9 @@ public class List extends BaseCmd<User> {
reportHead(title,id);
String format = reportColHead(" %-20s %-20s %-11s %-6s %12s\n","User","Approver","Type","Status","Updated");
java.util.List<Approval> lapp = approvals.getApprovals();
- Collections.sort(lapp, new Comparator<Approval>() {
- @Override
- public int compare(Approval a1, Approval a2) {
- return a1.getTicket().compareTo(a2.getTicket());
- }
- } );
- String ticket = null, prev = null;
+ Collections.sort(lapp, (Comparator<Approval>) (a1, a2) -> a1.getTicket().compareTo(a2.getTicket()));
+ String ticket = null;
+ String prev = null;
for (Approval app : lapp ) {
ticket = app.getTicket();
if (!ticket.equals(prev)) {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java
index 7d57b3d8..969505bb 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java
@@ -7,9 +7,9 @@
* 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
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* 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.
@@ -66,7 +66,7 @@ public class ApiDocs extends Page {
// + Symm.base64noSplit().encode("application/Error+xml")
+ "\">XML</a> ";
-
+
public ApiDocs(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, fields,
new BreadCrumbs(breadcrumbs),
@@ -74,15 +74,15 @@ public class ApiDocs extends Page {
new Table<AAF_GUI,AuthzTrans>("AAF API Reference",gui.env.newTransNoAvg(),new Model(), "class=std")
);
}
-
+
private static class Preamble extends NamedCode {
private static final String I = "i";
- private final String fs_url;
+ private final String fsUrl;
public Preamble(AAF_GUI gui) {
super(false, "preamble");
- fs_url = gui.access.getProperty("fs_url", "");
+ fsUrl = gui.access.getProperty("fs_url", "");
}
@Override
@@ -108,11 +108,11 @@ public class ApiDocs extends Page {
+ "+json after the type for JSON or +xml after the Type for XML").end()
.leaf(HTMLGen.LI).text("XSDs for Versions").end()
.incr(HTMLGen.UL)
- .leaf(HTMLGen.LI).leaf(HTMLGen.A,"href=" + fs_url + "/aaf_2_0.xsd").text("API 2.0").end().end()
+ .leaf(HTMLGen.LI).leaf(HTMLGen.A,"href=" + fsUrl + "/aaf_2_0.xsd").text("API 2.0").end().end()
.end()
.leaf(HTMLGen.LI).text("AAF can support multiple Versions of the API. Choose the ContentType/Accept that has "
+ "the appropriate version=?.?").end()
- .leaf(HTMLGen.LI).text("All Errors coming from AAF return AT&T Standard Error Message as a String: " + ERROR_LINK
+ .leaf(HTMLGen.LI).text("All Errors coming from AAF return AT&T Standard Error Message as a String: " + ERROR_LINK
+ " (does not apply to errors from Container)").end()
.end()
.leaf(HTMLGen.LI).text("Character Restrictions").end()
@@ -131,7 +131,7 @@ public class ApiDocs extends Page {
.end()
.end();
/*
-
+
The Content is defined in the AAF XSD - TODO Add aaf.xsd”;
Character Restrictions
@@ -141,24 +141,24 @@ public class ApiDocs extends Page {
“/“ is used to separate fields
*/
}
-
+
};
/**
* Implement the Table Content for Permissions by User
- *
+ *
* @author Jonathan
*
*/
private static class Model extends TableData<AAF_GUI,AuthzTrans> {
public static final String[] HEADERS = new String[] {"Entity","Method","Path Info","Description"};
private static final TextCell BLANK = new TextCell("");
-
+
@Override
public String[] headers() {
return HEADERS;
}
-
-
+
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final ArrayList<AbsCell[]> ns = new ArrayList<>();
@@ -167,8 +167,8 @@ public class ApiDocs extends Page {
final ArrayList<AbsCell[]> user = new ArrayList<>();
final ArrayList<AbsCell[]> aafOnly = new ArrayList<>();
final ArrayList<AbsCell[]> rv = new ArrayList<>();
-
-
+
+
final TimeTaken tt = trans.start("AAF APIs",Env.REMOTE);
try {
gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
@@ -184,20 +184,20 @@ public class ApiDocs extends Page {
String path = r.getPath();
// Build info
StringBuilder desc = new StringBuilder();
-
+
desc.append("<p class=double>");
desc.append(r.getDesc());
-
- if (r.getComments().size()>0) {
+
+ if (!r.getComments().isEmpty()) {
for (String ct : r.getComments()) {
desc.append("</p><p class=api_comment>");
desc.append(ct);
}
}
-
- if (r.getParam().size()>0) {
+
+ if (!r.getParam().isEmpty()) {
desc.append("<hr><p class=api_label>Parameters</p>");
-
+
for (String params : r.getParam()) {
String param[] = params.split("\\s*\\|\\s*");
desc.append("</p><p class=api_contentType>");
@@ -209,14 +209,14 @@ public class ApiDocs extends Page {
}
}
}
-
-
+
+
if (r.getExpected()!=0) {
desc.append("</p><p class=api_label>Expected HTTP Code</p><p class=api_comment>");
desc.append(r.getExpected());
- }
-
- if (r.getExplicitErr().size()!=0) {
+ }
+
+ if (!r.getExplicitErr().isEmpty()) {
desc.append("</p><p class=api_label>Explicit HTTP Error Codes</p><p class=api_comment>");
boolean first = true;
for (int ee : r.getExplicitErr()) {
@@ -228,7 +228,7 @@ public class ApiDocs extends Page {
desc.append(ee);
}
}
-
+
desc.append("</p><p class=api_label>");
desc.append("GET".equals(r.getMeth())?"Accept:":"ContentType:");
Collections.sort(r.getContentType());
@@ -249,31 +249,31 @@ public class ApiDocs extends Page {
}
}
desc.append("</p>");
-
-
+
+
AbsCell[] sa = new AbsCell[] {
null,
new TextCell(r.getMeth(),"class=right"),
new TextCell(r.getPath()),
new TextCell(desc.toString()),
};
-
+
if (path.startsWith("/authz/perm")) {
- sa[0] = perms.size()==0?new TextCell("PERMISSION"):BLANK;
+ sa[0] = perms.isEmpty()?new TextCell("PERMISSION"):BLANK;
perms.add(sa);
} else if (path.startsWith("/authz/role") || path.startsWith("/authz/userRole")) {
- sa[0] = roles.size()==0?new TextCell("ROLE"):BLANK;
+ sa[0] = roles.isEmpty()?new TextCell("ROLE"):BLANK;
roles.add(sa);
} else if (path.startsWith("/authz/ns")) {
- sa[0] = ns.size()==0?new TextCell("NAMESPACE"):BLANK;
+ sa[0] = ns.isEmpty()?new TextCell("NAMESPACE"):BLANK;
ns.add(sa);
- } else if (path.startsWith("/authn/basicAuth")
+ } else if (path.startsWith("/authn/basicAuth")
|| path.startsWith("/authn/validate")
|| path.startsWith("/authz/user")) {
- sa[0] = user.size()==0?new TextCell("USER"):BLANK;
+ sa[0] = user.isEmpty()?new TextCell("USER"):BLANK;
user.add(sa);
} else {
- sa[0] = aafOnly.size()==0?new TextCell("AAF ONLY"):BLANK;
+ sa[0] = aafOnly.isEmpty()?new TextCell("AAF ONLY"):BLANK;
aafOnly.add(sa);
}
}
@@ -293,7 +293,7 @@ public class ApiDocs extends Page {
} finally {
tt.done();
}
-
+
return new Cells(rv,null);
}
@@ -307,17 +307,14 @@ public class ApiDocs extends Page {
lead = row[0];
row[0]=BLANK;
al.get(0).clone()[0]=BLANK;
- Collections.sort(al, new Comparator<AbsCell[]>() {
- @Override
- public int compare(AbsCell[] ca1, AbsCell[] ca2) {
- int meth = ((TextCell)ca1[2]).name.compareTo(
- ((TextCell)ca2[2]).name);
- if (meth == 0) {
- return (HttpMethods.valueOf(((TextCell)ca1[1]).name).compareTo(
- HttpMethods.valueOf(((TextCell)ca2[1]).name)));
- } else {
- return meth;
- }
+ Collections.sort(al, (ca1, ca2) -> {
+ int meth = ((TextCell)ca1[2]).name.compareTo(
+ ((TextCell)ca2[2]).name);
+ if (meth == 0) {
+ return (HttpMethods.valueOf(((TextCell)ca1[1]).name).compareTo(
+ HttpMethods.valueOf(((TextCell)ca2[1]).name)));
+ } else {
+ return meth;
}
});
// set new first row
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java
index 789a2e65..67bf3b50 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java
@@ -2137,13 +2137,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<FutureDAO.Data> fd = mapper.future(trans,RoleDAO.TABLE,from,role,false,
- new Mapper.Memo() {
- @Override
- public String get() {
- return "Delete Role [" + role.fullName() + ']'
- + " and all attached user roles";
- }
- },
+ () -> "Delete Role [" + role.fullName() + ']'
+ + " and all attached user roles",
new MayChange() {
private Result<NsDAO.Data> nsd;
@Override
@@ -2753,12 +2748,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private String[] buildVariables(List<CredDAO.Data> value) {
// ensure credentials are sorted so we can fully automate Cred regression test
- Collections.sort(value, new Comparator<CredDAO.Data>() {
- @Override
- public int compare(CredDAO.Data cred1, CredDAO.Data cred2) {
- return cred1.expires.compareTo(cred2.expires);
- }
- });
+ Collections.sort(value, (cred1, cred2) -> cred1.expires.compareTo(cred2.expires));
String [] vars = new String[value.size()+1];
vars[0]="Choice";
for (int i = 0; i < value.size(); i++) {
@@ -2864,15 +2854,10 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
- Result<FutureDAO.Data> fd = mapper.future(trans,CredDAO.TABLE,from,cred.value,false,
- new Mapper.Memo() {
- @Override
- public String get() {
- return "Delete Credential [" +
- cred.value.id +
- ']';
- }
- },
+ Result<FutureDAO.Data> fd = mapper.future(trans,CredDAO.TABLE,from,cred.value,false,
+ () -> "Delete Credential [" +
+ cred.value.id +
+ ']',
mc);
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, cred.value.ns);
@@ -3033,14 +3018,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Check if user can change first
Result<FutureDAO.Data> fd = mapper.future(trans,UserRoleDAO.TABLE,from,urr.value,true, // may request Approvals
- new Mapper.Memo() {
- @Override
- public String get() {
- return "Add User [" + userRole.user + "] to Role [" +
- userRole.role +
- ']';
- }
- },
+ () -> "Add User [" + userRole.user + "] to Role [" +
+ userRole.role +
+ ']',
new MayChange() {
private Result<NsDAO.Data> nsd;
@Override
@@ -3837,27 +3817,21 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return rv;
}
- Result<FutureDAO.Data> fd = mapper.future(trans,DelegateDAO.TABLE,base, dd, false,
- new Mapper.Memo() {
- @Override
- public String get() {
- StringBuilder sb = new StringBuilder();
- sb.append(access.name());
- sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
- sb.append("Delegate ");
- sb.append(access==Access.create?"[":"to [");
- sb.append(rd.value.delegate);
- sb.append("] for [");
- sb.append(rd.value.user);
- sb.append(']');
- return sb.toString();
- }
+ Result<FutureDAO.Data> fd = mapper.future(trans,DelegateDAO.TABLE,base, dd, false,
+ () -> {
+ StringBuilder sb = new StringBuilder();
+ sb.append(access.name());
+ sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
+ sb.append("Delegate ");
+ sb.append(access==Access.create?"[":"to [");
+ sb.append(rd.value.delegate);
+ sb.append("] for [");
+ sb.append(rd.value.user);
+ sb.append(']');
+ return sb.toString();
},
- new MayChange() {
- @Override
- public Result<?> mayChange() {
- return Result.ok(); // Validate in code above
- }
+ () -> {
+ return Result.ok(); // Validate in code above
});
switch(fd.status) {
@@ -4009,12 +3983,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
curr = ques.approvalDAO.readByTicket(trans, updt.ticket);
if (curr.isOKhasData()) {
final List<ApprovalDAO.Data> add = curr.value;
- apprByTicket = new Lookup<List<ApprovalDAO.Data>>() { // Store a Pre-Lookup
- @Override
- public List<ApprovalDAO.Data> get(AuthzTrans trans, Object ... noop) {
- return add;
- }
- };
+ // Store a Pre-Lookup
+ apprByTicket = (trans1, noop) -> add;
}
} else if (updt.id!=null) {
curr = ques.approvalDAO.read(trans, updt);