AafServiceFactory implementation
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / service / DmaapService.java
index 48ee661..c54fce8 100644 (file)
@@ -3,6 +3,8 @@
  * org.onap.dmaap
  * ================================================================================
  * Copyright (C) 2017 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.
 package org.onap.dmaap.dbcapi.service;
 
 import java.util.ArrayList;
-
-
-
-
-
-
-
-
-
-
 import org.onap.dmaap.dbcapi.aaf.AafService;
+import org.onap.dmaap.dbcapi.aaf.AafServiceFactory;
 import org.onap.dmaap.dbcapi.aaf.DmaapGrant;
 import org.onap.dmaap.dbcapi.aaf.DmaapPerm;
 import org.onap.dmaap.dbcapi.aaf.AafService.ServiceType;
@@ -43,7 +36,6 @@ import org.onap.dmaap.dbcapi.logging.DmaapbcLogMessageEnum;
 import org.onap.dmaap.dbcapi.model.ApiError;
 import org.onap.dmaap.dbcapi.model.Dmaap;
 import org.onap.dmaap.dbcapi.model.MR_Client;
-import org.onap.dmaap.dbcapi.model.ReplicationType;
 import org.onap.dmaap.dbcapi.model.Topic;
 import org.onap.dmaap.dbcapi.model.DmaapObject.DmaapObject_Status;
 import org.onap.dmaap.dbcapi.util.DmaapConfig;
@@ -94,9 +86,9 @@ public class DmaapService  extends BaseLoggingClass  {
                        nd.setLastMod();
                        dmaapholder.update(nd);
                        
-                       AafService aaf = new AafServiceServiceType.AAF_Admin);
+                       AafService aaf = new AafServiceFactory().initAafService(ServiceType.AAF_Admin);
                        ApiPolicy apiPolicy = new ApiPolicy();
-                       if ( apiPolicy.getUseAuthClass() ) {
+                       if ( apiPolicy.isPermissionClassSet() ) {
                                ApiPerms p = new ApiPerms();
                                p.setEnvMap();
                        }
@@ -139,11 +131,11 @@ public class DmaapService  extends BaseLoggingClass  {
                        dmaapholder.update(nd);  //need to set this so the following perms will pick up any new vals.
                        //dcaeTopicNs = dmaapholder.get().getTopicNsRoot();
                        ApiPolicy apiPolicy = new ApiPolicy();
-                       if ( apiPolicy.getUseAuthClass()) {
+                       if ( apiPolicy.isPermissionClassSet()) {
                                ApiPerms p = new ApiPerms();
                                p.setEnvMap();
                        }
-                       AafService aaf = new AafServiceServiceType.AAF_Admin);
+                       AafService aaf = new AafServiceFactory().initAafService(ServiceType.AAF_Admin);
                        if ( multiSite ) {
                                anythingWrong = setTopicMgtPerms(  nd,  aaf ) || createMmaTopic();
                        }