Merge "DirectAAFLur.java-sonar fix"
[aaf/authz.git] / auth / auth-cass / src / main / java / org / onap / aaf / auth / dao / cass / OAuthTokenDAO.java
index 5d0f084..bda7ef0 100644 (file)
@@ -3,13 +3,14 @@
  * org.onap.aaf
  * ===========================================================================
  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 IBM.
  * ===========================================================================
  * 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.
@@ -44,19 +45,19 @@ import com.datastax.driver.core.Cluster;
 import com.datastax.driver.core.Row;
 
 /**
- * CredDAO manages credentials. 
+ * CredDAO manages credentials.
  * @author Jonathan
  * Date: 7/19/13
  */
 public class OAuthTokenDAO extends CassDAOImpl<AuthzTrans,OAuthTokenDAO.Data> {
     public static final String TABLE = "oauth_token";
     private AbsCassDAO<AuthzTrans, Data>.PSInfo psByUser;
-    
+
     public OAuthTokenDAO(AuthzTrans trans, Cluster cluster, String keyspace) {
         super(trans, OAuthTokenDAO.class.getSimpleName(),cluster, keyspace, Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
         init(trans);
     }
-    
+
     public OAuthTokenDAO(AuthzTrans trans, AbsCassDAO<AuthzTrans,?> aDao) {
             super(trans, OAuthTokenDAO.class.getSimpleName(),aDao, Data.class, TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
             init(trans);
@@ -73,7 +74,7 @@ public class OAuthTokenDAO extends CassDAOImpl<AuthzTrans,OAuthTokenDAO.Data> {
         public String                    refresh;
         public Date                      expires;
         public long                        exp_sec;
-        public String                     content;  
+        public String                     content;
         public Set<String>                  scopes;
         public String                    state;
         public String                    req_ip; // requesting
@@ -93,27 +94,27 @@ public class OAuthTokenDAO extends CassDAOImpl<AuthzTrans,OAuthTokenDAO.Data> {
             OAuthLoader.deflt.marshal(this,new DataOutputStream(baos));
             return ByteBuffer.wrap(baos.toByteArray());
         }
-        
+
         @Override
         public void reconstitute(ByteBuffer bb) throws IOException {
             OAuthLoader.deflt.unmarshal(this, toDIS(bb));
         }
 
         public String toString() {
-            return user.toString() + ' ' + id.toString() + ' ' + Chrono.dateTime(expires) + (active?"":"in") + "active";
+            return user + ' ' + id + ' ' + Chrono.dateTime(expires) + (active?"":"in") + "active";
         }
     }
 
     private static class OAuthLoader extends Loader<Data> implements Streamer<Data>{
         public static final int MAGIC=235677843;
             public static final int VERSION=1;
-            public static final int BUFF_SIZE=96; // Note: only used when  
-    
+            public static final int BUFF_SIZE=96; // Note: only used when
+
             public static final OAuthLoader deflt = new OAuthLoader(KEYLIMIT);
             public OAuthLoader(int keylimit) {
                 super(keylimit);
             }
-    
+
             @Override
         public Data load(Data data, Row row) {
             data.id = row.getString(0);