AT&T 2.0.19 Code drop, stage 5
[aaf/authz.git] / authz-gui / src / main / java / com / att / authz / gui / pages / UserRoleRemove.java
diff --git a/authz-gui/src/main/java/com/att/authz/gui/pages/UserRoleRemove.java b/authz-gui/src/main/java/com/att/authz/gui/pages/UserRoleRemove.java
deleted file mode 100644 (file)
index fd2123c..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2016 AT&T Intellectual Property. All rights reserved.
- *******************************************************************************/
-package com.att.authz.gui.pages;
-
-import java.io.IOException;
-import java.net.ConnectException;
-
-import com.att.authz.env.AuthzTrans;
-import com.att.authz.gui.AuthGUI;
-import com.att.authz.gui.BreadCrumbs;
-import com.att.authz.gui.NamedCode;
-import com.att.authz.gui.Page;
-import org.onap.aaf.cadi.CadiException;
-import org.onap.aaf.cadi.client.Future;
-import org.onap.aaf.cadi.client.Rcli;
-import org.onap.aaf.cadi.client.Retryable;
-import org.onap.aaf.inno.env.APIException;
-import org.onap.aaf.inno.env.Env;
-import org.onap.aaf.inno.env.Slot;
-import org.onap.aaf.inno.env.TimeTaken;
-import com.att.xgen.Cache;
-import com.att.xgen.DynamicCode;
-import com.att.xgen.html.HTMLGen;
-
-public class UserRoleRemove extends Page {
-       public static final String HREF = "/gui/urRemove";
-       static final String NAME = "Remove User Role";
-       static final String fields[] = {"user","role"};
-
-       public UserRoleRemove(final AuthGUI gui, final Page ... breadcrumbs) throws APIException, IOException {
-               super(gui.env,NAME, HREF, fields,
-                               new BreadCrumbs(breadcrumbs),
-                               new NamedCode(true, "content") {
-                       @Override
-                       public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
-                               final Slot sUser = gui.env.slot(NAME+".user");
-                               final Slot sRole = gui.env.slot(NAME+".role");
-                               
-                               
-                               cache.dynamic(hgen, new DynamicCode<HTMLGen, AuthGUI, AuthzTrans>() {
-                                       @Override
-                                       public void code(AuthGUI gui, AuthzTrans trans, Cache<HTMLGen> cache, HTMLGen hgen)     throws APIException, IOException {                                              
-                                               final String user = trans.get(sUser, "");
-                                               final String role = trans.get(sRole, "");
-
-                                               TimeTaken tt = trans.start("Request a user role delete",Env.REMOTE);
-                                               try {
-                                                       gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
-                                                               @Override
-                                                               public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
-                                                                       Future<Void> fv = client.setQueryParams("request=true").delete(
-                                                                                               "/authz/userRole/"+user+"/"+role,Void.class);
-                                                                       
-                                                                       if(fv.get(5000)) {
-                                                                               // not sure if we'll ever hit this
-                                                                               hgen.p("User ["+ user+"] Removed from Role [" +role+"]");
-                                                                       } else {
-                                                                               if (fv.code() == 202 ) {
-                                                                                       hgen.p("User ["+ user+"] Removal from Role [" +role+"] sent for Approval");
-                                                                               } else {
-                                                                                       gui.writeError(trans, fv, hgen);
-                                                                               }
-                                                                       }
-                                                                       return null;
-                                                               }
-                                                       });
-                                               } catch (Exception e) {
-                                                       e.printStackTrace();
-                                               } finally {
-                                                       tt.done();
-                                               }
-                                       }
-                               });
-                       }
-                       
-               });
-       }
-}