summaryrefslogtreecommitdiffstats
path: root/auth
diff options
context:
space:
mode:
Diffstat (limited to 'auth')
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java18
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java34
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java28
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java40
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java12
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java14
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java12
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java44
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java50
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java18
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java14
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java28
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java20
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java32
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java124
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java44
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java64
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_InputIterator.java2
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java60
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java32
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java34
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java54
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java72
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java32
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java2
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java12
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java18
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java70
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java6
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java14
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java54
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java6
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java120
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java28
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java122
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java32
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java6
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java6
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java2
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java18
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java6
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java16
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java16
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java2
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java18
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java12
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java12
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java44
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java34
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java32
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java16
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java2
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java14
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java26
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java14
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java48
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java48
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java40
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java6
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java22
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java38
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java98
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java2
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java38
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java2
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java18
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java26
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java26
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java26
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java18
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java2
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java46
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java2
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java18
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java2
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java2
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java18
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java14
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java20
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java24
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java18
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java2
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java2
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java10
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java14
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java34
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java36
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java32
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java46
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java70
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java12
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java18
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java60
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java14
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java16
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java50
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java18
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java28
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java10
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java28
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java12
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java44
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java2
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java4
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java2
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java12
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java4
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/validation/test/JU_Validator.java2
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java72
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java12
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java2
-rw-r--r--auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java4
-rw-r--r--auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java2
-rw-r--r--auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java4
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java4
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java10
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java24
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java38
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java4
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java26
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java44
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java10
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java12
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java20
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java44
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java24
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java22
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java48
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java14
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java14
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java18
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java12
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java34
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java30
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java4
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java10
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java4
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java4
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java30
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java18
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java2
-rw-r--r--auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java2
-rw-r--r--auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java14
-rw-r--r--auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java6
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java10
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java8
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java12
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java2
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java4
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java30
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java22
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java24
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java32
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java12
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java40
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java8
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java4
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java4
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java32
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java32
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java12
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java16
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java60
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java12
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java782
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java4
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java8
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java28
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java28
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java28
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java2
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java204
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java116
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java64
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/authz/service/mapper/JU_Mapper_2_0.java4
268 files changed, 2890 insertions, 2890 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java
index 559e3c51..5670ac95 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java
@@ -98,11 +98,11 @@ public abstract class Batch {
// load extra properties, i.e.
// PERF.cassandra.clusters=....
batchEnv = env.getProperty(CASS_ENV);
- if(batchEnv != null) {
+ if (batchEnv != null) {
batchEnv = batchEnv.trim();
env.info().log("Redirecting to ",batchEnv,"environment");
String str;
- for(String key : new String[]{
+ for (String key : new String[]{
CassAccess.CASSANDRA_CLUSTERS,
CassAccess.CASSANDRA_CLUSTERS_PORT,
CassAccess.CASSANDRA_CLUSTERS_USER_NAME,
@@ -111,7 +111,7 @@ public abstract class Batch {
LOG_DIR,
"SPECIAL_NAMES"
}) {
- if((str = env.getProperty(batchEnv+'.'+key))!=null) {
+ if ((str = env.getProperty(batchEnv+'.'+key))!=null) {
env.setProperty(key, str);
}
}
@@ -319,8 +319,8 @@ public abstract class Batch {
private static void transferVMProps(AuthzEnv env, String ... props) {
String value;
- for(String key : props) {
- if((value = System.getProperty(key))!=null) {
+ for (String key : props) {
+ if ((value = System.getProperty(key))!=null) {
env.setProperty(key, value);
}
}
@@ -357,8 +357,8 @@ public abstract class Batch {
protected static String logDir() {
String ld = env.getProperty(LOG_DIR);
- if(ld==null) {
- if(batchEnv==null) { // Deployed Batch doesn't use different ENVs, and a common logdir
+ if (ld==null) {
+ if (batchEnv==null) { // Deployed Batch doesn't use different ENVs, and a common logdir
ld = "logs/";
} else {
ld = "logs/"+batchEnv;
@@ -367,11 +367,11 @@ public abstract class Batch {
return ld;
}
protected int count(String str, char c) {
- if(str==null || str.isEmpty()) {
+ if (str==null || str.isEmpty()) {
return 0;
} else {
int count=1;
- for(int i=str.indexOf(c);i>=0;i=str.indexOf(c,i+1)) {
+ for (int i=str.indexOf(c);i>=0;i=str.indexOf(c,i+1)) {
++count;
}
return count;
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 cb2b158f..e80eada1 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
@@ -59,14 +59,14 @@ 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 (isDryRun() && !cql.startsWith("SELECT")) {
+ 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) {
- if(extra==null) {
+ if (extra==null) {
env.info().log("query: " + cql);
}
throw e;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java
index af636d65..5275cf93 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java
@@ -65,7 +65,7 @@ public abstract class ActionDAO<D,RV,T> implements Action<D,RV,T> {
}
public void close(AuthzTrans trans) {
- if(clean) {
+ if (clean) {
q.close(trans);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java
index 95b35fdb..707425ca 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java
@@ -58,9 +58,9 @@ public abstract class ActionPuntDAO<D, RV, T> extends ActionDAO<D, RV, T> {
* This method Randomized date. This is no longer needed. Just add the Punt Months.
temp.setTime(now);
temp.add(GregorianCalendar.MONTH, months);
- if(range>0) {
+ if (range>0) {
int forward = Math.abs(random.nextInt()%range);
- if(forward>1) {
+ if (forward>1) {
temp.add(GregorianCalendar.MONTH, forward);
temp.add(GregorianCalendar.DAY_OF_MONTH, (random.nextInt()%30)-15);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java
index e0fa4be5..269edc77 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java
@@ -41,7 +41,7 @@ public class CacheTouch extends ActionDAO<String,Void, String> {
@Override
public Result<Void> exec(AuthzTrans trans, String table, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would mark %s cache in DB for clearing: %s",table, text);
return Result.ok();
} else {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java
index b4b7d0b3..ceb0453b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java
@@ -43,7 +43,7 @@ public class CredDelete extends ActionDAO<CredDAO.Data,Void, String> {
@Override
public Result<Void> exec(AuthzTrans trans, CredDAO.Data cred, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Delete:",text,cred.id,CredPrint.type(cred.type),Chrono.dateOnlyStamp(cred.expires));
return Result.ok();
} else {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java
index a2c9ecf6..33151d9f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java
@@ -46,14 +46,14 @@ public class CredPunt extends ActionPuntDAO<CredDAO.Data,Void,String> {
public Result<Void> exec(AuthzTrans trans, CredDAO.Data cdd,String text) {
Result<Void> rv = null;
Result<List<CredDAO.Data>> read = q.credDAO.read(trans, cdd);
- if(read.isOKhasData()) {
- for(CredDAO.Data data : read.value) {
+ if (read.isOKhasData()) {
+ for (CredDAO.Data data : read.value) {
Date from = data.expires;
data.expires = puntDate(from);
- if(data.expires.compareTo(from)<=0) {
+ if (data.expires.compareTo(from)<=0) {
trans.debug().printf("Error: %s is before %s", Chrono.dateOnlyStamp(data.expires), Chrono.dateOnlyStamp(from));
} else {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Update Cred",cdd.id, CredPrint.type(cdd.type), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires));
} else {
trans.info().log("Updated Cred",cdd.id, CredPrint.type(cdd.type), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires));
@@ -62,7 +62,7 @@ public class CredPunt extends ActionPuntDAO<CredDAO.Data,Void,String> {
}
}
}
- if(rv==null) {
+ if (rv==null) {
rv=Result.err(read);
}
return rv;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java
index 0ac8f61d..f40eeb58 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java
@@ -55,7 +55,7 @@ public class Email implements Action<Organization,Void, String>{
public Email clear() {
toList.clear();
ccList.clear();
- for(String s: defaultCC) {
+ for (String s: defaultCC) {
ccList.add(s);
}
return this;
@@ -71,35 +71,35 @@ public class Email implements Action<Organization,Void, String>{
}
public Email addTo(Identity id) {
- if(id!=null && !toList.contains(id.email())) {
+ if (id!=null && !toList.contains(id.email())) {
toList.add(id.email());
}
return this;
}
public Email addTo(Collection<String> users) {
- for(String u : users) {
+ for (String u : users) {
addTo(u);
}
return this;
}
public Email addTo(String email) {
- if(!toList.contains(email)) {
+ if (!toList.contains(email)) {
toList.add(email);
}
return this;
}
public Email addCC(Identity id) {
- if(id!=null && !ccList.contains(id.email())) {
+ if (id!=null && !ccList.contains(id.email())) {
ccList.add(id.email());
}
return this;
}
public Email addCC(String email) {
- if(!ccList.contains(email)) {
+ if (!ccList.contains(email)) {
ccList.add(email);
}
return this;
@@ -108,7 +108,7 @@ public class Email implements Action<Organization,Void, String>{
public Email add(Identity id, boolean toSuper) throws OrganizationException {
Identity responsible = id.responsibleTo();
- if(toSuper) {
+ if (toSuper) {
addTo(responsible.email());
addCC(id.email());
} else {
@@ -119,7 +119,7 @@ public class Email implements Action<Organization,Void, String>{
}
public Email subject(String format, Object ... args) {
- if(format.contains("%s")) {
+ if (format.contains("%s")) {
subject = String.format(format, args);
} else {
subject = format;
@@ -140,18 +140,18 @@ public class Email implements Action<Organization,Void, String>{
@Override
public Result<Void> exec(AuthzTrans trans, Organization org, String text) {
StringBuilder sb = new StringBuilder();
- if(preamble!=null) {
+ if (preamble!=null) {
sb.append(lineIndent);
sb.append(preamble);
sb.append("\n\n");
}
- if(msg!=null) {
+ if (msg!=null) {
msg.msg(sb,lineIndent);
sb.append("\n");
}
- if(sig!=null) {
+ if (sig!=null) {
sb.append(sig);
sb.append("\n");
}
@@ -159,7 +159,7 @@ public class Email implements Action<Organization,Void, String>{
long ct = System.currentTimeMillis();
long wait = ct-lastSent;
lastSent = ct;
- if(wait < 100) { // 10 per second
+ if (wait < 100) { // 10 per second
try {
Thread.sleep(wait);
} catch (InterruptedException e) {
@@ -188,8 +188,8 @@ public class Email implements Action<Organization,Void, String>{
public void log(PrintStream ps, String text) {
ps.print(Chrono.dateTime());
boolean first = true;
- for(String s : toList) {
- if(first) {
+ for (String s : toList) {
+ if (first) {
first = false;
ps.print(": ");
} else {
@@ -197,10 +197,10 @@ public class Email implements Action<Organization,Void, String>{
}
ps.print(s);
}
- if(!ccList.isEmpty()) {
+ if (!ccList.isEmpty()) {
first=true;
- for(String s : ccList) {
- if(first) {
+ for (String s : ccList) {
+ if (first) {
first = false;
ps.print(" [");
} else {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java
index 5fdc15b1..141e382f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java
@@ -43,8 +43,8 @@ public class EmailPrint extends Email {
PrintStream out = System.out;
boolean first = true;
out.print("To: ");
- for(String s: toList) {
- if(first) {first = false;}
+ for (String s: toList) {
+ if (first) {first = false;}
else {out.print(',');}
out.print(s);
}
@@ -52,8 +52,8 @@ public class EmailPrint extends Email {
first = true;
out.print("CC: ");
- for(String s: ccList) {
- if(first) {first = false;}
+ for (String s: ccList) {
+ if (first) {first = false;}
else {out.print(',');}
out.print(s);
}
@@ -64,7 +64,7 @@ public class EmailPrint extends Email {
out.println();
boolean go = true;
- for(int start=0, end=LINE_LENGTH;go;start=end,end=Math.min(msg.length(), start+LINE_LENGTH)) {
+ for (int start=0, end=LINE_LENGTH;go;start=end,end=Math.min(msg.length(), start+LINE_LENGTH)) {
int ret = msg.indexOf("\n",start+1);
switch(ret) {
case -1:
@@ -75,13 +75,13 @@ public class EmailPrint extends Email {
out.println();
break;
default:
- if(ret<end) {
+ if (ret<end) {
end = ret;
}
- if(end==start+LINE_LENGTH) {
+ if (end==start+LINE_LENGTH) {
// Word-wrapping
ret = msg.lastIndexOf(" ", end);
- if(ret>start && ret<end) {
+ if (ret>start && ret<end) {
end=ret+1;
}
out.println(msg.substring(start,end));
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java
index ac594a47..f1eadb20 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java
@@ -42,8 +42,8 @@ public class Message {
}
public void msg(StringBuilder sb, String lineIndent) {
- if(!lines.isEmpty()) {
- for(String line : lines) {
+ if (!lines.isEmpty()) {
+ for (String line : lines) {
sb.append(lineIndent);
sb.append(line);
sb.append('\n');
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java
index 5e531269..58a8c4b8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java
@@ -41,12 +41,12 @@ public class NSACreate extends ActionDAO<NsAttrib,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, NsAttrib nsa, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would Create %s Attrib '%s=%s' in %s",text,nsa.key,nsa.value,nsa.ns);
return Result.ok();
} else {
Result<Void> rv = q.nsDAO.dao().attribAdd(trans, nsa.ns, nsa.key, nsa.value);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("%s - Created Attrib '%s=%s' in %s",text,nsa.key,nsa.value,nsa.ns);
} else {
trans.error().printf("Error Creating Attrib '%s=%s' in %s - %s",nsa.key,nsa.value,nsa.ns,rv.details);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java
index 4bed8687..c8a1c82c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java
@@ -41,12 +41,12 @@ public class NSADelete extends ActionDAO<NsAttrib,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, NsAttrib nsa, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would Delete %s Attrib '%s' in %s",text,nsa.key,nsa.ns);
return Result.ok();
} else {
Result<Void> rv = q.nsDAO.dao().attribRemove(trans, nsa.ns, nsa.key);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("%s - Deleted Attrib '%s' in %s",text,nsa.key,nsa.value,nsa.ns);
} else {
trans.error().printf("Error Deleting Attrib '%s' in %s - %s",nsa.key,nsa.value,nsa.ns,rv.details);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java
index 98fad0ab..d5d93b38 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java
@@ -41,12 +41,12 @@ public class NSDescUpdate extends ActionDAO<NS,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, NS ns, String desc) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would Update '%s' Description to '%s'",ns,desc);
return Result.ok();
} else {
Result<Void> rv = q.nsDAO.dao().addDescription(trans, ns.name, desc);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("Updated '%s' Description to '%s'",ns,desc);
} else {
trans.error().printf("Error Updating '%s' Description to '%s' - %s",ns,desc,rv.details);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java
index c32234d7..a6c02f2c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java
@@ -52,12 +52,12 @@ public class PermCreate extends ActionDAO<Perm,Data,String> {
pdd.description = p.description;
pdd.roles = p.roles;
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Create Perm:",text,p.fullType());
return Result.ok(pdd);
} else {
Result<Data> rv = q.permDAO.create(trans, pdd); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Created Perm:",text,p.fullType());
} else {
trans.error().log("Error Creating Role -",rv.details,":",p.fullType());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java
index c5b79185..db549948 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java
@@ -47,12 +47,12 @@ public class PermDelete extends ActionDAO<Perm,Void,String> {
pdd.type = p.type;
pdd.instance = p.instance;
pdd.action = p.action;
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Delete Perm:",text,p.fullType());
return Result.ok();
} else {
Result<Void> rv = q.permDAO.delete(trans, pdd, true); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Deleted Perm:",text,p.fullType());
} else {
trans.error().log("Error Deleting Perm -",rv.details,":",p.fullType());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java
index bc6f70ca..a3d4bb6d 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java
@@ -48,35 +48,35 @@ public class PermModify extends ActionDAO<Perm,PermDAO.Data,PermModify.Modify> {
@Override
public Result<PermDAO.Data> exec(AuthzTrans trans, final Perm p, final Modify modify) {
Result<List<PermDAO.Data>> rr = q.permDAO.read(trans, p.ns,p.type,p.instance,p.action);
- if(dryRun) {
- if(rr.isOKhasData()) {
+ if (dryRun) {
+ if (rr.isOKhasData()) {
return Result.ok(rr.value.get(0));
} else {
return Result.err(Result.ERR_NotFound, "Data not Found " + p.toString());
}
} else {
Result<PermDAO.Data> rv = null;
- if(rr.isOKhasData()) {
- for(final Data d : rr.value) {
+ if (rr.isOKhasData()) {
+ for (final Data d : rr.value) {
modify.change(d);
- if(d.ns.equals(p.ns) && d.type.equals(p.type) && d.instance.equals(p.instance) && d.action.equals(p.action)) {
+ if (d.ns.equals(p.ns) && d.type.equals(p.type) && d.instance.equals(p.instance) && d.action.equals(p.action)) {
// update for fields
// In either case, adjust Permissions
- for(String r : d.roles) {
- if(!p.roles.contains(r)) {
+ for (String r : d.roles) {
+ if (!p.roles.contains(r)) {
q.permDAO.dao().addRole(trans, d, r);
}
}
- for(String r : p.roles) {
- if(!d.roles.contains(r)) {
+ for (String r : p.roles) {
+ if (!d.roles.contains(r)) {
q.permDAO.dao().delRole(trans, d, r);
}
}
rv = Result.ok(d);
} else {
- for(String r : d.roles) {
+ for (String r : d.roles) {
Role role = Role.keys.get(r);
- if(role.perms.contains(p.encode())) {
+ if (role.perms.contains(p.encode())) {
modify.roleModify().exec(trans, role, new RoleModify.Modify() {
@Override
public PermModify permModify() {
@@ -93,7 +93,7 @@ public class PermModify extends ActionDAO<Perm,PermDAO.Data,PermModify.Modify> {
}
rv = q.permDAO.create(trans, d);
- if(rv.isOK()) {
+ if (rv.isOK()) {
PermDAO.Data pdd = new PermDAO.Data();
pdd.ns = p.ns;
pdd.type = p.type;
@@ -112,7 +112,7 @@ public class PermModify extends ActionDAO<Perm,PermDAO.Data,PermModify.Modify> {
} else {
rv = Result.err(rr);
}
- if(rv==null) {
+ if (rv==null) {
rv = Result.err(Status.ERR_General,"Never get to this code");
}
@@ -126,7 +126,7 @@ public class PermModify extends ActionDAO<Perm,PermDAO.Data,PermModify.Modify> {
}
public Result<Void> delete(AuthzTrans trans, Perm p) {
- if(dryRun) {
+ if (dryRun) {
return Result.ok();
} else {
PermDAO.Data data = new PermDAO.Data();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java
index 5353166c..cdbe92b4 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java
@@ -49,12 +49,12 @@ public class RoleCreate extends ActionDAO<Role,Data,String> {
rdd.description = r.description;
rdd.perms = r.perms;
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Create Role:",text,r.fullName());
return Result.ok(rdd);
} else {
Result<Data> rv = q.roleDAO.create(trans, rdd); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Created Role:",text,r.fullName());
} else {
trans.error().log("Error Creating Role -",rv.details,":",r.fullName());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java
index 1a663c99..67491b5b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java
@@ -42,7 +42,7 @@ public class RoleDelete extends ActionDAO<Role,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, Role r,String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Delete Role:",text,r.fullName());
return Result.ok();
} else {
@@ -50,7 +50,7 @@ public class RoleDelete extends ActionDAO<Role,Void,String> {
rdd.ns = r.ns;
rdd.name = r.name;
Result<Void> rv = q.roleDAO.delete(trans, rdd, true); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Deleted Role:",text,r.fullName());
} else {
trans.error().log("Error Deleting Role -",rv.details,":",r.fullName());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java
index 87e2e027..75937ef7 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java
@@ -48,42 +48,42 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
@Override
public Result<RoleDAO.Data> exec(final AuthzTrans trans, final Role r,final RoleModify.Modify modify) {
Result<List<Data>> rr = q.roleDAO.read(trans, r.ns,r.name);
- if(dryRun) {
- if(rr.isOKhasData()) {
+ if (dryRun) {
+ if (rr.isOKhasData()) {
return Result.ok(rr.value.get(0));
} else {
return Result.err(Result.ERR_NotFound, "Data not Found " + r.toString());
}
} else {
Result<Data> rv = null;
- if(rr.isOKhasData()) {
- for(final Data d : rr.value) {
+ if (rr.isOKhasData()) {
+ for (final Data d : rr.value) {
modify.change(d);
- if(d.ns.equals(r.ns) && d.name.equals(r.name)) {
+ if (d.ns.equals(r.ns) && d.name.equals(r.name)) {
// update for fields
// In either case, adjust Roles
- for(String p : d.perms) {
- if(!r.perms.contains(p)) {
+ for (String p : d.perms) {
+ if (!r.perms.contains(p)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans, q, p);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
q.roleDAO.dao().addPerm(trans, d, rpdd.value);
}
}
}
- for(String p : r.perms) {
- if(!d.perms.contains(p)) {
+ for (String p : r.perms) {
+ if (!d.perms.contains(p)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans, q, p);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
q.roleDAO.dao().delPerm(trans, d, rpdd.value);
}
}
}
rv = Result.ok(d);
} else {
- for(String p : d.perms) {
+ for (String p : d.perms) {
Perm perm = Perm.keys.get(p);
- if(perm!=null) {
- if(perm.roles.contains(r.encode())) {
+ if (perm!=null) {
+ if (perm.roles.contains(r.encode())) {
modify.permModify().exec(trans, perm, new PermModify.Modify() {
@Override
public RoleModify roleModify() {
@@ -100,11 +100,11 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
}
}
Result<List<Data>> preexist = q.roleDAO.read(trans, d);
- if(preexist.isOKhasData()) {
+ if (preexist.isOKhasData()) {
Data rdd = preexist.value.get(0);
- for(String p : d.perms) {
+ for (String p : d.perms) {
Result<PermDAO.Data> perm = PermDAO.Data.decode(trans, q, p);
- if(perm.isOKhasData()) {
+ if (perm.isOKhasData()) {
q.roleDAO.dao().addPerm(trans,rdd, perm.value);
}
}
@@ -112,7 +112,7 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
} else {
rv = q.roleDAO.create(trans, d);
}
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("Updating %s|%s to %s|%s", r.ns, r.name, d.ns, d.name);
RoleDAO.Data rmme = new RoleDAO.Data();
rmme.ns=r.ns;
@@ -127,7 +127,7 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
} else {
rv = Result.err(rr);
}
- if(rv==null) {
+ if (rv==null) {
rv = Result.err(Status.ERR_General,"Never get to this code");
}
return rv;
@@ -140,7 +140,7 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
}
public Result<Void> delete(AuthzTrans trans, Role r) {
- if(dryRun) {
+ if (dryRun) {
return Result.ok();
} else {
RoleDAO.Data data = new RoleDAO.Data();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java
index b6baea6c..4538c56b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java
@@ -44,7 +44,7 @@ public class URAdd extends ActionDAO<UserRole,UserRoleDAO.Data,String> {
@Override
public Result<Data> exec(AuthzTrans trans, UserRole ur, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Add:",text,ur.role(),ur.user(),"on",Chrono.dateOnlyStamp(ur.expires()));
return Result.ok(ur.urdd());
} else {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java
index d54b7805..cf519f6f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java
@@ -42,12 +42,12 @@ public class URDelete extends ActionDAO<UserRole,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, UserRole ur,String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Delete UserRole:",text,ur.user(),ur.role(),"on",Chrono.dateOnlyStamp(ur.expires()));
return Result.ok();
} else {
Result<Void> rv = q.userRoleDAO.delete(trans,ur.urdd(), true); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Deleted UserRole:",text,ur.user(),ur.role(),"on",Chrono.dateOnlyStamp(ur.expires()));
} else {
trans.error().log("Error Deleting User Role -",rv.details,":",ur.user(),ur.role(),"on",Chrono.dateOnlyStamp(ur.expires()) );
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java
index 8590714f..36b476e1 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java
@@ -59,11 +59,11 @@ public class URFutureApprove extends ActionDAO<UserRole, String,String> implemen
@Override
public Result<String> exec(AuthzTrans trans, UserRole ur,String text) {
- if(dryRun) {
+ if (dryRun) {
return Result.ok(text);
} else {
Result<NsDAO.Data> rns = q.deriveNs(trans, ur.ns());
- if(rns.isOK()) {
+ if (rns.isOK()) {
FutureDAO.Data data = new FutureDAO.Data();
data.id=null; // let Create function assign UUID
@@ -78,7 +78,7 @@ public class URFutureApprove extends ActionDAO<UserRole, String,String> implemen
return Result.err(e);
}
Result<String> rfuture = f.createFuture(trans, data, Function.FOP_USER_ROLE, ur.user(), rns.value, FUTURE_OP.A);
- if(rfuture.isOK()) {
+ if (rfuture.isOK()) {
trans.info().log(rfuture.value, text, ur.user(), data.memo);
} else {
trans.error().log(rfuture.details, text);
@@ -93,15 +93,15 @@ public class URFutureApprove extends ActionDAO<UserRole, String,String> implemen
@Override
public String key(UserRole ur) {
String expire;
- if(expires.before(start)) {
+ if (expires.before(start)) {
expire = "' - EXPIRED ";
} else {
expire = "' - expiring ";
}
- if(Question.OWNER.equals(ur.rname())) {
+ if (Question.OWNER.equals(ur.rname())) {
return Approval.RE_VALIDATE_OWNER + ur.ns() + expire + Chrono.dateOnlyStamp(ur.expires());
- } else if(Question.ADMIN.equals(ur.rname())) {
+ } else if (Question.ADMIN.equals(ur.rname())) {
return Approval.RE_VALIDATE_ADMIN + ur.ns() + expire + Chrono.dateOnlyStamp(ur.expires());
} else {
return Approval.RE_APPROVAL_IN_ROLE + ur.role() + expire + Chrono.dateOnlyStamp(ur.expires());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java
index fcba2364..75bbd813 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java
@@ -52,16 +52,16 @@ public class URFutureApproveExec extends ActionDAO<List<Approval>, OP_STATUS, Fu
@Override
public Result<OP_STATUS> exec(AuthzTrans trans, List<Approval> app, Future future) {
- if(dryRun) {
+ if (dryRun) {
return Result.err(Result.ERR_ActionNotCompleted,"Not Executed");
} else {
// Save on Lookups
final List<ApprovalDAO.Data> apprs = new ArrayList<>();
final List<UserRoleDAO.Data> urs = new ArrayList<>();
- for(Approval a : app) {
+ for (Approval a : app) {
apprs.add(a.add);
UserRole ur = UserRole.get(a.add.user, future.role);
- if(ur!=null) {
+ if (ur!=null) {
urs.add(ur.urdd());
}
}
@@ -76,9 +76,9 @@ public class URFutureApproveExec extends ActionDAO<List<Approval>, OP_STATUS, Fu
@Override
public UserRoleDAO.Data get(AuthzTrans trans, Object ... keys) {
List<UserRole> lur = UserRole.getByUser().get(keys[0]);
- if(lur!=null) {
- for(UserRole ur : lur) {
- if(ur.role().equals(keys[1])) {
+ if (lur!=null) {
+ for (UserRole ur : lur) {
+ if (ur.role().equals(keys[1])) {
return ur.urdd();
}
}
@@ -86,7 +86,7 @@ public class URFutureApproveExec extends ActionDAO<List<Approval>, OP_STATUS, Fu
return null;
}
});
- if(rv.isOK()) {
+ if (rv.isOK()) {
switch(rv.value) {
case D:
trans.info().printf("Denied %s on %s", future.memo(),future.fdd.target);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java
index a7d420e3..12460c97 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java
@@ -45,22 +45,22 @@ public class URModify extends ActionDAO<UserRole,Void,URModify.Modify> {
@Override
public Result<Void> exec(AuthzTrans trans, UserRole ur,Modify modify) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would Update %s %s", ur.user(), ur.role());
return Result.ok();
} else {
Result<List<Data>> rr = q.userRoleDAO.read(trans, ur.user(),ur.role());
- if(rr.notOKorIsEmpty()) {
+ if (rr.notOKorIsEmpty()) {
return Result.err(rr);
}
- for(Data d : rr.value) {
+ for (Data d : rr.value) {
modify.change(d);
- if(!(ur.expires().equals(d.expires))) {
+ if (!(ur.expires().equals(d.expires))) {
ur.expires(d.expires);
}
- if(ur.user().equals(d.user) && ur.role().equals(d.role)){
+ if (ur.user().equals(d.user) && ur.role().equals(d.role)){
Result<Void> rv = q.userRoleDAO.update(trans, d);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("Updated %s %s to %s", ur.user(), ur.role(), d.toString());
} else {
trans.info().log(rv.errorString());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java
index 856c89dc..6371ebb5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java
@@ -45,16 +45,16 @@ public class URPunt extends ActionPuntDAO<UserRole,Void,String> {
}
public Result<Void> exec(AuthzTrans trans, UserRole ur, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Update User",ur.user(),"and Role", ur.role(), text);
return Result.ok();
} else {
Result<List<Data>> read = q.userRoleDAO.read(trans, ur.user(), ur.role());
- if(read.isOK()) {
- for(UserRoleDAO.Data data : read.value) {
+ if (read.isOK()) {
+ for (UserRoleDAO.Data data : read.value) {
Date from = data.expires;
data.expires = puntDate(from);
- if(data.expires.compareTo(from)<=0) {
+ if (data.expires.compareTo(from)<=0) {
trans.debug().printf("Error: %s is same or before %s", Chrono.dateOnlyStamp(data.expires), Chrono.dateOnlyStamp(from));
} else {
trans.info().log("Updating User",ur.user(),"and Role", ur.role(), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires), text);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java
index 94c709b3..a4c4efbc 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java
@@ -70,19 +70,19 @@ public class Approval implements CacheChange.Data {
}
public static String roleFromMemo(String memo) {
- if(memo==null) {
+ if (memo==null) {
return null;
}
int first = memo.indexOf('\'');
- if(first>=0) {
+ if (first>=0) {
int second = memo.indexOf('\'', ++first);
- if(second>=0) {
+ if (second>=0) {
String role = memo.substring(first, second);
- if(memo.startsWith(RE_VALIDATE_ADMIN)) {
+ if (memo.startsWith(RE_VALIDATE_ADMIN)) {
return role + ".admin";
- } else if(memo.startsWith(RE_VALIDATE_OWNER)) {
+ } else if (memo.startsWith(RE_VALIDATE_OWNER)) {
return role + ".owner";
- } else if(memo.startsWith(RE_APPROVAL_IN_ROLE)) {
+ } else if (memo.startsWith(RE_APPROVAL_IN_ROLE)) {
return role;
}
}
@@ -106,14 +106,14 @@ public class Approval implements CacheChange.Data {
try {
List<Approval> ln;
- for(Row row : results.all()) {
+ for (Row row : results.all()) {
++count;
try {
Approval app = creator.create(row);
String person = app.getApprover();
- if(person!=null) {
+ if (person!=null) {
ln = byApprover.get(person);
- if(ln==null) {
+ if (ln==null) {
ln = new ArrayList<>();
byApprover.put(app.getApprover(), ln);
}
@@ -122,18 +122,18 @@ public class Approval implements CacheChange.Data {
person = app.getUser();
- if(person!=null) {
+ if (person!=null) {
ln = byUser.get(person);
- if(ln==null) {
+ if (ln==null) {
ln = new ArrayList<>();
byUser.put(app.getUser(), ln);
}
ln.add(app);
}
UUID ticket = app.getTicket();
- if(ticket!=null) {
+ if (ticket!=null) {
ln = byTicket.get(ticket);
- if(ln==null) {
+ if (ln==null) {
ln = new ArrayList<>();
byTicket.put(app.getTicket(), ln);
}
@@ -152,25 +152,25 @@ public class Approval implements CacheChange.Data {
@Override
public void expunge() {
List<Approval> la = byApprover.get(getApprover());
- if(la!=null) {
+ if (la!=null) {
la.remove(this);
}
la = byUser.get(getUser());
- if(la!=null) {
+ if (la!=null) {
la.remove(this);
}
UUID ticket = this.add==null?null:this.add.ticket;
- if(ticket!=null) {
+ if (ticket!=null) {
la = byTicket.get(this.add.ticket);
- if(la!=null) {
+ if (la!=null) {
la.remove(this);
}
}
}
public void update(AuthzTrans trans, ApprovalDAO apprDAO, boolean dryRun) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would update Approval %s, %s, last_notified %s",add.id,add.status,add.last_notified);
} else {
trans.info().printf("Update Approval %s, %s, last_notified %s",add.id,add.status,add.last_notified);
@@ -272,11 +272,11 @@ public class Approval implements CacheChange.Data {
}
public void delayDelete(AuthzTrans trans, ApprovalDAO ad, boolean dryRun, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log(text,"- Would Delete: Approval",getId(),"on ticket",getTicket(),"for",getApprover());
} else {
Result<Void> rv = ad.delete(trans, add, false);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log(text,"- Deleted: Approval",getId(),"on ticket",getTicket(),"for",getApprover());
cache.delayedDelete(this);
} else {
@@ -295,8 +295,8 @@ public class Approval implements CacheChange.Data {
}
public static void delayDelete(AuthzTrans noAvg, ApprovalDAO apprDAO, boolean dryRun, List<Approval> list, String text) {
- if(list!=null) {
- for(Approval a : list) {
+ if (list!=null) {
+ for (Approval a : list) {
a.delayDelete(noAvg, apprDAO, dryRun,text);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java
index 1adc3d08..1407bdd0 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java
@@ -44,10 +44,10 @@ public class CacheChange<T extends CacheChange.Data> {
}
public final void resetLocalData() {
- if(removed==null || removed.isEmpty()) {
+ if (removed==null || removed.isEmpty()) {
return;
}
- for(T t : removed) {
+ for (T t : removed) {
t.expunge();
}
removed.clear();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java
index 11580b80..a3eb8363 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java
@@ -29,7 +29,7 @@ public abstract class Creator<T> {
public String query(String where) {
StringBuilder sb = new StringBuilder(select());
- if(where!=null) {
+ if (where!=null) {
sb.append(" WHERE ");
sb.append(where);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java
index 4013f193..2f6ed415 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java
@@ -71,20 +71,20 @@ public class Cred {
public Date last(final int ... types) {
Date last = null;
- for(Instance i : instances) {
- if(types.length>0) { // filter by types, if requested
+ for (Instance i : instances) {
+ if (types.length>0) { // filter by types, if requested
boolean quit = true;
- for(int t : types) {
- if(t==i.type) {
+ for (int t : types) {
+ if (t==i.type) {
quit=false;
break;
}
}
- if(quit) {
+ if (quit) {
continue;
}
}
- if(last==null || i.expires.after(last)) {
+ if (last==null || i.expires.after(last)) {
last = i.expires;
}
}
@@ -94,7 +94,7 @@ public class Cred {
public Set<Integer> types() {
Set<Integer> types = new HashSet<>();
- for(Instance i : instances) {
+ for (Instance i : instances) {
types.add(i.type);
}
return types;
@@ -129,42 +129,42 @@ public class Cred {
String id;
tt = trans.start("Load Credentials", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
++count;
row = iter.next();
id = row.getString(0);
type = row.getInt(1);
- if(types.length>0) { // filter by types, if requested
+ if (types.length>0) { // filter by types, if requested
boolean quit = true;
- for(int t : types) {
- if(t==type) {
+ for (int t : types) {
+ if (t==type) {
quit=false;
break;
}
}
- if(quit) {
+ if (quit) {
continue;
}
}
Cred cred = data.get(id);
- if(cred==null) {
+ if (cred==null) {
cred = new Cred(id);
data.put(id, cred);
}
cred.instances.add(new Instance(type, row.getTimestamp(2), row.getInt(3), row.getLong(4)/1000));
List<Cred> lscd = byNS.get(cred.ns);
- if(lscd==null) {
+ if (lscd==null) {
byNS.put(cred.ns, (lscd=new ArrayList<>()));
}
boolean found = false;
- for(Cred c : lscd) {
- if(c.id.equals(cred.id)) {
+ for (Cred c : lscd) {
+ if (c.id.equals(cred.id)) {
found=true;
break;
}
}
- if(!found) {
+ if (!found) {
lscd.add(cred);
}
}
@@ -184,7 +184,7 @@ public class Cred {
*/
public static CredCount count(int numbuckets) {
CredCount cc = new CredCount(numbuckets);
- for(Cred c : data.values()) {
+ for (Cred c : data.values()) {
for (Instance ci : c.instances) {
cc.inc(ci.type,ci.written, ci.expires);
}
@@ -228,7 +228,7 @@ public class Cred {
gc.set(GregorianCalendar.SECOND,0);
gc.set(GregorianCalendar.MILLISECOND,0);
gc.add(GregorianCalendar.MILLISECOND, -1); // last milli of month
- for(int i=1;i<numbuckets;++i) {
+ for (int i=1;i<numbuckets;++i) {
dates[i] = gc.getTime();
gc.add(GregorianCalendar.MONTH, -1);
}
@@ -236,14 +236,14 @@ public class Cred {
}
public void inc(int type, Date start, Date expires) {
- for(int i=0;i<dates.length-1;++i) {
- if(start.before(dates[i])) {
- if(type==CredDAO.CERT_SHA256_RSA) {
- if(start.after(dates[i+1])) {
+ for (int i=0;i<dates.length-1;++i) {
+ if (start.before(dates[i])) {
+ if (type==CredDAO.CERT_SHA256_RSA) {
+ if (start.after(dates[i+1])) {
++x509Added[i];
}
}
- if(expires.after(dates[i])) {
+ if (expires.after(dates[i])) {
switch(type) {
case CredDAO.RAW:
++raw[i];
@@ -276,7 +276,7 @@ public class Cred {
public String toString() {
StringBuilder sb = new StringBuilder(id);
sb.append('[');
- for(Instance i : instances) {
+ for (Instance i : instances) {
sb.append('{');
sb.append(i.type);
sb.append(",\"");
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java
index 0c618eeb..8a11479e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java
@@ -98,15 +98,15 @@ public class Future implements CacheChange.Data, Comparable<Future> {
int count = 0;
tt = trans.start("Process Futures", Env.SUB);
try {
- for(Row row : results.all()) {
+ for (Row row : results.all()) {
++count;
Future f = creator.create(row);
data.put(f.fdd.id,f);
- if(f.role==null) {
+ if (f.role==null) {
continue;
}
List<Future> lf = byRole.get(f.role);
- if(lf==null) {
+ if (lf==null) {
lf = new ArrayList<>();
byRole.put(f.role,lf);
}
@@ -148,16 +148,16 @@ public class Future implements CacheChange.Data, Comparable<Future> {
public Result<Void> delayedDelete(AuthzTrans trans, FutureDAO fd, boolean dryRun, String text) {
Result<Void> rv;
- if(dryRun) {
+ if (dryRun) {
trans.info().log(text,"- Would Delete: ",fdd.id,fdd.memo,"expiring on",Chrono.dateOnlyStamp(fdd.expires));
rv = Result.ok();
} else {
rv = fd.delete(trans, fdd, true); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log(text, "- Deleted:",fdd.id,fdd.memo,"expiring on",Chrono.dateOnlyStamp(fdd.expires));
cache.delayedDelete(this);
} else {
- if(rv.status!=6) {
+ if (rv.status!=6) {
trans.info().log(text,"- Failed to Delete Future", fdd.id);
}
}
@@ -171,9 +171,9 @@ public class Future implements CacheChange.Data, Comparable<Future> {
@Override
public void expunge() {
data.remove(fdd.id);
- if(role!=null) {
+ if (role!=null) {
List<Future> lf = byRole.get(role);
- if(lf!=null) {
+ if (lf!=null) {
lf.remove(this);
}
}
@@ -181,7 +181,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
@Override
public int compareTo(Future o) {
- if(o==null) {
+ if (o==null) {
return -1;
}
return fdd.id.compareTo(o.fdd.id);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java
index c0841590..cffb55a5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java
@@ -84,7 +84,7 @@ public class History {
Row row;
tt = trans.start("Load History", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
++count;
row = iter.next();
loader.exec(creator.create(row));
@@ -151,9 +151,9 @@ public class History {
ByteBuffer bb = row.getBytes(3);
sb.setLength(0);
- if(bb!=null && bb.hasRemaining()) {
+ if (bb!=null && bb.hasRemaining()) {
sb.append("0x");
- while(bb.hasRemaining()) {
+ while (bb.hasRemaining()) {
sb.append(String.format("%02x",bb.get()));
}
bb.flip();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java
index 60b34af9..5fb3e5dc 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java
@@ -58,7 +58,7 @@ public class InputIterator implements Iterable<String> {
@Override
public String next() {
- if(!hasNext()) {
+ if (!hasNext()) {
throw new NoSuchElementException();
}
return input;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java
index afa68c08..8eecb656 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java
@@ -64,7 +64,7 @@ public class MiscID {
* @throws IllegalArgumentException
*/
public void set(String row []) throws BatchException {
- if(row.length<4) {throw new BatchException("Row of MiscID_XRef is too short");}
+ if (row.length<4) {throw new BatchException("Row of MiscID_XRef is too short");}
id = row[0];
sponsor = row[1];
created = row[2];
@@ -106,7 +106,7 @@ public class MiscID {
try {
tt = trans.start("Load Map", Env.SUB);
try {
- for( Row row : results.all()) {
+ for ( Row row : results.all()) {
MiscID miscID = new MiscID();
miscID.set(row);
data.put(miscID.id,miscID);
@@ -133,7 +133,7 @@ public class MiscID {
*/
@Override
public boolean equals(Object obj) {
- if(obj!=null && obj instanceof MiscID) {
+ if (obj!=null && obj instanceof MiscID) {
return id.equals(((MiscID)obj).id);
}
return false;
@@ -156,12 +156,12 @@ public class MiscID {
public StringBuilder updateStmt(MiscID source) {
StringBuilder sb = null;
- if(id.equals(source.id)) {
+ if (id.equals(source.id)) {
sb = addField(sb,"sponser",sponsor,source.sponsor);
sb = addField(sb,"created",created,source.created);
sb = addField(sb,"renewal",renewal,source.renewal);
}
- if(sb!=null) {
+ if (sb!=null) {
sb.append(" WHERE id='");
sb.append(id);
sb.append('\'');
@@ -170,8 +170,8 @@ public class MiscID {
}
private StringBuilder addField(StringBuilder sb, String name, String a, String b) {
- if(!a.equals(b)) {
- if(sb==null) {
+ if (!a.equals(b)) {
+ if (sb==null) {
sb = new StringBuilder("UPDATE authz.miscid SET ");
} else {
sb.append(',');
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java
index e9321f5f..e15a6bc2 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java
@@ -42,15 +42,15 @@ public class MonthData {
public MonthData(String env) throws IOException {
f = new File("Monthly"+env+".dat");
- if(f.exists()) {
+ if (f.exists()) {
BufferedReader br = new BufferedReader(new FileReader(f));
try {
String line;
String[] split;
- while((line=br.readLine())!=null) {
- if(!line.startsWith("#")) {
+ while ((line=br.readLine())!=null) {
+ if (!line.startsWith("#")) {
split = Split.split(',', line);
- if(split.length==5) {
+ if (split.length==5) {
add(Integer.parseInt(split[0]),split[1],
Integer.parseInt(split[2]),
Integer.parseInt(split[3]),
@@ -67,7 +67,7 @@ public class MonthData {
public void add(int yr_mon, String target, long total, long adds, long drops) {
Set<Row> row = data.get(yr_mon);
- if(row==null) {
+ if (row==null) {
data.put(yr_mon, (row=new HashSet<>()));
}
row.add(new Row(target,total,adds,drops));
@@ -101,14 +101,14 @@ public class MonthData {
}
public void write() throws IOException {
- if(f.exists()) {
+ if (f.exists()) {
File bu = new File(f.getName()+".bak");
f.renameTo(bu);
}
PrintStream ps = new PrintStream(f);
try {
- for( Entry<Integer, Set<Row>> rows : data.entrySet()) {
- for(Row row : rows.getValue()) {
+ for ( Entry<Integer, Set<Row>> rows : data.entrySet()) {
+ for (Row row : rows.getValue()) {
ps.printf("%d,%s,%d,%d,%d\n",rows.getKey(),row.target,row.total,row.adds,row.drops);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java
index a2833e55..5692d116 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java
@@ -81,7 +81,7 @@ public class NS implements Comparable<NS> {
Row row;
tt = trans.start("Load Namespaces", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
row = iter.next();
NS ns = creator.create(row);
data.put(ns.name,ns);
@@ -143,9 +143,9 @@ public class NS implements Comparable<NS> {
}
}
public static NSSplit deriveParent(String dotted) {
- if(dotted==null)return null;
- for(int idx = dotted.lastIndexOf('.');idx>=0; idx=dotted.lastIndexOf('.',idx-1)) {
- if(data.get(dotted.substring(0, idx))!=null) {
+ if (dotted==null)return null;
+ for (int idx = dotted.lastIndexOf('.');idx>=0; idx=dotted.lastIndexOf('.',idx-1)) {
+ if (data.get(dotted.substring(0, idx))!=null) {
return new NSSplit(dotted,idx);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java
index abfd1ca4..b178c377 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java
@@ -61,8 +61,8 @@ public class Notification {
}
public static TYPE get(int idx) {
- for(TYPE nt : TYPE.values()) {
- if(idx==nt.type) {
+ for (TYPE nt : TYPE.values()) {
+ if (idx==nt.type) {
return nt;
}
}
@@ -107,12 +107,12 @@ public class Notification {
tt = trans.start("Process Notify", Env.SUB);
try {
- for(Row row : results.all()) {
+ for (Row row : results.all()) {
++count;
try {
Notification not = creator.create(row);
List<Notification> ln = data.get(not.user);
- if(ln==null) {
+ if (ln==null) {
ln = new ArrayList<>();
data.put(not.user, ln);
}
@@ -129,9 +129,9 @@ public class Notification {
public static Notification get(String user, TYPE type) {
List<Notification> ln = data.get(user);
- if(ln!=null) {
- for(Notification n : ln) {
- if(type.equals(n.type)) {
+ if (ln!=null) {
+ for (Notification n : ln) {
+ if (type.equals(n.type)) {
return n;
}
}
@@ -148,7 +148,7 @@ public class Notification {
public Notification create(Row row) {
int idx =row.getInt(1);
TYPE type = TYPE.get(idx);
- if(type==null) {
+ if (type==null) {
return null;
}
return new Notification(row.getString(0), type, row.getTimestamp(2), row.getInt(3));
@@ -166,11 +166,11 @@ public class Notification {
}
public int checksum() {
- if(msg==null) {
+ if (msg==null) {
current=0;
- } else if(current==0) {
- for(String l : msg.lines) {
- for(byte b : l.getBytes()) {
+ } else if (current==0) {
+ for (String l : msg.lines) {
+ for (byte b : l.getBytes()) {
current+=b;
}
}
@@ -180,7 +180,7 @@ public class Notification {
public boolean update(AuthzTrans trans, Session session, boolean dryRun) {
checksum();
- if(last==null || current==0 || current!=checksum) {
+ if (last==null || current==0 || current!=checksum) {
last = now;
current = checksum();
String update = "UPDATE authz.notify SET " +
@@ -192,7 +192,7 @@ public class Notification {
"' AND type=" +
type.idx() +
";";
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would",update);
} else {
session.execute(update);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java
index d980bcc2..a3354f38 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java
@@ -76,20 +76,20 @@ public class NsAttrib {
tt = trans.start("Process NsAttributes", Env.SUB);
try {
- for(Row row : results.all()) {
+ for (Row row : results.all()) {
++count;
NsAttrib ur = creator.create(row);
data.add(ur);
List<NsAttrib> lna = byKey.get(ur.key);
- if(lna==null) {
+ if (lna==null) {
lna = new ArrayList<>();
byKey.put(ur.key, lna);
}
lna.add(ur);
lna = byNS.get(ur.ns);
- if(lna==null) {
+ if (lna==null) {
lna = new ArrayList<>();
byNS.put(ur.ns, lna);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java
index 799ce4df..ce22724b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java
@@ -47,21 +47,21 @@ public class Perm implements Comparable<Perm> {
public final Set<String> roles;
public String encode() {
- if(encode == null) {
+ if (encode == null) {
encode = ns + '|' + type + '|' + instance + '|' + action;
}
return encode;
}
public String fullType() {
- if(fullType==null) {
+ if (fullType==null) {
fullType = ns + '.' + type;
}
return fullType;
}
public String fullPerm() {
- if(fullPerm==null) {
+ if (fullPerm==null) {
fullPerm = ns + '.' + type + '|' + instance + '|' + action;
}
return fullPerm;
@@ -104,7 +104,7 @@ public class Perm implements Comparable<Perm> {
Row row;
tt = trans.start("Load Perms", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
row = iter.next();
Perm pk = new Perm(
row.getString(0),row.getString(1),row.getString(2),
@@ -164,7 +164,7 @@ public class Perm implements Comparable<Perm> {
}
public static void executeRemove() {
- for(Perm p : deletePerms) {
+ for (Perm p : deletePerms) {
keys.remove(p.encode);
data.remove(p);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java
index 46d3cced..04a5dceb 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java
@@ -64,14 +64,14 @@ public class Role implements Comparable<Role> {
}
public String encode() {
- if(encode==null) {
+ if (encode==null) {
encode = ns + '|' + name;
}
return encode;
}
public String fullName() {
- if(full==null) {
+ if (full==null) {
full = ns + '.' + name;
}
return full;
@@ -102,7 +102,7 @@ public class Role implements Comparable<Role> {
Row row;
tt = trans.start("Load Roles", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
row = iter.next();
Role rk =new Role(row.getString(0),row.getString(1), row.getString(2),row.getSet(3,String.class));
keys.put(rk.encode(), rk);
@@ -165,7 +165,7 @@ public class Role implements Comparable<Role> {
}
public static void executeRemove() {
- for(Role p : deleteRoles) {
+ for (Role p : deleteRoles) {
keys.remove(p.encode);
data.remove(p);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java
index fab9233d..762f6c66 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java
@@ -143,21 +143,21 @@ public class UserRole implements Cloneable, CacheChange.Data {
private static void iterateResults(Creator<UserRole> creator, Iterator<Row> iter ) {
Row row;
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
++totalLoaded;
row = iter.next();
UserRole ur = creator.create(row);
data.add(ur);
List<UserRole> lur = byUser.get(ur.urdd.user);
- if(lur==null) {
+ if (lur==null) {
lur = new ArrayList<>();
byUser.put(ur.urdd.user, lur);
}
lur.add(ur);
lur = byRole.get(ur.urdd.role);
- if(lur==null) {
+ if (lur==null) {
lur = new ArrayList<>();
byRole.put(ur.urdd.role, lur);
}
@@ -178,12 +178,12 @@ public class UserRole implements Cloneable, CacheChange.Data {
data.remove(this);
List<UserRole> lur = byUser.get(urdd.user);
- if(lur!=null) {
+ if (lur!=null) {
lur.remove(this);
}
lur = byRole.get(urdd.role);
- if(lur!=null) {
+ if (lur!=null) {
lur.remove(this);
}
}
@@ -245,10 +245,10 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static UserRole get(String u, String r) {
List<UserRole> lur = byUser.get(u);
- if(lur!=null) {
- for(UserRole ur : lur) {
+ if (lur!=null) {
+ for (UserRole ur : lur) {
- if(ur.urdd.role.equals(r)) {
+ if (ur.urdd.role.equals(r)) {
return ur;
}
}
@@ -260,7 +260,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
// We write to a file, and validate. If the size is iffy, we email Support
public void delayDelete(AuthzTrans trans, String text, boolean dryRun) {
String dt = Chrono.dateTime(urdd.expires);
- if(dryRun) {
+ if (dryRun) {
trans.info().printf(LOG_FMT,text,"Would Delete",urdd.user,urdd.role,urdd.ns,urdd.rname,dt);
} else {
trans.info().printf(LOG_FMT,text,"Staged Deletion",urdd.user,urdd.role,urdd.ns,urdd.rname,dt);
@@ -289,7 +289,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
}
public static void actuateDeletionNow(AuthzTrans trans, URDelete directDel) {
- for(UserRole ur : cache.getRemoved()) {
+ for (UserRole ur : cache.getRemoved()) {
directDel.exec(trans, ur, "Actuating UserRole Deletion");
}
cache.getRemoved().clear();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java
index 4555857a..f4a0f37c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java
@@ -150,7 +150,7 @@ public class JavaxMailer implements Mailer {
try{
addressArray[count] = new InternetAddress(addr);
count++;
- }catch(Exception e){
+ } catch (Exception e){
throw new OrganizationException("Failed to parse the email address "+ addr +": "+e.getMessage());
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java
index 886bd56a..d34f9248 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java
@@ -76,20 +76,20 @@ public class ExpiringNext extends Batch {
List<String> expiring = new ArrayList<>();
trans.info().log("Checking for Expired UserRoles");
- for(UserRole ur : UserRole.getData()) {
- if(ur.expires().after(now)) {
- if(ur.expires().before(twoWeeks)) {
+ for (UserRole ur : UserRole.getData()) {
+ if (ur.expires().after(now)) {
+ if (ur.expires().before(twoWeeks)) {
expiring.add(Chrono.dateOnlyStamp(ur.expires()) + ":\t" + ur.user() + '\t' + ur.role());
}
- if(ur.expires().before(earliestUR)) {
+ if (ur.expires().before(earliestUR)) {
earliestUR = ur.expires();
}
}
}
- if(expiring.size()>0) {
+ if (expiring.size()>0) {
Collections.sort(expiring,Collections.reverseOrder());
- for(String s : expiring) {
+ for (String s : expiring) {
System.err.print('\t');
System.err.println(s);
}
@@ -101,30 +101,30 @@ public class ExpiringNext extends Batch {
expiring.clear();
trans.info().log("Checking for Expired Credentials");
- for( Cred creds : Cred.data.values()) {
+ for ( Cred creds : Cred.data.values()) {
Instance lastInstance=null;
- for(Instance inst : creds.instances) {
- if(inst.type==CredDAO.BASIC_AUTH || inst.type==CredDAO.BASIC_AUTH_SHA256) {
- if(lastInstance == null || inst.expires.after(lastInstance.expires)) {
+ for (Instance inst : creds.instances) {
+ if (inst.type==CredDAO.BASIC_AUTH || inst.type==CredDAO.BASIC_AUTH_SHA256) {
+ if (lastInstance == null || inst.expires.after(lastInstance.expires)) {
lastInstance = inst;
}
}
}
- if(lastInstance!=null) {
- if(lastInstance.expires.after(now)) {
- if(lastInstance.expires.before(twoWeeks)) {
+ if (lastInstance!=null) {
+ if (lastInstance.expires.after(now)) {
+ if (lastInstance.expires.before(twoWeeks)) {
expiring.add(Chrono.dateOnlyStamp(lastInstance.expires) + ": \t" + creds.id);
}
}
- if(lastInstance.expires.before(earliestCred)) {
+ if (lastInstance.expires.before(earliestCred)) {
earliestCred = lastInstance.expires;
}
}
}
- if(expiring.size()>0) {
+ if (expiring.size()>0) {
Collections.sort(expiring,Collections.reverseOrder());
- for(String s : expiring) {
+ for (String s : expiring) {
System.err.print('\t');
System.err.println(s);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java
index 868811a3..e9f0e726 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java
@@ -117,7 +117,7 @@ public class Expiring extends Batch {
}
File data_dir = new File(env.getProperty("aaf_data_dir"));
- if(!data_dir.exists() || !data_dir.canWrite() || !data_dir.canRead()) {
+ if (!data_dir.exists() || !data_dir.canWrite() || !data_dir.canRead()) {
throw new IOException("Cannot read/write to Data Directory "+ data_dir.getCanonicalPath() + ": EXITING!!!");
}
UserRole.setDeleteStream(
@@ -137,7 +137,7 @@ public class Expiring extends Batch {
email.preamble("Expiring Process Alert for %s",batchEnv);
email.signature("Sincerely,\nAAF Expiring Batch Process\n");
String address = env.getProperty("ALERT_TO_ADDRESS");
- if(address==null) {
+ if (address==null) {
throw new APIException("ALERT_TO_ADDRESS property is required");
}
email.addTo(address);
@@ -169,30 +169,30 @@ public class Expiring extends Batch {
// Clean out Approvals UserRoles are fixed up.
String memo;
- for(List<Approval> la : Approval.byUser.values()) {
- for(Approval a : la ) {
+ for (List<Approval> la : Approval.byUser.values()) {
+ for (Approval a : la ) {
memo = a.getMemo();
- if(memo!=null && (memo.contains("Re-Approval") || memo.contains("Re-Validate"))) {
+ if (memo!=null && (memo.contains("Re-Approval") || memo.contains("Re-Validate"))) {
String role = a.getRole();
- if(role!=null) {
+ if (role!=null) {
UserRole ur = UserRole.get(a.getUser(), a.getRole());
Future f=null;
- if(ur!=null) {
- if(ur.expires().after(future)) { // no need for Approval anymore
+ if (ur!=null) {
+ if (ur.expires().after(future)) { // no need for Approval anymore
a.delayDelete(noAvg, apprDAO, dryRun, "User Role already Extended");
UUID tkt = a.getTicket();
- if(tkt!=null && Future.data.containsKey(tkt)) {
+ if (tkt!=null && Future.data.containsKey(tkt)) {
f = Future.data.get(a.getTicket());
}
}
} else {
a.delayDelete(noAvg, apprDAO, dryRun, "User Role does not exist");
UUID tkt = a.getTicket();
- if(tkt !=null && Future.data.containsKey(tkt)) {
+ if (tkt !=null && Future.data.containsKey(tkt)) {
f = Future.data.get(a.getTicket());
}
}
- if(f!=null) {
+ if (f!=null) {
f.delayedDelete(noAvg, futureDAO, dryRun, "Approvals removed");
}
}
@@ -212,12 +212,12 @@ public class Expiring extends Batch {
tt = trans.start("Delete old Futures", Env.REMOTE);
trans.info().log("### Running Future Execution on ",Future.data.size(), "Items");
// Execute any Futures waiting
- for(Future f : Future.data.values()) {
- if(f.memo().contains("Re-Approval") || f.memo().contains("Re-Validate")) {
+ for (Future f : Future.data.values()) {
+ if (f.memo().contains("Re-Approval") || f.memo().contains("Re-Validate")) {
List<Approval> la = Approval.byTicket.get(f.id());
- if(la!=null) {
+ if (la!=null) {
Result<OP_STATUS> ruf = urFutureApproveExec.exec(noAvg,la,f);
- if(ruf.isOK()) {
+ if (ruf.isOK()) {
switch(ruf.value) {
case P:
break;
@@ -246,11 +246,11 @@ public class Expiring extends Batch {
String expiredBeforeNow = "Expired before " + tooLate;
String expiredAfterFuture = "Expired after " + future;
try {
- for(Future f : Future.data.values()) {
- if(f.expires().before(tooLate)) {
+ for (Future f : Future.data.values()) {
+ if (f.expires().before(tooLate)) {
f.delayedDelete(noAvg,futureDAO,dryRun, expiredBeforeNow);
Approval.delayDelete(noAvg, apprDAO, dryRun, Approval.byTicket.get(f.id()), expiredBeforeNow);
- } else if(f.expires().after(future)) {
+ } else if (f.expires().after(future)) {
f.delayedDelete(noAvg,futureDAO,dryRun, expiredAfterFuture);
Approval.delayDelete(noAvg,apprDAO,dryRun, Approval.byTicket.get(f.id()), expiredAfterFuture);
}
@@ -268,19 +268,19 @@ public class Expiring extends Batch {
trans.info().log("### Checking Approvals valid (",Approval.byApprover.size(),"Items)");
// Make sure users of Approvals are still valid
- for(List<Approval> lapp : Approval.byTicket.values()) {
- for(Approval app : lapp) {
+ for (List<Approval> lapp : Approval.byTicket.values()) {
+ for (Approval app : lapp) {
Future f;
- if(app.getTicket()==null) {
+ if (app.getTicket()==null) {
f = null;
} else {
f = Future.data.get(app.getTicket());
- if(Future.pendingDelete(f)) {
+ if (Future.pendingDelete(f)) {
f=null;
}
}
String msg;
- if(f!=null && app.getRole()!=null && Role.byName.get(app.getRole())==null) {
+ if (f!=null && app.getRole()!=null && Role.byName.get(app.getRole())==null) {
f.delayedDelete(noAvg,futureDAO,dryRun,msg="Role '" + app.getRole() + "' no longer exists");
Approval.delayDelete(noAvg,apprDAO,dryRun, Approval.byTicket.get(f.id()), msg);
continue;
@@ -288,7 +288,7 @@ public class Expiring extends Batch {
switch(app.getStatus()) {
case "pending":
- if(f==null) {
+ if (f==null) {
app.delayDelete(noAvg,apprDAO, isDryRun(), "ticketDeleted");
continue;
}
@@ -296,19 +296,19 @@ public class Expiring extends Batch {
case "owner":
boolean anOwner=false;
String approle = app.getRole();
- if(approle!=null) {
+ if (approle!=null) {
Role role = Role.byName.get(approle);
- if(role==null) {
+ if (role==null) {
app.delayDelete(noAvg, apprDAO, dryRun, "Role No Longer Exists");
continue;
} else {
// Make sure Owner Role exists
String owner = role.ns + ".owner";
- if(Role.byName.containsKey(owner)) {
+ if (Role.byName.containsKey(owner)) {
List<UserRole> lur = UserRole.getByRole().get(owner);
- if(lur != null) {
- for(UserRole ur : lur) {
- if(ur.user().equals(app.getApprover())) {
+ if (lur != null) {
+ for (UserRole ur : lur) {
+ if (ur.user().equals(app.getApprover())) {
anOwner = true;
break;
}
@@ -316,7 +316,7 @@ public class Expiring extends Batch {
}
}
}
- if(!anOwner) {
+ if (!anOwner) {
app.delayDelete(noAvg, apprDAO, dryRun, "No longer Owner");
}
@@ -325,14 +325,14 @@ public class Expiring extends Batch {
case "supervisor":
try {
Identity identity = org.getIdentity(noAvg, app.getUser());
- if(identity==null) {
- if(f!=null) {
+ if (identity==null) {
+ if (f!=null) {
f.delayedDelete(noAvg,futureDAO,dryRun,msg = app.getUser() + " is no longer associated with " + org.getName());
Approval.delayDelete(noAvg,apprDAO,dryRun, Approval.byTicket.get(f.id()), msg);
}
} else {
- if(!app.getApprover().equals(identity.responsibleTo().fullID())) {
- if(f!=null) {
+ if (!app.getApprover().equals(identity.responsibleTo().fullID())) {
+ if (f!=null) {
f.delayedDelete(noAvg,futureDAO,dryRun,msg = app.getApprover() + " is no longer a Supervisor of " + app.getUser());
Approval.delayDelete(noAvg,apprDAO,dryRun, Approval.byTicket.get(f.id()), msg);
}
@@ -360,9 +360,9 @@ public class Expiring extends Batch {
// Run for User Roles
trans.info().log("Checking for Expired User Roles");
try {
- for(UserRole ur : UserRole.getData()) {
- if(org.getIdentity(noAvg, ur.user())==null) { // if not part of Organization;
- if(isSpecial(ur.user())) {
+ for (UserRole ur : UserRole.getData()) {
+ if (org.getIdentity(noAvg, ur.user())==null) { // if not part of Organization;
+ if (isSpecial(ur.user())) {
trans.info().log(ur.user(),"is not part of organization, but may not be deleted");
} else {
ur.delayDelete(noAvg, "Not Part of Organization", dryRun);
@@ -370,16 +370,16 @@ public class Expiring extends Batch {
++delayedURDeletes;
}
} else {
- if(NS.data.get(ur.ns())==null) {
+ if (NS.data.get(ur.ns())==null) {
ur.delayDelete(noAvg,"Namespace " + ur.ns() + " does not exist.",dryRun);
++delayedURDeletes;
++deleted;
- } else if(!Role.byName.containsKey(ur.role())) {
+ } else if (!Role.byName.containsKey(ur.role())) {
ur.delayDelete(noAvg,"Role " + ur.role() + " does not exist.",dryRun);
++deleted;
++delayedURDeletes;
- } else if(ur.expires().before(tooLate)) {
- if("owner".equals(ur.rname())) { // don't delete Owners, even if Expired
+ } else if (ur.expires().before(tooLate)) {
+ if ("owner".equals(ur.rname())) { // don't delete Owners, even if Expired
urPrint.exec(noAvg,ur,"Owner Expired (but not deleted)");
} else {
// In this case, when UR is expired, not dependent on other lookups, we delete straight out.
@@ -387,16 +387,16 @@ public class Expiring extends Batch {
++deleted;
}
//trans.logAuditTrail(trans.info());
- } else if(ur.expires().before(future) && ur.expires().after(now)) {
+ } else if (ur.expires().before(future) && ur.expires().after(now)) {
++count;
// Is there an Approval set already
boolean needNew = true;
- if(ur.role()!=null && ur.user()!=null) {
+ if (ur.role()!=null && ur.user()!=null) {
List<Approval> abm = Approval.byUser.get(ur.user());
- if(abm!=null) {
- for(Approval a : abm) {
- if(a.getOperation().equals(FUTURE_OP.A.name()) && ur.role().equals(a.getRole())) {
- if(Future.data.get(a.getTicket())!=null) {
+ if (abm!=null) {
+ for (Approval a : abm) {
+ if (a.getOperation().equals(FUTURE_OP.A.name()) && ur.role().equals(a.getRole())) {
+ if (Future.data.get(a.getTicket())!=null) {
needNew = false;
break;
}
@@ -404,7 +404,7 @@ public class Expiring extends Batch {
}
}
}
- if(needNew) {
+ if (needNew) {
urFutureApprove.exec(noAvg, ur,"");
}
}
@@ -418,10 +418,10 @@ public class Expiring extends Batch {
}
// Actualize UR Deletes, or send Email
- if(UserRole.sizeForDeletion()>0) {
+ if (UserRole.sizeForDeletion()>0) {
count+=UserRole.sizeForDeletion();
double onePercent = 0.01;
- if(((double)UserRole.sizeForDeletion())/UserRole.getData().size() > onePercent) {
+ if (((double)UserRole.sizeForDeletion())/UserRole.getData().size() > onePercent) {
Message msg = new Message();
try {
msg.line("Found %d of %d UserRoles marked for Deletion in file %s",
@@ -448,7 +448,7 @@ public class Expiring extends Batch {
}
}
}
- if(count>0) {
+ if (count>0) {
String str = String.format("%d UserRoles modified or deleted", count);
cacheTouch.exec(trans, "user_role", str);
}
@@ -460,20 +460,20 @@ public class Expiring extends Batch {
try {
CredDAO.Data crd = new CredDAO.Data();
Date last = null;
- for( Cred creds : Cred.data.values()) {
+ for ( Cred creds : Cred.data.values()) {
crd.id = creds.id;
- for(int type : creds.types()) {
+ for (int type : creds.types()) {
crd.type = type;
- for( Instance inst : creds.instances) {
- if(inst.expires.before(tooLate)) {
+ for ( Instance inst : creds.instances) {
+ if (inst.expires.before(tooLate)) {
crd.expires = inst.expires;
crDelete.exec(noAvg, crd,"Expired before " + tooLate);
- } else if(last==null || inst.expires.after(last)) {
+ } else if (last==null || inst.expires.after(last)) {
last = inst.expires;
}
}
- if(last!=null) {
- if(last.before(future)) {
+ if (last!=null) {
+ if (last.before(future)) {
crd.expires = last;
crPrint.exec(noAvg, crd,"");
++count;
@@ -483,7 +483,7 @@ public class Expiring extends Batch {
}
} finally {
String str = String.format("Found %d current creds expiring before %s", count, Chrono.dateOnlyStamp(future));
- if(count>0) {
+ if (count>0) {
cacheTouch.exec(trans, "cred", str);
}
}
@@ -493,8 +493,8 @@ public class Expiring extends Batch {
@Override
protected void _close(AuthzTrans trans) {
aspr.info("End " + this.getClass().getSimpleName() + " processing" );
- for(Action<?,?,?> action : new Action<?,?,?>[] {crDelete}) {
- if(action instanceof ActionDAO) {
+ for (Action<?,?,?> action : new Action<?,?,?>[] {crDelete}) {
+ if (action instanceof ActionDAO) {
((ActionDAO<?,?,?>)action).close(trans);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java
index f9797c86..cab612eb 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java
@@ -70,7 +70,7 @@ public class ExpiringP2 extends Batch {
cacheTouch = new CacheTouch(trans,urDelete);
File data_dir = new File(env.getProperty("aaf_data_dir"));
- if(!data_dir.exists() || !data_dir.canWrite() || !data_dir.canRead()) {
+ if (!data_dir.exists() || !data_dir.canWrite() || !data_dir.canRead()) {
throw new IOException("Cannot read/write to Data Directory "+ data_dir.getCanonicalPath() + ": EXITING!!!");
}
urDeleteF = new BufferedReader(new FileReader(new File(data_dir,"UserRoleDeletes.dat")));
@@ -92,10 +92,10 @@ public class ExpiringP2 extends Batch {
Map<String,Count> tally = new HashMap<>();
int count=0;
try {
- while((line=urDeleteF.readLine())!=null) {
- if(line.startsWith("#")) {
+ while ((line=urDeleteF.readLine())!=null) {
+ if (line.startsWith("#")) {
Count cnt = tally.get(line);
- if(cnt==null) {
+ if (cnt==null) {
tally.put(line, cnt=new Count());
}
cnt.inc();
@@ -114,11 +114,11 @@ public class ExpiringP2 extends Batch {
}
System.out.println("Tallies of UserRole Deletions");
- for(Entry<String, Count> es : tally.entrySet()) {
+ for (Entry<String, Count> es : tally.entrySet()) {
System.out.printf(" %6d\t%20s\n", es.getValue().cnt,es.getKey());
}
} finally {
- if(cacheTouch!=null && count>0) {
+ if (cacheTouch!=null && count>0) {
cacheTouch.exec(trans, "user_roles", "Removing UserRoles");
}
}
@@ -142,8 +142,8 @@ public class ExpiringP2 extends Batch {
@Override
protected void _close(AuthzTrans trans) {
aspr.info("End " + this.getClass().getSimpleName() + " processing" );
- for(Action<?,?,?> action : new Action<?,?,?>[] {urDelete,cacheTouch}) {
- if(action instanceof ActionDAO) {
+ for (Action<?,?,?> action : new Action<?,?,?>[] {urDelete,cacheTouch}) {
+ if (action instanceof ActionDAO) {
((ActionDAO<?,?,?>)action).close(trans);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java
index 8b12399d..50c6dc21 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java
@@ -69,7 +69,7 @@ public class NotifyApprovals extends Batch {
session = historyDAO.getSession(trans);
apprDAO = new ApprovalDAO(trans, historyDAO);
futureDAO = new FutureDAO(trans, historyDAO);
- if(isDryRun()) {
+ if (isDryRun()) {
email = new EmailPrint();
maxEmails=3;
} else {
@@ -105,10 +105,10 @@ public class NotifyApprovals extends Batch {
int emailCount = 0;
List<Approval> pending = new ArrayList<>();
boolean isOwner,isSupervisor;
- for(Entry<String, List<Approval>> es : Approval.byApprover.entrySet()) {
+ for (Entry<String, List<Approval>> es : Approval.byApprover.entrySet()) {
isOwner = isSupervisor = false;
String approver = es.getKey();
- if(approver.indexOf('@')<0) {
+ if (approver.indexOf('@')<0) {
approver += org.getRealm();
}
Date latestNotify=null, soonestExpire=null;
@@ -116,28 +116,28 @@ public class NotifyApprovals extends Batch {
GregorianCalendar soonest=new GregorianCalendar();
pending.clear();
- for(Approval app : es.getValue()) {
+ for (Approval app : es.getValue()) {
Future f = app.getTicket()==null?null:Future.data.get(app.getTicket());
- if(f==null) { // only Ticketed Approvals are valid.. the others are records.
+ if (f==null) { // only Ticketed Approvals are valid.. the others are records.
// Approvals without Tickets are no longer valid.
- if("pending".equals(app.getStatus())) {
+ if ("pending".equals(app.getStatus())) {
app.setStatus("lapsed");
app.update(noAvg,apprDAO,dryRun); // obeys dryRun
}
} else {
- if((soonestExpire==null && f.expires()!=null) || (soonestExpire!=null && f.expires()!=null && soonestExpire.before(f.expires()))) {
+ if ((soonestExpire==null && f.expires()!=null) || (soonestExpire!=null && f.expires()!=null && soonestExpire.before(f.expires()))) {
soonestExpire=f.expires();
}
- if("pending".equals(app.getStatus())) {
- if(!isOwner) {
+ if ("pending".equals(app.getStatus())) {
+ if (!isOwner) {
isOwner = "owner".equals(app.getType());
}
- if(!isSupervisor) {
+ if (!isSupervisor) {
isSupervisor = "supervisor".equals(app.getType());
}
- if((latestNotify==null && app.getLast_notified()!=null) ||(latestNotify!=null && app.getLast_notified()!=null && latestNotify.before(app.getLast_notified()))) {
+ if ((latestNotify==null && app.getLast_notified()!=null) ||(latestNotify!=null && app.getLast_notified()!=null && latestNotify.before(app.getLast_notified()))) {
latestNotify=app.getLast_notified();
}
pending.add(app);
@@ -145,29 +145,29 @@ public class NotifyApprovals extends Batch {
}
}
- if(!pending.isEmpty()) {
+ if (!pending.isEmpty()) {
boolean go = false;
- if(latestNotify==null) { // never notified... make it so
+ if (latestNotify==null) { // never notified... make it so
go=true;
} else {
- if(!today.equals(Chrono.dateOnlyStamp(latest))) { // already notified today
+ if (!today.equals(Chrono.dateOnlyStamp(latest))) { // already notified today
latest.setTime(latestNotify);
soonest.setTime(soonestExpire);
int year;
int days = soonest.get(GregorianCalendar.DAY_OF_YEAR)-latest.get(GregorianCalendar.DAY_OF_YEAR);
days+=((year=soonest.get(GregorianCalendar.YEAR))-latest.get(GregorianCalendar.YEAR))*365 +
(soonest.isLeapYear(year)?1:0);
- if(days<7) { // If Expirations get within a Week (or expired), notify everytime.
+ if (days<7) { // If Expirations get within a Week (or expired), notify everytime.
go = true;
}
}
}
- if(go) {
- if(maxEmails>emailCount++) {
+ if (go) {
+ if (maxEmails>emailCount++) {
try {
Organization org = OrganizationFactory.obtain(env, approver);
Identity user = org.getIdentity(noAvg, approver);
- if(user==null) {
+ if (user==null) {
ps.printf("Invalid Identity: %s\n", approver);
} else {
email.clear();
@@ -175,7 +175,7 @@ public class NotifyApprovals extends Batch {
email.addTo(user.email());
msg.line(LINE);
msg.line("Why are you receiving this Notification?\n");
- if(isSupervisor) {
+ if (isSupervisor) {
msg.line("%sYou are the supervisor of one or more employees who need access to tools which are protected by AAF. " +
"Your employees may ask for access to various tools and applications to do their jobs. ASPR requires "
+ "that you are notified and approve their requests. The details of each need is provided when you click "
@@ -183,7 +183,7 @@ public class NotifyApprovals extends Batch {
msg.line("Your participation in this process fulfills the ASPR requirement to re-authorize users in roles on a regular basis.\n\n");
}
- if(isOwner) {
+ if (isOwner) {
msg.line("%sYou are the listed owner of one or more AAF Namespaces. ASPR requires that those responsible for "
+ "applications and their access review them regularly for accuracy. The AAF WIKI page for AT&T is https://wiki.web.att.com/display/aaf. "
+ "More info regarding questions of being a Namespace Owner is available at https://wiki.web.att.com/pages/viewpage.action?pageId=594741363\n",isSupervisor?"2) ":"");
@@ -208,9 +208,9 @@ public class NotifyApprovals extends Batch {
email.msg(msg);
email.exec(noAvg, org,"");
- if(!isDryRun()) {
+ if (!isDryRun()) {
email.log(ps,"NotifyApprovals");
- for(Approval app : pending) {
+ for (Approval app : pending) {
app.setLastNotified(now);
app.update(noAvg, apprDAO, dryRun);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java
index ab386c56..b4631f66 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java
@@ -87,10 +87,10 @@ public class NotifyCredExpiring extends Batch {
noAvg = env.newTransNoAvg();
noAvg.setUser(new BatchPrincipal("batch:NotifyCredExpiring"));
- if((supportEmailAddr = env.getProperty("mailFromUserId"))==null) {
+ if ((supportEmailAddr = env.getProperty("mailFromUserId"))==null) {
throw new APIException("mailFromUserId property must be set");
}
- if(isDryRun()) {
+ if (isDryRun()) {
email = new EmailPrint();
maxEmails=3;
maxEmails = Integer.parseInt(trans.getProperty("MAX_EMAILS","3"));
@@ -137,17 +137,17 @@ public class NotifyCredExpiring extends Batch {
ownerCreds.put(UNKNOWN_ID,noOwner);
// Get a list of ONLY the ones needing email by Owner
- for(Entry<String, List<Cred>> es : Cred.byNS.entrySet()) {
+ for (Entry<String, List<Cred>> es : Cred.byNS.entrySet()) {
lastCred.clear();
- for(Cred c : es.getValue()) {
+ for (Cred c : es.getValue()) {
last = c.last(CredDAO.BASIC_AUTH,CredDAO.BASIC_AUTH_SHA256);
- if(last!=null && last.after(tooLate) && last.before(early)) {
+ if (last!=null && last.after(tooLate) && last.before(early)) {
List<UserRole> ownerURList = UserRole.getByRole().get(es.getKey()+".owner");
- if(ownerURList!=null) {
- for(UserRole ur:ownerURList) {
+ if (ownerURList!=null) {
+ for (UserRole ur:ownerURList) {
String owner = ur.user();
List<LastCred> llc = ownerCreds.get(owner);
- if(llc==null) {
+ if (llc==null) {
ownerCreds.put(owner, (llc=new ArrayList<>()));
}
llc.add(new LastCred(c,last));
@@ -164,39 +164,39 @@ public class NotifyCredExpiring extends Batch {
Message msg = new Message();
Notification ownNotf;
StringBuilder logMessage = new StringBuilder();
- for(Entry<String,List<LastCred>> es : ownerCreds.entrySet()) {
+ for (Entry<String,List<LastCred>> es : ownerCreds.entrySet()) {
String owner = es.getKey();
boolean header = true;
try {
Organization org = OrganizationFactory.obtain(env, owner);
Identity user = org.getIdentity(noAvg, owner);
- if(!UNKNOWN_ID.equals(owner) && user==null) {
+ if (!UNKNOWN_ID.equals(owner) && user==null) {
ps.printf("Invalid Identity: %s\n", owner);
} else {
logMessage.setLength(0);
- if(maxEmails>emailCount) {
+ if (maxEmails>emailCount) {
bCritical=bNormal=bEarly = false;
email.clear();
msg.clear();
email.addTo(user==null?supportEmailAddr:user.email());
ownNotf = Notification.get(es.getKey(),TYPE.CN);
- if(ownNotf==null) {
+ if (ownNotf==null) {
ownNotf = Notification.create(user==null?UNKNOWN_ID:user.fullID(), TYPE.CN);
}
last = ownNotf.last;
// Get Max ID size for formatting purposes
int length = AAF_INSTANTIATED_MECHID.length();
- for(LastCred lc : es.getValue()) {
+ for (LastCred lc : es.getValue()) {
length = Math.max(length, lc.cred.id.length());
}
String id_exp_fmt = "\t%-"+length+"s %15s %s";
Collections.sort(es.getValue(),LastCred.COMPARE);
- for(LastCred lc : es.getValue()) {
- if(lc.last.after(must) && lc.last.before(early) &&
+ for (LastCred lc : es.getValue()) {
+ if (lc.last.after(must) && lc.last.before(early) &&
(ownNotf.last==null || ownNotf.last.before(withinLastWeek))) {
- if(!bEarly && header) {
+ if (!bEarly && header) {
msg.line("\tThe following are friendly 2 month reminders, just in case you need to schedule your updates early. "
+ "You will be reminded next month\n");
msg.line(id_exp_fmt, AAF_INSTANTIATED_MECHID,EXPIRATION_DATE, QUICK_LINK);
@@ -204,19 +204,19 @@ public class NotifyCredExpiring extends Batch {
header = false;
}
bEarly = true;
- } else if(lc.last.after(critical) && lc.last.before(must) &&
+ } else if (lc.last.after(critical) && lc.last.before(must) &&
(ownNotf.last==null || ownNotf.last.before(withinLastWeek))) {
- if(!bNormal) {
+ if (!bNormal) {
boolean last2wks = lc.last.before(within2Weeks);
- if(last2wks) {
+ if (last2wks) {
try {
Identity supvsr = user.responsibleTo();
email.addCC(supvsr.email());
- } catch(OrganizationException e) {
+ } catch (OrganizationException e) {
trans.error().log(e, "Supervisor cannot be looked up");
}
}
- if(header) {
+ if (header) {
msg.line("\tIt is now important for you to update Passwords all all configurations using them for the following.\n" +
(last2wks?"\tNote: Your Supervisor is CCd\n":"\tNote: Your Supervisor will be notified if this is not being done before the last 2 weeks\n"));
msg.line(id_exp_fmt, AAF_INSTANTIATED_MECHID,EXPIRATION_DATE, QUICK_LINK);
@@ -225,8 +225,8 @@ public class NotifyCredExpiring extends Batch {
header = false;
}
bNormal=true;
- } else if(lc.last.after(tooLate) && lc.last.before(critical)) { // Email Every Day, with Supervisor
- if(!bCritical && header) {
+ } else if (lc.last.after(tooLate) && lc.last.before(critical)) { // Email Every Day, with Supervisor
+ if (!bCritical && header) {
msg.line("\t!!! WARNING: These Credentials will expire in LESS THAN ONE WEEK !!!!\n" +
"\tYour supervisor is added to this Email\n");
msg.line(id_exp_fmt, AAF_INSTANTIATED_MECHID,EXPIRATION_DATE, QUICK_LINK);
@@ -235,22 +235,22 @@ public class NotifyCredExpiring extends Batch {
}
bCritical = true;
try {
- if(user!=null) {
+ if (user!=null) {
Identity supvsr = user.responsibleTo();
- if(supvsr!=null) {
+ if (supvsr!=null) {
email.addCC(supvsr.email());
supvsr = supvsr.responsibleTo();
- if(supvsr!=null) {
+ if (supvsr!=null) {
email.addCC(supvsr.email());
}
}
}
- } catch(OrganizationException e) {
+ } catch (OrganizationException e) {
trans.error().log(e, "Supervisor cannot be looked up");
}
}
- if(bEarly || bNormal || bCritical) {
- if(logMessage.length()==0) {
+ if (bEarly || bNormal || bCritical) {
+ if (logMessage.length()==0) {
logMessage.append("NotifyCredExpiring");
}
logMessage.append("\n\t");
@@ -261,7 +261,7 @@ public class NotifyCredExpiring extends Batch {
}
}
- if(bEarly || bNormal || bCritical) {
+ if (bEarly || bNormal || bCritical) {
msg.line(LINE);
msg.line("Why are you receiving this Notification?\n");
msg.line("You are the listed owner of one or more AAF Namespaces. ASPR requires that those responsible for "
@@ -271,9 +271,9 @@ public class NotifyCredExpiring extends Batch {
msg.line(" %s/ns\n\n",env.getProperty(GUI_URL));
email.msg(msg);
Result<Void> rv = email.exec(trans, org,"");
- if(rv.isOK()) {
+ if (rv.isOK()) {
++emailCount;
- if(!isDryRun()) {
+ if (!isDryRun()) {
ownNotf.update(noAvg, session, false);
// SET LastNotification
}
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_InputIterator.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_InputIterator.java
index c0a9a3cd..07fd65f0 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_InputIterator.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_InputIterator.java
@@ -69,7 +69,7 @@ public class JU_InputIterator {
@After
public void cleanUp() {
- if(f.exists()) {
+ if (f.exists()) {
f.delete();
}
}
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java
index cef81ded..97b6c56b 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java
@@ -94,10 +94,10 @@ public class JU_MonthData {
@After
public void cleanUp() {
File g = new File("Monthlyenv.dat.bak");
- if(f.exists()) {
+ if (f.exists()) {
f.delete();
}
- if(g.exists()) {
+ if (g.exists()) {
g.delete();
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java
index f24c7c9f..d0e4eaab 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java
@@ -128,18 +128,18 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
psinfos.add(this);
cql = theCQL.trim().toUpperCase();
- if(cql.startsWith("INSERT")) {
+ if (cql.startsWith("INSERT")) {
crud = CRUD.create;
- } else if(cql.startsWith("UPDATE")) {
+ } else if (cql.startsWith("UPDATE")) {
crud = CRUD.update;
- } else if(cql.startsWith("DELETE")) {
+ } else if (cql.startsWith("DELETE")) {
crud = CRUD.delete;
} else {
crud = CRUD.read;
}
int idx = 0, count=0;
- while((idx=cql.indexOf('?',idx))>=0) {
+ while ((idx=cql.indexOf('?',idx))>=0) {
++idx;
++count;
}
@@ -155,7 +155,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
You should prepare only once, and cache the PreparedStatement in your application (it is thread-safe).
If you call prepare multiple times with the same query string, the driver will log a warning.
*/
- if(ps==null) {
+ if (ps==null) {
TimeTaken tt = trans.start("Preparing PSInfo " + crud.toString().toUpperCase() + " on " + name,Env.SUB);
try {
ps = getSession(trans).prepare(cql);
@@ -287,7 +287,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
rs = getSession(trans).execute(key==null?ps(trans):ps(trans).bind(key));
/// TEST CODE for Exception
// boolean force = true;
-// if(force) {
+// if (force) {
// Map<InetSocketAddress, Throwable> misa = new HashMap<>();
// //misa.put(new InetSocketAddress(444),new Exception("no host was tried"));
// misa.put(new InetSocketAddress(444),new Exception("Connection has been closed"));
@@ -334,19 +334,19 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
@SuppressWarnings("unchecked")
protected final Result<List<DATA>> extract(Loader<DATA> loader, ResultSet rs, List<DATA> indata, Accept<DATA> accept) {
List<Row> rows = rs.all();
- if(rows.isEmpty()) {
+ if (rows.isEmpty()) {
return Result.ok((List<DATA>)EMPTY); // Result sets now .emptyList(true);
} else {
DATA d;
List<DATA> data = indata==null?new ArrayList<>(rows.size()):indata;
- for(Row row : rows) {
+ for (Row row : rows) {
try {
d = loader.load(dataClass.newInstance(),row);
- if(accept.ok(d)) {
+ if (accept.ok(d)) {
data.add(d);
}
- } catch(Exception e) {
+ } catch (Exception e) {
return Result.err(e);
}
}
@@ -372,8 +372,8 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
public static final void primePSIs(TransStore trans) throws APIException, IOException {
- for(AbsCassDAO<? extends TransStore, ?>.PSInfo psi : psinfos) {
- if(psi.ps==null) {
+ for (AbsCassDAO<? extends TransStore, ?>.PSInfo psi : psinfos) {
+ if (psi.ps==null) {
psi.ps(trans);
}
}
@@ -382,28 +382,28 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
public final Session getSession(TransStore trans) throws APIException, IOException {
// SessionFilter unused since 2015
// Try to use Trans' session, if exists
-// if(sessionSlot!=null) { // try to get from Trans
+// if (sessionSlot!=null) { // try to get from Trans
// Session sess = trans.get(sessionSlot, null);
-// if(sess!=null) {
+// if (sess!=null) {
// return sess;
// }
// }
// If there's an owning DAO, use it's session
- if(owningDAO!=null) {
+ if (owningDAO!=null) {
return owningDAO.getSession(trans);
}
// OK, nothing else works... get our own.
- if(session==null || resetTrigger) {
+ if (session==null || resetTrigger) {
Cluster tempCluster = null;
Session tempSession = null;
try {
synchronized(LOCK) {
boolean reset = false;
- for(ResetRequest r : resetDeque) {
- if(r.session == session) {
- if(r.timestamp>nextAvailableReset) {
+ for (ResetRequest r : resetDeque) {
+ if (r.session == session) {
+ if (r.timestamp>nextAvailableReset) {
reset=true;
nextAvailableReset = System.currentTimeMillis() + 60000;
tempCluster = cluster;
@@ -415,22 +415,22 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
}
- if(reset || session == null) {
+ if (reset || session == null) {
TimeTaken tt = trans.start(NEW_CASSANDRA_SESSION, Env.SUB);
try {
// Note: Maitrayee recommended not closing the cluster, just
// overwrite it. Jonathan 9/30/2016 assuming same for Session
// This was a bad idea. Ran out of File Handles as I suspected, Jonathan
- if(reset) {
- for(AbsCassDAO<? extends TransStore, ?>.PSInfo psi : psinfos) {
+ if (reset) {
+ for (AbsCassDAO<? extends TransStore, ?>.PSInfo psi : psinfos) {
psi.reset();
}
}
- if(reset || cluster==null) {
+ if (reset || cluster==null) {
cluster = CassAccess.cluster(trans, keyspace);
trans.warn().log(NEW_CASSANDRA_CLUSTER_OBJECT_CREATED);
}
- if(reset || session==null) {
+ if (reset || session==null) {
session = cluster.connect(keyspace);
trans.warn().log(NEW_CASSANDRA_SESSION_CREATED);
}
@@ -445,10 +445,10 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
try {
resetDeque.clear();
// Not clearing Session/Cluster appears to kill off FileHandles
- if(tempSession!=null && !tempSession.isClosed()) {
+ if (tempSession!=null && !tempSession.isClosed()) {
tempSession.close();
}
- if(tempCluster!=null && !tempCluster.isClosed()) {
+ if (tempCluster!=null && !tempCluster.isClosed()) {
tempCluster.close();
}
} finally {
@@ -460,11 +460,11 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
public final boolean reportPerhapsReset(TransStore trans, Exception e) {
- if(owningDAO!=null) {
+ if (owningDAO!=null) {
return owningDAO.reportPerhapsReset(trans, e);
} else {
boolean rv = false;
- if(CassAccess.isResetException(e)) {
+ if (CassAccess.isResetException(e)) {
trans.warn().printf("Session Reset called for %s by %s ",session==null?"":session,e==null?"Mgmt Command":e.getClass().getName());
resetDeque.addFirst(new ResetRequest(session));
rv = resetTrigger = true;
@@ -475,8 +475,8 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
public void close(TransStore trans) {
- if(owningDAO==null) {
- if(session!=null) {
+ if (owningDAO==null) {
+ if (session!=null) {
TimeTaken tt = trans.start("Cassandra Session Close", Env.SUB);
try {
session.close();
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java
index 3f4bbb20..1bda405c 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java
@@ -56,7 +56,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
for (int i = 0; i < key.length(); i++) {
h = 31*h + key.charAt(i);
}
- if(h<0)h*=-1;
+ if (h<0)h*=-1;
return h%segSize;
}
@@ -67,7 +67,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
this.expireIn = expireIn;
cache = new Object[segSize];
// Create a new Map for each Segment, and store locally
- for(int i=0;i<segSize;++i) {
+ for (int i=0;i<segSize;++i) {
cache[i]=obtain(name+i);
}
}
@@ -83,17 +83,17 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
int cacheIdx = cacheIdx(key);
@SuppressWarnings("unchecked")
Map<String,Dated> map = ((Map<String,Dated>)cache[cacheIdx]);
-// if(map.remove(key)!=null) // Not seeming to remove all the time
- if(map!=null)map.clear();
+// if (map.remove(key)!=null) // Not seeming to remove all the time
+ if (map!=null)map.clear();
// System.err.println("Remove " + name + " " + key);
return cacheIdx;
}
public Result<Void> invalidate(int segment) {
- if(segment<0 || segment>=cache.length) return Result.err(Status.ERR_BadData,"Cache Segment %s is out of range",Integer.toString(segment));
+ if (segment<0 || segment>=cache.length) return Result.err(Status.ERR_BadData,"Cache Segment %s is out of range",Integer.toString(segment));
@SuppressWarnings("unchecked")
Map<String,Dated> map = ((Map<String,Dated>)cache[segment]);
- if(map!=null) {
+ if (map!=null) {
map.clear();
}
return Result.ok();
@@ -118,14 +118,14 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
Date dbStamp = info.get(trans, name,cacheIdx);
// Check for cache Entry and whether it is still good (a good Cache Entry is same or after DBEntry, so we use "before" syntax)
- if(cached!=null && dbStamp.before(cached.timestamp)) {
+ if (cached!=null && dbStamp.before(cached.timestamp)) {
ld = (List<DATA>)cached.data;
rld = Result.ok(ld);
} else {
rld = getter.get();
- if(rld.isOK()) { // only store valid lists
+ if (rld.isOK()) { // only store valid lists
map.put(key, new Dated(rld.value,expireIn)); // successful item found gets put in cache
-// } else if(rld.status == Result.ERR_Backend){
+// } else if (rld.status == Result.ERR_Backend){
// map.remove(key);
}
}
@@ -138,8 +138,8 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
* @param dao
*/
public static void startCleansing(AuthzEnv env, CachedDAO<?,?,?> ... dao) {
- for(CachedDAO<?,?,?> d : dao) {
- for(int i=0;i<d.segSize;++i) {
+ for (CachedDAO<?,?,?> d : dao) {
+ for (int i=0;i<d.segSize;++i) {
startCleansing(env, d.table()+i);
}
}
@@ -147,7 +147,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
public static<T extends Trans> void startRefresh(AuthzEnv env, CIDAO<AuthzTrans> cidao) {
- if(infoTimer==null) {
+ if (infoTimer==null) {
infoTimer = new Timer("CachedDAO Info Refresh Timer");
int minRefresh = 10*1000*60; // 10 mins Integer.parseInt(env.getProperty(CACHE_MIN_REFRESH_INTERVAL,"2000")); // 2 second minimum refresh
infoTimer.schedule(new Refresh(env,cidao, minRefresh), 1000, minRefresh); // note: Refresh from DB immediately
@@ -156,7 +156,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
public static void stopTimer() {
Cache.stopTimer();
- if(infoTimer!=null) {
+ if (infoTimer!=null) {
infoTimer.cancel();
infoTimer = null;
}
@@ -182,14 +182,14 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
long now = System.currentTimeMillis();
long interval = now-lastRun;
- if(interval < minRefresh || interval < Math.min(env.transRate(),maxRefresh)) return;
+ if (interval < minRefresh || interval < Math.min(env.transRate(),maxRefresh)) return;
lastRun = now;
AuthzTrans trans = env.newTransNoAvg();
Result<Void> rv = cidao.check(trans);
- if(rv.status!=Result.OK) {
+ if (rv.status!=Result.OK) {
env.error().log("Error in CacheInfo Refresh",rv.details);
}
- if(env.debug().isLoggable()) {
+ if (env.debug().isLoggable()) {
StringBuilder sb = new StringBuilder("Cache Info Refresh: ");
trans.auditTrail(0, sb, Env.REMOTE);
env.debug().log(sb);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java
index 9375502c..cf410d0b 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java
@@ -52,7 +52,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
this.dao = dao;
//read_str = "Cached READ for " + dao.table();
// dirty_str = "Cache DIRTY on " + dao.table();
- if(dao instanceof CassDAOImpl) {
+ if (dao instanceof CassDAOImpl) {
((CassDAOImpl<?,?>)dao).cache = this;
}
}
@@ -80,14 +80,14 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
public static String keyFromObjs(Object ... objs) {
String key;
- if(objs.length==1 && objs[0] instanceof String) {
+ if (objs.length==1 && objs[0] instanceof String) {
key = (String)objs[0];
} else {
StringBuilder sb = new StringBuilder();
boolean first = true;
- for(Object o : objs) {
- if(o!=null) {
- if(first) {
+ for (Object o : objs) {
+ if (o!=null) {
+ if (first) {
first =false;
} else {
sb.append('|');
@@ -102,7 +102,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
public Result<DATA> create(TRANS trans, DATA data) {
Result<DATA> d = dao.create(trans,data);
- if(d.status==Status.OK) {
+ if (d.status==Status.OK) {
add(d.value);
} else {
trans.error().log(d.errorString());
@@ -134,7 +134,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
@Override
public final Result<List<DATA>> get() {
return call();
-// if(result.isOKhasData()) { // Note, given above logic, could exist, but stale
+// if (result.isOKhasData()) { // Note, given above logic, could exist, but stale
// return result.value;
// } else {
// return null;
@@ -146,11 +146,11 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
public Result<List<DATA>> read(final TRANS trans, final Object ... objs) {
DAOGetter getter = new DAOGetter(trans,dao,objs);
return get(trans, keyFromObjs(objs),getter);
-// if(ld!=null) {
+// if (ld!=null) {
// return Result.ok(ld);//.emptyList(ld.isEmpty());
// }
// // Result Result if exists
-// if(getter.result==null) {
+// if (getter.result==null) {
// return Result.err(Status.ERR_NotFound, "No Cache or Lookup found on [%s]",dao.table());
// }
// return getter.result;
@@ -160,11 +160,11 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
public Result<List<DATA>> read(final String key, final TRANS trans, final Object[] objs) {
DAOGetter getter = new DAOGetter(trans,dao,objs);
return get(trans, key, getter);
-// if(ld!=null) {
+// if (ld!=null) {
// return Result.ok(ld);//.emptyList(ld.isEmpty());
// }
// // Result Result if exists
-// if(getter.result==null) {
+// if (getter.result==null) {
// return Result.err(Status.ERR_NotFound, "No Cache or Lookup found on [%s]",dao.table());
// }
// return getter.result;
@@ -176,7 +176,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
}
public Result<Void> update(TRANS trans, DATA data) {
Result<Void> d = dao.update(trans, data);
- if(d.status==Status.OK) {
+ if (d.status==Status.OK) {
add(data);
} else {
trans.error().log(d.errorString());
@@ -185,14 +185,14 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
}
public Result<Void> delete(TRANS trans, DATA data, boolean reread) {
- if(reread) { // If reread, get from Cache, if possible, not DB exclusively
+ if (reread) { // If reread, get from Cache, if possible, not DB exclusively
Result<List<DATA>> rd = read(trans,data);
- if(rd.notOK()) {
+ if (rd.notOK()) {
return Result.err(rd);
// } else {
// trans.error().log(rd.errorString());
}
- if(rd.isEmpty()) {
+ if (rd.isEmpty()) {
data.invalidate(this);
return Result.err(Status.ERR_NotFound,"Not Found");
}
@@ -205,7 +205,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
@Override
public void close(TRANS trans) {
- if(dao!=null) {
+ if (dao!=null) {
dao.close(trans);
}
}
@@ -221,7 +221,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
}
public void invalidate(TRANS trans, DATA data) {
- if(info.touch(trans, dao.table(),data.invalidate(this)).notOK()) {
+ if (info.touch(trans, dao.table(),data.invalidate(this)).notOK()) {
trans.error().log("Cannot touch CacheInfo for Role");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
index 9b168a83..b8062fcd 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
@@ -64,9 +64,9 @@ public class CassAccess {
// @SuppressWarnings("deprecation")
public static synchronized Cluster cluster(Env env, String prefix) throws APIException, IOException {
- if(cb == null) {
+ if (cb == null) {
String pre;
- if(prefix==null) {
+ if (prefix==null) {
pre="";
} else {
env.info().log("Cassandra Connection for ",prefix);
@@ -74,19 +74,19 @@ public class CassAccess {
}
cb = Cluster.builder();
String str = env.getProperty(pre+CASSANDRA_CLUSTERS_PORT,env.getProperty(CASSANDRA_CLUSTERS_PORT,"9042"));
- if(str!=null) {
+ if (str!=null) {
env.init().log("Cass Port = ",str );
cb.withPort(Integer.parseInt(str));
}
str = env.getProperty(pre+CASSANDRA_CLUSTERS_USER_NAME,env.getProperty(CASSANDRA_CLUSTERS_USER_NAME,null));
- if(str!=null) {
+ if (str!=null) {
env.init().log("Cass User = ",str );
String epass = env.getProperty(pre + CASSANDRA_CLUSTERS_PASSWORD,env.getProperty(CASSANDRA_CLUSTERS_PASSWORD,null));
- if(epass==null) {
+ if (epass==null) {
throw new APIException("No Password configured for " + str);
}
//TODO Figure out way to ensure Decryptor setting in AuthzEnv
- if(env instanceof AuthzEnv) {
+ if (env instanceof AuthzEnv) {
cb.withCredentials(str,((AuthzEnv)env).decrypt(epass,true));
} else {
cb.withCredentials(str, env.decryptor().decrypt(epass));
@@ -94,9 +94,9 @@ public class CassAccess {
}
str = env.getProperty(pre+CASSANDRA_RESET_EXCEPTIONS,env.getProperty(CASSANDRA_RESET_EXCEPTIONS,null));
- if(str!=null) {
+ if (str!=null) {
env.init().log("Cass ResetExceptions = ",str );
- for(String ex : Split.split(',', str)) {
+ for (String ex : Split.split(',', str)) {
resetExceptions.add(new Resettable(env,ex));
}
}
@@ -105,7 +105,7 @@ public class CassAccess {
Double lat = str!=null?Double.parseDouble(str):null;
str = env.getProperty(Config.CADI_LONGITUDE);
Double lon = str!=null?Double.parseDouble(str):null;
- if(lat == null || lon == null) {
+ if (lat == null || lon == null) {
throw new APIException(Config.CADI_LATITUDE + " and/or " + Config.CADI_LONGITUDE + " are not set");
}
@@ -118,23 +118,23 @@ public class CassAccess {
String bestDC = null;
int numInBestDC = 1;
double mlat, mlon,temp,distance = Double.MAX_VALUE;
- for(int i=0;i<machs.length;++i) {
+ for (int i=0;i<machs.length;++i) {
String[] minfo = Split.split(':',machs[i]);
- if(minfo.length>0) {
+ if (minfo.length>0) {
cpoints[i]=minfo[0];
}
- if(minfo.length>3) {
- if(minfo[1].equals(bestDC)) {
+ if (minfo.length>3) {
+ if (minfo[1].equals(bestDC)) {
++numInBestDC;
} else {
// Calc closest DC with Great Circle
mlat = Double.parseDouble(minfo[2]);
mlon = Double.parseDouble(minfo[3]);
// Note: GreatCircle Distance is always >= 0.0 (not negative)
- if((temp=GreatCircle.calc(lat, lon, mlat, mlon)) < distance) {
+ if ((temp=GreatCircle.calc(lat, lon, mlat, mlon)) < distance) {
distance = temp;
- if(bestDC==null || !bestDC.equals(minfo[1])) {
+ if (bestDC==null || !bestDC.equals(minfo[1])) {
bestDC = minfo[1];
numInBestDC = 1;
}
@@ -145,7 +145,7 @@ public class CassAccess {
cb.addContactPoints(cpoints);
- if(bestDC!=null) {
+ if (bestDC!=null) {
// 8/26/2016 Management has determined that Accuracy is preferred over speed in bad situations
// Local DC Aware Load Balancing appears to have the highest normal performance, with the best
// Degraded Accuracy
@@ -171,18 +171,18 @@ public class CassAccess {
@SuppressWarnings("unchecked")
public Resettable(Env env, String propData) throws APIException {
- if(propData!=null && propData.length()>1) {
+ if (propData!=null && propData.length()>1) {
String[] split = Split.split(':', propData);
- if(split.length>0) {
+ if (split.length>0) {
try {
cls = (Class<? extends Exception>)Class.forName(split[0]);
} catch (ClassNotFoundException e) {
throw new APIException("Declared Cassandra Reset Exception, " + propData + ", cannot be ClassLoaded");
}
}
- if(split.length>1) {
+ if (split.length>1) {
messages=new ArrayList<>();
- for(int i=1;i<split.length;++i) {
+ for (int i=1;i<split.length;++i) {
String str = split[i];
int start = str.startsWith("\"")?1:0;
int end = str.length()-(str.endsWith("\"")?1:0);
@@ -195,11 +195,11 @@ public class CassAccess {
}
public boolean matches(Exception ex) {
- if(ex.getClass().equals(cls)) {
- if(messages!=null) {
+ if (ex.getClass().equals(cls)) {
+ if (messages!=null) {
String msg = ex.getMessage();
- for(String m : messages) {
- if(msg.contains(m)) {
+ for (String m : messages) {
+ if (msg.contains(m)) {
return true;
}
}
@@ -210,11 +210,11 @@ public class CassAccess {
}
public static final boolean isResetException(Exception e) {
- if(e==null) {
+ if (e==null) {
return true;
}
- for(Resettable re : resetExceptions) {
- if(re.matches(e)) {
+ for (Resettable re : resetExceptions) {
+ if (re.matches(e)) {
return true;
}
}
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 fae8f693..58c4386b 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
@@ -120,25 +120,25 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
StringBuilder sbwc = new StringBuilder();
StringBuilder sbup = new StringBuilder();
- if(keylimit>0) {
- for(int i=0;i<end;++i) {
- if(i>0) {
+ if (keylimit>0) {
+ for (int i=0;i<end;++i) {
+ if (i>0) {
sbfc.append(',');
sbq.append(',');
- if(i<keylimit) {
+ if (i<keylimit) {
sbwc.append(" AND ");
}
}
sbfc.append(fields[i].getName());
sbq.append('?');
- if(i>=keylimit) {
- if(i>keylimit) {
+ if (i>=keylimit) {
+ if (i>keylimit) {
sbup.append(',');
}
sbup.append(fields[i].getName());
sbup.append("=?");
}
- if(i<keylimit) {
+ if (i<keylimit) {
sbwc.append(fields[i].getName());
sbwc.append("=?");
}
@@ -149,7 +149,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
readPS = new PSInfo(trans, "SELECT " + 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) {
+ if (sbup.length()==0) {
updatePS = createPS; // the same as an insert
} else {
updatePS = new PSInfo(trans, "UPDATE " + table + " SET " + sbup + " WHERE " + sbwc + ';',loader,writeConsistency);
@@ -184,17 +184,17 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
* execute element.
*/
public Result<DATA> create(TRANS trans, DATA data) {
- if(createPS==null) {
+ if (createPS==null) {
return Result.err(Result.ERR_NotImplemented,"Create is disabled for %s",getClass().getSimpleName());
}
- if(async) /*ResultSetFuture */ {
+ if (async) /*ResultSetFuture */ {
Result<ResultSetFuture> rs = createPS.execAsync(trans, C_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
} else {
Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
}
@@ -206,26 +206,26 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
* Read the Unique Row associated with Full Keys
*/
public Result<List<DATA>> read(TRANS trans, DATA data) {
- if(readPS==null) {
+ if (readPS==null) {
return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName());
}
return readPS.read(trans, R_TEXT, data);
}
public Result<List<DATA>> read(TRANS trans, Object ... key) {
- if(readPS==null) {
+ if (readPS==null) {
return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName());
}
return readPS.read(trans, R_TEXT, key);
}
public Result<DATA> readPrimKey(TRANS trans, Object ... key) {
- if(readPS==null) {
+ if (readPS==null) {
return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName());
}
Result<List<DATA>> rld = readPS.read(trans, R_TEXT, key);
- if(rld.isOK()) {
- if(rld.isEmpty()) {
+ if (rld.isOK()) {
+ if (rld.isEmpty()) {
return Result.err(Result.ERR_NotFound,rld.details);
} else {
return Result.ok(rld.value.get(0));
@@ -240,17 +240,17 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
}
public Result<Void> update(TRANS trans, DATA data, boolean async) {
- if(updatePS==null) {
+ if (updatePS==null) {
return Result.err(Result.ERR_NotImplemented,"Update is disabled for %s",getClass().getSimpleName());
}
- if(async)/* ResultSet rs =*/ {
+ if (async)/* ResultSet rs =*/ {
Result<ResultSetFuture> rs = updatePS.execAsync(trans, U_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
} else {
Result<ResultSet> rs = updatePS.exec(trans, U_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
}
@@ -261,41 +261,41 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
// This method Sig for Cached...
public Result<Void> delete(TRANS trans, DATA data, boolean reread) {
- if(deletePS==null) {
+ if (deletePS==null) {
return Result.err(Result.ERR_NotImplemented,"Delete is disabled for %s",getClass().getSimpleName());
}
// Since Deleting will be stored off, for possible re-constitution, need the whole thing
- if(reread) {
+ if (reread) {
Result<List<DATA>> rd = read(trans,data);
- if(rd.notOK()) {
+ if (rd.notOK()) {
return Result.err(rd);
}
- if(rd.isEmpty()) {
+ if (rd.isEmpty()) {
return Result.err(Status.ERR_NotFound,"Not Found");
}
- for(DATA d : rd.value) {
- if(async) {
+ for (DATA d : rd.value) {
+ if (async) {
Result<ResultSetFuture> rs = deletePS.execAsync(trans, D_TEXT, d);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
} else {
Result<ResultSet> rs = deletePS.exec(trans, D_TEXT, d);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
}
wasModified(trans, CRUD.delete, d);
}
} else {
- if(async)/* ResultSet rs =*/ {
+ if (async)/* ResultSet rs =*/ {
Result<ResultSetFuture> rs = deletePS.execAsync(trans, D_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
} else {
Result<ResultSet> rs = deletePS.exec(trans, D_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
}
@@ -317,9 +317,9 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
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) {
+ if (prop==null) {
prop = trans.getProperty(CASS_READ_CONSISTENCY);
- if(prop==null) {
+ if (prop==null) {
return ConsistencyLevel.ONE; // this is Cassandra Default
}
}
@@ -328,9 +328,9 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
protected static ConsistencyLevel writeConsistency(AuthzTrans trans, String table) {
String prop = trans.getProperty(CASS_WRITE_CONSISTENCY+'.'+table);
- if(prop==null) {
+ if (prop==null) {
prop = trans.getProperty(CASS_WRITE_CONSISTENCY);
- if(prop==null) {
+ if (prop==null) {
return ConsistencyLevel.ONE; // this is Cassandra Default\
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java
index cdfd0697..4a078f90 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java
@@ -60,14 +60,14 @@ public abstract class Loader<DATA> {
rv = new Object[size];
body(data,0,rv);
int body = size-keylimit();
- if(body>0) {
+ if (body>0) {
key(data,body,rv);
}
break;
default:
rv = new Object[size];
key(data,0,rv);
- if(size>keylimit()) {
+ if (size>keylimit()) {
body(data,keylimit(),rv);
}
break;
@@ -76,7 +76,7 @@ public abstract class Loader<DATA> {
}
public static void writeString(DataOutputStream os, String s) throws IOException {
- if(s==null) {
+ if (s==null) {
os.writeInt(-1);
} else {
switch(s.length()) {
@@ -108,7 +108,7 @@ public abstract class Loader<DATA> {
case 0: return "";
default:
// Cover case where there is a large string, without always allocating a large buffer.
- if(l>buff.length) {
+ if (l>buff.length) {
buff = new byte[l];
}
is.read(buff,0,l);
@@ -127,11 +127,11 @@ public abstract class Loader<DATA> {
* @throws IOException
*/
public static void writeStringSet(DataOutputStream os, Collection<String> set) throws IOException {
- if(set==null) {
+ if (set==null) {
os.writeInt(-1);
} else {
os.writeInt(set.size());
- for(String s : set) {
+ for (String s : set) {
writeString(os, s);
}
}
@@ -140,11 +140,11 @@ public abstract class Loader<DATA> {
public static Set<String> readStringSet(DataInputStream is, byte[] buff) throws IOException {
int l = is.readInt();
- if(l<0) {
+ if (l<0) {
return null;
}
Set<String> set = new HashSet<>(l);
- for(int i=0;i<l;++i) {
+ for (int i=0;i<l;++i) {
set.add(readString(is,buff));
}
return set;
@@ -152,11 +152,11 @@ public abstract class Loader<DATA> {
public static List<String> readStringList(DataInputStream is, byte[] buff) throws IOException {
int l = is.readInt();
- if(l<0) {
+ if (l<0) {
return null;
}
List<String> list = new ArrayList<>(l);
- for(int i=0;i<l;++i) {
+ for (int i=0;i<l;++i) {
list.add(Loader.readString(is,buff));
}
return list;
@@ -169,12 +169,12 @@ public abstract class Loader<DATA> {
* @throws IOException
*/
public static void writeStringMap(DataOutputStream os, Map<String,String> map) throws IOException {
- if(map==null) {
+ if (map==null) {
os.writeInt(-1);
} else {
Set<Entry<String, String>> es = map.entrySet();
os.writeInt(es.size());
- for(Entry<String,String> e : es) {
+ for (Entry<String,String> e : es) {
writeString(os, e.getKey());
writeString(os, e.getValue());
}
@@ -184,11 +184,11 @@ public abstract class Loader<DATA> {
public static Map<String,String> readStringMap(DataInputStream is, byte[] buff) throws IOException {
int l = is.readInt();
- if(l<0) {
+ if (l<0) {
return null;
}
Map<String,String> map = new HashMap<>(l);
- for(int i=0;i<l;++i) {
+ for (int i=0;i<l;++i) {
String key = readString(is,buff);
map.put(key,readString(is,buff));
}
@@ -200,11 +200,11 @@ public abstract class Loader<DATA> {
}
public static int readHeader(DataInputStream is, final int magic, final int version) throws IOException {
- if(is.readInt()!=magic) {
+ if (is.readInt()!=magic) {
throw new IOException("Corrupted Data Stream");
}
int v = is.readInt();
- if(version<0 || v>version) {
+ if (version<0 || v>version) {
throw new IOException("Unsupported Data Version: " + v);
}
return v;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java
index eb5885f0..106999d3 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java
@@ -57,7 +57,7 @@ public class CachedCredDAO extends CachedDAO<AuthzTrans, CredDAO, CredDAO.Data>
};
Result<List<CredDAO.Data>> lurd = get(trans, id, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserNotFound,"No User Cred found");
}
return lurd;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java
index a18e6a67..13180ab1 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java
@@ -46,13 +46,13 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
};
Result<List<Data>> lurd = get(trans, ns, getter);
- if(lurd.isOKhasData()) {
+ if (lurd.isOKhasData()) {
return lurd;
} else {
}
-// if(getter.result==null) {
-// if(lurd==null) {
+// if (getter.result==null) {
+// if (lurd==null) {
return Result.err(Status.ERR_PermissionNotFound,"No Permission found - " + lurd.details);
// } else {
// return Result.ok(lurd);
@@ -81,7 +81,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
// Note: Can reuse index1 here, because there is no name collision versus response
Result<List<Data>> lurd = get(trans, ns+'|'+type, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_PermissionNotFound,"No Permission found");
}
return lurd;
@@ -106,7 +106,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
public Result<Void> addRole(AuthzTrans trans, PermDAO.Data perm, RoleDAO.Data role) {
Result<Void> rv = dao().addRole(trans,perm,role.encode());
- if(trans.debug().isLoggable())
+ if (trans.debug().isLoggable())
trans.debug().log("Adding",role.encode(),"to", perm, "with CachedPermDAO.addRole");
invalidate(trans,perm);
return rv;
@@ -114,7 +114,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
public Result<Void> delRole(AuthzTrans trans, Data perm, RoleDAO.Data role) {
Result<Void> rv = dao().delRole(trans,perm,role.encode());
- if(trans.debug().isLoggable())
+ if (trans.debug().isLoggable())
trans.debug().log("Removing",role.encode(),"from", perm, "with CachedPermDAO.delRole");
invalidate(trans,perm);
return rv;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java
index 1d8e6709..99fac2da 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java
@@ -45,7 +45,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
};
Result<List<Data>> lurd = get(trans, ns, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_RoleNotFound,"No Role found");
}
return lurd;
@@ -59,7 +59,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
};
Result<List<Data>> lurd = get(trans, name, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_RoleNotFound,"No Role found");
}
return lurd;
@@ -74,7 +74,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
public Result<Void> addPerm(AuthzTrans trans, RoleDAO.Data rd, PermDAO.Data perm) {
Result<Void> rv = dao().addPerm(trans,rd,perm);
- if(trans.debug().isLoggable())
+ if (trans.debug().isLoggable())
trans.debug().log("Adding",perm,"to", rd, "with CachedRoleDAO.addPerm");
invalidate(trans, rd);
return rv;
@@ -82,7 +82,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
public Result<Void> delPerm(AuthzTrans trans, RoleDAO.Data rd, PermDAO.Data perm) {
Result<Void> rv = dao().delPerm(trans,rd,perm);
- if(trans.debug().isLoggable())
+ if (trans.debug().isLoggable())
trans.debug().log("Removing",perm,"from", rd, "with CachedRoleDAO.addPerm");
invalidate(trans, rd);
return rv;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java
index 2121b136..c1aa9017 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java
@@ -53,9 +53,9 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
DAOGetter getter = new DAOGetter(trans,dao()) {
public Result<List<Data>> call() {
// If the call is for THIS user, and it exists, get from TRANS, add to TRANS if not.
- if(user!=null && user.equals(trans.user())) {
+ if (user!=null && user.equals(trans.user())) {
Result<List<Data>> transLD = trans.get(transURSlot,null);
- if(transLD==null ) {
+ if (transLD==null ) {
transLD = dao.readByUser(trans, user);
}
return transLD;
@@ -65,7 +65,7 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
}
};
Result<List<Data>> lurd = get(trans, user, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,"UserRole not found for [%s]",user);
}
return lurd;
@@ -79,7 +79,7 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
}
};
Result<List<Data>> lurd = get(trans, role, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,"UserRole not found for [%s]",role);
}
return lurd;
@@ -88,12 +88,12 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
public Result<List<UserRoleDAO.Data>> readUserInRole(final AuthzTrans trans, final String user, final String role) {
DAOGetter getter = new DAOGetter(trans,dao()) {
public Result<List<Data>> call() {
- if(user.equals(trans.user())) {
+ if (user.equals(trans.user())) {
Result<List<Data>> rrbu = readByUser(trans, user);
- if(rrbu.isOK()) {
+ if (rrbu.isOK()) {
List<Data> ld = new ArrayList<>(1);
- for(Data d : rrbu.value) {
- if(d.role.equals(role)) {
+ for (Data d : rrbu.value) {
+ if (d.role.equals(role)) {
ld.add(d);
break;
}
@@ -107,7 +107,7 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
}
};
Result<List<Data>> lurd = get(trans, keyFromObjs(user,role), getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,"UserRole not found for role [%s] and user [%s]",role,user);
}
return lurd;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java
index 1948ac65..cc4135ee 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java
@@ -99,7 +99,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
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"
- if(row.getColumnDefinitions().size()>9) {
+ if (row.getColumnDefinitions().size()>9) {
// Rows reported in MicroSeconds
data.updated = new Date(row.getLong(9)/1000);
}
@@ -168,11 +168,11 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
@Override
public Result<Data> create(AuthzTrans trans, Data data) {
// If ID is not set (typical), create one.
- if(data.id==null) {
+ if (data.id==null) {
data.id = Chrono.dateToUUID(System.currentTimeMillis());
}
Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
return Result.ok(data);
@@ -200,14 +200,14 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
*/
@Override
public Result<Void> delete(AuthzTrans trans, Data data, boolean reread) {
- if(reread || data.status == null) { // if Memo is empty, likely not full record
+ if (reread || data.status == null) { // if Memo is empty, likely not full record
Result<ResultSet> rd = readPS.exec(trans, R_TEXT, data);
- if(rd.notOK()) {
+ if (rd.notOK()) {
return Result.err(rd);
}
ApprovalLoader.deflt.load(data, rd.value.one());
}
- if("approved".equals(data.status) || "denied".equals(data.status)) {
+ if ("approved".equals(data.status) || "denied".equals(data.status)) {
StringBuilder sb = new StringBuilder("BEGIN BATCH\n");
sb.append("INSERT INTO ");
sb.append(TABLELOG);
@@ -228,7 +228,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
sb.append("APPLY BATCH;\n");
TimeTaken tt = trans.start("DELETE APPROVAL",Env.REMOTE);
try {
- if(async) {
+ if (async) {
getSession(trans).executeAsync(sb.toString());
return Result.ok();
} else {
@@ -270,7 +270,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
: (modified.name() + "d approval for " + data.user);
// Detail?
// Reconstruct?
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java
index 6702476a..e0c0c0d4 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java
@@ -170,7 +170,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
writeString(os, data.mechid);
writeString(os, data.machine);
os.writeInt(data.type.size());
- for(String s : data.type) {
+ for (String s : data.type) {
writeString(os, s);
}
writeString(os, data.sponsor);
@@ -181,9 +181,9 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
writeString(os, data.notify);
os.writeLong(data.expires==null?-1:data.expires.getTime());
os.writeInt(data.renewDays);
- if(data.sans!=null) {
+ if (data.sans!=null) {
os.writeInt(data.sans.size());
- for(String s : data.sans) {
+ for (String s : data.sans) {
writeString(os, s);
}
} else {
@@ -200,7 +200,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
data.machine = readString(is,buff);
int size = is.readInt();
data.type = new HashSet<>(size);
- for(int i=0;i<size;++i) {
+ for (int i=0;i<size;++i) {
data.type.add(readString(is,buff));
}
data.sponsor = readString(is,buff);
@@ -214,7 +214,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
data.renewDays = is.readInt();
size = is.readInt();
data.sans = new HashSet<>(size);
- for(int i=0;i<size;++i) {
+ for (int i=0;i<size;++i) {
data.sans.add(readString(is,buff));
}
}
@@ -222,7 +222,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
private void init(AuthzTrans trans) {
// Set up sub-DAOs
- if(historyDAO==null) {
+ if (historyDAO==null) {
historyDAO = new HistoryDAO(trans,this);
}
@@ -288,7 +288,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
? String.format("%s by %s", override[0], hd.user)
: String.format("%sd %s for %s",modified.name(),data.mechid,data.machine);
// Detail?
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -296,7 +296,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
index e3f994c0..4aa94866 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
@@ -138,7 +138,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
}
public static<T extends Trans> void startUpdate(AuthzEnv env, HMangr hman, SecuritySetter<HttpURLConnection> ss, String ip, int port) {
- if(cacheUpdate==null) {
+ if (cacheUpdate==null) {
Thread t= new Thread(cacheUpdate = new CacheUpdate(env,hman,ss, ip,port),"CacheInfo Update Thread");
t.setDaemon(true);
t.start();
@@ -146,7 +146,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
}
public static<T extends Trans> void stopUpdate() {
- if(cacheUpdate!=null) {
+ if (cacheUpdate!=null) {
cacheUpdate.go=false;
}
}
@@ -195,9 +195,9 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
@Override
public Integer code(Rcli<?> client) throws APIException, CadiException {
URI to = client.getURI();
- if(!to.getAuthority().equals(authority)) {
+ if (!to.getAuthority().equals(authority)) {
Future<Void> f = client.delete("/mgmt/cache/"+type+'/'+segs,VOID_CT);
- if(f.get(hman.readTimeout())) {
+ if (f.get(hman.readTimeout())) {
++total;
} else {
trans.error().log("Error During AAF Peer Notify",f.code(),f.body());
@@ -216,14 +216,14 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
set = null;
}
public void add(int[] ints) {
- if(set==null) {
+ if (set==null) {
set = new HashSet<>();
- for(int i=0;i<raw.length;++i) {
+ for (int i=0;i<raw.length;++i) {
set.add(raw[i]);
}
}
- for(int i=0;i<ints.length;++i) {
+ for (int i=0;i<ints.length;++i) {
set.add(ints[i]);
}
}
@@ -232,9 +232,9 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
public String toString() {
StringBuilder sb = new StringBuilder();
boolean first = true;
- if(set==null) {
- for(int i : raw) {
- if(first) {
+ if (set==null) {
+ for (int i : raw) {
+ if (first) {
first=false;
} else {
sb.append(',');
@@ -242,8 +242,8 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
sb.append(i);
}
} else {
- for(Integer i : set) {
- if(first) {
+ for (Integer i : set) {
+ if (first) {
first=false;
} else {
sb.append(',');
@@ -260,7 +260,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
do {
try {
Transfer data = notifyDQ.poll(4,TimeUnit.SECONDS);
- if(data==null) {
+ if (data==null) {
continue;
}
@@ -271,37 +271,37 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
long start=0;
// Do a block poll first
do {
- if(gather==null) {
+ if (gather==null) {
start = System.nanoTime();
trans = env.newTransNoAvg();
cc = new CacheClear(trans);
gather = new HashMap<>();
}
IntHolder prev = gather.get(data.table);
- if(prev==null) {
+ if (prev==null) {
gather.put(data.table,new IntHolder(data.segs));
} else {
prev.add(data.segs);
}
// continue while there is data
- } while((data = notifyDQ.poll())!=null);
- if(gather!=null) {
- for(Entry<String, IntHolder> es : gather.entrySet()) {
+ } while ((data = notifyDQ.poll())!=null);
+ if (gather!=null) {
+ for (Entry<String, IntHolder> es : gather.entrySet()) {
cc.set(es);
try {
- if(hman.all(ss, cc, false)!=null) {
+ if (hman.all(ss, cc, false)!=null) {
++count;
}
} catch (Exception e) {
trans.error().log(e, "Error on Cache Update");
}
}
- if(env.debug().isLoggable()) {
+ if (env.debug().isLoggable()) {
float millis = (System.nanoTime()-start)/1000000f;
StringBuilder sb = new StringBuilder("Direct Cache Refresh: ");
sb.append("Updated ");
sb.append(count);
- if(count==1) {
+ if (count==1) {
sb.append(" entry for ");
} else {
sb.append(" entries for ");
@@ -309,7 +309,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
int peers = count<=0?0:cc.total/count;
sb.append(peers);
sb.append(" client");
- if(peers!=1) {
+ if (peers!=1) {
sb.append('s');
}
sb.append(" in ");
@@ -323,7 +323,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
go = false;
Thread.currentThread().interrupt();
}
- } while(go);
+ } while (go);
}
}
@@ -347,9 +347,9 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
/////////////
// ConcurrentQueues are open-ended. We don't want any Memory leaks
// Note: we keep a separate counter, because "size()" on a Linked Queue is expensive
- if(cacheUpdate!=null) {
+ if (cacheUpdate!=null) {
try {
- if(!CacheUpdate.notifyDQ.offer(new CacheUpdate.Transfer(name, seg),2,TimeUnit.SECONDS)) {
+ if (!CacheUpdate.notifyDQ.offer(new CacheUpdate.Transfer(name, seg),2,TimeUnit.SECONDS)) {
trans.error().log("Cache Notify Queue is not accepting messages, bouncing may be appropriate" );
}
} catch (InterruptedException e) {
@@ -367,7 +367,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
start.append(": ");
StringBuilder sb = new StringBuilder("BEGIN BATCH\n");
boolean first = true;
- for(int s : seg) {
+ for (int s : seg) {
sb.append(UPDATE_SP);
sb.append(TABLE);
sb.append(" SET touched=dateof(now()) WHERE name = '");
@@ -375,7 +375,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
sb.append("' AND seg = ");
sb.append(s);
sb.append(";\n");
- if(first) {
+ if (first) {
first =false;
} else {
start.append(',');
@@ -413,24 +413,24 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
String lastName = null;
Date[] dates = null;
- for(Row row : rs.all()) {
+ for (Row row : rs.all()) {
String name = row.getString(0);
int seg = row.getInt(1);
- if(!name.equals(lastName)) {
+ if (!name.equals(lastName)) {
dates = info.get(name);
lastName=name;
}
- if(dates==null) {
+ if (dates==null) {
dates=new Date[seg+1];
info.put(name,dates);
- } else if(dates.length<=seg) {
+ } else if (dates.length<=seg) {
Date[] temp = new Date[seg+1];
System.arraycopy(dates, 0, temp, 0, dates.length);
dates = temp;
info.put(name, dates);
}
Date temp = row.getTimestamp(2);
- if(dates[seg]==null || dates[seg].before(temp)) {
+ if (dates[seg]==null || dates[seg].before(temp)) {
dates[seg]=temp;
}
}
@@ -443,16 +443,16 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
@Override
public Date get(AuthzTrans trans, String table, int seg) {
Date[] dates = info.get(table);
- if(dates==null) {
+ if (dates==null) {
dates = new Date[seg+1];
touch(trans,table, seg);
- } else if(dates.length<=seg) {
+ } else if (dates.length<=seg) {
Date[] temp = new Date[seg+1];
System.arraycopy(dates, 0, temp, 0, dates.length);
dates = temp;
}
Date rv = dates[seg];
- if(rv==null) {
+ if (rv==null) {
rv=dates[seg]=startTime;
}
return rv;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java
index 00c9ae90..6c23938f 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java
@@ -143,7 +143,7 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
writeString(os, data.x500);
writeString(os, data.x509);
writeString(os, data.ca);
- if(data.serial==null) {
+ if (data.serial==null) {
os.writeInt(-1);
} else {
byte[] dsba = data.serial.toByteArray();
@@ -164,9 +164,9 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
data.ca = readString(is,buff);
int i = is.readInt();
data.serial=null;
- if(i>=0) {
+ if (i>=0) {
byte[] bytes = new byte[i]; // a bit dangerous, but lessened because of all the previous sized data reads
- if(is.read(bytes)>0) {
+ if (is.read(bytes)>0) {
data.serial = new BigInteger(bytes);
}
}
@@ -180,10 +180,10 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
private void init(AuthzTrans trans) throws APIException, IOException {
// Set up sub-DAOs
- if(historyDAO==null) {
+ if (historyDAO==null) {
historyDAO = new HistoryDAO(trans,this);
}
- if(infoDAO==null) {
+ if (infoDAO==null) {
infoDAO = new CacheInfoDAO(trans,this);
}
@@ -226,7 +226,7 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
? String.format("%s by %s", override[0], hd.user)
: (modified.name() + "d certificate info for " + data.id);
// Detail?
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -234,10 +234,10 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).status!=Status.OK) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).status!=Status.OK) {
trans.error().log("Cannot touch Cert");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
index 5bcba9d9..7674c7e8 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
@@ -158,7 +158,7 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
os.writeInt(data.other==null?0:data.other);
writeString(os, data.ns);
writeString(os, data.notes);
- if(data.cred==null) {
+ if (data.cred==null) {
os.writeInt(-1);
} else {
int l = data.cred.limit()-data.cred.position();
@@ -183,10 +183,10 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
int i = is.readInt();
data.cred=null;
- if(i>=0) {
+ if (i>=0) {
byte[] bytes = new byte[i]; // a bit dangerous, but lessened because of all the previous sized data reads
int read = is.read(bytes);
- if(read>0) {
+ if (read>0) {
data.cred = ByteBuffer.wrap(bytes);
}
}
@@ -195,10 +195,10 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
private void init(AuthzTrans trans) throws APIException, IOException {
// Set up sub-DAOs
- if(historyDAO==null) {
+ if (historyDAO==null) {
historyDAO = new HistoryDAO(trans,this);
}
- if(infoDAO==null) {
+ if (infoDAO==null) {
infoDAO = new CacheInfoDAO(trans,this);
}
@@ -241,7 +241,7 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
? String.format("%s by %s", override[0], hd.user)
: (modified.name() + "d credential for " + data.id);
// Detail?
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -249,10 +249,10 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).status!=Status.OK) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).status!=Status.OK) {
trans.error().log("Cannot touch Cred");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
index 6b0ea2df..a98f101f 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
@@ -143,14 +143,14 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
*/
public Result<FutureDAO.Data> create(AuthzTrans trans, FutureDAO.Data data, String id) {
// If ID is not set (typical), create one.
- if(data.id==null) {
+ if (data.id==null) {
StringBuilder sb = new StringBuilder(trans.user());
sb.append(data.target);
sb.append(System.currentTimeMillis());
data.id = UUID.nameUUIDFromBytes(sb.toString().getBytes());
}
Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
wasModified(trans, CRUD.create, data, null, id);
@@ -175,7 +175,7 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
hd.subject = subject?override[1]:"";
hd.memo = memo?String.format("%s by %s", override[0], hd.user):data.memo;
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
index ce7e5477..a40b28fb 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
@@ -174,7 +174,7 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
public Result<List<Data>> readByYYYYMM(AuthzTrans trans, int yyyymm) {
Result<ResultSet> rs = readByYRMN.exec(trans, "yr_mon", yyyymm);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
return extract(defLoader,rs.value,null,dflt);
@@ -186,22 +186,22 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
* month - the month in a year ...values 1 - 12
**/
public Result<List<Data>> readByUser(AuthzTrans trans, String user, int ... yyyymm) {
- if(yyyymm.length==0) {
+ if (yyyymm.length==0) {
return Result.err(Status.ERR_BadData, "No or invalid yyyymm specified");
}
Result<ResultSet> rs = readByUser.exec(trans, "user", user);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
return extract(defLoader,rs.value,null,yyyymm.length>0?new YYYYMM(yyyymm):dflt);
}
public Result<List<Data>> readBySubject(AuthzTrans trans, String subject, String target, int ... yyyymm) {
- if(yyyymm.length==0) {
+ if (yyyymm.length==0) {
return Result.err(Status.ERR_BadData, "No or invalid yyyymm specified");
}
Result<ResultSet> rs = readBySubject.exec(trans, "subject", subject, target);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
return extract(defLoader,rs.value,null,yyyymm.length>0?new YYYYMM(yyyymm):dflt);
@@ -215,8 +215,8 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
@Override
public boolean ok(Data data) {
int dym = data.yr_mon;
- for(int ym:yyyymm) {
- if(dym==ym) {
+ for (int ym:yyyymm) {
+ if (dym==ym) {
return true;
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
index 5d7aebed..757efa5f 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
@@ -162,11 +162,11 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
os.writeFloat(data.latitude);
os.writeFloat(data.longitude);
writeString(os, data.protocol);
- if(data.subprotocol==null) {
+ if (data.subprotocol==null) {
os.writeInt(0);
} else {
os.writeInt(data.subprotocol.size());
- for(String s: data.subprotocol) {
+ for (String s: data.subprotocol) {
writeString(os,s);
}
}
@@ -192,11 +192,11 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
int size = is.readInt();
data.subprotocol = new HashSet<>(size);
- for(int i=0;i<size;++i) {
+ for (int i=0;i<size;++i) {
data.subprotocol.add(readString(is,buff));
}
String port_key = readString(is,buff);
- if(port_key.length()>0) {
+ if (port_key.length()>0) {
data.port_key=UUID.fromString(port_key);
} else {
data.port_key = null;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java
index 29ac379b..192887b9 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java
@@ -55,9 +55,9 @@ public class Namespace implements Bytification {
description = ndd.description;
type = ndd.type;
parent = ndd.parent;
- if(ndd.attrib!=null && !ndd.attrib.isEmpty()) {
+ if (ndd.attrib!=null && !ndd.attrib.isEmpty()) {
attrib = new ArrayList<>();
- for( Entry<String, String> entry : ndd.attrib.entrySet()) {
+ for ( Entry<String, String> entry : ndd.attrib.entrySet()) {
attrib.add(new Pair<String,String>(entry.getKey(),entry.getValue()));
}
}
@@ -70,9 +70,9 @@ public class Namespace implements Bytification {
description = ndd.description;
type = ndd.type;
parent = ndd.parent;
- if(ndd.attrib!=null && !ndd.attrib.isEmpty()) {
+ if (ndd.attrib!=null && !ndd.attrib.isEmpty()) {
attrib = new ArrayList<>();
- for( Entry<String, String> entry : ndd.attrib.entrySet()) {
+ for ( Entry<String, String> entry : ndd.attrib.entrySet()) {
attrib.add(new Pair<String,String>(entry.getKey(),entry.getValue()));
}
}
@@ -141,7 +141,7 @@ public class Namespace implements Bytification {
*/
@Override
public boolean equals(Object arg0) {
- if(arg0==null || !(arg0 instanceof Namespace)) {
+ if (arg0==null || !(arg0 instanceof Namespace)) {
return false;
}
return name.equals(((Namespace)arg0).name);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java
index 30f0d6b5..f769e38c 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java
@@ -149,10 +149,10 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
private void init(AuthzTrans trans) throws APIException, IOException {
// Set up sub-DAOs
- if(historyDAO==null) {
+ if (historyDAO==null) {
historyDAO = new HistoryDAO(trans, this);
}
- if(infoDAO==null) {
+ if (infoDAO==null) {
infoDAO = new CacheInfoDAO(trans,this);
}
@@ -205,11 +205,11 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
os.writeInt(data.type);
writeString(os,data.description);
writeString(os,data.parent);
- if(data.attrib==null) {
+ if (data.attrib==null) {
os.writeInt(-1);
} else {
os.writeInt(data.attrib.size());
- for(Entry<String, String> es : data.attrib(false).entrySet()) {
+ for (Entry<String, String> es : data.attrib(false).entrySet()) {
writeString(os,es.getKey());
writeString(os,es.getValue());
}
@@ -227,9 +227,9 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
data.description = readString(is,buff);
data.parent = readString(is,buff);
int count = is.readInt();
- if(count>0) {
+ if (count>0) {
Map<String, String> da = data.attrib(true);
- for(int i=0;i<count;++i) {
+ for (int i=0;i<count;++i) {
da.put(readString(is,buff), readString(is,buff));
}
}
@@ -241,7 +241,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public Result<Data> create(AuthzTrans trans, Data data) {
String ns = data.name;
// Ensure Parent is set
- if(data.parent==null) {
+ if (data.parent==null) {
return Result.err(Result.ERR_BadData, "Need parent for %s", ns);
}
@@ -254,7 +254,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
getSession(trans).execute(stmt.toString());
//// TEST CODE for Exception
// boolean force = true;
-// if(force) {
+// if (force) {
// throw new com.datastax.driver.core.exceptions.NoHostAvailableException(new HashMap<>());
//// throw new com.datastax.driver.core.exceptions.AuthenticationException(new InetSocketAddress(9999),"Sample Message");
// }
@@ -272,7 +272,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public Result<Void> update(AuthzTrans trans, Data data) {
String ns = data.name;
// Ensure Parent is set
- if(data.parent==null) {
+ if (data.parent==null) {
return Result.err(Result.ERR_BadData, "Need parent for %s", ns);
}
@@ -281,26 +281,26 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
try {
Map<String, String> localAttr = data.attrib;
Result<Map<String, String>> rremoteAttr = readAttribByNS(trans,ns);
- if(rremoteAttr.notOK()) {
+ if (rremoteAttr.notOK()) {
return Result.err(rremoteAttr);
}
// update Attributes
String str;
- for(Entry<String, String> es : localAttr.entrySet()) {
+ for (Entry<String, String> es : localAttr.entrySet()) {
str = rremoteAttr.value.get(es.getKey());
- if(str==null || !str.equals(es.getValue())) {
+ if (str==null || !str.equals(es.getValue())) {
attribUpdateStmt(stmt, ns, es.getKey(),es.getValue());
}
}
// No point in deleting... insert overwrites...
-// for(Entry<String, String> es : remoteAttr.entrySet()) {
+// for (Entry<String, String> es : remoteAttr.entrySet()) {
// str = localAttr.get(es.getKey());
-// if(str==null || !str.equals(es.getValue())) {
+// if (str==null || !str.equals(es.getValue())) {
// attribDeleteStmt(stmt, ns, es.getKey());
// }
// }
- if(stmt.length()>BEGIN_BATCH.length()) {
+ if (stmt.length()>BEGIN_BATCH.length()) {
stmt.append(APPLY_BATCH);
getSession(trans).execute(stmt.toString());
}
@@ -320,11 +320,11 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public Result<List<Data>> read(AuthzTrans trans, Data data) {
Result<List<Data>> rld = super.read(trans, data);
- if(rld.isOKhasData()) {
- for(Data d : rld.value) {
+ if (rld.isOKhasData()) {
+ for (Data d : rld.value) {
// Note: Map is null at this point, save time/mem by assignment
Result<Map<String, String>> rabn = readAttribByNS(trans,d.name);
- if(rabn.isOK()) {
+ if (rabn.isOK()) {
d.attrib = rabn.value;
} else {
return Result.err(rabn);
@@ -341,11 +341,11 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public Result<List<Data>> read(AuthzTrans trans, Object... key) {
Result<List<Data>> rld = super.read(trans, key);
- if(rld.isOKhasData()) {
- for(Data d : rld.value) {
+ if (rld.isOKhasData()) {
+ for (Data d : rld.value) {
// Note: Map is null at this point, save time/mem by assignment
Result<Map<String, String>> rabn = readAttribByNS(trans,d.name);
- if(rabn.isOK()) {
+ if (rabn.isOK()) {
d.attrib = rabn.value;
} else {
return Result.err(rabn);
@@ -385,7 +385,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
+ ns
+ "';");
- for(Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
+ for (Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
Row r = iter.next();
map.put(r.getString(0), r.getString(1));
}
@@ -408,7 +408,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
+ key
+ "';");
- for(Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
+ for (Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
Row r = iter.next();
set.add(r.getString(0));
}
@@ -489,7 +489,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
private void attribInsertStmts(StringBuilder stmt, Data data) {
// INSERT new Attrib
- for(Entry<String,String> es : data.attrib(false).entrySet() ) {
+ for (Entry<String,String> es : data.attrib(false).entrySet() ) {
stmt.append(" ");
attribInsertStmt(stmt,data.name,es.getKey(),es.getValue());
}
@@ -541,7 +541,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
hd.target = TABLE;
hd.subject = subject ? override[1] : data.name;
hd.memo = memo ? override[0] : (data.name + " was " + modified.name() + 'd' );
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -549,10 +549,10 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
trans.error().log("Cannot touch CacheInfo");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java
index a64c0a94..2beeaf38 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java
@@ -28,10 +28,10 @@ public class NsSplit {
public NsSplit(NsDAO.Data nsd, String child) {
this.nsd = nsd;
- if(child.startsWith(nsd.name)) {
+ if (child.startsWith(nsd.name)) {
ns = nsd.name;
int dot = ns.length();
- if(dot<child.length() && child.charAt(dot)=='.') {
+ if (dot<child.length() && child.charAt(dot)=='.') {
name = child.substring(dot+1);
} else {
name="";
@@ -48,7 +48,7 @@ public class NsSplit {
this.nsd = new NsDAO.Data();
nsd.name = ns;
int dot = ns.lastIndexOf('.');
- if(dot>=0) {
+ if (dot>=0) {
nsd.parent = ns.substring(0, dot);
} else {
nsd.parent = ".";
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java
index 59e18ae9..e656a555 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java
@@ -46,8 +46,8 @@ public enum NsType {
* @return
*/
public static NsType fromType(int t) {
- for(NsType nst : values()) {
- if(t==nst.type) {
+ for (NsType nst : values()) {
+ if (t==nst.type) {
return nst;
}
}
@@ -60,9 +60,9 @@ public enum NsType {
* @return
*/
public static NsType fromString(String s) {
- if(s!=null) {
- for(NsType nst : values()) {
- if(nst.name().equals(s)) {
+ if (s!=null) {
+ for (NsType nst : values()) {
+ if (nst.name().equals(s)) {
return nst;
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
index c02387b1..6e1057b8 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
@@ -114,13 +114,13 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
*/
public static Result<Data> decode(AuthzTrans trans, Question q, String p) {
String[] ss = Split.splitTrim('|', p,4);
- if(ss[2]==null) {
+ if (ss[2]==null) {
return Result.err(Status.ERR_BadData,"Perm Encodings must be separated by '|'");
}
Data data = new Data();
- if(ss[3]==null) { // older 3 part encoding must be evaluated for NS
+ if (ss[3]==null) { // older 3 part encoding must be evaluated for NS
Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
- if(nss.notOK()) {
+ if (nss.notOK()) {
return Result.err(nss);
}
data.ns=nss.value.ns;
@@ -146,15 +146,15 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
*/
public static Result<String[]> decodeToArray(AuthzTrans trans, Question q, String p) {
String[] ss = Split.splitTrim('|', p,4);
- if(ss[2]==null) {
+ if (ss[2]==null) {
return Result.err(Status.ERR_BadData,"Perm Encodings must be separated by '|'");
}
- if(ss[3]==null) { // older 3 part encoding must be evaluated for NS
+ if (ss[3]==null) { // older 3 part encoding must be evaluated for NS
ss[3] = ss[2];
ss[2] = ss[1];
Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
- if(nss.notOK()) {
+ if (nss.notOK()) {
return Result.err(nss);
}
ss[1] = nss.value.name;
@@ -191,7 +191,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
String[] s = name.split("\\|");
Result<NsSplit> rdns = q.deriveNsSplit(trans, s[0]);
Data rv = new PermDAO.Data();
- if(rdns.isOKhasData()) {
+ if (rdns.isOKhasData()) {
switch(s.length) {
case 3:
rv.type=s[1];
@@ -482,7 +482,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
hd.memo = String.format("%sd %s|%s|%s", modified.name(),data.fullType(),data.instance,data.action);
}
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -490,10 +490,10 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
trans.error().log("Cannot touch CacheInfo");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
index 4489d268..127dd4e2 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
@@ -124,9 +124,9 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
public static Result<Data> decode(AuthzTrans trans, Question q, String r) {
String[] ss = Split.splitTrim('|', r,2);
Data data = new Data();
- if(ss[1]==null) { // older 1 part encoding must be evaluated for NS
+ if (ss[1]==null) { // older 1 part encoding must be evaluated for NS
Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
- if(nss.notOK()) {
+ if (nss.notOK()) {
return Result.err(nss);
}
data.ns=nss.value.ns;
@@ -161,9 +161,9 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
*/
public static Result<String[]> decodeToArray(AuthzTrans trans, Question q, String p) {
String[] ss = Split.splitTrim('|', p,2);
- if(ss[1]==null) { // older 1 part encoding must be evaluated for NS
+ if (ss[1]==null) { // older 1 part encoding must be evaluated for NS
Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
- if(nss.notOK()) {
+ if (nss.notOK()) {
return Result.err(nss);
}
ss[0] = nss.value.ns;
@@ -287,7 +287,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
}
public Result<List<Data>> readChildren(AuthzTrans trans, String ns, String role) {
- if(role.length()==0 || "*".equals(role)) {
+ if (role.length()==0 || "*".equals(role)) {
return psChildren.read(trans, R_TEXT, new Object[]{ns, FIRST_CHAR, LAST_CHAR});
} else {
return psChildren.read(trans, R_TEXT, new Object[]{ns, role+DOT, role+DOT_PLUS_ONE});
@@ -392,7 +392,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
hd.target = TABLE;
hd.subject = subject ? override[1] : data.fullName();
hd.memo = memo ? override[0] : (data.fullName() + " was " + modified.name() + 'd' );
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -400,10 +400,10 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
trans.error().log("Cannot touch CacheInfo for Role");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java
index 7b9f7b91..26f9a995 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java
@@ -127,7 +127,7 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
public boolean role(AuthzTrans trans, Question ques, String role) {
this.role = role;
Result<NsSplit> rnss = ques.deriveNsSplit(trans, role);
- if(rnss.isOKhasData()) {
+ if (rnss.isOKhasData()) {
ns = rnss.value.ns;
rname = rnss.value.name;
return true;
@@ -304,15 +304,15 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
: "n/a";
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(historyDAO.create(trans, hdRole).status!=Status.OK) {
+ if (historyDAO.create(trans, hdRole).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
// uses User as Segment
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
trans.error().log("Cannot touch CacheInfo");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java
index f0a59582..0bc23c92 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java
@@ -47,7 +47,7 @@ public class CassExecutor implements Executor {
@Override
public boolean inRole(String name) {
Result<NsSplit> nss = q.deriveNsSplit(trans, name);
- if(nss.notOK())return false;
+ if (nss.notOK())return false;
return q.roleDAO.read(trans, nss.value.ns,nss.value.name).isOKhasData();
}
@@ -58,7 +58,7 @@ public class CassExecutor implements Executor {
@Override
public String namespace() throws Exception {
Result<Data> res = q.validNSOfDomain(trans,trans.user());
- if(res.isOK()) {
+ if (res.isOK()) {
String user[] = trans.user().split("\\.");
return user[user.length-1] + '.' + user[user.length-2];
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
index f3aae2ec..f440a8cd 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
@@ -81,9 +81,9 @@ public class Function {
* @return
*/
public static FUTURE_OP toFO(String value) {
- if(value!=null) {
- for(FUTURE_OP fo : values()) {
- if(fo.name().equals(value)){
+ if (value!=null) {
+ for (FUTURE_OP fo : values()) {
+ if (fo.name().equals(value)){
return fo;
}
}
@@ -194,16 +194,16 @@ public class Function {
String reason;
if (orgUser == null) {
return Result.err(Status.ERR_Policy,"%s is not a valid user at %s",u,org.getName());
- } else if((reason=orgUser.mayOwn())!=null) {
+ } else if ((reason=orgUser.mayOwn())!=null) {
if (org.isTestEnv()) {
String reason2;
- if((reason2=org.validate(trans, Policy.AS_RESPONSIBLE,new CassExecutor(trans, this), u))!=null) { // can masquerade as responsible
+ if ((reason2=org.validate(trans, Policy.AS_RESPONSIBLE,new CassExecutor(trans, this), u))!=null) { // can masquerade as responsible
trans.debug().log(reason2);
return Result.err(Status.ERR_Policy,CANNOT_BE_THE_OWNER_OF_A_NAMESPACE,orgUser.fullName(),orgUser.id(),namespace.name,reason);
}
// a null means ok
} else {
- if(orgUser.isFound()) {
+ if (orgUser.isFound()) {
return Result.err(Status.ERR_Policy,CANNOT_BE_THE_OWNER_OF_A_NAMESPACE,orgUser.fullName(),orgUser.id(),namespace.name, reason);
} else {
return Result.err(Status.ERR_Policy,u + " is an invalid Identity");
@@ -267,7 +267,7 @@ public class Function {
// or helpful for Operations folks..
// Admins can be empty, because they can be changed by lower level
// NSs
- // if(ns.admin(false).isEmpty()) {
+ // if (ns.admin(false).isEmpty()) {
// ns.admin(true).add(user);
// }
if (namespace.admin != null) {
@@ -334,9 +334,9 @@ public class Function {
for (RoleDAO.Data rdd : rrdc.value) {
// Remove old Role from Perms, save them off
List<PermDAO.Data> lpdd = new ArrayList<>();
- for(String p : rdd.perms(false)) {
+ for (String p : rdd.perms(false)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans,q,p);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
PermDAO.Data pdd = rpdd.value;
lpdd.add(pdd);
q.permDAO.delRole(trans, pdd, rdd);
@@ -358,13 +358,13 @@ public class Function {
// "create" per se
if ((rq = q.roleDAO.create(trans, rdd)).isOK()) {
// Put Role back into Perm, with correct info
- for(PermDAO.Data pdd : lpdd) {
+ for (PermDAO.Data pdd : lpdd) {
q.permDAO.addRole(trans, pdd, rdd);
}
// Change data for User Roles
Result<List<UserRoleDAO.Data>> rurd = q.userRoleDAO.readByRole(trans, rdd.fullName());
- if(rurd.isOKhasData()) {
- for(UserRoleDAO.Data urd : rurd.value) {
+ if (rurd.isOKhasData()) {
+ for (UserRoleDAO.Data urd : rurd.value) {
urd.ns = rdd.ns;
urd.rname = rdd.name;
q.userRoleDAO.update(trans, urd);
@@ -389,9 +389,9 @@ public class Function {
// Remove old Perm from Roles, save them off
List<RoleDAO.Data> lrdd = new ArrayList<>();
- for(String rl : pdd.roles(false)) {
+ for (String rl : pdd.roles(false)) {
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,q,rl);
- if(rrdd.isOKhasData()) {
+ if (rrdd.isOKhasData()) {
RoleDAO.Data rdd = rrdd.value;
lrdd.add(rdd);
q.roleDAO.delPerm(trans, rdd, pdd);
@@ -408,7 +408,7 @@ public class Function {
.substring(targetNameDot) : "";
if ((rq = q.permDAO.create(trans, pdd)).isOK()) {
// Put Role back into Perm, with correct info
- for(RoleDAO.Data rdd : lrdd) {
+ for (RoleDAO.Data rdd : lrdd) {
q.roleDAO.addPerm(trans, rdd, pdd);
}
@@ -698,7 +698,7 @@ public class Function {
} else {
if (org.isTestEnv()) {
String reason2;
- if((reason2 = org.validate(trans, Policy.AS_RESPONSIBLE, new CassExecutor(trans, this), id))==null) {
+ if ((reason2 = org.validate(trans, Policy.AS_RESPONSIBLE, new CassExecutor(trans, this), id))==null) {
return Result.ok();
} else {
trans.debug().log(reason2);
@@ -726,7 +726,7 @@ public class Function {
rq = q.mayUser(trans, trans.user(), rq.value, Access.write);
if (rq.notOK()) {
Result<List<UserRoleDAO.Data>> ruinr = q.userRoleDAO.readUserInRole(trans, trans.user(),ns+".owner");
- if(!(ruinr.isOKhasData() && ruinr.value.get(0).expires.after(new Date()))) {
+ if (!(ruinr.isOKhasData() && ruinr.value.get(0).expires.after(new Date()))) {
return Result.err(rq);
}
}
@@ -748,7 +748,7 @@ public class Function {
"%s is not a valid %s Credential", user, org.getName());
}
//TODO find out how to make sure good ALTERNATE OAUTH DOMAIN USER
-// } else if(user.endsWith(ALTERNATE OAUTH DOMAIN)) {
+// } else if (user.endsWith(ALTERNATE OAUTH DOMAIN)) {
// return Result.ok();
} else {
Result<List<CredDAO.Data>> cdr = q.credDAO.readID(trans, user);
@@ -794,7 +794,7 @@ public class Function {
if (rq.notOK()) {
// Even though not a "writer", Owners still determine who gets to be an Admin
Result<List<UserRoleDAO.Data>> ruinr = q.userRoleDAO.readUserInRole(trans, trans.user(),ns+".owner");
- if(!(ruinr.isOKhasData() && ruinr.value.get(0).expires.after(new Date()))) {
+ if (!(ruinr.isOKhasData() && ruinr.value.get(0).expires.after(new Date()))) {
return Result.err(rq);
}
}
@@ -827,9 +827,9 @@ public class Function {
// Remove old Perm from Roles, save them off
List<RoleDAO.Data> lrdd = new ArrayList<>();
- for(String rl : pdd.roles(false)) {
+ for (String rl : pdd.roles(false)) {
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,q,rl);
- if(rrdd.isOKhasData()) {
+ if (rrdd.isOKhasData()) {
RoleDAO.Data rdd = rrdd.value;
lrdd.add(rdd);
q.roleDAO.delPerm(trans, rdd, pdd);
@@ -846,7 +846,7 @@ public class Function {
// Use direct Create/Delete, because switching namespaces
if ((pd = q.permDAO.create(trans, pdd)).isOK()) {
// Put Role back into Perm, with correct info
- for(RoleDAO.Data rdd : lrdd) {
+ for (RoleDAO.Data rdd : lrdd) {
q.roleDAO.addPerm(trans, rdd, pdd);
}
@@ -892,9 +892,9 @@ public class Function {
}
// Remove old Role from Perms, save them off
List<PermDAO.Data> lpdd = new ArrayList<>();
- for(String p : rdd.perms(false)) {
+ for (String p : rdd.perms(false)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans,q,p);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
PermDAO.Data pdd = rpdd.value;
lpdd.add(pdd);
q.permDAO.delRole(trans, pdd, rdd);
@@ -912,7 +912,7 @@ public class Function {
// Use direct Create/Delete, because switching namespaces
if ((rd = q.roleDAO.create(trans, rdd)).isOK()) {
// Put Role back into Perm, with correct info
- for(PermDAO.Data pdd : lpdd) {
+ for (PermDAO.Data pdd : lpdd) {
q.permDAO.addRole(trans, pdd, rdd);
}
@@ -973,7 +973,7 @@ public class Function {
// For each Role
for (String role : roles = perm.roles(true)) {
Result<RoleDAO.Data> rdd = RoleDAO.Data.decode(trans,q,role);
- if(rdd.isOKhasData()) {
+ if (rdd.isOKhasData()) {
RoleDAO.Data rd = rdd.value;
if (!fromApproval) {
// May User write to the Role in question.
@@ -1038,7 +1038,7 @@ public class Function {
for (String role : fullperm.roles) {
Result<Void> rv = null;
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, q, role);
- if(rrdd.isOKhasData()) {
+ if (rrdd.isOKhasData()) {
trans.debug().log("Removing", role, "from", fullperm, "on Perm Delete");
if ((rv = q.roleDAO.delPerm(trans, rrdd.value, fullperm)).notOK()) {
if (rv.notOK()) {
@@ -1131,19 +1131,19 @@ public class Function {
if (!fromApproval) {
Result<NsDAO.Data> rRoleCo = q.deriveFirstNsForType(trans, role.ns, NsType.COMPANY);
- if(rRoleCo.notOK()) {
+ if (rRoleCo.notOK()) {
return Result.err(rRoleCo);
}
Result<NsDAO.Data> rPermCo = q.deriveFirstNsForType(trans, pd.ns, NsType.COMPANY);
- if(rPermCo.notOK()) {
+ if (rPermCo.notOK()) {
return Result.err(rPermCo);
}
// Not from same company
- if(!rRoleCo.value.name.equals(rPermCo.value.name)) {
+ if (!rRoleCo.value.name.equals(rPermCo.value.name)) {
Result<Data> r;
// Only grant if User ALSO has Write ability in Other Company
- if((r = q.mayUser(trans, user, role, Access.write)).notOK()) {
+ if ((r = q.mayUser(trans, user, role, Access.write)).notOK()) {
return Result.err(r);
}
}
@@ -1279,7 +1279,7 @@ public class Function {
break;
}
}
- if(!notFound) {
+ if (!notFound) {
break;
}
}
@@ -1343,14 +1343,14 @@ public class Function {
*/
public Result<Void> addUserRole(AuthzTrans trans,UserRoleDAO.Data urData) {
Result<Void> rv;
- if(Question.ADMIN.equals(urData.rname)) {
+ if (Question.ADMIN.equals(urData.rname)) {
rv = mayAddAdmin(trans, urData.ns, urData.user);
- } else if(Question.OWNER.equals(urData.rname)) {
+ } else if (Question.OWNER.equals(urData.rname)) {
rv = mayAddOwner(trans, urData.ns, urData.user);
} else {
rv = checkValidID(trans, new Date(), urData.user);
}
- if(rv.notOK()) {
+ if (rv.notOK()) {
return rv;
}
@@ -1378,7 +1378,7 @@ public class Function {
public Result<Void> addUserRole(AuthzTrans trans, String user, String ns, String rname) {
try {
- if(trans.org().getIdentity(trans, user)==null) {
+ if (trans.org().getIdentity(trans, user)==null) {
return Result.err(Result.ERR_BadData,user+" is an Invalid Identity for " + trans.org().getName());
}
} catch (OrganizationException e) {
@@ -1476,9 +1476,9 @@ public class Function {
Result<List<UserRoleDAO.Data>> rrbr = q.userRoleDAO
.readByRole(trans, nsd.name + Question.DOT_OWNER);
if (rrbr.isOKhasData()) {
- for(UserRoleDAO.Data urd : rrbr.value) {
+ for (UserRoleDAO.Data urd : rrbr.value) {
Identity owner = org.getIdentity(trans, urd.user);
- if(owner==null) {
+ if (owner==null) {
return Result.err(Result.ERR_NotFound,urd.user + " is not a Valid Owner of " + nsd.name);
} else {
owners.add(owner);
@@ -1487,7 +1487,7 @@ public class Function {
}
}
- if(owners.isEmpty()) {
+ if (owners.isEmpty()) {
return Result.err(Result.ERR_NotFound,"No Owners found for " + nsd.name);
}
@@ -1501,17 +1501,17 @@ public class Function {
final UUID ticket = fr.value.id;
sb.append(", Approvals: ");
Boolean first[] = new Boolean[]{true};
- if(op!=FUTURE_OP.A) {
+ if (op!=FUTURE_OP.A) {
for (Identity u : approvers) {
Result<ApprovalDAO.Data> r = addIdentity(trans,sb,first,user,data.memo,op,u,ticket,org.getApproverType());
- if(r.notOK()) {
+ if (r.notOK()) {
return Result.err(r);
}
}
}
for (Identity u : owners) {
Result<ApprovalDAO.Data> r = addIdentity(trans,sb,first,user,data.memo,op,u,ticket,"owner");
- if(r.notOK()) {
+ if (r.notOK()) {
return Result.err(r);
}
}
@@ -1534,7 +1534,7 @@ public class Function {
@Override
public UserRoleDAO.Data get(AuthzTrans trans, Object ... keys) {
Result<List<UserRoleDAO.Data>> r = q.userRoleDAO.read(trans, keys);
- if(r.isOKhasData()) {
+ if (r.isOKhasData()) {
return r.value.get(0);
} else {
return null;
@@ -1556,18 +1556,18 @@ public class Function {
public Result<OP_STATUS> performFutureOp(final AuthzTrans trans, FUTURE_OP fop, FutureDAO.Data curr, Lookup<List<ApprovalDAO.Data>> la, Lookup<UserRoleDAO.Data> lur) {
// Pre-Evaluate if ReApproval is already done.
UserRoleDAO.Data urdd = null;
- if(fop.equals(FUTURE_OP.A) && curr.target.equals(FOP_USER_ROLE) && curr.construct!=null) {
+ if (fop.equals(FUTURE_OP.A) && curr.target.equals(FOP_USER_ROLE) && curr.construct!=null) {
try {
// Get Expected UserRole from Future
urdd = new UserRoleDAO.Data();
urdd.reconstitute(curr.construct);
// Get Current UserRole from lookup
UserRoleDAO.Data lurdd = lur.get(trans, urdd.user,urdd.role);
- if(lurdd==null) {
+ if (lurdd==null) {
q.futureDAO.delete(trans, curr, false);
return OP_STATUS.RL;
} else {
- if(curr.expires.compareTo(lurdd.expires)<0) {
+ if (curr.expires.compareTo(lurdd.expires)<0) {
q.futureDAO.delete(trans, curr, false);
return OP_STATUS.RL;
}
@@ -1579,21 +1579,21 @@ public class Function {
boolean aDenial = false;
int cntSuper=0, appSuper=0,cntOwner=0, appOwner=0;
- for(ApprovalDAO.Data add : la.get(trans)) {
+ for (ApprovalDAO.Data add : la.get(trans)) {
switch(add.status) {
case "approved":
- if("owner".equals(add.type)) {
+ if ("owner".equals(add.type)) {
++cntOwner;
++appOwner;
- } else if("supervisor".equals(add.type)) {
+ } else if ("supervisor".equals(add.type)) {
++cntSuper;
++appSuper;
}
break;
case "pending":
- if("owner".equals(add.type)) {
+ if ("owner".equals(add.type)) {
++cntOwner;
- } else if("supervisor".equals(add.type)) {
+ } else if ("supervisor".equals(add.type)) {
++cntSuper;
}
break;
@@ -1604,18 +1604,18 @@ public class Function {
}
Result<OP_STATUS> ros=null;
- if(aDenial) {
+ if (aDenial) {
// Note: Denial will be Audit-logged.
// for (ApprovalDAO.Data ad : allApprovalsForTicket.value) {
// q.approvalDAO.delete(trans, ad, false);
// }
ros = OP_STATUS.RD;
- if(q.futureDAO.delete(trans, curr, false).notOK()) {
+ if (q.futureDAO.delete(trans, curr, false).notOK()) {
trans.info().printf("Future %s could not be deleted", curr.id.toString());
} else {
if (FOP_USER_ROLE.equalsIgnoreCase(curr.target)) {
// A Denial means we must remove UserRole
- if(fop.equals(FUTURE_OP.U) || fop.equals(FUTURE_OP.A)) {
+ if (fop.equals(FUTURE_OP.U) || fop.equals(FUTURE_OP.A)) {
UserRoleDAO.Data data = new UserRoleDAO.Data();
try {
data.reconstitute(curr.construct);
@@ -1631,7 +1631,7 @@ public class Function {
// Decision: If not Denied, and at least owner, if exists, and at least one Super, if exists
boolean goDecision = (cntOwner>0?appOwner>0:true) && (cntSuper>0?appSuper>0:true);
- if(goDecision) {
+ if (goDecision) {
// should check if any other pendings before performing
// actions
try {
@@ -1684,7 +1684,7 @@ public class Function {
default:
}
} else if (FOP_USER_ROLE.equalsIgnoreCase(curr.target)) {
- if(urdd==null) {
+ if (urdd==null) {
urdd = new UserRoleDAO.Data();
urdd.reconstitute(curr.construct);
}
@@ -1737,7 +1737,7 @@ public class Function {
}
q.futureDAO.delete(trans, curr, false);
} // end for goDecision
- if(ros==null) {
+ if (ros==null) {
//return Result.err(Status.ACC_Future, "Full Approvals not obtained: No action taken");
ros = OP_STATUS.RP;
}
@@ -1747,7 +1747,7 @@ public class Function {
// Convenience method for setting OPSTatus Results
private Result<OP_STATUS> set(Result<OP_STATUS> rs, Result<?> orig) {
- if(orig.isOK()) {
+ if (orig.isOK()) {
return rs;
} else {
return Result.err(orig);
@@ -1767,8 +1767,8 @@ public class Function {
ad.operation = op.name();
// Note ad.updated is created in System
Result<ApprovalDAO.Data> r = q.approvalDAO.create(trans,ad);
- if(r.isOK()) {
- if(first[0]) {
+ if (r.isOK()) {
+ if (first[0]) {
first[0] = false;
} else {
sb.append(", ");
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
index 6bb440ad..98621457 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
@@ -75,17 +75,17 @@ class PermLookup {
}
public Result<List<UserRoleDAO.Data>> getUserRoles() {
- if(userRoles==null) {
+ if (userRoles==null) {
userRoles = q.userRoleDAO.readByUser(trans,user);
- if(userRoles.isOKhasData()) {
+ if (userRoles.isOKhasData()) {
List<UserRoleDAO.Data> lurdd = new ArrayList<>();
Date now = new Date();
- for(UserRoleDAO.Data urdd : userRoles.value) {
- if(urdd.expires.after(now)) { // Remove Expired
+ for (UserRoleDAO.Data urdd : userRoles.value) {
+ if (urdd.expires.after(now)) { // Remove Expired
lurdd.add(urdd);
}
}
- if(lurdd.size()==0) {
+ if (lurdd.size()==0) {
return userRoles = Result.err(Status.ERR_UserNotFound,
"%s not found or not associated with any Roles: ",
user);
@@ -101,18 +101,18 @@ class PermLookup {
}
public Result<List<RoleDAO.Data>> getRoles() {
- if(roles==null) {
+ if (roles==null) {
Result<List<UserRoleDAO.Data>> rur = getUserRoles();
- if(rur.isOK()) {
+ if (rur.isOK()) {
List<RoleDAO.Data> lrdd = new ArrayList<>();
for (UserRoleDAO.Data urdata : rur.value) {
// Gather all permissions from all Roles
- if(urdata.ns==null || urdata.rname==null) {
+ if (urdata.ns==null || urdata.rname==null) {
return Result.err(Status.ERR_BadData,"DB Content Error: nulls in User Role %s %s", urdata.user,urdata.role);
} else {
Result<List<RoleDAO.Data>> rlrd = q.roleDAO.read(
trans, urdata.ns, urdata.rname);
- if(rlrd.isOK()) {
+ if (rlrd.isOK()) {
lrdd.addAll(rlrd.value);
}
}
@@ -127,7 +127,7 @@ class PermLookup {
}
public Result<Set<String>> getPermNames() {
- if(permNames==null) {
+ if (permNames==null) {
Result<List<RoleDAO.Data>> rlrd = getRoles();
if (rlrd.isOK()) {
Set<String> pns = new TreeSet<>();
@@ -144,16 +144,16 @@ class PermLookup {
}
public Result<List<PermDAO.Data>> getPerms(boolean lookup) {
- if(perms==null) {
+ if (perms==null) {
// Note: It should be ok for a Valid user to have no permissions -
// Jonathan 8/12/2013
Result<Set<String>> rss = getPermNames();
- if(rss.isOK()) {
+ if (rss.isOK()) {
List<PermDAO.Data> lpdd = new ArrayList<>();
for (String perm : rss.value) {
- if(lookup) {
+ if (lookup) {
Result<String[]> ap = PermDAO.Data.decodeToArray(trans, q, perm);
- if(ap.isOK()) {
+ if (ap.isOK()) {
Result<List<PermDAO.Data>> rlpd = q.permDAO.read(perm,trans,ap.value);
if (rlpd.isOKhasData()) {
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
index 152412a2..e63bc52a 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
@@ -166,17 +166,17 @@ public class Question {
// Only want to aggressively cleanse User related Caches... The others,
// just normal refresh
- if(startClean) {
+ if (startClean) {
CachedDAO.startCleansing(trans.env(), credDAO, userRoleDAO);
CachedDAO.startRefresh(trans.env(), cacheInfoDAO);
}
// Set a Timer to Check Caches to send messages for Caching changes
- if(specialLogSlot==null) {
+ if (specialLogSlot==null) {
specialLogSlot = trans.slot(AuthzTransFilter.SPECIAL_LOG_SLOT);
}
- if(transIDSlot==null) {
+ if (transIDSlot==null) {
transIDSlot = trans.slot(AuthzTransFilter.TRANS_ID_SLOT);
}
@@ -226,25 +226,25 @@ public class Question {
public Result<List<PermDAO.Data>> getPermsByUserFromRolesFilter(AuthzTrans trans, String user, String forUser) {
PermLookup plUser = PermLookup.get(trans, this, user);
Result<Set<String>> plPermNames = plUser.getPermNames();
- if(plPermNames.notOK()) {
+ if (plPermNames.notOK()) {
return Result.err(plPermNames);
}
Set<String> nss;
- if(forUser.equals(user)) {
+ if (forUser.equals(user)) {
nss = null;
} else {
// Setup a TreeSet to check on Namespaces to
nss = new TreeSet<>();
PermLookup fUser = PermLookup.get(trans, this, forUser);
Result<Set<String>> forUpn = fUser.getPermNames();
- if(forUpn.notOK()) {
+ if (forUpn.notOK()) {
return Result.err(forUpn);
}
- for(String pn : forUpn.value) {
+ for (String pn : forUpn.value) {
Result<String[]> decoded = PermDAO.Data.decodeToArray(trans, this, pn);
- if(decoded.isOKhasData()) {
+ if (decoded.isOKhasData()) {
nss.add(decoded.value[0]);
} else {
trans.error().log(pn,", derived from a Role, is invalid:",decoded.errorString());
@@ -255,11 +255,11 @@ public class Question {
List<PermDAO.Data> rlpUser = new ArrayList<>();
Result<PermDAO.Data> rpdd;
PermDAO.Data pdd;
- for(String pn : plPermNames.value) {
+ for (String pn : plPermNames.value) {
rpdd = PermDAO.Data.decode(trans, this, pn);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
pdd=rpdd.value;
- if(nss==null || nss.contains(pdd.ns)) {
+ if (nss==null || nss.contains(pdd.ns)) {
rlpUser.add(pdd);
}
} else {
@@ -314,7 +314,7 @@ public class Question {
return Result.err(pr);
}
- if(lookup) {
+ if (lookup) {
Result<List<PermDAO.Data>> rlpd = permDAO.read(trans, pr.value);
if (rlpd.isOKhasData()) {
for (PermDAO.Data pData : rlpd.value) {
@@ -368,7 +368,7 @@ public class Question {
return Result.ok(r.value.get(0));
} else {
int dot;
- if(child==null) {
+ if (child==null) {
return Result.err(Status.ERR_NsNotFound, "No Namespace");
} else {
dot = child.lastIndexOf('.');
@@ -384,12 +384,12 @@ public class Question {
public Result<NsDAO.Data> deriveFirstNsForType(AuthzTrans trans, String str, NsType type) {
NsDAO.Data nsd;
- for(String lookup = str;!".".equals(lookup) && lookup!=null;) {
+ for (String lookup = str;!".".equals(lookup) && lookup!=null;) {
Result<List<NsDAO.Data>> rld = nsDAO.read(trans, lookup);
- if(rld.isOKhasData()) {
+ if (rld.isOKhasData()) {
nsd=rld.value.get(0);
lookup = nsd.parent;
- if(type.type == nsd.type) {
+ if (type.type == nsd.type) {
return Result.ok(nsd);
}
} else {
@@ -455,13 +455,13 @@ public class Question {
public Result<NsDAO.Data> validNSOfDomain(AuthzTrans trans, String id) {
// Take domain, reverse order, and check on NS
String ns;
- if(id.indexOf('@')<0) { // it's already an ns, not an ID
+ if (id.indexOf('@')<0) { // it's already an ns, not an ID
ns = id;
} else {
ns = domain2ns(id);
}
if (ns.length() > 0) {
- if(!trans.org().getDomain().equals(ns)) {
+ if (!trans.org().getDomain().equals(ns)) {
Result<List<NsDAO.Data>> rlnsd = nsDAO.read(trans, ns);
if (rlnsd.isOKhasData()) {
return Result.ok(rlnsd.value.get(0));
@@ -490,7 +490,7 @@ public class Question {
Result<NsDAO.Data> rv = mayUserVirtueOfNS(trans, user, ndd, ":" + ndd.name + ":ns", access.name());
if (rv.isOK()) {
return rv;
- } else if(rv.status==Result.ERR_Backend) {
+ } else if (rv.status==Result.ERR_Backend) {
return Result.err(rv);
} else {
return Result.err(Status.ERR_Denied, "[%s] may not %s in NS [%s]",
@@ -532,7 +532,7 @@ public class Question {
+ rdd.ns + roleInst, access.name());
if (rnsd.isOK()) {
return rnsd;
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
@@ -543,7 +543,7 @@ public class Question {
":" + rdd.ns + ":ns", access.name());
if (rv.isOK()) {
return rv;
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
} else {
return Result.err(Status.ERR_Denied, "[%s] may not %s Role [%s]",
@@ -582,7 +582,7 @@ public class Question {
Result<NsDAO.Data> rnsd = mayUserVirtueOfNS(trans, user, ndd, ":" + pdd.ns + permInst, access.name());
if (rnsd.isOK()) {
return rnsd;
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
@@ -603,7 +603,7 @@ public class Question {
public Result<Void> mayUser(AuthzTrans trans, DelegateDAO.Data dd, Access access) {
try {
Result<NsDAO.Data> rnsd = deriveNs(trans, domain2ns(trans.user()));
- if(rnsd.isOKhasData() && mayUserVirtueOfNS(trans,trans.user(),rnsd.value, ":" + rnsd.value.name + ":ns", access.name()).isOK()) {
+ if (rnsd.isOKhasData() && mayUserVirtueOfNS(trans,trans.user(),rnsd.value, ":" + rnsd.value.name + ":ns", access.name()).isOK()) {
return Result.ok();
}
boolean isUser = trans.user().equals(dd.user);
@@ -663,7 +663,7 @@ public class Question {
Result<List<UserRoleDAO.Data>> rurd;
if ((rurd = userRoleDAO.readUserInRole(trans, user, ns+DOT_ADMIN)).isOKhasData()) {
return Result.ok(nsd);
- } else if(rurd.status==Result.ERR_Backend) {
+ } else if (rurd.status==Result.ERR_Backend) {
return Result.err(rurd);
}
@@ -679,12 +679,12 @@ public class Question {
Result<NsDAO.Data> rnsd = deriveNs(trans, ns.substring(0, dot));
if (rnsd.isOK()) {
rnsd = mayUserVirtueOfNS(trans, user, rnsd.value, ns_and_type,access);
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
if (rnsd.isOK()) {
return Result.ok(nsd);
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
}
@@ -712,7 +712,7 @@ public class Question {
if (ns.equals(pd.ns)) {
if (type.equals(pd.type)) {
if (PermEval.evalInstance(pd.instance, instance)) {
- if(PermEval.evalAction(pd.action, action)) { // don't return action here, might miss other action
+ if (PermEval.evalAction(pd.action, action)) { // don't return action here, might miss other action
return true;
}
}
@@ -733,7 +733,7 @@ public class Question {
}
Result<Date> rv = null;
- if(result.isOK()) {
+ if (result.isOK()) {
if (result.isEmpty()) {
rv = Result.err(Status.ERR_UserNotFound, user);
if (willSpecialLog(trans,user)) {
@@ -743,14 +743,14 @@ public class Question {
Date now = new Date();//long now = System.currentTimeMillis();
// Bug noticed 6/22. Sorting on the result can cause Concurrency Issues.
List<CredDAO.Data> cddl;
- if(result.value.size() > 1) {
+ if (result.value.size() > 1) {
cddl = new ArrayList<>(result.value.size());
- for(CredDAO.Data old : result.value) {
- if(old.type==CredDAO.BASIC_AUTH || old.type==CredDAO.BASIC_AUTH_SHA256) {
+ for (CredDAO.Data old : result.value) {
+ if (old.type==CredDAO.BASIC_AUTH || old.type==CredDAO.BASIC_AUTH_SHA256) {
cddl.add(old);
}
}
- if(cddl.size()>1) {
+ if (cddl.size()>1) {
Collections.sort(cddl,new Comparator<CredDAO.Data>() {
@Override
public int compare(org.onap.aaf.auth.dao.cass.CredDAO.Data a,
@@ -766,7 +766,7 @@ public class Question {
Date expired = null;
StringBuilder debug = willSpecialLog(trans,user)?new StringBuilder():null;
for (CredDAO.Data cdd : cddl) {
- if(!cdd.id.equals(user)) {
+ if (!cdd.id.equals(user)) {
trans.error().log("doesUserCredMatch DB call does not match for user: " + user);
}
if (cdd.expires.after(now)) {
@@ -776,7 +776,7 @@ public class Question {
switch(cdd.type) {
case CredDAO.BASIC_AUTH:
byte[] md5=Hash.hashMD5(cred);
- if(Hash.compareTo(md5,dbcred)==0) {
+ if (Hash.compareTo(md5,dbcred)==0) {
checkLessThanDays(trans,7,now,cdd);
return Result.ok(cdd.expires);
} else if (debug!=null) {
@@ -789,7 +789,7 @@ public class Question {
bb.put(cred);
byte[] hash = Hash.hashSHA256(bb.array());
- if(Hash.compareTo(hash,dbcred)==0) {
+ if (Hash.compareTo(hash,dbcred)==0) {
checkLessThanDays(trans,7,now,cdd);
return Result.ok(cdd.expires);
} else if (debug!=null) {
@@ -803,17 +803,17 @@ public class Question {
trans.error().log(e);
}
} else {
- if(expired==null || expired.before(cdd.expires)) {
+ if (expired==null || expired.before(cdd.expires)) {
expired = cdd.expires;
}
}
} // end for each
- if(debug==null) {
+ if (debug==null) {
trans.audit().printf("No cred matches ip=%s, user=%s\n",trans.ip(),user);
} else {
trans.audit().printf("No cred matches ip=%s, user=%s %s\n",trans.ip(),user,debug.toString());
}
- if(expired!=null) {
+ if (expired!=null) {
// Note: this is only returned if there are no good Credentials
rv = Result.err(Status.ERR_Security,
"Credentials %s from %s expired %s",trans.user(), trans.ip(), Chrono.dateTime(expired));
@@ -840,7 +840,7 @@ public class Question {
private void checkLessThanDays(AuthzTrans trans, int days, Date now, Data cdd) {
long close = now.getTime() + (days * 86400000);
long cexp=cdd.expires.getTime();
- if(cexp<close) {
+ if (cexp<close) {
int daysLeft = days-(int)((close-cexp)/86400000);
trans.audit().printf("user=%s,ip=%s,expires=%s,days=%d,msg=\"Password expires in less than %d day%s\"",
cdd.id,trans.ip(),Chrono.dateOnlyStamp(cdd.expires),daysLeft, daysLeft,daysLeft==1?"":"s");
@@ -849,7 +849,7 @@ public class Question {
public Result<CredDAO.Data> userCredSetup(AuthzTrans trans, CredDAO.Data cred) {
- if(cred.type==CredDAO.RAW) {
+ if (cred.type==CredDAO.RAW) {
TimeTaken tt = trans.start("Hash Cred", Env.SUB);
try {
cred.type = CredDAO.BASIC_AUTH_SHA256;
@@ -935,32 +935,32 @@ public class Question {
if (all || NsDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, NsDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, NsDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, NsDAO.TABLE, seg);
}
if (all || PermDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, PermDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, PermDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, PermDAO.TABLE,seg);
}
if (all || RoleDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, RoleDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, RoleDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, RoleDAO.TABLE,seg);
}
if (all || UserRoleDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, UserRoleDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, UserRoleDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, UserRoleDAO.TABLE,seg);
}
if (all || CredDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, CredDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, CredDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, CredDAO.TABLE,seg);
}
if (all || CertDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, CertDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, CertDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, CertDAO.TABLE,seg);
}
@@ -999,11 +999,11 @@ public class Question {
public boolean isDelegated(AuthzTrans trans, String user, String approver, Map<String,Result<List<DelegateDAO.Data>>> rldd ) {
Result<List<DelegateDAO.Data>> userDelegatedFor = rldd.get(user);
- if(userDelegatedFor==null) {
+ if (userDelegatedFor==null) {
userDelegatedFor=delegateDAO.readByDelegate(trans, user);
rldd.put(user, userDelegatedFor);
}
- if(userDelegatedFor.isOKhasData()) {
+ if (userDelegatedFor.isOKhasData()) {
for (DelegateDAO.Data curr : userDelegatedFor.value) {
if (curr.user.equals(approver) && curr.delegate.equals(user)
&& curr.expires.after(new Date())) {
@@ -1016,8 +1016,8 @@ public class Question {
public static boolean willSpecialLog(AuthzTrans trans, String user) {
Boolean b = trans.get(specialLogSlot, null);
- if(b==null) { // we haven't evaluated in this trans for Special Log yet
- if(specialLog==null) {
+ if (b==null) { // we haven't evaluated in this trans for Special Log yet
+ if (specialLog==null) {
return false;
} else {
b = specialLog.contains(user);
@@ -1042,21 +1042,21 @@ public class Question {
specialLog = new HashSet<>();
}
boolean rc = specialLog.add(id);
- if(rc) {
+ if (rc) {
trans.trace().printf("Trace on for %s requested by %s",id,trans.user());
}
return rc;
}
public static synchronized boolean specialLogOff(AuthzTrans trans, String id) {
- if(specialLog==null) {
+ if (specialLog==null) {
return false;
}
boolean rv = specialLog.remove(id);
if (specialLog.isEmpty()) {
specialLog = null;
}
- if(rv) {
+ if (rv) {
trans.trace().printf("Trace off for %s requested by %s",id,trans.user());
}
return rv;
@@ -1086,8 +1086,8 @@ public class Question {
public boolean isAdmin(AuthzTrans trans, String user, String ns) {
Date now = new Date();
Result<List<UserRoleDAO.Data>> rur = userRoleDAO.read(trans, user,ns+DOT_ADMIN);
- if(rur.isOKhasData()) {for(UserRoleDAO.Data urdd : rur.value){
- if(urdd.expires.after(now)) {
+ if (rur.isOKhasData()) {for (UserRoleDAO.Data urdd : rur.value){
+ if (urdd.expires.after(now)) {
return true;
}
}};
@@ -1097,8 +1097,8 @@ public class Question {
public boolean isOwner(AuthzTrans trans, String user, String ns) {
Result<List<UserRoleDAO.Data>> rur = userRoleDAO.read(trans, user,ns+DOT_OWNER);
Date now = new Date();
- if(rur.isOKhasData()) {for(UserRoleDAO.Data urdd : rur.value){
- if(urdd.expires.after(now)) {
+ if (rur.isOKhasData()) {for (UserRoleDAO.Data urdd : rur.value){
+ if (urdd.expires.after(now)) {
return true;
}
}};
@@ -1109,8 +1109,8 @@ public class Question {
Result<List<UserRoleDAO.Data>> rur = userRoleDAO.readByRole(trans,ns+DOT_OWNER);
Date now = new Date();
int count = 0;
- if(rur.isOKhasData()) {for(UserRoleDAO.Data urdd : rur.value){
- if(urdd.expires.after(now)) {
+ if (rur.isOKhasData()) {for (UserRoleDAO.Data urdd : rur.value){
+ if (urdd.expires.after(now)) {
++count;
}
}};
@@ -1129,7 +1129,7 @@ public class Question {
byte[] from = name.getBytes();
StringBuilder sb = new StringBuilder();
byte f;
- for(int i=0;i<from.length;++i) {
+ for (int i=0;i<from.length;++i) {
f=(byte)(from[i]); // printables;
sb.append((char)((f>>4)+0x61));
sb.append((char)((f&0x0F)+0x61));
@@ -1141,7 +1141,7 @@ public class Question {
byte[] from = name.getBytes();
StringBuilder sb = new StringBuilder();
char c;
- for(int i=0;i<from.length;++i) {
+ for (int i=0;i<from.length;++i) {
c = (char)((from[i]-0x61)<<4);
c |= (from[++i]-0x61);
sb.append(c);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
index 1fb050b8..93fab977 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
@@ -57,13 +57,13 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
super(env.access(), name, 1000L /* Don't hit DB more than once a second */);
this.env = env;
this.ldao = ldao;
- if(version!=null) {
+ if (version!=null) {
try {
String[] v = Split.split('.',version);
- if(v.length>0) {major = Integer.parseInt(v[0]);}
- if(v.length>1) {minor = Integer.parseInt(v[1]);}
- if(v.length>2) {patch = Integer.parseInt(v[2]);}
- if(v.length>3) {pkg = Integer.parseInt(v[3]);}
+ if (v.length>0) {major = Integer.parseInt(v[0]);}
+ if (v.length>1) {minor = Integer.parseInt(v[1]);}
+ if (v.length>2) {patch = Integer.parseInt(v[2]);}
+ if (v.length>3) {pkg = Integer.parseInt(v[3]);}
} catch (NumberFormatException e) {
throw new LocatorException("Invalid Version String: " + version);
}
@@ -83,13 +83,13 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
public boolean refresh() {
AuthzTrans trans = env.newTransNoAvg();
Result<List<Data>> rl = ldao.readByName(trans, name);
- if(rl.isOK()) {
+ if (rl.isOK()) {
LinkedList<EP> epl = new LinkedList<>();
- for(Data d : rl.value) {
-// if(myhostname!=null && d.port==myport && d.hostname.equals(myhostname)) {
+ for (Data d : rl.value) {
+// if (myhostname!=null && d.port==myport && d.hostname.equals(myhostname)) {
// continue;
// }
- if((major<0 || major==d.major) &&
+ if ((major<0 || major==d.major) &&
(minor<0 || minor<=d.minor) &&
(patch<0 || patch==d.patch) &&
(pkg<0 || pkg ==d.pkg)) {
@@ -104,7 +104,7 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
endpoint.setLatitude(d.latitude);
endpoint.setLongitude(d.longitude);
endpoint.setProtocol(d.protocol);
- for(String s : d.subprotocol(false)) {
+ for (String s : d.subprotocol(false)) {
endpoint.getSubprotocol().add(s);
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java
index 75f6c7a5..59613961 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java
@@ -61,10 +61,10 @@ public class DirectAAFLur implements Lur {
Result<List<Data>> pdr = question.getPermsByUser(trans, bait.getName(),false);
switch(pdr.status) {
case OK:
- for(PermDAO.Data d : pdr.value) {
- if(!rv) {
+ for (PermDAO.Data d : pdr.value) {
+ if (!rv) {
for (Permission p : pond) {
- if(new PermPermission(d).match(p)) {
+ if (new PermPermission(d).match(p)) {
rv=true;
break;
}
@@ -86,7 +86,7 @@ public class DirectAAFLur implements Lur {
Result<List<Data>> pdr = question.getPermsByUser(env.newTrans(), bait.getName(),false);
switch(pdr.status) {
case OK:
- for(PermDAO.Data d : pdr.value) {
+ for (PermDAO.Data d : pdr.value) {
permissions.add(new PermPermission(d));
}
break;
@@ -135,23 +135,23 @@ public class DirectAAFLur implements Lur {
@Override
public boolean match(Permission p) {
- if(p==null) {
+ if (p==null) {
return false;
}
PermDAO.Data pd;
- if(p instanceof DirectAAFLur.PermPermission) {
+ if (p instanceof DirectAAFLur.PermPermission) {
pd = ((DirectAAFLur.PermPermission)p).data;
- if(data.ns.equals(pd.ns))
- if(data.type.equals(pd.type))
- if(data.instance!=null && (data.instance.equals(pd.instance) || "*".equals(data.instance)))
- if(data.action!=null && (data.action.equals(pd.action) || "*".equals(data.action)))
+ if (data.ns.equals(pd.ns))
+ if (data.type.equals(pd.type))
+ if (data.instance!=null && (data.instance.equals(pd.instance) || "*".equals(data.instance)))
+ if (data.action!=null && (data.action.equals(pd.action) || "*".equals(data.action)))
return true;
} else{
String[] lp = p.getKey().split("\\|");
- if(lp.length<3)return false;
- if(data.fullType().equals(lp[0]))
- if(data.instance!=null && (data.instance.equals(lp[1]) || "*".equals(data.instance)))
- if(data.action!=null && (data.action.equals(lp[2]) || "*".equals(data.action)))
+ if (lp.length<3)return false;
+ if (data.fullType().equals(lp[0]))
+ if (data.instance!=null && (data.instance.equals(lp[1]) || "*".equals(data.instance)))
+ if (data.action!=null && (data.action.equals(lp[2]) || "*".equals(data.action)))
return true;
}
return false;
@@ -180,9 +180,9 @@ public class DirectAAFLur implements Lur {
@Override
public Permission createPerm(String p) {
String[] params = Split.split('|', p);
- if(params.length==3) {
+ if (params.length==3) {
Result<NsSplit> nss = question.deriveNsSplit(NullTrans.singleton(), params[0]);
- if(nss.isOK()) {
+ if (nss.isOK()) {
return new PermPermission(nss.value.ns,nss.value.name,params[1],params[2]);
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
index 9d4cd05f..3ef532b4 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
@@ -54,12 +54,12 @@ public class DirectAAFUserPass implements CredVal {
public boolean validate(String user, Type type, byte[] pass, Object state) {
try {
AuthzTrans trans;
- if(state !=null) {
- if(state instanceof AuthzTrans) {
+ if (state !=null) {
+ if (state instanceof AuthzTrans) {
trans = (AuthzTrans)state;
} else {
trans = env.newTransNoAvg();
- if(state instanceof HttpServletRequest) {
+ if (state instanceof HttpServletRequest) {
trans.set((HttpServletRequest)state);
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java
index 6dd5e006..f3351dae 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java
@@ -53,10 +53,10 @@ public class DirectCertIdentity implements CertIdentity {
@Override
public TaggedPrincipal identity(HttpServletRequest req, X509Certificate cert, byte[] _certBytes) throws CertificateException {
byte[] certBytes = _certBytes;
- if(cert==null && certBytes==null) {
+ if (cert==null && certBytes==null) {
return null;
}
- if(certBytes==null) {
+ if (certBytes==null) {
certBytes = cert.getEncoded();
}
byte[] fingerprint = X509Taf.getFingerPrint(certBytes);
@@ -64,7 +64,7 @@ public class DirectCertIdentity implements CertIdentity {
AuthzTrans trans = (AuthzTrans) req.getAttribute(TransFilter.TRANS_TAG);
Result<List<Data>> cresp = certDAO.read(trans, ByteBuffer.wrap(fingerprint));
- if(cresp.isOKhasData()) {
+ if (cresp.isOKhasData()) {
Data cdata = cresp.value.get(0);
return new X509Principal(cdata.id,cert,certBytes,null);
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java
index caededa2..aa6bf8c5 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java
@@ -40,7 +40,7 @@ public class DirectLocatorCreator implements AbsAAFLocator.LocatorCreator {
@Override
public AbsAAFLocator<?> create(String key, String version) throws LocatorException {
DirectAAFLocator dal = new DirectAAFLocator(env,locateDAO,key,version);
- if(myhostname!=null) {
+ if (myhostname!=null) {
dal.setSelf(myhostname, myport);
}
return dal;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
index da7044cf..9eea77e3 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
@@ -45,14 +45,14 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
try {
String latitude = access.getProperty(Config.CADI_LATITUDE, null);
- if(latitude==null) {
+ if (latitude==null) {
latitude = access.getProperty("AFT_LATITUDE", null);
}
String longitude = access.getProperty(Config.CADI_LONGITUDE, null);
- if(longitude==null) {
+ if (longitude==null) {
longitude = access.getProperty("AFT_LONGITUDE", null);
}
- if(latitude==null || longitude==null) {
+ if (latitude==null || longitude==null) {
throw new CadiException(Config.CADI_LATITUDE + " and " + Config.CADI_LONGITUDE + " is required");
} else {
locate.latitude = Float.parseFloat(latitude);
@@ -64,18 +64,18 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
locate.minor = split.length>1?Integer.parseInt(split[1]):0;
locate.major = split.length>0?Integer.parseInt(split[0]):0;
locate.hostname = access.getProperty(Config.AAF_REGISTER_AS, null);
- if(locate.hostname==null) {
+ if (locate.hostname==null) {
locate.hostname = access.getProperty(Config.HOSTNAME, null);
}
- if(locate.hostname==null) {
+ if (locate.hostname==null) {
locate.hostname = Inet4Address.getLocalHost().getHostName();
}
String subprotocols = access.getProperty(Config.CADI_PROTOCOLS, null);
- if(subprotocols==null) {
+ if (subprotocols==null) {
locate.protocol="http";
} else {
locate.protocol="https";
- for(String s : Split.split(',', subprotocols)) {
+ for (String s : Split.split(',', subprotocols)) {
locate.subprotocol(true).add(s);
}
}
@@ -87,7 +87,7 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
@Override
public Result<Void> update(AuthzEnv env) {
org.onap.aaf.auth.layer.Result<Void> dr = ldao.update(env.newTransNoAvg(), locate);
- if(dr.isOK()) {
+ if (dr.isOK()) {
return Result.ok(200, null);
} else {
return Result.err(503, dr.errorString());
@@ -100,7 +100,7 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
@Override
public Result<Void> cancel(AuthzEnv env) {
org.onap.aaf.auth.layer.Result<Void> dr = ldao.delete(env.newTransNoAvg(), locate, false);
- if(dr.isOK()) {
+ if (dr.isOK()) {
return Result.ok(200, null);
} else {
return Result.err(503, dr.errorString());
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java
index 0dd03da4..7cc8bd67 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java
@@ -121,14 +121,14 @@ public class JU_Cached {
// Date dbStamp = info.get(trans, name,cacheIdx);
//
// // Check for cache Entry and whether it is still good (a good Cache Entry is same or after DBEntry, so we use "before" syntax)
-// if(cached!=null && dbStamp.before(cached.timestamp)) {
+// if (cached!=null && dbStamp.before(cached.timestamp)) {
// ld = (List<DATA>)cached.data;
// rld = Result.ok(ld);
// } else {
// rld = getter.get();
-// if(rld.isOK()) { // only store valid lists
+// if (rld.isOK()) { // only store valid lists
// map.put(key, new Dated(rld.value)); // successful item found gets put in cache
-//// } else if(rld.status == Result.ERR_Backend){
+//// } else if (rld.status == Result.ERR_Backend){
//// map.remove(key);
// }
// }
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java
index 692c3a82..dea2ccdd 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java
@@ -67,13 +67,13 @@ public class AbsJUCass {
@BeforeClass
public static void startup() throws APIException, IOException {
synchronized(AUTHZ) {
- if(env==null) {
+ if (env==null) {
final String resource = "cadi.properties";
File f = new File("etc" + resource);
InputStream is=null;
Properties props = new Properties();
try {
- if(f.exists()) {
+ if (f.exists()) {
is = new FileInputStream(f);
} else {
URL rsrc = ClassLoader.getSystemResource(resource);
@@ -81,7 +81,7 @@ public class AbsJUCass {
}
props.load(is);
} finally {
- if(is==null) {
+ if (is==null) {
env= new AuthzEnv();
Assert.fail(resource + " must exist in etc dir, or in Classpath");
}
@@ -95,7 +95,7 @@ public class AbsJUCass {
env.info().log("Connecting to Cluster");
try {
cluster.connect(AUTHZ);
- } catch(Exception e) {
+ } catch (Exception e) {
cluster=null;
env.error().log(e);
Assert.fail("Not able to connect to DB: " + e.getLocalizedMessage());
@@ -114,7 +114,7 @@ public class AbsJUCass {
@AfterClass
public static void shutdown() {
- if(cluster!=null) {
+ if (cluster!=null) {
cluster.close();
cluster = null;
}
@@ -129,10 +129,10 @@ public class AbsJUCass {
@After
public void auditTrail() {
- if(totals==0) { // "updateTotals()" was not called... just do one Trans
+ if (totals==0) { // "updateTotals()" was not called... just do one Trans
StringBuilder sb = new StringBuilder();
Metric metric = trans.auditTrail(4, sb, Env.JSON, Env.REMOTE);
- if(details) {
+ if (details) {
env.info().log(
sb,
"Total time:",
@@ -159,7 +159,7 @@ public class AbsJUCass {
@AfterClass
public static void print() {
float transTime;
- if(iterations==0) {
+ if (iterations==0) {
transTime=totals;
} else {
transTime=totals/iterations;
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java
index c91bfe1e..7e460899 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java
@@ -78,12 +78,12 @@ public class JU_Bytification {
assertEquals(a.type,b.type);
// assertEquals(a.admin.size(),b.admin.size());
-// for(String s: a.admin) {
+// for (String s: a.admin) {
// assertTrue(b.admin.contains(s));
// }
//
// assertEquals(a.responsible.size(),b.responsible.size());
-// for(String s: a.responsible) {
+// for (String s: a.responsible) {
// assertTrue(b.responsible.contains(s));
// }
}
@@ -105,7 +105,7 @@ public class JU_Bytification {
// Overshoot Buffer
StringBuilder sb = new StringBuilder(300);
sb.append("role|instance|veryLongAction...");
- for(int i=0;i<280;++i) {
+ for (int i=0;i<280;++i) {
sb.append('a');
}
rd1.perms(true).add(sb.toString());
@@ -123,7 +123,7 @@ public class JU_Bytification {
check(rd1,rd2);
// 1000 Perms
- for(int i=0;i<1000;++i) {
+ for (int i=0;i<1000;++i) {
rd1.perms(true).add("com|inst|action"+ i);
}
@@ -139,7 +139,7 @@ public class JU_Bytification {
assertEquals(a.name,b.name);
assertEquals(a.perms.size(),b.perms.size());
- for(String s: a.perms) {
+ for (String s: a.perms) {
assertTrue(b.perms.contains(s));
}
}
@@ -169,7 +169,7 @@ public class JU_Bytification {
check(pd1,rd2);
// 1000 Perms
- for(int i=0;i<1000;++i) {
+ for (int i=0;i<1000;++i) {
pd1.roles(true).add("org.osaaf.<pass>.my.Role"+ i);
}
@@ -187,7 +187,7 @@ public class JU_Bytification {
assertEquals(a.action,b.action);
assertEquals(a.roles.size(),b.roles.size());
- for(String s: a.roles) {
+ for (String s: a.roles) {
assertTrue(b.roles.contains(s));
}
}
@@ -252,7 +252,7 @@ public class JU_Bytification {
assertEquals(a.id,b.id);
assertEquals(a.ns,b.ns);
assertEquals(a.type,b.type);
- if(a.cred==null) {
+ if (a.cred==null) {
assertEquals(a.cred,b.cred);
} else {
int l = a.cred.limit();
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java
index 33b67429..05195eeb 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java
@@ -38,7 +38,7 @@ public class JU_NsType {
public void test() {
NsType nt,nt2;
String[] tests = new String[] {"DOT","ROOT","COMPANY","APP","STACKED_APP","STACK"};
- for(String s : tests) {
+ for (String s : tests) {
nt = NsType.valueOf(s);
assertEquals(s,nt.name());
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
index d80b085b..15e298b7 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
@@ -97,7 +97,7 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
aafAuthn = aafCon().newAuthn(aafLurPerm);
String aaf_env = env.getProperty(Config.AAF_ENV);
- if(aaf_env==null) {
+ if (aaf_env==null) {
throw new APIException("aaf_env needs to be set");
}
@@ -112,17 +112,17 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
// Load Supported Certificate Authorities by property
// Note: Some will be dynamic Properties, so we need to look through all
- for(Entry<Object, Object> es : env.access().getProperties().entrySet()) {
+ for (Entry<Object, Object> es : env.access().getProperties().entrySet()) {
String key = es.getKey().toString();
- if(key.startsWith(CA.CM_CA_PREFIX)) {
+ if (key.startsWith(CA.CM_CA_PREFIX)) {
int idx = key.indexOf('.');
- if(idx==key.lastIndexOf('.')) { // else it's a regular property
+ if (idx==key.lastIndexOf('.')) { // else it's a regular property
env.log(Level.INIT, "Loading Certificate Authority Module: " + key.substring(idx+1));
String[] segs = Split.split(',', env.getProperty(key));
- if(segs.length>0) {
+ if (segs.length>0) {
String[][] multiParams = new String[segs.length-1][];
- for(int i=0;i<multiParams.length;++i) {
+ for (int i=0;i<multiParams.length;++i) {
multiParams[i]=Split.split(';',segs[1+i]);
}
@SuppressWarnings("unchecked")
@@ -141,7 +141,7 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
}
}
}
- if(certAuths.size()==0) {
+ if (certAuths.size()==0) {
throw new APIException("No Certificate Authorities have been configured in CertMan");
}
@@ -152,7 +152,7 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
synchronized(env) {
- if(cacheUser == null) {
+ if (cacheUser == null) {
cacheUser = Cache.obtain(USER_PERMS);
Cache.startCleansing(env, USER_PERMS);
}
@@ -184,7 +184,7 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
String version = "1.0";
// Get Correct API Class from Mapper
Class<?> respCls = facade1_0.mapper().getClass(api);
- if(respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
+ if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
// setup Application API HTML ContentTypes for JSON and Route
String application = applicationJSON(respCls, version);
route(env,meth,path,code,application,"application/json;version="+version,"*/*");
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java
index 34f7927e..a3a30607 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java
@@ -52,7 +52,7 @@ public class API_Artifact {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.createArtifacts(trans, req, resp);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.CREATED_201);
} else {
context.error(trans,resp,r);
@@ -67,7 +67,7 @@ public class API_Artifact {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.readArtifacts(trans, req, resp);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -81,7 +81,7 @@ public class API_Artifact {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.readArtifacts(trans, resp, pathParam(req,":mechid"), pathParam(req,":machine"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -94,7 +94,7 @@ public class API_Artifact {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.updateArtifacts(trans, req, resp);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -107,7 +107,7 @@ public class API_Artifact {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.deleteArtifacts(trans, resp,
pathParam(req, ":mechid"), pathParam(req,":machine"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -120,7 +120,7 @@ public class API_Artifact {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.deleteArtifacts(trans, req, resp);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java
index 625fed62..68354413 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java
@@ -63,12 +63,12 @@ public class API_Cert {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String key = pathParam(req, ":ca");
CA ca;
- if((ca = aafCM.getCA(key))==null) {
+ if ((ca = aafCM.getCA(key))==null) {
context.error(trans,resp,Result.ERR_BadData,"CA %s is not supported",key);
} else {
trans.put(sCertAuth, ca);
Result<Void> r = context.requestCert(trans, req, resp, ca);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -82,12 +82,12 @@ public class API_Cert {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String key = pathParam(req, ":ca");
CA ca;
- if((ca = aafCM.getCA(key))==null) {
+ if ((ca = aafCM.getCA(key))==null) {
context.error(trans,resp,Result.ERR_BadData,"CA %s is not supported",key);
} else {
trans.put(sCertAuth, ca);
Result<Void> r = context.requestPersonalCert(trans, req, resp, ca);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -104,7 +104,7 @@ public class API_Cert {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.check(trans, resp, pathParam(req,"perm"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
trans.checkpoint(r.errorString());
@@ -125,7 +125,7 @@ public class API_Cert {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.readCertsByMechID(trans, resp, pathParam(req,"id"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java
index 820f02d1..881c9bea 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java
@@ -71,7 +71,7 @@ public abstract class CA {
this.env = env;
permNS = CM_CA_PREFIX + name;
permType = access.getProperty(permNS + ".perm_type",null);
- if(permType==null) {
+ if (permType==null) {
throw new CertException(permNS + ".perm_type" + MUST_EXIST_TO_CREATE_CSRS_FOR + caName);
}
caIssuerDNs = Split.splitTrim(':', access.getProperty(Config.CADI_X509_ISSUERS, null));
@@ -79,22 +79,22 @@ public abstract class CA {
String tag = CA.CM_CA_PREFIX+caName+CA.CM_CA_BASE_SUBJECT;
String fields = access.getProperty(tag, null);
- if(fields==null) {
+ if (fields==null) {
throw new CertException(tag + MUST_EXIST_TO_CREATE_CSRS_FOR + caName);
}
access.log(Level.INFO, tag, "=",fields);
rdns = RDN.parse('/',fields);
- for(RDN rdn : rdns) {
- if(rdn.aoi==BCStyle.EmailAddress) { // Cert Specs say Emails belong in Subject
+ for (RDN rdn : rdns) {
+ if (rdn.aoi==BCStyle.EmailAddress) { // Cert Specs say Emails belong in Subject
throw new CertException("email address is not allowed in " + CM_CA_BASE_SUBJECT);
}
}
idDomains = new ArrayList<>();
StringBuilder sb = null;
- for(String s : Split.splitTrim(',', access.getProperty(CA.CM_CA_PREFIX+caName+".idDomains", ""))) {
- if(s.length()>0) {
- if(sb==null) {
+ for (String s : Split.splitTrim(',', access.getProperty(CA.CM_CA_PREFIX+caName+".idDomains", ""))) {
+ if (s.length()>0) {
+ if (sb==null) {
sb = new StringBuilder();
} else {
sb.append(", ");
@@ -103,31 +103,31 @@ public abstract class CA {
sb.append(s);
}
}
- if(sb!=null) {
+ if (sb!=null) {
access.printf(Level.INIT, "CA '%s' supports Personal Certificates for %s", caName, sb);
}
String dataDir = access.getProperty(CM_PUBLIC_DIR,null);
- if(dataDir!=null) {
+ if (dataDir!=null) {
File data = new File(dataDir);
byte[] bytes;
- if(data.exists()) {
+ if (data.exists()) {
String trustCas = access.getProperty(CM_TRUST_CAS,null);
- if(trustCas!=null) {
- for(String fname : Split.splitTrim(',', trustCas)) {
+ if (trustCas!=null) {
+ for (String fname : Split.splitTrim(',', trustCas)) {
File crt;
- if(fname.contains("/")) {
+ if (fname.contains("/")) {
crt = new File(fname);
} else {
crt = new File(data,fname);
}
- if(crt.exists()) {
+ if (crt.exists()) {
access.printf(Level.INIT, "Loading CA Cert from %s", crt.getAbsolutePath());
bytes = new byte[(int)crt.length()];
FileInputStream fis = new FileInputStream(crt);
try {
int read = fis.read(bytes);
- if(read>0) {
+ if (read>0) {
addTrustedCA(new String(bytes));
}
} finally {
@@ -148,13 +148,13 @@ public abstract class CA {
protected void addCaIssuerDN(String issuerDN) {
boolean changed = true;
- for(String id : caIssuerDNs) {
- if(id.equals(issuerDN)) {
+ for (String id : caIssuerDNs) {
+ if (id.equals(issuerDN)) {
changed = false;
break;
}
}
- if(changed) {
+ if (changed) {
String[] newsa = new String[caIssuerDNs.length+1];
newsa[0]=issuerDN;
System.arraycopy(caIssuerDNs, 0, newsa, 1, caIssuerDNs.length);
@@ -164,13 +164,13 @@ public abstract class CA {
protected synchronized void addTrustedCA(final String crtString) {
String crt;
- if(crtString.endsWith("\n")) {
+ if (crtString.endsWith("\n")) {
crt = crtString;
} else {
crt = crtString + '\n';
}
- for(int i=0;i<trustedCAs.length;++i) {
- if(trustedCAs[i]==null) {
+ for (int i=0;i<trustedCAs.length;++i) {
+ if (trustedCAs[i]==null) {
trustedCAs[i]=crt;
return;
}
@@ -221,7 +221,7 @@ public abstract class CA {
*/
public boolean inPersonalDomains(Principal p) {
int at = p.getName().indexOf('@');
- if(at>=0) {
+ if (at>=0) {
return idDomains.contains(p.getName().substring(at+1));
} else {
return false;
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java
index 000b6dd5..bc81fc43 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java
@@ -75,10 +75,10 @@ public class JscepCA extends CA {
mxcwiS = new ConcurrentHashMap<>();
mxcwiC = new ConcurrentHashMap<>();
- if(params.length<2) {
+ if (params.length<2) {
throw new CertException("No Trust Chain parameters are included");
}
- if(params[0].length<2) {
+ if (params[0].length<2) {
throw new CertException("User/Password required for JSCEP");
}
final String id = params[0][0];
@@ -98,21 +98,21 @@ public class JscepCA extends CA {
StringBuilder urlstr = new StringBuilder();
- for(int i=1;i<params.length;++i) { // skip first section, which is user/pass
+ for (int i=1;i<params.length;++i) { // skip first section, which is user/pass
// Work
- if(i>1) {
+ if (i>1) {
urlstr.append(','); // delimiter
}
urlstr.append(params[i][0]);
String dir = access.getProperty(CM_PUBLIC_DIR, "");
- if(!"".equals(dir) && !dir.endsWith("/")) {
+ if (!"".equals(dir) && !dir.endsWith("/")) {
dir = dir + '/';
}
String path;
List<FileReader> frs = new ArrayList<>(params.length-1);
try {
- for(int j=1; j<params[i].length; ++j) { // first 3 taken up, see above
+ for (int j=1; j<params[i].length; ++j) { // first 3 taken up, see above
path = !params[i][j].contains("/")?dir+params[i][j]:params[i][j];
access.printf(Level.INIT, "Loading a TrustChain Member for %s from %s",name, path);
frs.add(new FileReader(path));
@@ -121,8 +121,8 @@ public class JscepCA extends CA {
addCaIssuerDN(xcwi.getIssuerDN());
mxcwiS.put(params[i][0],xcwi);
} finally {
- for(FileReader fr : frs) {
- if(fr!=null) {
+ for (FileReader fr : frs) {
+ if (fr!=null) {
fr.close();
}
}
@@ -139,10 +139,10 @@ public class JscepCA extends CA {
PKCS10CertificationRequest csr;
try {
csr = csrmeta.generateCSR(trans);
- if(trans.info().isLoggable()) {
+ if (trans.info().isLoggable()) {
trans.info().log(BCFactory.toString(csr));
}
- if(trans.info().isLoggable()) {
+ if (trans.info().isLoggable()) {
trans.info().log(csr);
}
} finally {
@@ -152,7 +152,7 @@ public class JscepCA extends CA {
tt = trans.start("Enroll CSR", Env.SUB);
Client client = null;
Item item = null;
- for(int i=0; i<MAX_RETRY;++i) {
+ for (int i=0; i<MAX_RETRY;++i) {
try {
item = clients.best();
client = clients.get(item);
@@ -163,12 +163,12 @@ public class JscepCA extends CA {
csr,
MS_PROFILE /* profile... MS can't deal with blanks*/);
- while(true) {
- if(er.isSuccess()) {
+ while (true) {
+ if (er.isSuccess()) {
trans.checkpoint("Cert from " + clients.info(item));
X509Certificate x509 = null;
- for( Certificate cert : er.getCertStore().getCertificates(null)) {
- if(x509==null) {
+ for ( Certificate cert : er.getCertStore().getCertificates(null)) {
+ if (x509==null) {
x509 = (X509Certificate)cert;
break;
}
@@ -183,14 +183,14 @@ public class JscepCA extends CA {
throw new CertException(clients.info(item)+':'+er.getFailInfo().toString());
}
}
- } catch(LocatorException e) {
+ } catch (LocatorException e) {
trans.error().log(e);
i=MAX_RETRY;
} catch (ClientException e) {
trans.error().log(e,"SCEP Client Error, Temporarily Invalidating Client: " + clients.info(item));
try {
clients.invalidate(client);
- if(!clients.hasItems()) {
+ if (!clients.hasItems()) {
clients.refresh();
}
} catch (LocatorException e1) {
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java
index b7d78f05..2a3ce537 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java
@@ -92,55 +92,55 @@ public class LocalCA extends CA {
serial = new BigInteger(64,random);
- if(params.length<1 || params[0].length<2) {
+ if (params.length<1 || params[0].length<2) {
throw new IOException("LocalCA expects cm_ca.<ca name>=org.onap.aaf.auth.cm.ca.LocalCA,<full path to key file>[;<Full Path to Trust Chain, ending with actual CA>]+");
}
// Read in the Private Key
String configured;
File f = new File(params[0][0]);
- if(f.exists() && f.isFile()) {
+ if (f.exists() && f.isFile()) {
String fileName = f.getName();
- if(fileName.endsWith(".key")) {
+ if (fileName.endsWith(".key")) {
caKey = Factory.toPrivateKey(NullTrans.singleton(),f);
List<FileReader> frs = new ArrayList<>(params.length-1);
try {
String dir = access.getProperty(CM_PUBLIC_DIR, "");
- if(!"".equals(dir) && !dir.endsWith("/")) {
+ if (!"".equals(dir) && !dir.endsWith("/")) {
dir = dir + '/';
}
String path;
- for(int i=1; i<params[0].length; ++i) { // first param is Private Key, remainder are TrustChain
+ for (int i=1; i<params[0].length; ++i) { // first param is Private Key, remainder are TrustChain
path = !params[0][i].contains("/")?dir+params[0][i]:params[0][i];
access.printf(Level.INIT, "Loading a TrustChain Member for %s from %s\n",name, path);
frs.add(new FileReader(path));
}
x509cwi = new X509ChainWithIssuer(frs);
} finally {
- for(FileReader fr : frs) {
- if(fr!=null) {
+ for (FileReader fr : frs) {
+ if (fr!=null) {
fr.close();
}
}
}
configured = "Configured with " + fileName;
} else {
- if(params.length<1 || params[0].length<3) {
+ if (params.length<1 || params[0].length<3) {
throw new CertException("LocalCA parameters must be <keystore [.p12|.pkcs12|.jks|.pkcs11(sun only)]; <alias>; enc:<encrypted Keystore Password>>");
}
try {
Provider p;
KeyStore keyStore;
FileInputStream fis = null;
- if(fileName.endsWith(".pkcs11")) {
+ if (fileName.endsWith(".pkcs11")) {
String ksType="PKCS11";
p = Factory.getSecurityProvider(ksType,params);
keyStore = KeyStore.getInstance(ksType,p);
- } else if(fileName.endsWith(".jks")) {
+ } else if (fileName.endsWith(".jks")) {
keyStore = KeyStore.getInstance("JKS");
fis = new FileInputStream(f);
- } else if(fileName.endsWith(".p12") || fileName.endsWith(".pkcs12")) {
+ } else if (fileName.endsWith(".p12") || fileName.endsWith(".pkcs12")) {
keyStore = KeyStore.getInstance("PKCS12");
fis = new FileInputStream(f);
} else {
@@ -151,7 +151,7 @@ public class LocalCA extends CA {
try {
String pass = access.decrypt(params[0][2]/*encrypted passcode*/, true);
- if(pass==null) {
+ if (pass==null) {
throw new CertException("Passcode for " + fileName + " cannot be decrypted.");
}
char[] ksPass = pass.toCharArray();
@@ -164,12 +164,12 @@ public class LocalCA extends CA {
fis.close();
}
Entry entry;
- if(fileName.endsWith(".pkcs11")) {
+ if (fileName.endsWith(".pkcs11")) {
entry = keyStore.getEntry(params[0][1]/*alias*/, null);
} else {
entry = keyStore.getEntry(params[0][1]/*alias*/, keyPass);
}
- if(entry==null) {
+ if (entry==null) {
throw new CertException("There is no Keystore entry with name '" + params[0][1] +'\'');
}
PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry)entry;
@@ -188,7 +188,7 @@ public class LocalCA extends CA {
X500NameBuilder xnb = new X500NameBuilder();
List<RDN> rp = RDN.parse(',', x509cwi.getIssuerDN());
Collections.reverse(rp);
- for(RDN rnd : rp) {
+ for (RDN rnd : rp) {
xnb.addRDN(rnd.aoi,rnd.value);
}
issuer = xnb.build();
@@ -226,7 +226,7 @@ public class LocalCA extends CA {
// new SubjectPublicKeyInfo(ASN1Sequence.getInstance(caCert.getPublicKey().getEncoded()))
);
List<GeneralName> lsan = new ArrayList<>();
- for(String s : csrmeta.sans()) {
+ for (String s : csrmeta.sans()) {
lsan.add(new GeneralName(GeneralName.dNSName,s));
}
GeneralName[] sans = new GeneralName[lsan.size()];
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java
index e51f2faa..2ef6da55 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java
@@ -45,8 +45,8 @@ public class X509ChainWithIssuer extends X509andChain {
// Trust Chain. Last one should be the CA
Collection<? extends Certificate> certs;
X509Certificate x509;
- for(Reader rdr : rdrs) {
- if(rdr==null) { // cover for badly formed array
+ for (Reader rdr : rdrs) {
+ if (rdr==null) { // cover for badly formed array
continue;
}
@@ -56,13 +56,13 @@ public class X509ChainWithIssuer extends X509andChain {
} catch (CertificateException e) {
throw new CertException(e);
}
- for(Certificate c : certs) {
+ for (Certificate c : certs) {
x509=(X509Certificate)c;
Principal subject = x509.getSubjectDN();
- if(subject==null) {
+ if (subject==null) {
continue;
}
- if(cert==null) { // first in Trust Chain
+ if (cert==null) { // first in Trust Chain
issuerDN = subject.toString();
cert=x509; // adding each time makes sure last one is signer.
}
@@ -73,12 +73,12 @@ public class X509ChainWithIssuer extends X509andChain {
public X509ChainWithIssuer(Certificate[] certs) throws IOException, CertException {
X509Certificate x509;
- for(int i=certs.length-1; i>=0; --i) {
+ for (int i=certs.length-1; i>=0; --i) {
x509=(X509Certificate)certs[i];
Principal subject = x509.getSubjectDN();
- if(subject!=null) {
+ if (subject!=null) {
addTrustChainEntry(x509);
- if(i==0) { // last one is signer
+ if (i==0) { // last one is signer
cert=x509;
issuerDN= subject.toString();
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java
index 3c684db2..7eb88bd2 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java
@@ -58,7 +58,7 @@ public class X509andChain {
public void addTrustChainEntry(X509Certificate x509) throws IOException, CertException {
- if(trustChain==null) {
+ if (trustChain==null) {
trustChain = new String[] {Factory.toString(NullTrans.singleton(),x509)};
} else {
String[] temp = new String[trustChain.length+1];
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java
index 8edfa634..b84816ab 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java
@@ -65,7 +65,7 @@ public class BCFactory extends Factory {
}
public static String toString(PKCS10CertificationRequest csr) throws IOException, CertException {
- if(csr==null) {
+ if (csr==null) {
throw new CertException("x509 Certificate Request not built");
}
return textBuilder("CERTIFICATE REQUEST",csr.getEncoded());
@@ -94,8 +94,8 @@ public class BCFactory extends Factory {
CSRMeta csr = ca.newCSRMeta();
boolean first = true;
// Set CN (and SAN)
- for(String fqdn : fqdns) {
- if(first) {
+ for (String fqdn : fqdns) {
+ if (first) {
first = false;
csr.cn(fqdn);
}
@@ -106,7 +106,7 @@ public class BCFactory extends Factory {
csr.mechID(mechid);
csr.email(sponsorEmail);
String errs;
- if((errs=validateApp(csr))!=null) {
+ if ((errs=validateApp(csr))!=null) {
throw new CertException(errs);
}
return csr;
@@ -114,7 +114,7 @@ public class BCFactory extends Factory {
private static String validateApp(CSRMeta csr) {
CertmanValidator v = new CertmanValidator();
- if(v.nullOrBlank("cn", csr.cn())
+ if (v.nullOrBlank("cn", csr.cn())
.nullOrBlank("mechID", csr.mechID())
// .nullOrBlank("email", csr.email())
.err()) {
@@ -130,7 +130,7 @@ public class BCFactory extends Factory {
csr.challenge(new String(Symm.randomGen(24)));
csr.email(email);
String errs;
- if((errs=validatePersonal(csr))!=null) {
+ if ((errs=validatePersonal(csr))!=null) {
throw new CertException(errs);
}
return csr;
@@ -138,7 +138,7 @@ public class BCFactory extends Factory {
private static String validatePersonal(CSRMeta csr) {
CertmanValidator v = new CertmanValidator();
- if(v.nullOrBlank("cn", csr.cn())
+ if (v.nullOrBlank("cn", csr.cn())
.nullOrBlank("email", csr.email())
.err()) {
return v.errs();
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java
index 5df439ab..a3740bfe 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java
@@ -70,18 +70,18 @@ public class CSRMeta {
}
public X500Name x500Name() {
- if(name==null) {
+ if (name==null) {
X500NameBuilder xnb = new X500NameBuilder();
xnb.addRDN(BCStyle.CN,cn);
xnb.addRDN(BCStyle.E,email);
- if(mechID!=null) {
- if(environment==null) {
+ if (mechID!=null) {
+ if (environment==null) {
xnb.addRDN(BCStyle.OU,mechID);
} else {
xnb.addRDN(BCStyle.OU,mechID+':'+environment);
}
}
- for(RDN rdn : rdns) {
+ for (RDN rdn : rdns) {
xnb.addRDN(rdn.aoi,rdn.value);
}
name = xnb.build();
@@ -92,16 +92,16 @@ public class CSRMeta {
public PKCS10CertificationRequest generateCSR(Trans trans) throws IOException, CertException {
PKCS10CertificationRequestBuilder builder = new JcaPKCS10CertificationRequestBuilder(x500Name(),keypair(trans).getPublic());
- if(challenge!=null) {
+ if (challenge!=null) {
DERPrintableString password = new DERPrintableString(challenge);
builder.addAttribute(PKCSObjectIdentifiers.pkcs_9_at_challengePassword, password);
}
int plus = email==null?0:1;
- if(!sanList.isEmpty()) {
+ if (!sanList.isEmpty()) {
GeneralName[] gna = new GeneralName[sanList.size()+plus];
int i=-1;
- for(String s : sanList) {
+ for (String s : sanList) {
gna[++i]=new GeneralName(GeneralName.dNSName,s);
}
gna[++i]=new GeneralName(GeneralName.rfc822Name,email);
@@ -132,17 +132,17 @@ public class CSRMeta {
Extensions extensions = Extensions.getInstance(attribute.getAttrValues().getObjectAt(0));
GeneralNames gns = GeneralNames.fromExtensions(extensions,Extension.subjectAlternativeName);
GeneralName[] names = gns.getNames();
- for(int k=0; k < names.length; k++) {
+ for (int k=0; k < names.length; k++) {
String title = "";
- if(names[k].getTagNo() == GeneralName.dNSName) {
+ if (names[k].getTagNo() == GeneralName.dNSName) {
title = "dNSName";
- } else if(names[k].getTagNo() == GeneralName.iPAddress) {
+ } else if (names[k].getTagNo() == GeneralName.iPAddress) {
title = "iPAddress";
// Deprecated, but I don't see anything better to use.
names[k].toASN1Object();
- } else if(names[k].getTagNo() == GeneralName.otherName) {
+ } else if (names[k].getTagNo() == GeneralName.otherName) {
title = "otherName";
- } else if(names[k].getTagNo() == GeneralName.rfc822Name) {
+ } else if (names[k].getTagNo() == GeneralName.rfc822Name) {
title = "email";
}
@@ -180,7 +180,7 @@ public class CSRMeta {
public KeyPair keypair(Trans trans) {
- if(keyPair == null) {
+ if (keyPair == null) {
keyPair = Factory.generateKeyPair(trans);
}
return keyPair;
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java
index c39ba6d3..f57c837a 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java
@@ -69,19 +69,19 @@ public class RDN {
List<RDN> lrnd = new ArrayList<>();
StringBuilder sb = new StringBuilder();
boolean inQuotes = false;
- for(int i=0;i<dnString.length();++i) {
+ for (int i=0;i<dnString.length();++i) {
char c = dnString.charAt(i);
- if(inQuotes) {
- if('"' == c) {
+ if (inQuotes) {
+ if ('"' == c) {
inQuotes=false;
} else {
sb.append(dnString.charAt(i));
}
} else {
- if('"' == c) {
+ if ('"' == c) {
inQuotes=true;
- } else if(delim==c) {
- if(sb.length()>0) {
+ } else if (delim==c) {
+ if (sb.length()>0) {
lrnd.add(new RDN(sb.toString()));
sb.setLength(0);
}
@@ -90,7 +90,7 @@ public class RDN {
}
}
}
- if(sb.indexOf("=")>0) {
+ if (sb.indexOf("=")>0) {
lrnd.add(new RDN(sb.toString()));
}
return lrnd;
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java
index 310ea8b2..e05b2a27 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java
@@ -115,7 +115,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
(certDF = env.newDataFactory(mapper.getClass(API.CERT))).in(dataType).out(dataType);
(artiDF = env.newDataFactory(mapper.getClass(API.ARTIFACTS))).in(dataType).out(dataType);
// sCertAuth = env.slot(API_Cert.CERT_AUTH);
- if(artiDF.getOutType().name().contains("xml")) {
+ if (artiDF.getOutType().name().contains("xml")) {
voidResp = "application/Void+xml;charset=utf-8;version=1.0,application/xml;version=1.0,*/*";
} else {
voidResp = "application/Void+json;charset=utf-8;version=1.0,application/json;version=1.0,*/*";
@@ -206,7 +206,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
"] " +
holder.toString(),
Env.ALWAYS);
- if(hidemsg) {
+ if (hidemsg) {
holder.setLength(0);
em = mapper().errorFromMessage(holder, msgId, "Server had an issue processing this request");
}
@@ -231,7 +231,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
default:
return Result.err(Result.ERR_BadData,"Invalid Perm String");
}
- if(certman.aafLurPerm.fish(trans.getUserPrincipal(), ap)) {
+ if (certman.aafLurPerm.fish(trans.getUserPrincipal(), ap)) {
resp.setContentType(voidResp);
resp.getOutputStream().write(0);
return Result.ok();
@@ -253,13 +253,13 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
try {
Data<REQ> rd = certRequestDF.newData().load(req.getInputStream());
request = rd.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,REQUEST_CERT);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
Result<CertResp> rcr = service.requestCert(trans,mapper.toReq(trans,request), ca);
- if(rcr.notOK()) {
+ if (rcr.notOK()) {
return Result.err(rcr);
}
@@ -291,7 +291,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
public Result<Void> requestPersonalCert(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, CA ca) {
return Result.err(Result.ERR_NotImplemented,"not implemented yet");
// Result<CertResp> rcr = service.requestPersonalCert(trans,ca);
-// if(rcr.notOK()) {
+// if (rcr.notOK()) {
// return Result.err(rcr);
// } else {
// try {
@@ -308,17 +308,17 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
// zos.closeEntry();
//
// String wt;
-// if((wt=req.getParameter("withTrust"))!=null || TRUE.equalsIgnoreCase(wt)) {
+// if ((wt=req.getParameter("withTrust"))!=null || TRUE.equalsIgnoreCase(wt)) {
// zos.putNextEntry(new ZipEntry(trans.user()+".trustCrts"));
-// for(String s : ca.getTrustChain()) {
+// for (String s : ca.getTrustChain()) {
// ps.println(s);
// }
// zos.closeEntry();
// }
//
// boolean withJKS = (wt=req.getParameter("withJKS"))!=null || TRUE.equalsIgnoreCase(wt);
-// if(withJKS) {
-// if(trans.getUserPrincipal() instanceof BasicPrincipal) {
+// if (withJKS) {
+// if (trans.getUserPrincipal() instanceof BasicPrincipal) {
// char[] cap = new String(((BasicPrincipal)trans.getUserPrincipal()).getCred()).toCharArray();
// KeyStore ks = keystore(trans, rcr.value, ca.getTrustChain(), trans.user(), cap);
// zos.putNextEntry(new ZipEntry(trans.user()+".jks"));
@@ -337,7 +337,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
// ps.println("echo \"Deploying to `pwd`\"");
// ps.println("jar -xvf $THE_PWD/$1 " + trans.user());
// ps.println("chmod 600 " + trans.user() + ".key");
-// if(withJKS) {
+// if (withJKS) {
// ps.println("chmod 600 " + trans.user() + ".jks");
// }
// ps.println("cd $THE_PWD");
@@ -362,7 +362,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
// // Get the Cert(s)... Might include Trust store
// List<String> lcerts = new ArrayList<>();
// lcerts.add(cr.asCertString());
-// for(String s : trustChain) {
+// for (String s : trustChain) {
// lcerts.add(s);
// }
//
@@ -377,7 +377,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
// jks.setEntry(name, pkEntry, protParam);
//
// int i=0;
-// for(X509Certificate x509 : certs) {
+// for (X509Certificate x509 : certs) {
// jks.setCertificateEntry("cert_"+ ++i, x509);
// }
// return jks;
@@ -391,7 +391,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
try {
Data<REQ> rd = certRenewDF.newData().load(req.getInputStream());
request = rd.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,RENEW_CERT);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
@@ -427,7 +427,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
try {
Data<REQ> rd = certDropDF.newData().load(req.getInputStream());
request = rd.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,DROP_CERT);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
@@ -485,7 +485,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
try {
Data<ARTIFACTS> rd = artiDF.newData().load(req.getInputStream());
arti = rd.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,CREATE_ARTIFACTS);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
@@ -509,23 +509,23 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
String ns = req.getParameter("ns");
Result<ARTIFACTS> ra;
- if( machine !=null && mechid == null) {
+ if ( machine !=null && mechid == null) {
ra = mapper.fromArtifacts(service.readArtifactsByMachine(trans, machine));
- } else if(mechid!=null && machine==null) {
+ } else if (mechid!=null && machine==null) {
ra = mapper.fromArtifacts(service.readArtifactsByMechID(trans, mechid));
- } else if(mechid!=null && machine!=null) {
+ } else if (mechid!=null && machine!=null) {
ArtiDAO.Data add = new ArtiDAO.Data();
add.mechid = mechid;
add.machine = machine;
add.ns = ns;
ra = mapper.fromArtifacts(service.readArtifacts(trans,add));
- } else if(ns!=null) {
+ } else if (ns!=null) {
ra = mapper.fromArtifacts(service.readArtifactsByNs(trans, ns));
} else {
ra = Result.err(Status.ERR_BadData,"Invalid request inputs");
}
- if(ra.isOK()) {
+ if (ra.isOK()) {
RosettaData<ARTIFACTS> data = artiDF.newData(trans).load(ra.value);
data.to(resp.getOutputStream());
setContentType(resp,artiDF.getOutType());
@@ -550,7 +550,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
add.mechid = mechid;
add.machine = machine;
Result<ARTIFACTS> ra = mapper.fromArtifacts(service.readArtifacts(trans,add));
- if(ra.isOK()) {
+ if (ra.isOK()) {
RosettaData<ARTIFACTS> data = artiDF.newData(trans).load(ra.value);
data.to(resp.getOutputStream());
setContentType(resp,artiDF.getOutType());
@@ -575,7 +575,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
try {
Data<ARTIFACTS> rd = artiDF.newData().load(req.getInputStream());
arti = rd.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,UPDATE_ARTIFACTS);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
@@ -597,7 +597,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
try {
Data<ARTIFACTS> rd = artiDF.newData().load(req.getInputStream());
arti = rd.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,DELETE_ARTIFACTS);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java
index 53b97626..99d0c478 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java
@@ -86,7 +86,7 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
err.setMessageId(msgID);
// AT&T Restful Error Format requires numbers "%" placements
err.setText(Vars.convert(holder, text, var));
- for(String s : var) {
+ for (String s : var) {
err.getVariables().add(s);
}
return err;
@@ -97,7 +97,7 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
*/
@Override
public Result<CertInfo> toCert(AuthzTrans trans, Result<CertResp> in, boolean withTrustChain) throws IOException {
- if(!in.isOK()) {
+ if (!in.isOK()) {
return Result.err(in);
}
@@ -105,15 +105,15 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
CertInfo cout = newInstance(API.CERT);
cout.setPrivatekey(cin.privateString());
String value;
- if((value=cin.challenge())!=null) {
+ if ((value=cin.challenge())!=null) {
cout.setChallenge(value);
}
// In Version 1, Cert is always first
cout.getCerts().add(cin.asCertString());
// Follow with Trust Chain
- if(cin.trustChain()!=null) {
- for(String c : cin.trustChain()) {
- if(c!=null) {
+ if (cin.trustChain()!=null) {
+ for (String c : cin.trustChain()) {
+ if (c!=null) {
cout.getCerts().add(c);
}
}
@@ -121,20 +121,20 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
// Adding all the Certs in one response is a mistake. Makes it very hard for Agent to setup
// Certs in keystore versus Truststore. Separate in Version 2_0
- if(cin.trustCAs()!=null) {
- for(String c : cin.trustCAs()) {
- if(c!=null) {
- if(!cout.getCerts().contains(c)) {
+ if (cin.trustCAs()!=null) {
+ for (String c : cin.trustCAs()) {
+ if (c!=null) {
+ if (!cout.getCerts().contains(c)) {
cout.getCerts().add(c);
}
}
}
}
- if(cin.notes()!=null) {
+ if (cin.notes()!=null) {
boolean first = true;
StringBuilder sb = new StringBuilder();
- for(String n : cin.notes()) {
- if(first) {
+ for (String n : cin.notes()) {
+ if (first) {
first = false;
} else {
sb.append('\n');
@@ -144,7 +144,7 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
cout.setNotes(sb.toString());
}
List<String> caIssuerDNs = cout.getCaIssuerDNs();
- for(String s : cin.caIssuerDNs()) {
+ for (String s : cin.caIssuerDNs()) {
caIssuerDNs.add(s);
}
cout.setEnv(cin.env());
@@ -154,10 +154,10 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
@Override
public Result<CertInfo> toCert(AuthzTrans trans, Result<List<CertDAO.Data>> in) {
- if(in.isOK()) {
+ if (in.isOK()) {
CertInfo cout = newInstance(API.CERT);
List<String> certs = cout.getCerts();
- for(CertDAO.Data cdd : in.value) {
+ for (CertDAO.Data cdd : in.value) {
certs.add(cdd.x509);
}
return Result.ok(cout);
@@ -174,7 +174,7 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
CertificateRequest in;
try {
in = (CertificateRequest)req;
- } catch(ClassCastException e) {
+ } catch (ClassCastException e) {
return Result.err(Result.ERR_BadData,"Request is not a CertificateRequest");
}
@@ -184,7 +184,7 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
out.fqdns=in.getFqdns();
v.isNull("CertRequest", req).nullOrBlank("MechID", out.mechid);
v.nullBlankMin("FQDNs", out.fqdns,1);
- if(v.err()) {
+ if (v.err()) {
return Result.err(Result.ERR_BadData, v.errs());
}
out.emails = in.getEmail();
@@ -217,7 +217,7 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
@Override
public List<ArtiDAO.Data> toArtifact(AuthzTrans trans, Artifacts artifacts) {
List<ArtiDAO.Data> ladd = new ArrayList<>();
- for(Artifact arti : artifacts.getArtifact()) {
+ for (Artifact arti : artifacts.getArtifact()) {
ArtiDAO.Data data = new ArtiDAO.Data();
data.mechid = arti.getMechid();
data.machine = arti.getMachine();
@@ -235,11 +235,11 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
data.expires = null;
// Derive Optional Data from Machine (Domain) if exists
- if(data.machine!=null) {
- if(data.ca==null && data.machine.endsWith(".att.com")) {
+ if (data.machine!=null) {
+ if (data.ca==null && data.machine.endsWith(".att.com")) {
data.ca = "aaf"; // default
}
- if(data.ns==null ) {
+ if (data.ns==null ) {
data.ns=FQI.reverseDomain(data.machine);
}
}
@@ -254,9 +254,9 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
*/
@Override
public Result<Artifacts> fromArtifacts(Result<List<Data>> lArtiDAO) {
- if(lArtiDAO.isOK()) {
+ if (lArtiDAO.isOK()) {
Artifacts artis = new Artifacts();
- for(ArtiDAO.Data arti : lArtiDAO.value) {
+ for (ArtiDAO.Data arti : lArtiDAO.value) {
Artifact a = new Artifact();
a.setMechid(arti.mechid);
a.setMachine(arti.machine);
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java
index d85ea2ca..55a292e0 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java
@@ -86,7 +86,7 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
err.setMessageId(msgID);
// AT&T Restful Error Format requires numbers "%" placements
err.setText(Vars.convert(holder, text, var));
- for(String s : var) {
+ for (String s : var) {
err.getVariables().add(s);
}
return err;
@@ -100,25 +100,25 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
*/
@Override
public Result<CertInfo> toCert(AuthzTrans trans, Result<CertResp> in, boolean withTrustChain) throws IOException {
- if(!in.isOK()) {
+ if (!in.isOK()) {
CertResp cin = in.value;
CertInfo cout = newInstance(API.CERT);
cout.setPrivatekey(cin.privateString());
String value;
- if((value=cin.challenge())!=null) {
+ if ((value=cin.challenge())!=null) {
cout.setChallenge(value);
}
cout.getCerts().add(cin.asCertString());
- if(cin.trustChain()!=null) {
- for(String c : cin.trustChain()) {
+ if (cin.trustChain()!=null) {
+ for (String c : cin.trustChain()) {
cout.getCerts().add(c);
}
}
- if(cin.notes()!=null) {
+ if (cin.notes()!=null) {
boolean first = true;
StringBuilder sb = new StringBuilder();
- for(String n : cin.notes()) {
- if(first) {
+ for (String n : cin.notes()) {
+ if (first) {
first = false;
} else {
sb.append('\n');
@@ -129,7 +129,7 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
}
List<String> caIssuerDNs = cout.getCaIssuerDNs();
- for(String s : cin.caIssuerDNs()) {
+ for (String s : cin.caIssuerDNs()) {
caIssuerDNs.add(s);
}
@@ -143,10 +143,10 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
@Override
public Result<CertInfo> toCert(AuthzTrans trans, Result<List<CertDAO.Data>> in) {
- if(in.isOK()) {
+ if (in.isOK()) {
CertInfo cout = newInstance(API.CERT);
List<String> certs = cout.getCerts();
- for(CertDAO.Data cdd : in.value) {
+ for (CertDAO.Data cdd : in.value) {
certs.add(cdd.x509);
}
return Result.ok(cout);
@@ -163,7 +163,7 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
CertificateRequest in;
try {
in = (CertificateRequest)req;
- } catch(ClassCastException e) {
+ } catch (ClassCastException e) {
return Result.err(Result.ERR_BadData,"Request is not a CertificateRequest");
}
@@ -172,7 +172,7 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
v.isNull("CertRequest", req)
.nullOrBlank("MechID", out.mechid=in.getMechid());
v.nullBlankMin("FQDNs", out.fqdns=in.getFqdns(),1);
- if(v.err()) {
+ if (v.err()) {
return Result.err(Result.ERR_BadData, v.errs());
}
@@ -206,7 +206,7 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
@Override
public List<ArtiDAO.Data> toArtifact(AuthzTrans trans, Artifacts artifacts) {
List<ArtiDAO.Data> ladd = new ArrayList<>();
- for(Artifact arti : artifacts.getArtifact()) {
+ for (Artifact arti : artifacts.getArtifact()) {
ArtiDAO.Data data = new ArtiDAO.Data();
data.mechid = arti.getMechid();
data.machine = arti.getMachine();
@@ -224,13 +224,13 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
data.expires = null;
// Derive Optional Data from Machine (Domain) if exists
- if(data.machine!=null) {
- if(data.ca==null) {
- if(data.machine.endsWith(".att.com")) {
+ if (data.machine!=null) {
+ if (data.ca==null) {
+ if (data.machine.endsWith(".att.com")) {
data.ca = "aaf"; // default
}
}
- if(data.ns==null ) {
+ if (data.ns==null ) {
data.ns=FQI.reverseDomain(data.machine);
}
}
@@ -245,9 +245,9 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
*/
@Override
public Result<Artifacts> fromArtifacts(Result<List<Data>> lArtiDAO) {
- if(lArtiDAO.isOK()) {
+ if (lArtiDAO.isOK()) {
Artifacts artis = new Artifacts();
- for(ArtiDAO.Data arti : lArtiDAO.value) {
+ for (ArtiDAO.Data arti : lArtiDAO.value) {
Artifact a = new Artifact();
a.setMechid(arti.mechid);
a.setMachine(arti.machine);
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java
index 62f0d680..89824a47 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java
@@ -164,7 +164,7 @@ public class CMService {
} else {
for (String cn : req.value.fqdns) {
- if(!ignoreIPs) {
+ if (!ignoreIPs) {
try {
InetAddress[] ias = InetAddress.getAllByName(cn);
Set<String> potentialSanNames = new HashSet<>();
@@ -186,7 +186,7 @@ public class CMService {
}
final String host;
- if(ignoreIPs) {
+ if (ignoreIPs) {
host = req.value.fqdns.get(0);
} else if (primary == null) {
return Result.err(Result.ERR_Denied, "Request not made from matching IP (%s)", trans.ip());
@@ -271,7 +271,7 @@ public class CMService {
// Make sure Primary is the first in fqdns
if (fqdns.size() > 1) {
for (int i = 0; i < fqdns.size(); ++i) {
- if(primary==null) {
+ if (primary==null) {
trans.error().log("CMService var primary is null");
} else {
String fg = fqdns.get(i);
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java
index ea97dd0d..1a27b41f 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java
@@ -49,13 +49,13 @@ public class CertmanValidator extends Validator{
private static final String ARTIFACTS_MUST_HAVE_AT_LEAST = "Artifacts must have at least ";
public CertmanValidator nullBlankMin(String name, List<String> list, int min) {
- if(list==null) {
+ if (list==null) {
msg(name + IS_NULL);
} else {
- if(list.size()<min) {
+ if (list.size()<min) {
msg(name + MUST_HAVE_AT_LEAST + min + ENTR + (min==1?Y:IES));
} else {
- for(String s : list) {
+ for (String s : list) {
nullOrBlank("List Item",s);
}
}
@@ -64,13 +64,13 @@ public class CertmanValidator extends Validator{
}
public CertmanValidator artisRequired(List<ArtiDAO.Data> list, int min) {
- if(list==null) {
+ if (list==null) {
msg(ARTIFACT_LIST_IS_NULL);
} else {
- if(list.size()<min) {
+ if (list.size()<min) {
msg(ARTIFACTS_MUST_HAVE_AT_LEAST + min + ENTR + (min==1?Y:IES));
} else {
- for(ArtiDAO.Data a : list) {
+ for (ArtiDAO.Data a : list) {
allRequired(a);
}
}
@@ -79,13 +79,13 @@ public class CertmanValidator extends Validator{
}
public CertmanValidator artisKeys(List<ArtiDAO.Data> list, int min) {
- if(list==null) {
+ if (list==null) {
msg(ARTIFACT_LIST_IS_NULL);
} else {
- if(list.size()<min) {
+ if (list.size()<min) {
msg(ARTIFACTS_MUST_HAVE_AT_LEAST + min + ENTR + (min==1?Y:IES));
} else {
- for(ArtiDAO.Data a : list) {
+ for (ArtiDAO.Data a : list) {
keys(a);
}
}
@@ -95,7 +95,7 @@ public class CertmanValidator extends Validator{
public CertmanValidator keys(ArtiDAO.Data add) {
- if(add==null) {
+ if (add==null) {
msg("Artifact is null.");
} else {
nullOrBlank(MECHID, add.mechid);
@@ -105,7 +105,7 @@ public class CertmanValidator extends Validator{
}
private CertmanValidator allRequired(Data a) {
- if(a==null) {
+ if (a==null) {
msg("Artifact is null.");
} else {
nullOrBlank(MECHID, a.mechid);
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java
index 7e6c3647..2eab9b2b 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java
@@ -76,7 +76,7 @@ public class CertmanTest {
// }
//
// Locator<URI> loc = new DNSLocator(env, "https", "aaf.it.att.com", "8150");
-// for(Item item = loc.first(); item!=null; item=loc.next(item)) {
+// for (Item item = loc.first(); item!=null; item=loc.next(item)) {
// System.out.println(loc.get(item));
// }
//
@@ -111,7 +111,7 @@ public class CertmanTest {
// @Test
// public void testX500Name() throws Exception {
//
-// for( InetAddress ia : InetAddress.getAllByName("aaf.dev.att.com")) {
+// for ( InetAddress ia : InetAddress.getAllByName("aaf.dev.att.com")) {
// System.out.printf("%s - %s\n", ia.getHostName(), ia.getHostAddress());
// InetAddress ia1 = InetAddress.getByName(ia.getHostAddress());
// System.out.printf("%s - %s\n", ia1.getHostName(), ia1.getHostAddress());
@@ -133,12 +133,12 @@ public class CertmanTest {
// try {
// System.out.println(reqDF.newData().option(Data.PRETTY).load(cr).asString());
// Future<String> f = client.updateRespondString(path, reqDF, cr);
-// if(f.get(10000)) {
+// if (f.get(10000)) {
// end = System.nanoTime();
// System.out.println(f.body());
// CertInfo capi = certDF.newData().in(Data.TYPE.JSON).load(f.body()).asObject();
-// for(String c :capi.getCerts()) {
-// for( java.security.cert.Certificate x509 : Factory.toX509Certificate(c)) {
+// for (String c :capi.getCerts()) {
+// for ( java.security.cert.Certificate x509 : Factory.toX509Certificate(c)) {
// System.out.println(x509.toString());
// }
// }
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
index c308e775..ea366576 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
@@ -161,7 +161,7 @@ public class AAFcli {
sb.append(largs[idx], e, v);
if ((e = largs[idx].indexOf(']', v)) >= 0) {
String p = access.getProperty(largs[idx].substring(v + 2, e),null);
- if(p==null) {
+ if (p==null) {
p = System.getProperty(largs[idx].substring(v+2,e));
}
++e;
@@ -183,7 +183,7 @@ public class AAFcli {
while (rv && idx < largs.length) {
// Allow Script to change Credential
if (!gui) {
- if("as".equalsIgnoreCase(largs[idx])) {
+ if ("as".equalsIgnoreCase(largs[idx])) {
if (largs.length > ++idx) {
// get Password from Props with ID as Key
String user = largs[idx++];
@@ -255,13 +255,13 @@ public class AAFcli {
}
- if("REQUEST".equalsIgnoreCase(largs[idx])) {
+ if ("REQUEST".equalsIgnoreCase(largs[idx])) {
request=true;
++idx;
- } else if("FORCE".equalsIgnoreCase(largs[idx])) {
+ } else if ("FORCE".equalsIgnoreCase(largs[idx])) {
force="true";
++idx;
- } else if("DETAILS".equalsIgnoreCase(largs[idx])) {
+ } else if ("DETAILS".equalsIgnoreCase(largs[idx])) {
showDetails=true;
++idx;
} else if ("set".equalsIgnoreCase(largs[idx])) {
@@ -271,11 +271,11 @@ public class AAFcli {
if (equals < 0) {
tag = largs[idx];
value = access.getProperty(Config.AAF_APPPASS,null);
- if(value==null) {
+ if (value==null) {
break;
} else {
value = access.decrypt(value, false);
- if(value==null) {
+ if (value==null) {
break;
}
access.getProperties().put(tag, value);
@@ -287,11 +287,11 @@ public class AAFcli {
pw.println("set " + tag + ' ' + value);
}
boolean isTrue = "TRUE".equalsIgnoreCase(value);
- if("FORCE".equalsIgnoreCase(tag)) {
+ if ("FORCE".equalsIgnoreCase(tag)) {
force = value;
- } else if("REQUEST".equalsIgnoreCase(tag)) {
+ } else if ("REQUEST".equalsIgnoreCase(tag)) {
request = isTrue;
- } else if("DETAILS".equalsIgnoreCase(tag)) {
+ } else if ("DETAILS".equalsIgnoreCase(tag)) {
showDetails = isTrue;
} else {
access.getProperties().put(tag, value);
@@ -380,7 +380,7 @@ public class AAFcli {
} else {
quote = ch;
}
- } else if(ch=='|' && quote==0) {
+ } else if (ch=='|' && quote==0) {
arr.add(sb.toString());
sb.setLength(0);
start = true;
@@ -437,7 +437,7 @@ public class AAFcli {
try {
PropAccess access = aafsso.access();
- if(aafsso.ok()) {
+ if (aafsso.ok()) {
Define.set(access);
AuthzEnv env = new AuthzEnv(access);
@@ -450,7 +450,7 @@ public class AAFcli {
for (int i = 0; i < args.length; ++i) {
if ("-i".equalsIgnoreCase(args[i])) {
rdr = new InputStreamReader(System.in);
- // } else if("-o".equalsIgnoreCase(args[i])) {
+ // } else if ("-o".equalsIgnoreCase(args[i])) {
// // shall we do something different? Output stream is
// already done...
} else if ("-f".equalsIgnoreCase(args[i])) {
@@ -488,7 +488,7 @@ public class AAFcli {
aafsso.setStdErrDefault();
// Note, with AAF Locator, this may not longer be necessary 3/2018 Jonathan
- if(!aafsso.loginOnly()) {
+ if (!aafsso.loginOnly()) {
// try {
// loc = new AAFLocator(si,new URI(access.getProperty(Config.AAF_URL)));
// } catch (Throwable t) {
@@ -502,7 +502,7 @@ public class AAFcli {
TIMEOUT = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
// HMangr hman = new HMangr(access, loc).readTimeout(TIMEOUT).apiVersion(Config.AAF_DEFAULT_VERSION);
- if(access.getProperty(Config.AAF_DEFAULT_REALM)==null) {
+ if (access.getProperty(Config.AAF_DEFAULT_REALM)==null) {
access.setProperty(Config.AAF_DEFAULT_REALM, "people.osaaf.org");
aafsso.addProp(Config.AAF_DEFAULT_REALM, "people.osaaf.org");
}
@@ -511,13 +511,13 @@ public class AAFcli {
aafcon.hman(), aafcon.securityInfo(), aafcon.securityInfo().defSS);
// new HBasicAuthSS(si,aafsso.user(), access.decrypt(aafsso.enc_pass(),false)));
// }
- if(!ignoreDelay) {
+ if (!ignoreDelay) {
File delay = new File("aafcli.delay");
- if(delay.exists()) {
+ if (delay.exists()) {
BufferedReader br = new BufferedReader(new FileReader(delay));
try {
globalDelay = Integer.parseInt(br.readLine());
- } catch(Exception e) {
+ } catch (Exception e) {
access.log(Level.DEBUG,e);
} finally {
br.close();
@@ -596,7 +596,7 @@ public class AAFcli {
System.err.println(err);
}
}
- if(noexit==null) {
+ if (noexit==null) {
return;
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java
index 168d2753..77d1894f 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java
@@ -45,20 +45,20 @@ public class BaseCmd<CMD extends Cmd> extends Cmd {
@Override
public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException {
- if(args.length-idx<1) {
+ if (args.length-idx<1) {
pw().println(build(new StringBuilder(),null).toString());
} else {
String s = args[idx];
String name;
Cmd empty = null;
- for(Cmd c: cmds) {
+ for (Cmd c: cmds) {
name = c.getName();
- if(name==null && empty==null) { // Mark with Command is null, and take the first one.
+ if (name==null && empty==null) { // Mark with Command is null, and take the first one.
empty = c;
- } else if(s.equalsIgnoreCase(c.getName()))
+ } else if (s.equalsIgnoreCase(c.getName()))
return c.exec(idx+1, args);
}
- if(empty!=null) {
+ if (empty!=null) {
return empty.exec(idx, args); // If name is null, don't account for it on command line. Jonathan 4-29
}
pw().println("Instructions not understood.");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java
index 9ec126b4..3a0c869b 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java
@@ -92,21 +92,21 @@ public abstract class Cmd {
this.aafcli = aafcli;
this.env = aafcli.env;
this.access = aafcli.access;
- if(parent!=null) {
+ if (parent!=null) {
parent.children.add(this);
}
children = new ArrayList<>();
this.params = params;
this.name = name;
required=0;
- for(Param p : params) {
- if(p.required) {
+ for (Param p : params) {
+ if (p.required) {
++required;
}
}
String temp = access.getProperty(Config.AAF_DEFAULT_REALM,null);
- if(temp!=null && !temp.startsWith("@")) {
+ if (temp!=null && !temp.startsWith("@")) {
defaultRealm = '@' + temp;
} else {
defaultRealm="<Set Default Realm>";
@@ -114,7 +114,7 @@ public abstract class Cmd {
}
public final int exec(int idx, String ... args) throws CadiException, APIException, LocatorException {
- if(args.length-idx<required) {
+ if (args.length-idx<required) {
throw new CadiException(build(new StringBuilder("Too few args: "),null).toString());
}
return _exec(idx,args);
@@ -135,7 +135,7 @@ public abstract class Cmd {
protected void api(StringBuilder sb, int indent, HttpMethods meth, String pathInfo, Class<?> cls,boolean head) {
final String smeth = meth.name();
- if(head) {
+ if (head) {
sb.append('\n');
detailLine(sb,indent,"APIs:");
}
@@ -145,7 +145,7 @@ public abstract class Cmd {
sb.append(' ');
sb.append(pathInfo);
String cliString = aafcli.typeString(cls,true);
- if(indent+smeth.length()+pathInfo.length()+cliString.length()+2>80) {
+ if (indent+smeth.length()+pathInfo.length()+cliString.length()+2>80) {
sb.append(" ...");
multiChar(sb,indent+3+smeth.length(),' ',0);
} else { // same line
@@ -156,54 +156,54 @@ public abstract class Cmd {
protected void multiChar(StringBuilder sb, int length, char c, int indent) {
sb.append('\n');
- for(int i=0;i<indent;++i)sb.append(' ');
- for(int i=indent;i<length;++i)sb.append(c);
+ for (int i=0;i<indent;++i)sb.append(' ');
+ for (int i=indent;i<length;++i)sb.append(c);
}
public StringBuilder build(StringBuilder sb, StringBuilder detail) {
- if(name!=null) {
+ if (name!=null) {
sb.append(name);
sb.append(' ');
}
int line = sb.lastIndexOf("\n")+1;
- if(line<0) {
+ if (line<0) {
line=0;
}
int indent = sb.length()-line;
- for(Param p : params) {
+ for (Param p : params) {
sb.append(p.required?'<':'[');
sb.append(p.tag);
sb.append(p.required?"> ": "] ");
}
boolean first = true;
- for(Cmd child : children) {
- if(!(child instanceof DeprecatedCMD)) {
- if(first) {
+ for (Cmd child : children) {
+ if (!(child instanceof DeprecatedCMD)) {
+ if (first) {
first = false;
- } else if(detail==null) {
+ } else if (detail==null) {
multiChar(sb,indent,' ',0);
} else {
// Write parents for Detailed Report
Stack<String> stack = new Stack<String>();
- for(Cmd c = child.parent;c!=null;c=c.parent) {
- if(c.name!=null) {
+ for (Cmd c = child.parent;c!=null;c=c.parent) {
+ if (c.name!=null) {
stack.push(c.name);
}
}
- if(!stack.isEmpty()) {
+ if (!stack.isEmpty()) {
sb.append(" ");
- while(!stack.isEmpty()) {
+ while (!stack.isEmpty()) {
sb.append(stack.pop());
sb.append(' ');
}
}
}
child.build(sb,detail);
- if(detail!=null) {
+ if (detail!=null) {
child.detailedHelp(4, detail);
// If Child wrote something, then add, bracketing by lines
- if(detail.length()>0) {
+ if (detail.length()>0) {
multiChar(sb,80,'-',2);
sb.append(detail);
sb.append('\n');
@@ -223,9 +223,9 @@ public abstract class Cmd {
StringBuilder sb = new StringBuilder("Failed");
String desc = future.body();
int code = future.code();
- if(desc==null || desc.length()==0) {
+ if (desc==null || desc.length()==0) {
withCode(sb,code);
- } else if(desc.startsWith("{")) {
+ } else if (desc.startsWith("{")) {
StringReader sr = new StringReader(desc);
try {
// Note: 11-18-2013, JonathanGathman. This rather convoluted Message Structure required by TSS Restful Specs, reflecting "Northbound" practices.
@@ -240,7 +240,7 @@ public abstract class Cmd {
String var = vars.get(varCounter);
++varCounter;
if (messageBody.indexOf("%" + varCounter) >= 0) {
- if((pipe = var.indexOf('|'))>=0) { // In AAF, we use a PIPE for Choice
+ if ((pipe = var.indexOf('|'))>=0) { // In AAF, we use a PIPE for Choice
if (aafcli.isTest()) {
String expiresStr = var.substring(pipe);
var = var.replace(expiresStr, "[Placeholder]");
@@ -260,7 +260,7 @@ public abstract class Cmd {
withCode(sb,code);
sb.append(" (Note: Details cannot be obtained from Error Structure)");
}
- } else if(desc.startsWith("<html>")){ // Core Jetty, etc sends HTML for Browsers
+ } else if (desc.startsWith("<html>")){ // Core Jetty, etc sends HTML for Browsers
withCode(sb,code);
} else {
sb.append(" with code ");
@@ -296,11 +296,11 @@ public abstract class Cmd {
protected void setStartEnd(Request req) {
// Set Start/End Dates, if exist
String str;
- if((str = access.getProperty(Cmd.STARTDATE,null))!=null) {
+ if ((str = access.getProperty(Cmd.STARTDATE,null))!=null) {
req.setStart(Chrono.timeStamp(Date.valueOf(str)));
}
- if((str = access.getProperty(Cmd.ENDDATE,null))!=null) {
+ if ((str = access.getProperty(Cmd.ENDDATE,null))!=null) {
req.setEnd(Chrono.timeStamp(Date.valueOf(str)));
}
}
@@ -326,7 +326,7 @@ public abstract class Cmd {
@SuppressWarnings("unchecked")
public static <T> RosettaDF<T> getDF(AuthzEnv env, Class<T> cls) throws APIException {
RosettaDF<T> rdf = (RosettaDF<T>)dfs.get(cls);
- if(rdf == null) {
+ if (rdf == null) {
rdf = env.newDataFactory(cls);
dfs.put(cls, rdf);
}
@@ -341,11 +341,11 @@ public abstract class Cmd {
}
} else {
pw().println(header);
- for(int i=0;i<lineLength;++i)pw().print('-');
+ for (int i=0;i<lineLength;++i)pw().print('-');
pw().println();
pw().format(hformat,"Date","Table","User","Memo");
- for(int i=0;i<lineLength;++i)pw().print('-');
+ for (int i=0;i<lineLength;++i)pw().print('-');
pw().println();
// Save Server time by Sorting locally
@@ -357,7 +357,7 @@ public abstract class Cmd {
}
});
- for(History.Item item : items) {
+ for (History.Item item : items) {
GregorianCalendar gc = item.getTimestamp().toGregorianCalendar();
pw().format(hformat,
dateFmt.format(gc.getTime()),
@@ -376,8 +376,8 @@ public abstract class Cmd {
public static String optionsToString(String[] options) {
StringBuilder sb = new StringBuilder();
boolean first = true;
- for(String s : options) {
- if(first) {
+ for (String s : options) {
+ if (first) {
first = false;
} else {
sb.append('|');
@@ -398,8 +398,8 @@ public abstract class Cmd {
* @throws Exception
*/
public int whichOption(String[] options, String test) throws CadiException {
- for(int i=0;i<options.length;++i) {
- if(options[i].equals(test)) {
+ for (int i=0;i<options.length;++i) {
+ if (options[i].equals(test)) {
return i;
}
}
@@ -416,7 +416,7 @@ public abstract class Cmd {
public<RET> RET same(Retryable<RET> retryable) throws APIException, CadiException, LocatorException {
// We're storing in AAFCli, because we know it's always the same, and single threaded
- if(aafcli.prevCall!=null) {
+ if (aafcli.prevCall!=null) {
retryable.item(aafcli.prevCall.item());
retryable.lastClient=aafcli.prevCall.lastClient;
}
@@ -450,9 +450,9 @@ public abstract class Cmd {
pw().println();
boolean first = true;
int i=0;
- for(String s : str) {
- if(first) {
- if(++i>1) {
+ for (String s : str) {
+ if (first) {
+ if (++i>1) {
first = false;
pw().print("[");
}
@@ -461,7 +461,7 @@ public abstract class Cmd {
}
pw().print(s);
}
- if(!first) {
+ if (!first) {
pw().print(']');
}
pw().println();
@@ -475,25 +475,25 @@ public abstract class Cmd {
}
public void reportLine() {
- for(int i=0;i<lineLength;++i)pw().print('-');
+ for (int i=0;i<lineLength;++i)pw().print('-');
pw().println();
}
protected void setQueryParamsOn(Rcli<?> rcli) {
StringBuilder sb=null;
String force;
- if((force=aafcli.forceString())!=null) {
+ if ((force=aafcli.forceString())!=null) {
sb = new StringBuilder("force=");
sb.append(force);
}
- if(aafcli.addRequest()) {
- if(sb==null) {
+ if (aafcli.addRequest()) {
+ if (sb==null) {
sb = new StringBuilder("future=true");
} else {
sb.append("&future=true");
}
}
- if(sb!=null && rcli!=null) {
+ if (sb!=null && rcli!=null) {
rcli.setQueryParams(sb.toString());
}
}
@@ -504,7 +504,7 @@ public abstract class Cmd {
// * @return
// */
// protected String checkForce() {
-// if(TRUE.equalsIgnoreCase(env.getProperty(FORCE, FALSE))) {
+// if (TRUE.equalsIgnoreCase(env.getProperty(FORCE, FALSE))) {
// env.setProperty(FORCE, FALSE);
// return "true";
// }
@@ -513,7 +513,7 @@ public abstract class Cmd {
public String toString() {
StringBuilder sb = new StringBuilder();
- if(parent==null) { // ultimate parent
+ if (parent==null) { // ultimate parent
build(sb,null);
return sb.toString();
} else {
@@ -530,7 +530,7 @@ public abstract class Cmd {
* @throws OrganizationException
*/
public String fullID(String id) {
- if(id != null) {
+ if (id != null) {
if (id.indexOf('@') < 0) {
id+=defaultRealm;
} else {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java
index bd70d9e5..66a3355a 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java
@@ -53,27 +53,27 @@ public class Help extends Cmd {
details = aafcli.isDetailed()?new StringBuilder():null;
String comp = args.length>idx?args[idx++]:null;
- if("help".equalsIgnoreCase(comp)) {
+ if ("help".equalsIgnoreCase(comp)) {
build(sb,null);
detailedHelp(4, sb);
sb.append('\n');
} else {
- for(Cmd c : cmds) {
- if(!(c instanceof DeprecatedCMD)) {
- if(comp!=null) {
- if(comp.equals(c.getName())) {
+ for (Cmd c : cmds) {
+ if (!(c instanceof DeprecatedCMD)) {
+ if (comp!=null) {
+ if (comp.equals(c.getName())) {
multiChar(sb,2,' ',0);
c.build(sb,details);
}
} else {
- if(first) {
+ if (first) {
first=false;
} else {
multiChar(sb,80,'-',2);
}
multiChar(sb,2,' ',0);
c.build(sb,details);
- if(details!=null) {
+ if (details!=null) {
c.detailedHelp(4, sb);
// multiChar(sb,80,'-',2);
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java
index ca8a72ca..5c74dda8 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java
@@ -48,7 +48,7 @@ public class Clear extends Cmd {
public int _exec(int _idx, String ... args) throws CadiException, APIException, LocatorException {
int idx = _idx;
int rv=409;
- for(final String name : args[idx++].split(COMMA)) {
+ for (final String name : args[idx++].split(COMMA)) {
rv = all(new Retryable<Integer>() {
@Override
public Integer code(Rcli<?> client) throws APIException, CadiException {
@@ -57,11 +57,11 @@ public class Clear extends Cmd {
"/mgmt/cache/"+name,
Void.class
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().println("Cleared Cache for " + name + " on " + client);
rv=200;
} else {
- if(rv==409)rv = fp.code();
+ if (rv==409)rv = fp.code();
error(fp);
}
return rv;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java
index 17f23729..159a51bc 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java
@@ -59,9 +59,9 @@ public class Deny extends BaseCmd<Mgmt> {
String action = args[idx++];
final int option = whichOption(options, action);
int rv=409;
- for(final String name : args[idx++].split(COMMA)) {
+ for (final String name : args[idx++].split(COMMA)) {
final String append;
- if(isID && name.indexOf("@")<0) {
+ if (isID && name.indexOf("@")<0) {
append='@'+ access.getProperty(Config.AAF_DEFAULT_REALM,null);
} else {
append = "";
@@ -82,11 +82,11 @@ public class Deny extends BaseCmd<Mgmt> {
fp = client.delete(path, Void.class);
resp = " deleted";
}
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().println(name + append + resp + " on " + client);
rv=fp.code();
} else {
- if(rv==409)rv = fp.code();
+ if (rv==409)rv = fp.code();
error(fp);
}
return rv;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java
index 535de3bb..db59df0a 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java
@@ -49,9 +49,9 @@ public class Log extends BaseCmd<Mgmt> {
int idx = _idx;
final int option = whichOption(options, args[idx++]);
- for(String name : args[idx++].split(COMMA)) {
+ for (String name : args[idx++].split(COMMA)) {
final String fname;
- if(name.indexOf("@")<0) {
+ if (name.indexOf("@")<0) {
fname=name+'@'+ access.getProperty(Config.AAF_DEFAULT_REALM,null);
} else {
fname = name;
@@ -78,12 +78,12 @@ public class Log extends BaseCmd<Mgmt> {
msg = "Ignored";
}
- if(fp!=null) {
- if(fp.get(AAFcli.timeout())) {
+ if (fp!=null) {
+ if (fp.get(AAFcli.timeout())) {
pw().println(msg + " Special Log for " + fname + " on " + client);
rv=200;
} else {
- if(rv==409)rv = fp.code();
+ if (rv==409)rv = fp.code();
error(fp);
}
return rv;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java
index a52d5dc7..cd10ef60 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java
@@ -56,11 +56,11 @@ public class SessClear extends Cmd {
"/mgmt/dbsession",
Void.class
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().println("Cleared DBSession on " + client);
rv=200;
} else {
- if(rv==409)rv = fp.code();
+ if (rv==409)rv = fp.code();
error(fp);
}
return rv;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java
index f1952fa9..90141819 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java
@@ -54,7 +54,7 @@ public class Admin extends BaseCmd<NS> {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Void> fp = null;
- for(String id : ids) {
+ for (String id : ids) {
id = fullID(id);
String verb;
switch(option) {
@@ -70,7 +70,7 @@ public class Admin extends BaseCmd<NS> {
throw new CadiException("Bad Argument");
};
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().append("Admin ");
pw().append(id);
pw().append(verb);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java
index f1b2621d..31dad45c 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java
@@ -50,8 +50,8 @@ public class Attrib extends BaseCmd<NS> {
final String ns = args[idx+1];
final String key = args[idx+2];
final String value;
- if(option!=2) {
- if(args.length<=idx+3) {
+ if (option!=2) {
+ if (args.length<=idx+3) {
throw new CadiException("Not added: Need more Data");
}
value = args[idx+3];
@@ -83,10 +83,10 @@ public class Attrib extends BaseCmd<NS> {
default:
throw new CadiException("Bad Argument");
};
- if(fp==null) {
+ if (fp==null) {
return 500;
} else {
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().println(message);
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java
index 1719ada7..05d66881 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java
@@ -56,16 +56,16 @@ public class Create extends Cmd {
nr.setName(args[idx++]);
String[] responsible = args[idx++].split(COMMA);
- for(String s : responsible) {
+ for (String s : responsible) {
nr.getResponsible().add(fullID(s));
}
String[] admin;
- if(args.length>idx) {
+ if (args.length>idx) {
admin = args[idx++].split(COMMA);
} else {
admin = responsible;
}
- for(String s : admin) {
+ for (String s : admin) {
nr.getAdmin().add(fullID(s));
}
@@ -82,10 +82,10 @@ public class Create extends Cmd {
getDF(NsRequest.class),
nr
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().println("Created Namespace");
} else {
- if(fp.code()==202) {
+ if (fp.code()==202) {
pw().println("Namespace Creation Accepted, but requires Approvals before actualizing");
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java
index 99ac7ed2..7da6c26b 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java
@@ -56,7 +56,7 @@ public class Delete extends Cmd {
setQueryParamsOn(client);
Future<Void> fp = client.delete(path.toString(),Void.class);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().println("Deleted Namespace");
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java
index 18823297..e521d616 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java
@@ -70,11 +70,11 @@ public class Describe extends Cmd {
nsr
);
- if(fn.get(AAFcli.timeout())) {
+ if (fn.get(AAFcli.timeout())) {
rv=fn.code();
pw().println("Description added to Namespace");
} else {
- if((rv=fn.code())==202) {
+ if ((rv=fn.code())==202) {
pw().print("Adding description");
pw().println(" Accepted, but requires Approvals before actualizing");
} else {
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 01b3ad14..8fc79401 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
@@ -58,34 +58,34 @@ public class List extends BaseCmd<NS> {
public void report(Future<Nss> fp, String ... str) {
reportHead(str);
- if(fp==null) {
+ if (fp==null) {
pw().println(" *** Namespace Not Found ***");
}
- if(fp!=null && fp.value!=null) {
- for(Ns ns : fp.value.getNs()) {
+ if (fp!=null && fp.value!=null) {
+ for (Ns ns : fp.value.getNs()) {
pw().println(ns.getName());
if (this.aafcli.isDetailed()) {
pw().println(" Description");
pw().format(sformat,ns.getDescription()==null?"":ns.getDescription());
}
- if(ns.getAdmin().size()>0) {
+ if (ns.getAdmin().size()>0) {
pw().println(" Administrators");
- for(String admin : ns.getAdmin()) {
+ for (String admin : ns.getAdmin()) {
pw().format(sformat,admin);
}
}
- if(ns.getResponsible().size()>0) {
+ if (ns.getResponsible().size()>0) {
pw().println(" Owners (Responsible for Namespace)");
- for(String responsible : ns.getResponsible()) {
+ for (String responsible : ns.getResponsible()) {
pw().format(sformat,responsible);
}
}
- if(ns.getAttrib().size()>0) {
+ if (ns.getAttrib().size()>0) {
pw().println(" Namespace Attributes");
- for( Ns.Attrib attr : ns.getAttrib()) {
+ for ( Ns.Attrib attr : ns.getAttrib()) {
StringBuilder sb = new StringBuilder(attr.getKey());
- if(attr.getValue()==null || attr.getValue().length()>0) {
+ if (attr.getValue()==null || attr.getValue().length()>0) {
sb.append('=');
sb.append(attr.getValue());
}
@@ -99,7 +99,7 @@ public class List extends BaseCmd<NS> {
public void reportName(Future<Nss> fp, String ... str) {
reportHead(str);
- if(fp!=null && fp.value!=null) {
+ if (fp!=null && fp.value!=null) {
java.util.List<Ns> nss = fp.value.getNs();
Collections.sort(nss, new Comparator<Ns>() {
@Override
@@ -108,7 +108,7 @@ public class List extends BaseCmd<NS> {
}
});
- for(Ns ns : nss) {
+ for (Ns ns : nss) {
pw().println(ns.getName());
if (this.aafcli.isDetailed() && ns.getDescription() != null) {
pw().println(" " + ns.getDescription());
@@ -118,9 +118,9 @@ 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().size()>0) {
pw().println(" Roles");
- for(aaf.v2_0.Role r : fr.value.getRole()) {
+ for (aaf.v2_0.Role r : fr.value.getRole()) {
pw().format(sformat,r.getName());
}
}
@@ -128,9 +128,9 @@ 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().size()>0) {
pw().println(" Permissions");
- for(aaf.v2_0.Perm p : fp.value.getPerm()) {
+ for (aaf.v2_0.Perm p : fp.value.getPerm()) {
pw().format(pformat,p.getType(),p.getInstance(),p.getAction());
}
}
@@ -139,7 +139,7 @@ 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().size()>0) {
pw().println(" Credentials");
java.util.List<User> users = fc.value.getUser();
Collections.sort(users, new Comparator<User>() {
@@ -148,7 +148,7 @@ public class List extends BaseCmd<NS> {
return u1.getId().compareTo(u2.getId());
}
});
- for(aaf.v2_0.Users.User u : users) {
+ for (aaf.v2_0.Users.User u : users) {
if (this.aafcli.isTest()) {
pw().format(sformat,u.getId());
} else {
@@ -160,7 +160,7 @@ public class List extends BaseCmd<NS> {
public static String getType(User u) {
Integer type;
- if((type=u.getType())==null) {
+ if ((type=u.getType())==null) {
type = 9999;
}
switch(type) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java
index 52b9a108..f8f82466 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java
@@ -59,7 +59,7 @@ public class ListActivity extends Cmd {
getDF(History.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
activity(fp.value, HEADER + " [ " + ns + " ]");
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java
index 06de6cab..e62207a0 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java
@@ -56,9 +56,9 @@ public class ListAdminResponsible extends Cmd {
String apipart = "owner".equals(title)?"responsible":title;
Future<Nss> fn = client.read("/authz/nss/"+apipart+"/"+user,getDF(Nss.class));
- if(fn.get(AAFcli.timeout())) {
+ if (fn.get(AAFcli.timeout())) {
((List)parent).reportName(fn,HEADER + title + " privileges for ",user);
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
((List)parent).report(null,HEADER + title + " privileges for ",user);
return 200;
} else {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java
index ffd3cf01..3189b88b 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java
@@ -59,29 +59,29 @@ public class ListByName extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Nss> fn = client.read("/authz/nss/"+ns,getDF(Nss.class));
- if(fn.get(AAFcli.timeout())) {
+ if (fn.get(AAFcli.timeout())) {
((List)parent).report(fn,HEADER,ns);
- if(fn.value!=null) {
- for(Ns n : fn.value.getNs()) {
+ if (fn.value!=null) {
+ for (Ns n : fn.value.getNs()) {
Future<Roles> fr = client.read("/authz/roles/ns/"+n.getName(), getDF(Roles.class));
- if(fr.get(AAFcli.timeout())) {
+ if (fr.get(AAFcli.timeout())) {
((List)parent).reportRole(fr);
}
}
- for(Ns n : fn.value.getNs()) {
+ for (Ns n : fn.value.getNs()) {
Future<Perms> fp = client.read("/authz/perms/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":""), getDF(Perms.class));
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
((List)parent).reportPerm(fp);
}
}
- for(Ns n : fn.value.getNs()) {
+ for (Ns n : fn.value.getNs()) {
Future<Users> fu = client.read("/authn/creds/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":""), getDF(Users.class));
- if(fu.get(AAFcli.timeout())) {
+ if (fu.get(AAFcli.timeout())) {
((List)parent).reportCred(fu);
}
}
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
((List)parent).report(null,HEADER,ns);
return 200;
} else {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java
index 6d514df8..b3b0bcfc 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java
@@ -56,12 +56,12 @@ public class ListChildren extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Nss> fn = client.read("/authz/nss/children/"+ns,getDF(Nss.class));
- if(fn.get(AAFcli.timeout())) {
+ if (fn.get(AAFcli.timeout())) {
parent.reportHead(HEADER);
- for(Ns ns : fn.value.getNs()) {
+ for (Ns ns : fn.value.getNs()) {
pw().format(List.kformat, ns.getName());
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
((List)parent).report(null,HEADER,ns);
return 200;
} else {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java
index df72ff08..01b0f21c 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java
@@ -58,12 +58,12 @@ public class ListNsKeysByAttrib extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Keys> fn = client.read("/authz/ns/attrib/"+attrib,getDF(Keys.class));
- if(fn.get(AAFcli.timeout())) {
+ if (fn.get(AAFcli.timeout())) {
parent.reportHead(HEADER);
- for(String key : fn.value.getKey()) {
+ for (String key : fn.value.getKey()) {
pw().printf(List.kformat, key);
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
parent.reportHead(HEADER);
pw().println(" *** No Namespaces Found ***");
return 200;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java
index 1347b918..eadf1c97 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java
@@ -65,42 +65,42 @@ public class ListUsersContact extends Cmd {
public Integer code(Rcli<?> client) throws CadiException, APIException {
((ListUsers)parent).report(HEADER,ns);
Future<Nss> fn = client.read("/authz/nss/"+ns,getDF(Nss.class));
- if(fn.get(AAFcli.timeout())) {
- if(fn.value!=null) {
+ if (fn.get(AAFcli.timeout())) {
+ if (fn.value!=null) {
Set<String> uset = detail?null:new HashSet<>();
- for(Ns n : fn.value.getNs()) {
+ for (Ns n : fn.value.getNs()) {
Future<Roles> fr = client.read("/authz/roles/ns/"+n.getName(), getDF(Roles.class));
- if(fr.get(AAFcli.timeout())) {
- for(Role r : fr.value.getRole()) {
- if(detail) {
+ if (fr.get(AAFcli.timeout())) {
+ for (Role r : fr.value.getRole()) {
+ if (detail) {
((ListUsers)parent).report(r.getName());
}
Future<Users> fus = client.read(
"/authz/users/role/"+r.getName(),
getDF(Users.class)
);
- if(fus.get(AAFcli.timeout())) {
- for(User u : fus.value.getUser()) {
- if(detail) {
+ if (fus.get(AAFcli.timeout())) {
+ for (User u : fus.value.getUser()) {
+ if (detail) {
((ListUsers)parent).report(" ",u);
} else {
uset.add(u.getId());
}
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
return 200;
}
}
}
}
- if(uset!=null) {
- for(String u : uset) {
+ if (uset!=null) {
+ for (String u : uset) {
pw().print(" ");
pw().println(u);
}
}
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
return 200;
} else {
error(fn);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java
index 301e1508..c0838cb7 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java
@@ -65,42 +65,42 @@ public class ListUsersInRole extends Cmd {
public Integer code(Rcli<?> client) throws CadiException, APIException {
((ListUsers)parent).report(HEADER,ns);
Future<Nss> fn = client.read("/authz/nss/"+ns,getDF(Nss.class));
- if(fn.get(AAFcli.timeout())) {
- if(fn.value!=null) {
+ if (fn.get(AAFcli.timeout())) {
+ if (fn.value!=null) {
Set<String> uset = detail?null:new HashSet<>();
- for(Ns n : fn.value.getNs()) {
+ for (Ns n : fn.value.getNs()) {
Future<Roles> fr = client.read("/authz/roles/ns/"+n.getName(), getDF(Roles.class));
- if(fr.get(AAFcli.timeout())) {
- for(Role r : fr.value.getRole()) {
- if(detail) {
+ if (fr.get(AAFcli.timeout())) {
+ for (Role r : fr.value.getRole()) {
+ if (detail) {
((ListUsers)parent).report(r.getName());
}
Future<Users> fus = client.read(
"/authz/users/role/"+r.getName(),
getDF(Users.class)
);
- if(fus.get(AAFcli.timeout())) {
- for(User u : fus.value.getUser()) {
- if(detail) {
+ if (fus.get(AAFcli.timeout())) {
+ for (User u : fus.value.getUser()) {
+ if (detail) {
((ListUsers)parent).report(" ",u);
} else {
uset.add(u.getId());
}
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
return 200;
}
}
}
}
- if(uset!=null) {
- for(String u : uset) {
+ if (uset!=null) {
+ for (String u : uset) {
pw().print(" ");
pw().println(u);
}
}
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
return 200;
} else {
error(fn);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java
index 472070d9..96ca95ee 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java
@@ -65,42 +65,42 @@ public class ListUsersWithPerm extends Cmd {
public Integer code(Rcli<?> client) throws CadiException, APIException {
((ListUsers)parent).report(HEADER,ns);
Future<Nss> fn = client.read("/authz/nss/"+ns,getDF(Nss.class));
- if(fn.get(AAFcli.timeout())) {
- if(fn.value!=null) {
+ if (fn.get(AAFcli.timeout())) {
+ if (fn.value!=null) {
Set<String> uset = detail?null:new HashSet<>();
- for(Ns n : fn.value.getNs()) {
+ for (Ns n : fn.value.getNs()) {
Future<Perms> fp = client.read("/authz/perms/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":"")
, getDF(Perms.class));
- if(fp.get(AAFcli.timeout())) {
- for(Perm p : fp.value.getPerm()) {
+ if (fp.get(AAFcli.timeout())) {
+ for (Perm p : fp.value.getPerm()) {
String perm = p.getType()+'/'+p.getInstance()+'/'+p.getAction();
- if(detail)((ListUsers)parent).report(perm);
+ if (detail)((ListUsers)parent).report(perm);
Future<Users> fus = client.read(
"/authz/users/perm/"+perm,
getDF(Users.class)
);
- if(fus.get(AAFcli.timeout())) {
- for(User u : fus.value.getUser()) {
- if(detail)
+ if (fus.get(AAFcli.timeout())) {
+ for (User u : fus.value.getUser()) {
+ if (detail)
((ListUsers)parent).report(" ",u);
else
uset.add(u.getId());
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
return 200;
}
}
}
}
- if(uset!=null) {
- for(String u : uset) {
+ if (uset!=null) {
+ for (String u : uset) {
pw().print(" ");
pw().println(u);
}
}
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
return 200;
} else {
error(fn);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java
index e5e50187..35dd6b96 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java
@@ -55,7 +55,7 @@ public class Owner extends BaseCmd<NS> {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Void> fp=null;
- for(String id : ids) {
+ for (String id : ids) {
id=fullID(id);
String verb;
switch(option) {
@@ -71,7 +71,7 @@ public class Owner extends BaseCmd<NS> {
throw new CadiException("Bad Argument");
};
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().append(id);
pw().append(verb);
pw().append("responsible for ");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java
index 1f123cff..be49cf28 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java
@@ -65,9 +65,9 @@ public class Create extends Cmd {
boolean force = aafcli.forceString()!=null;
int rv;
- if(roles!=null && force) { // Make sure Roles are Created
+ if (roles!=null && force) { // Make sure Roles are Created
RoleRequest rr = new RoleRequest();
- for(String role : roles) {
+ for (String role : roles) {
rr.setName(role);;
Future<RoleRequest> fr = client.create(
"/authz/role",
@@ -96,13 +96,13 @@ public class Create extends Cmd {
getDF(PermRequest.class),
pr
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
rv = fp.code();
pw().println("Created Permission");
- if(roles!=null) {
- if(aafcli.forceString()!=null) { // Make sure Roles are Created
+ if (roles!=null) {
+ if (aafcli.forceString()!=null) { // Make sure Roles are Created
RoleRequest rr = new RoleRequest();
- for(String role : roles) {
+ for (String role : roles) {
rr.setName(role);;
Future<RoleRequest> fr = client.create(
"/authz/role",
@@ -120,7 +120,7 @@ public class Create extends Cmd {
}
try {
- if(201!=(rv=((Perm)parent)._exec(0,
+ if (201!=(rv=((Perm)parent)._exec(0,
new String[] {"grant",pr.getType(),pr.getInstance(),pr.getAction(),roleCommas}))) {
rv = 206 /*HttpStatus.PARTIAL_CONTENT_206*/;
}
@@ -130,9 +130,9 @@ public class Create extends Cmd {
}
} else {
rv = fp.code();
- if(rv==409 && force) {
+ if (rv==409 && force) {
rv = 201;
- } else if(rv==202) {
+ } else if (rv==202) {
pw().println("Permission Creation Accepted, but requires Approvals before actualizing");
if (roles!=null)
pw().println("You need to grant the roles after approval.");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java
index ed52a071..0f0c0011 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java
@@ -65,10 +65,10 @@ public class Delete extends Cmd {
"/authz/perm",
getDF(PermRequest.class),
pk);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().println("Deleted Permission");
} else {
- if(fp.code()==202) {
+ if (fp.code()==202) {
pw().println("Permission Deletion Accepted, but requires Approvals before actualizing");
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java
index 8396f7d3..bb894ca7 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java
@@ -76,11 +76,11 @@ public class Describe extends Cmd {
pr
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
rv=fp.code();
pw().println("Description added to Permission");
} else {
- if((rv=fp.code())==202) {
+ if ((rv=fp.code())==202) {
pw().print("Adding description");
pw().println(" Accepted, but requires Approvals before actualizing");
} else {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java
index 4ed411ba..dd45fb4b 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java
@@ -75,9 +75,9 @@ public class Grant extends Cmd {
if (option != 2) {
String[] roles = args[idx++].split(",");
String strA,strB;
- for(String role : roles) {
+ for (String role : roles) {
rpr.setRole(role);
- if(option==0) {
+ if (option==0) {
// You can request to Grant Permission to a Role
setQueryParamsOn(client);
frpr = client.create(
@@ -98,7 +98,7 @@ public class Grant extends Cmd {
strA = "UnGranted Permission [";
strB = "] from Role [";
}
- if(frpr.get(AAFcli.timeout())) {
+ if (frpr.get(AAFcli.timeout())) {
pw().println(strA + pk.getType() + '|' + pk.getInstance() + '|' + pk.getAction()
+ strB + role +']');
} else {
@@ -122,7 +122,7 @@ public class Grant extends Cmd {
"/authz/role/perm",
getDF(RolePermRequest.class),
rpr);
- if(frpr.get(AAFcli.timeout())) {
+ if (frpr.get(AAFcli.timeout())) {
pw().println("Set Permission's Roles to [" + allRoles + "]");
} else {
error(frpr);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java
index 48b8a488..5df2afa2 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java
@@ -48,7 +48,7 @@ public class List extends BaseCmd<Perm> {
// Package Level on purpose
abstract class ListPerms extends Retryable<Integer> {
protected int list(Future<Perms> fp,String header, String parentPerm) throws CadiException, APIException {
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
report(fp,header, parentPerm);
} else {
error(fp);
@@ -61,10 +61,10 @@ public class List extends BaseCmd<Perm> {
@Override
public int compare(aaf.v2_0.Perm a, aaf.v2_0.Perm b) {
int rc;
- if((rc=a.getType().compareTo(b.getType()))!=0) {
+ if ((rc=a.getType().compareTo(b.getType()))!=0) {
return rc;
}
- if((rc=a.getInstance().compareTo(b.getInstance()))!=0) {
+ if ((rc=a.getInstance().compareTo(b.getInstance()))!=0) {
return rc;
}
return a.getAction().compareTo(b.getAction());
@@ -80,9 +80,9 @@ public class List extends BaseCmd<Perm> {
String descFmt = " %-75s\n";
reportColHead(format + descFmt,"[PERM NS].Type","Instance","Action", "Description");
Collections.sort(fp.value.getPerm(),permCompare);
- for(aaf.v2_0.Perm p : fp.value.getPerm()) {
+ for (aaf.v2_0.Perm p : fp.value.getPerm()) {
String pns = p.getNs();
- if(pns==null) {
+ if (pns==null) {
pw().format(format,
p.getType(),
p.getInstance(),
@@ -94,7 +94,7 @@ public class List extends BaseCmd<Perm> {
p.getAction());
}
String desc = p.getDescription();
- if(desc!=null && desc.length()>0) {
+ if (desc!=null && desc.length()>0) {
pw().format(descFmt,p.getDescription());
}
}
@@ -103,7 +103,7 @@ public class List extends BaseCmd<Perm> {
String format = reportColHead(permFormat,"PERM Type","Instance","Action");
Collections.sort(fp.value.getPerm(),permCompare);
- for(aaf.v2_0.Perm p : fp.value.getPerm()) {
+ for (aaf.v2_0.Perm p : fp.value.getPerm()) {
pw().format(format,
p.getType(),
p.getInstance(),
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java
index c59e9b5a..c96220a5 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java
@@ -57,7 +57,7 @@ public class ListActivity extends Cmd {
"/authz/hist/perm/"+type,
getDF(History.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
activity(fp.value, HEADER + " [ " + type + " ]");
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java
index 550386cf..325f45db 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java
@@ -51,12 +51,12 @@ public class ListByUser extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
StringBuilder sb = null;
- if("true".equalsIgnoreCase(aafcli.forceString())) {
+ if ("true".equalsIgnoreCase(aafcli.forceString())) {
sb = new StringBuilder();
sb.append("?force");
}
- if(aafcli.isDetailed()) {
- if(sb==null) {
+ if (aafcli.isDetailed()) {
+ if (sb==null) {
sb = new StringBuilder('?');
} else {
sb.append('&');
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java
index 620e1e04..dbadd8a0 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java
@@ -71,12 +71,12 @@ public class Rename extends Cmd {
pr
);
int rv;
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
rv = fp.code();
pw().println("Updated Permission");
} else {
rv = fp.code();
- if(rv==202) {
+ if (rv==202) {
pw().println("Permission Update Accepted, but requires Approvals before actualizing");
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java
index f9dcbcd8..320bac5b 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java
@@ -90,17 +90,17 @@ public class CreateDelete extends Cmd {
}
boolean rolesSupplied = (args.length>idx);
- if(fp == null) {// This useless code brought to you by Sonar.
+ if (fp == null) {// This useless code brought to you by Sonar.
throw new CadiException("No call made.");
}
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
rv=fp.code();
pw().print(verb);
pw().println("d Role");
- if(rolesSupplied) {
- for(;args.length>idx;++idx ) {
+ if (rolesSupplied) {
+ for (;args.length>idx;++idx ) {
try {
- if(201!=(rv=((Role)parent)._exec(0,new String[] {"user","add",rr.getName(),args[idx]}))) {
+ if (201!=(rv=((Role)parent)._exec(0,new String[] {"user","add",rr.getName(),args[idx]}))) {
rv = 206 /*HttpStatus.PARTIAL_CONTENT_206*/;
}
} catch (LocatorException e) {
@@ -109,7 +109,7 @@ public class CreateDelete extends Cmd {
}
}
} else {
- if((rv=fp.code())==202) {
+ if ((rv=fp.code())==202) {
pw().print("Role ");
pw().print(verb);
pw().println(" Accepted, but requires Approvals before actualizing");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java
index e8001040..f4d24fb1 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java
@@ -70,11 +70,11 @@ public class Describe extends Cmd {
rr
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
rv=fp.code();
pw().println("Description added to role");
} else {
- if((rv=fp.code())==202) {
+ if ((rv=fp.code())==202) {
pw().print("Adding description");
pw().println(" Accepted, but requires Approvals before actualizing");
} else {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java
index ec8d8ee3..f8a633af 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java
@@ -61,16 +61,16 @@ public class List extends BaseCmd<Role> {
// Package Level on purpose
abstract class ListRoles extends Retryable<Integer> {
protected int list(Future<Roles> fr,Rcli<?> client, String header) throws APIException, CadiException {
- if(fr.get(AAFcli.timeout())) {
+ if (fr.get(AAFcli.timeout())) {
Perms perms=null;
if (aafcli.isDetailed()) {
- for(aaf.v2_0.Role r : fr.value.getRole()) {
+ for (aaf.v2_0.Role r : fr.value.getRole()) {
Future<Perms> fp = client.read(
"/authz/perms/role/"+r.getName()+(aafcli.isDetailed()?"?ns":""),
getDF(Perms.class)
);
- if(fp.get(AAFcli.timeout())) {
- if(perms==null) {
+ if (fp.get(AAFcli.timeout())) {
+ if (perms==null) {
perms = fp.value;
} else {
perms.getPerm().addAll(fp.value.getPerm());
@@ -101,7 +101,7 @@ public class List extends BaseCmd<Role> {
public void report(Roles roles, Perms perms, UserRoles urs, String ... str) {
reportHead(str);
XMLGregorianCalendar now = Chrono.timeStamp().normalize();
- if(roles==null || roles.getRole().isEmpty()) {
+ if (roles==null || roles.getRole().isEmpty()) {
pw().println("<No Roles Found>");
} else if (aafcli.isDetailed()){
if (aafcli.isDetailed() && str[0].toLowerCase().contains(LIST_ROLES_BY_NAME)) {
@@ -113,25 +113,25 @@ public class List extends BaseCmd<Role> {
String fullFormat = roleFormat+permFormat;
reportColHead(fullFormat,"[ROLE NS].Name","","[PERM NS].Type","Instance","Action");
Collections.sort(roles.getRole(),roleCompare);
- for(aaf.v2_0.Role r : roles.getRole()) {
+ for (aaf.v2_0.Role r : roles.getRole()) {
String roleName = r.getName();
String ns = r.getNs();
- if(aafcli.isTest()) {
- if(ns==null) {
+ if (aafcli.isTest()) {
+ if (ns==null) {
pw().format(roleFormat, roleName,XXXX_XX_XX);
} else {
pw().format(roleFormat, "["+ns+"]"+roleName.substring(ns.length()),XXXX_XX_XX);
}
} else {
UserRole ur = get(roleName,urs);
- if(ur!=null && now.compare(ur.getExpires().normalize())>0) {
- if(ns==null) {
+ if (ur!=null && now.compare(ur.getExpires().normalize())>0) {
+ if (ns==null) {
pw().format(roleExpiredFormat, roleName,Chrono.dateOnlyStamp(ur.getExpires()));
} else {
pw().format(roleExpiredFormat, "["+ns+"]"+roleName.substring(ns.length()),Chrono.dateOnlyStamp(ur.getExpires()));
}
} else {
- if(ns==null) {
+ if (ns==null) {
pw().format(roleFormat, roleName,ur!=null?Chrono.dateOnlyStamp(ur.getExpires()):"");
} else {
pw().format(roleFormat, "["+ns+"]"+roleName.substring(ns.length()),ur!=null?Chrono.dateOnlyStamp(ur.getExpires()):"");
@@ -139,9 +139,9 @@ public class List extends BaseCmd<Role> {
}
}
- for(Pkey pkey : r.getPerms()) {
+ for (Pkey pkey : r.getPerms()) {
Perm perm = get(pkey,perms);
- if(perm==null || perm.getNs()==null) {
+ if (perm==null || perm.getNs()==null) {
pw().format(permFormat,
pkey.getType(),
pkey.getInstance(),
@@ -159,12 +159,12 @@ public class List extends BaseCmd<Role> {
String fullFormat = roleFormat;
reportColHead(fullFormat,"ROLE Name","","PERM Type","Instance","Action");
Collections.sort(roles.getRole(),roleCompare);
- for(aaf.v2_0.Role r : roles.getRole()) {
+ for (aaf.v2_0.Role r : roles.getRole()) {
if (urs != null) {
String roleName = r.getName();
- if(!aafcli.isTest()) {
+ if (!aafcli.isTest()) {
UserRole ur = get(roleName,urs);
- if(ur!=null && now.compare(ur.getExpires().normalize())>0) {
+ if (ur!=null && now.compare(ur.getExpires().normalize())>0) {
pw().format(roleExpiredFormat, roleName+"*",Chrono.dateOnlyStamp(ur.getExpires()));
} else {
pw().format(roleFormat, roleName,ur!=null?Chrono.dateOnlyStamp(ur.getExpires()):"");
@@ -174,7 +174,7 @@ public class List extends BaseCmd<Role> {
}
} else {
pw().format(roleFormatNoDate, r.getName());
- for(Pkey perm : r.getPerms()) {
+ for (Pkey perm : r.getPerms()) {
pw().format(permFormat,
perm.getType(),
perm.getInstance(),
@@ -185,9 +185,9 @@ public class List extends BaseCmd<Role> {
}
}
private Perm get(Pkey pkey, Perms perms) {
- if(perms!=null) {
- for(Perm p : perms.getPerm()) {
- if(pkey.getAction().equals(p.getAction()) &&
+ if (perms!=null) {
+ for (Perm p : perms.getPerm()) {
+ if (pkey.getAction().equals(p.getAction()) &&
pkey.getInstance().equals(p.getInstance()) &&
pkey.getType().equals(p.getType())) {
return p;
@@ -198,9 +198,9 @@ public class List extends BaseCmd<Role> {
}
// The assumption is that these UserRoles are already pulled in by User... no need to check
private UserRole get(String roleName, UserRoles urs) {
- if(urs!=null) {
- for(UserRole ur : urs.getUserRole()) {
- if(roleName.equals(ur.getRole())) {
+ if (urs!=null) {
+ for (UserRole ur : urs.getUserRole()) {
+ if (roleName.equals(ur.getRole())) {
return ur;
}
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java
index 1f6f18f7..603ec33b 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java
@@ -57,7 +57,7 @@ public class ListActivity extends Cmd {
"/authz/hist/role/"+role,
getDF(History.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
activity(fp.value,HEADER + " [ " + role + " ]");
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java
index c9ed37a4..bdcf1e50 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java
@@ -68,13 +68,13 @@ public class ListByUser extends Cmd {
"/authz/userRoles/user/"+user,
getDF(UserRoles.class)
);
- if(fr.get(AAFcli.timeout())) {
+ if (fr.get(AAFcli.timeout())) {
if (aafcli.isDetailed()) {
Future<Perms> fp = client.read(
"/authz/perms/user/"+user+(aafcli.isDetailed()?"?ns":""),
getDF(Perms.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
perms = fp.value;
}
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java
index c628eb17..364b3980 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java
@@ -69,7 +69,7 @@ public class User extends Cmd {
// You can request to be added or removed from role.
setQueryParamsOn(client);
- for(String id: ids) {
+ for (String id: ids) {
id=fullID(id);
urr.setUser(id);
switch(option) {
@@ -97,7 +97,7 @@ public class User extends Cmd {
default: // actually, should never get here...
throw new CadiException("Invalid action [" + action + ']');
}
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().print(verb);
pw().print(" User [");
pw().print(urr.getUser());
@@ -112,7 +112,7 @@ public class User extends Cmd {
pw().println(" is Accepted, but requires Approvals before actualizing");
break;
case 404:
- if(option==3) {
+ if (option==3) {
pw().println("Failed with code 404: UserRole is not found, or you do not have permission to view");
break;
}
@@ -139,7 +139,7 @@ public class User extends Cmd {
"/authz/userRole/role",
getDF(UserRoleRequest.class),
urr);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().println("Set the Role to Users [" + allUsers + "]");
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java
index 40447c19..cc9ccf98 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java
@@ -57,11 +57,11 @@ public class Cred extends Cmd {
final CredRequest cr = new CredRequest();
cr.setId(args[idx++]);
- if(option!=1 && option!=3) {
- if(idx>=args.length) throw new CadiException("Password Required");
+ if (option!=1 && option!=3) {
+ if (idx>=args.length) throw new CadiException("Password Required");
cr.setPassword(args[idx++]);
}
- if(args.length>idx)
+ if (args.length>idx)
cr.setEntry(args[idx++]);
// Set Start/End commands
@@ -82,7 +82,7 @@ public class Cred extends Cmd {
verb = "Added Credential [";
break;
case 1:
-// if(aafcli.addForce())cr.setForce("TRUE");
+// if (aafcli.addForce())cr.setForce("TRUE");
setQueryParamsOn(client);
fp = client.delete(CRED_PATH,
getDF(CredRequest.class),
@@ -109,16 +109,16 @@ public class Cred extends Cmd {
// case 4:
// return clean.exec(cleanIDX, args);
}
- if(fp==null) {
+ if (fp==null) {
return null; // get by Sonar check.
}
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().print(verb);
pw().print(cr.getId());
pw().println(']');
- } else if(fp.code()==202) {
+ } else if (fp.code()==202) {
pw().println("Credential Action Accepted, but requires Approvals before actualizing");
- } else if(fp.code()==406 && option==1) {
+ } else if (fp.code()==406 && option==1) {
pw().println("You cannot delete this Credential");
} else {
pw().println(ATTEMPT_FAILED_SPECIFICS_WITHELD);
@@ -126,7 +126,7 @@ public class Cred extends Cmd {
return fp.code();
}
});
- if(ret==null)ret = -1;
+ if (ret==null)ret = -1;
return ret;
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java
index 8587ac3d..3cb9fb04 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java
@@ -64,10 +64,10 @@ public class Delg extends BaseCmd<User> {
int option= whichOption(options, args[idx++]);
String user = fullID(args[idx++]);
dr.setUser(user);
- if(option<2) {
+ if (option<2) {
String delegate = fullID(args[idx++]);
dr.setDelegate(delegate);
- if(option<2 && args.length>idx) {
+ if (option<2 && args.length>idx) {
Date date;
try {
date = Chrono.dateOnlyFmt.parse(args[idx++]);
@@ -100,7 +100,7 @@ public class Delg extends BaseCmd<User> {
throw new CadiException("Bad Argument");
};
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
pw().append("Delegate ");
pw().println(verb);
} else {
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 03148ce5..3074ab86 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
@@ -53,7 +53,7 @@ public class List extends BaseCmd<User> {
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) {
+ if (u1==null || u2 == null) {
return -1;
}
return u1.getId().compareTo(u2.getId());
@@ -61,8 +61,8 @@ public class List extends BaseCmd<User> {
});
String format = reportColHead("%-40s %-10s %-30s\n","User","Type","Expires");
String date = "XXXX-XX-XX";
- for(aaf.v2_0.Users.User user : sorted) {
- if(!aafcli.isTest()) {
+ for (aaf.v2_0.Users.User user : sorted) {
+ if (!aafcli.isTest()) {
date = Chrono.dateOnlyStamp(user.getExpires());
}
pw().format(format,
@@ -84,9 +84,9 @@ public class List extends BaseCmd<User> {
}
} );
String ticket = null, prev = null;
- for(Approval app : lapp ) {
+ for (Approval app : lapp ) {
ticket = app.getTicket();
- if(!ticket.equals(prev)) {
+ if (!ticket.equals(prev)) {
pw().print("Ticket: ");
pw().println(ticket);
}
@@ -106,8 +106,8 @@ public class List extends BaseCmd<User> {
reportHead(title,id);
String format = reportColHead(" %-25s %-25s %-10s\n","User","Delegate","Expires");
String date = "XXXX-XX-XX";
- for(Delg delg : delgs.getDelgs()) {
- if(!this.aafcli.isTest())
+ for (Delg delg : delgs.getDelgs()) {
+ if (!this.aafcli.isTest())
date = Chrono.dateOnlyStamp(delg.getExpires());
pw().printf(format,
delg.getUser(),
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java
index 4bb87374..162dadac 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java
@@ -58,7 +58,7 @@ public class ListActivity extends Cmd {
"/authz/hist/user/"+user,
getDF(History.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
activity(fp.value,HEADER + " [ " + user + " ]");
} else {
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java
index d9379174..068aacb1 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java
@@ -67,9 +67,9 @@ public class ListApprovals extends Cmd {
"/authz/approval/"+type+'/'+fullValue,
getDF(Approvals.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
((List)parent).report(fp.value,HEADER + " by " + type,fullValue);
- if(fp.code()==404) {
+ if (fp.code()==404) {
return 200;
}
} else {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java
index 5cc7a52b..28b5c9e7 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java
@@ -61,9 +61,9 @@ public class ListDelegates extends Cmd {
"/authz/delegates/" + key + '/' + id,
getDF(Delgs.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
((List)parent).report(fp.value,HEADER + " by " + key, id);
- if(fp.code()==404)return 200;
+ if (fp.code()==404)return 200;
} else {
error(fp);
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java
index a71090ea..4977b752 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java
@@ -66,7 +66,7 @@ public class ListForCreds extends Cmd {
"/authn/creds/"+which+'/'+value,
getDF(Users.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
if (aafcli.isTest())
Collections.sort(fp.value.getUser(), new Comparator<User>() {
@Override
@@ -75,7 +75,7 @@ public class ListForCreds extends Cmd {
}
});
((org.onap.aaf.auth.cmd.user.List)parent).report(fp.value,option==1,HEADER+which,value);
- if(fp.code()==404)return 200;
+ if (fp.code()==404)return 200;
} else {
error(fp);
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java
index 439c8af6..516713ef 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java
@@ -60,14 +60,14 @@ public class ListForPermission extends Cmd {
int idx = index;
String type = args[idx++];
String instance = args[idx++];
- if("\\*".equals(instance))instance="*";
+ if ("\\*".equals(instance))instance="*";
String action = args[idx++];
- if("\\*".equals(action))action="*";
+ if ("\\*".equals(action))action="*";
Future<Users> fp = client.read(
"/authz/users/perm/"+type+'/'+instance+'/'+action,
getDF(Users.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
if (aafcli.isTest())
Collections.sort(fp.value.getUser(), new Comparator<User>() {
@Override
@@ -76,7 +76,7 @@ public class ListForPermission extends Cmd {
}
});
((org.onap.aaf.auth.cmd.user.List)parent).report(fp.value,false,HEADER,type+"|"+instance+"|"+action);
- if(fp.code()==404)return 200;
+ if (fp.code()==404)return 200;
} else {
error(fp);
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java
index 1d1b328a..b534240b 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java
@@ -60,7 +60,7 @@ public class ListForRoles extends Cmd {
"/authz/users/role/"+role,
getDF(Users.class)
);
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
if (aafcli.isTest())
Collections.sort(fp.value.getUser(), new Comparator<User>() {
@Override
@@ -69,7 +69,7 @@ public class ListForRoles extends Cmd {
}
});
((org.onap.aaf.auth.cmd.user.List)parent).report(fp.value,false, HEADER,role);
- if(fp.code()==404)return 200;
+ if (fp.code()==404)return 200;
} else {
error(fp);
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java
index 04b444a1..4bc99366 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java
@@ -108,7 +108,7 @@ public class Role extends Cmd {
pw().println(" Accepted, but requires Approvals before actualizing");
break;
case 404:
- if(option==3) {
+ if (option==3) {
pw().println("Failed with code 404: UserRole is not found, or you do not have permission to view");
break;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java
index 13aa04fd..9393e143 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java
@@ -89,7 +89,7 @@ public class Cache<TRANS extends Trans, DATA> {
public static Map<String,Dated> obtain(String key) {
Map<String, Dated> m = cacheMap.get(key);
- if(m==null) {
+ if (m==null) {
m = new ConcurrentHashMap<>();
synchronized(cacheMap) {
cacheMap.put(key, m);
@@ -137,13 +137,13 @@ public class Cache<TRANS extends Trans, DATA> {
Date now = new Date(System.currentTimeMillis() + advance);
- for(String name : set) {
+ for (String name : set) {
Map<String,Dated> map = cacheMap.get(name);
- if(map==null) {
+ if (map==null) {
continue;
}
- for(Map.Entry<String,Dated> me : map.entrySet()) {
+ for (Map.Entry<String,Dated> me : map.entrySet()) {
++total;
if (me.getValue().timestamp.before(now)) {
map.remove(me.getKey());
@@ -152,13 +152,13 @@ public class Cache<TRANS extends Trans, DATA> {
}
}
- if(count>0) {
+ if (count>0) {
env.info().log(Level.INFO, "Cache removed",count,"expired Cached Elements out of", total);
}
// If High (total) is reached during this period, increase the number of expired services removed for next time.
// There's no point doing it again here, as there should have been cleaned items.
- if(total>high) {
+ if (total>high) {
// advance cleanup by 10%, without getting greater than timeInterval.
advance = Math.min(timeInterval, advance+(timeInterval/10));
} else {
@@ -169,20 +169,20 @@ public class Cache<TRANS extends Trans, DATA> {
}
public static synchronized void startCleansing(Env env, String ... keys) {
- if(cleanseTimer==null) {
+ if (cleanseTimer==null) {
cleanseTimer = new Timer("Cache Cleanup Timer");
int cleanInterval = Integer.parseInt(env.getProperty(CACHE_CLEAN_INTERVAL,"60000")); // 1 minute clean cycles
int highCount = Integer.parseInt(env.getProperty(CACHE_HIGH_COUNT,"5000"));
cleanseTimer.schedule(clean = new Clean(env, cleanInterval, highCount), cleanInterval, cleanInterval);
}
- for(String key : keys) {
+ for (String key : keys) {
clean.add(key);
}
}
public static void stopTimer() {
- if(cleanseTimer!=null) {
+ if (cleanseTimer!=null) {
cleanseTimer.cancel();
cleanseTimer = null;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
index 606e7735..7bc1fdc6 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
@@ -38,14 +38,14 @@ public class Define {
private static final String ROOT_NS_TAG_DOT = ROOT_NS_TAG +".";
public static String ROOT_NS() {
- if(ROOT_NS==null) {
+ if (ROOT_NS==null) {
throw new RuntimeException(Define.class.getName() + MSG);
}
return ROOT_NS;
}
public static String ROOT_COMPANY() {
- if(ROOT_NS==null) {
+ if (ROOT_NS==null) {
throw new RuntimeException(Define.class.getName() + MSG);
}
return ROOT_COMPANY;
@@ -54,17 +54,17 @@ public class Define {
public static void set(Access access) throws CadiException {
ROOT_NS = access.getProperty(Config.AAF_ROOT_NS,"org.osaaf.aaf");
ROOT_COMPANY = access.getProperty(Config.AAF_ROOT_COMPANY,null);
- if(ROOT_COMPANY==null) {
+ if (ROOT_COMPANY==null) {
int last = ROOT_NS.lastIndexOf('.');
- if(last>=0) {
+ if (last>=0) {
ROOT_COMPANY = ROOT_NS.substring(0, last);
} else {
throw new CadiException(Config.AAF_ROOT_COMPANY + " or " + Config.AAF_ROOT_NS + " property with 3 positions is required.");
}
}
- for( Entry<Object, Object> es : access.getProperties().entrySet()) {
- if(es.getKey().toString().startsWith(ROOT_NS_TAG_DOT)) {
+ for ( Entry<Object, Object> es : access.getProperties().entrySet()) {
+ if (es.getKey().toString().startsWith(ROOT_NS_TAG_DOT)) {
access.getProperties().setProperty(es.getKey().toString(),varReplace(es.getValue().toString()));
}
}
@@ -74,7 +74,7 @@ public class Define {
}
public static String varReplace(final String potential) {
- if(potential.startsWith(ROOT_NS_TAG_DOT)) {
+ if (potential.startsWith(ROOT_NS_TAG_DOT)) {
return ROOT_NS + potential.substring(6);
} else {
return potential;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
index 70cee5c3..56db6f60 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
@@ -120,7 +120,7 @@ public class AuthzEnv extends RosettaEnv implements Access {
public AuthzTransImpl newTrans() {
synchronized(this) {
times[idx]=System.currentTimeMillis();
- if(++idx>=times.length)idx=0;
+ if (++idx>=times.length)idx=0;
}
return new AuthzTransImpl(this);
}
@@ -137,18 +137,18 @@ public class AuthzEnv extends RosettaEnv implements Access {
int count = 0;
long pot = 0;
long prev = 0;
- for(int i=idx;i<times.length;++i) {
- if(times[i]>0) {
- if(prev>0) {
+ for (int i=idx;i<times.length;++i) {
+ if (times[i]>0) {
+ if (prev>0) {
++count;
pot += times[i]-prev;
}
prev = times[i];
}
}
- for(int i=0;i<idx;++i) {
- if(times[i]>0) {
- if(prev>0) {
+ for (int i=0;i<idx;++i) {
+ if (times[i]>0) {
+ if (prev>0) {
++count;
pot += times[i]-prev;
}
@@ -199,11 +199,11 @@ public class AuthzEnv extends RosettaEnv implements Access {
private static final byte[] ENC="enc:".getBytes();
public String decrypt(String encrypted, final boolean anytext) throws IOException {
- if(encrypted==null) {
+ if (encrypted==null) {
throw new IOException("Password to be decrypted is null");
}
- if(anytext || encrypted.startsWith("enc:")) {
- if(decryptor.equals(Decryptor.NULL) && getProperty(Config.CADI_KEYFILE)!=null) {
+ if (anytext || encrypted.startsWith("enc:")) {
+ if (decryptor.equals(Decryptor.NULL) && getProperty(Config.CADI_KEYFILE)!=null) {
final Symm s;
try {
s = Symm.obtain(this);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
index 06fd310e..b08e0240 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
@@ -54,10 +54,10 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
this.env = env;
serviceMetric = new Metric();
serviceMetric.buckets = new float[BUCKETSIZE];
- if(transIDslot==null) {
+ if (transIDslot==null) {
transIDslot = env.slot(TRANS_ID_SLOT);
}
- if(specialLogSlot==null) {
+ if (specialLogSlot==null) {
specialLogSlot = env.slot(SPECIAL_LOG_SLOT);
}
}
@@ -89,7 +89,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
Boolean b = trans.get(specialLogSlot, false);
LogTarget lt = b?trans.warn():trans.info();
- if(lt.isLoggable()) {
+ if (lt.isLoggable()) {
// Transaction is done, now post full Audit Trail
StringBuilder sb = new StringBuilder("AuditTrail\n");
// We'll grabAct sub-metrics for Remote Calls and JSON
@@ -98,12 +98,12 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
// Add current Metrics to total metrics
serviceMetric.total+= m.total;
- for(int i=0;i<serviceMetric.buckets.length;++i) {
+ for (int i=0;i<serviceMetric.buckets.length;++i) {
serviceMetric.buckets[i]+=m.buckets[i];
}
Long tsi;
- if((tsi=trans.get(transIDslot, null))!=null) {
+ if ((tsi=trans.get(transIDslot, null))!=null) {
sb.append(" TraceID=");
sb.append(Long.toHexString(tsi));
sb.append('\n');
@@ -123,24 +123,24 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
Metric m = trans.auditTrail(lt,1, content, Env.REMOTE,Env.JSON);
// Add current Metrics to total metrics
serviceMetric.total+= m.total;
- for(int i=0;i<serviceMetric.buckets.length;++i) {
+ for (int i=0;i<serviceMetric.buckets.length;++i) {
serviceMetric.buckets[i]+=m.buckets[i];
}
StringBuilder sb = new StringBuilder();
sb.append("user=");
Principal p = trans.getUserPrincipal();
- if(p==null) {
+ if (p==null) {
sb.append("n/a");
} else {
sb.append(p.getName());
- if(p instanceof TrustPrincipal) {
+ if (p instanceof TrustPrincipal) {
sb.append('(');
sb.append(((TrustPrincipal)p).personalName()); // UserChain
sb.append(')');
} else {
sb.append('[');
- if(p instanceof TaggedPrincipal) {
+ if (p instanceof TaggedPrincipal) {
sb.append(((TaggedPrincipal)p).tag());
} else {
sb.append(p.getClass().getSimpleName());
@@ -154,7 +154,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
sb.append(trans.port());
// Current code won't ever get here... Always does a Full Audit Trail
// Long tsi;
-// if((tsi=trans.get(transIDslot, null))!=null) {
+// if ((tsi=trans.get(transIDslot, null))!=null) {
// sb.append(",TraceID=");
// sb.append(Long.toHexString(tsi));
// }
@@ -165,10 +165,10 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
sb.append(",path=");
sb.append(trans.path());
- if(content.length()>0) {
+ if (content.length()>0) {
sb.append(",msg=\"");
int start = content.lastIndexOf(",msg=\"");
- if(start>=0) {
+ if (start>=0) {
sb.append(content,start+6,content.length()-1);
} else {
sb.append(content);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
index ee90f284..aa6b038b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
@@ -60,12 +60,12 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
meth = req.getMethod();
path = req.getPathInfo();
- for(REQD_TYPE rt : REQD_TYPE.values()) {
+ for (REQD_TYPE rt : REQD_TYPE.values()) {
requested(rt,req);
}
// Handle alternate "request" for "future"
String request = req.getParameter("request");
- if(request!=null) {
+ if (request!=null) {
requested(REQD_TYPE.future,(request.length()==0 || "true".equalsIgnoreCase(request)));
}
@@ -146,7 +146,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
}
public void requested(REQD_TYPE requested, boolean b) {
- if(b) {
+ if (b) {
mask|=requested.bit;
} else {
mask&=~requested.bit;
@@ -155,7 +155,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
private void requested(REQD_TYPE reqtype, HttpServletRequest req) {
String p = req.getParameter(reqtype.name());
- if(p!=null) {
+ if (p!=null) {
requested(reqtype,p.length()==0 || "true".equalsIgnoreCase(p));
}
}
@@ -167,7 +167,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
@Override
public boolean fish(Permission ... pond) {
- if(lur!=null) {
+ if (lur!=null) {
return lur.fish(user, pond);
}
return false;
@@ -178,9 +178,9 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
*/
@Override
public Organization org() {
- if(org==null) {
+ if (org==null) {
try {
- if((org = OrganizationFactory.obtain(env(), user()))==null) {
+ if ((org = OrganizationFactory.obtain(env(), user()))==null) {
org = Organization.NULL;
}
} catch (Exception e) {
@@ -196,7 +196,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
*/
@Override
public void logAuditTrail(LogTarget lt) {
- if(lt.isLoggable()) {
+ if (lt.isLoggable()) {
StringBuilder sb = new StringBuilder();
auditTrail(1, sb);
lt.log(sb);
@@ -208,7 +208,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
*/
@Override
public Date now() {
- if(now==null) {
+ if (now==null) {
now = new Date();
}
return now;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
index d7b6f1da..b1111638 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
@@ -70,7 +70,7 @@ public class AuthzTransOnlyFilter extends TransOnlyFilter<AuthzTrans> {
Metric m = trans.auditTrail(1, sb, Env.REMOTE,Env.JSON);
// Add current Metrics to total metrics
serviceMetric.total+= m.total;
- for(int i=0;i<serviceMetric.buckets.length;++i) {
+ for (int i=0;i<serviceMetric.buckets.length;++i) {
serviceMetric.buckets[i]+=m.buckets[i];
}
// Log current info
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
index 3b7ed6f0..d1c5d28c 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
@@ -225,7 +225,7 @@ public class NullTrans implements AuthzTrans {
@Override
public Date now() {
- if(now==null) {
+ if (now==null) {
now = new Date();
}
return now;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
index 92a8269a..edb1f242 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
@@ -55,12 +55,12 @@ public class Result<RV> {
protected Result(RV value, int status, String details, String[] variables) {
this.value = value;
- if(value==null) {
+ if (value==null) {
specialCondition|=EMPTY_LIST;
}
this.status = status;
this.details = details;
- if(variables==null) {
+ if (variables==null) {
this.variables = EMPTY_VARS;
} else {
this.variables=variables;
@@ -290,17 +290,17 @@ public class Result<RV> {
@Override
public String toString() {
- if(status==0) {
+ if (status==0) {
return details;
} else {
StringBuilder sb = new StringBuilder();
sb.append(status);
sb.append(':');
sb.append(String.format(details,((Object[])variables)));
- if(isEmpty()) {
+ if (isEmpty()) {
sb.append("{empty}");
}
- if(value!=null) {
+ if (value!=null) {
sb.append('-');
sb.append(value.toString());
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java
index 90857b42..6f644bd4 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java
@@ -74,14 +74,14 @@ public abstract class AbsData implements Iterable<String> {
TimeTaken tt = trans.start("Open Data File", Env.SUB);
boolean first = true;
try {
- if(!dataf.exists()) {
+ if (!dataf.exists()) {
throw new FileNotFoundException("Data File Missing:" + dataf.getCanonicalPath());
}
long begin = System.currentTimeMillis();
long end = begin+timeout;
boolean exists;
- while((exists=lockf.exists()) && begin<end) {
- if(first) {
+ while ((exists=lockf.exists()) && begin<end) {
+ if (first) {
trans.warn().log("Waiting for",lockf.getCanonicalPath(),"to close");
first = false;
}
@@ -92,7 +92,7 @@ public abstract class AbsData implements Iterable<String> {
}
begin = System.currentTimeMillis();
}
- if(exists) {
+ if (exists) {
throw new IOException(lockf.getCanonicalPath() + "exists. May not open Datafile");
}
data.open();
@@ -110,12 +110,12 @@ public abstract class AbsData implements Iterable<String> {
}
private synchronized void ensureIdxGood(AuthzTrans trans) throws IOException {
- if(!idxf.exists() || idxf.length()==0 || dataf.lastModified()>idxf.lastModified()) {
+ if (!idxf.exists() || idxf.length()==0 || dataf.lastModified()>idxf.lastModified()) {
trans.warn().log(idxf.getAbsolutePath(),"is missing, empty or out of date, creating");
RandomAccessFile raf = new RandomAccessFile(lockf, "rw");
try {
ti.create(trans, data, maxLineSize, delim, fieldOffset, skipLines);
- if(!idxf.exists() || (idxf.length()==0 && dataf.length()!=0)) {
+ if (!idxf.exists() || (idxf.length()==0 && dataf.length()!=0)) {
throw new IOException("Data Index File did not create correctly");
}
} finally {
@@ -189,7 +189,7 @@ public abstract class AbsData implements Iterable<String> {
@Override
public String next() {
- if(!hasNext()) {
+ if (!hasNext()) {
throw new NoSuchElementException();
}
reuse.reset();
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java
index 7e420df4..a65c13db 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java
@@ -43,7 +43,7 @@ public class DataFile {
this.access = access;
}
public void open() throws IOException {
- if(!file.exists()) throw new FileNotFoundException();
+ if (!file.exists()) throw new FileNotFoundException();
rafile = new RandomAccessFile(file,access);
channel = rafile.getChannel();
mapBuff = channel.map("r".equals(access)?MapMode.READ_ONLY:MapMode.READ_WRITE,0,channel.size());
@@ -52,10 +52,10 @@ public class DataFile {
return mapBuff!=null;
}
public void close() throws IOException {
- if(channel!=null){
+ if (channel!=null){
channel.close();
}
- if(rafile!=null) {
+ if (rafile!=null) {
rafile.close();
}
mapBuff = null;
@@ -67,7 +67,7 @@ public class DataFile {
private synchronized int load(Token t) {
int len = Math.min(mapBuff.limit()-t.next,t.buff.length);
- if(len>0) {
+ if (len>0) {
mapBuff.position(t.next);
mapBuff.get(t.buff,0,len);
}
@@ -91,8 +91,8 @@ public class DataFile {
public boolean nextLine() {
end = load(this);
pos = next;
- for(int i=0;i<end;++i) {
- if(buff[i]=='\n') {
+ for (int i=0;i<end;++i) {
+ if (buff[i]=='\n') {
end = i;
next += i+1;
return true;
@@ -126,16 +126,16 @@ public class DataFile {
}
public String next() {
- if(idx>=end)return null;
+ if (idx>=end)return null;
int start = idx;
byte c=0;
int endStr = -1;
- while(idx<end && idx<buff.length && (c=buff[idx])!=delim && c!='\n') { // for DOS
- if(c=='\r')endStr=idx;
+ while (idx<end && idx<buff.length && (c=buff[idx])!=delim && c!='\n') { // for DOS
+ if (c=='\r')endStr=idx;
++idx;
}
- if(endStr<0) {
+ if (endStr<0) {
endStr=idx-start;
} else {
endStr=endStr-start;
@@ -147,9 +147,9 @@ public class DataFile {
public String at(int fieldOffset) {
int start;
byte c=0;
- for(int count = idx = start = 0; idx<end && idx<buff.length; ++idx) {
- if((c=buff[idx])==delim || c=='\n') {
- if(count++ == fieldOffset) {
+ for (int count = idx = start = 0; idx<end && idx<buff.length; ++idx) {
+ if ((c=buff[idx])==delim || c=='\n') {
+ if (count++ == fieldOffset) {
break;
}
start = idx+1;
@@ -161,16 +161,16 @@ public class DataFile {
public String atToEnd(int fieldOffset) {
int start;
byte c=0;
- for(int count = idx = start = 0; idx<end && idx<buff.length; ++idx) {
- if((c=buff[idx])==delim || c=='\n') {
- if(count++ == fieldOffset) {
+ for (int count = idx = start = 0; idx<end && idx<buff.length; ++idx) {
+ if ((c=buff[idx])==delim || c=='\n') {
+ if (count++ == fieldOffset) {
break;
}
start = idx+1;
}
}
- for(; idx<end && idx<buff.length && (c=buff[idx])!='\n'; ++idx) {
+ for (; idx<end && idx<buff.length && (c=buff[idx])!='\n'; ++idx) {
++idx;
}
return new String(buff,start,(idx-start-((c=='\r' || idx>=end)?1:0)));
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
index bb1b6117..73ad07c7 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
@@ -54,7 +54,7 @@ public class TextIndex {
}
public void close() throws IOException {
- if(dataFile!=null) {
+ if (dataFile!=null) {
dataFile.close();
dataFile=null;
}
@@ -65,7 +65,7 @@ public class TextIndex {
}
public int find(Object key, DataFile.Token dtok, Field df, int offset) throws IOException {
- if(dataFile==null) {
+ if (dataFile==null) {
throw new IOException("File not opened");
}
long hash = hashToLong(key.hashCode());
@@ -74,13 +74,13 @@ public class TextIndex {
IntBuffer tib = ttok.getIntBuffer();
long lhash;
int curr;
- while((max-min)>100) {
+ while ((max-min)>100) {
ttok.pos((curr=(min+(max-min)/2))*REC_SIZE);
tib.rewind();
lhash = hashToLong(tib.get());
- if(lhash<hash) {
+ if (lhash<hash) {
min=curr+1;
- } else if(lhash>hash) {
+ } else if (lhash>hash) {
max=curr-1;
} else {
min=curr-40;
@@ -90,20 +90,20 @@ public class TextIndex {
}
List<Integer> entries = new ArrayList<>();
- for(int i=min;i<=max;++i) {
+ for (int i=min;i<=max;++i) {
ttok.pos(i*REC_SIZE);
tib.rewind();
lhash = hashToLong(tib.get());
- if(lhash==hash) {
+ if (lhash==hash) {
entries.add(tib.get());
- } else if(lhash>hash) {
+ } else if (lhash>hash) {
break;
}
}
- for(Integer i : entries) {
+ for (Integer i : entries) {
dtok.pos(i);
- if(df.at(offset).equals(key)) {
+ if (df.at(offset).equals(key)) {
return i;
}
}
@@ -116,7 +116,7 @@ public class TextIndex {
*/
private static long hashToLong(int hash) {
long rv;
- if(hash<0) {
+ if (hash<0) {
rv = 0xFFFFFFFFL & hash;
} else {
rv = hash;
@@ -145,15 +145,15 @@ public class TextIndex {
Field f = t.new Field(delim);
int count = 0;
- if(skipLines>0) {
+ if (skipLines>0) {
trans.info().log("Skipping",skipLines,"line"+(skipLines==1?" in":"s in"),data.file().getName());
}
- for(int i=0;i<skipLines;++i) {
+ for (int i=0;i<skipLines;++i) {
t.nextLine();
}
tt2 = trans.start("Read", Env.SUB);
try {
- while(t.nextLine()) {
+ while (t.nextLine()) {
list.add(new Idx(f.at(fieldOffset),t.pos()));
++count;
}
@@ -168,8 +168,8 @@ public class TextIndex {
try {
ByteBuffer bb = ByteBuffer.allocate(8*1024);
IntBuffer ib = bb.asIntBuffer();
- for(Idx idx : list) {
- if(!ib.hasRemaining()) {
+ for (Idx idx : list) {
+ if (!ib.hasRemaining()) {
fos.write(bb);
ib.clear();
bb.rewind();
@@ -186,7 +186,7 @@ public class TextIndex {
fos.close();
}
} finally {
- if(raf!=null) {
+ if (raf!=null) {
raf.close(); // closed by fos
}
}
@@ -244,7 +244,7 @@ public class TextIndex {
*/
@Override
public boolean equals(Object o) {
- if(o!=null && o instanceof Idx) {
+ if (o!=null && o instanceof Idx) {
return hash == ((Idx)o).hash;
}
return false;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
index 3ade1195..fd252fe4 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
@@ -161,8 +161,8 @@ public interface Organization {
Notify(int id) {this.id = id;}
public int getValue() {return id;}
public static Notify from(int type) {
- for(Notify t : Notify.values()) {
- if(t.id==type) {
+ for (Notify t : Notify.values()) {
+ if (t.id==type) {
return t;
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
index 3b97d6f3..80a382a8 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
@@ -53,39 +53,39 @@ public class OrganizationFactory {
int idx = ORGANIZATION_DOT.length();
Organization org,firstOrg = null;
- for(Entry<Object, Object> es : env.getProperties().entrySet()) {
+ for (Entry<Object, Object> es : env.getProperties().entrySet()) {
String key = es.getKey().toString();
- if(key.startsWith(ORGANIZATION_DOT)) {
+ if (key.startsWith(ORGANIZATION_DOT)) {
org = obtain(env,key.substring(idx));
- if(firstOrg==null) {
+ if (firstOrg==null) {
firstOrg = org;
}
}
}
- if(defaultOrg == null) {
+ if (defaultOrg == null) {
defaultOrg = firstOrg;
}
return defaultOrg;
}
public static Organization obtain(Env env,final String theNS) throws OrganizationException {
String orgNS;
- if(theNS.indexOf('@')>=0) {
+ if (theNS.indexOf('@')>=0) {
orgNS=FQI.reverseDomain(theNS);
} else {
orgNS=theNS;
}
Organization org = orgs.get(orgNS);
- if(org == null) {
+ if (org == null) {
env.debug().printf("Attempting to instantiate Organization %s\n",orgNS);
String orgClass = env.getProperty(ORGANIZATION_DOT+orgNS);
- if(orgClass == null) {
+ if (orgClass == null) {
env.warn().log("There is no Organization." + orgNS + " property");
} else {
try {
Class<?> orgCls = Class.forName(orgClass);
- for(Organization o : orgs.values()) {
- if(o.getClass().isAssignableFrom(orgCls)) {
+ for (Organization o : orgs.values()) {
+ if (o.getClass().isAssignableFrom(orgCls)) {
org = o;
}
}
@@ -93,15 +93,15 @@ public class OrganizationFactory {
env.error().log(e1, orgClass + " is not on the Classpath.");
throw new OrganizationException(e1);
}
- if(org==null) {
+ if (org==null) {
try {
@SuppressWarnings("unchecked")
Class<Organization> cls = (Class<Organization>) Class.forName(orgClass);
Constructor<Organization> cnst = cls.getConstructor(Env.class,String.class);
org = cnst.newInstance(env,orgNS);
String other_realms = env.getProperty(orgNS+".also_supports");
- if(other_realms!=null) {
- for(String r : Split.splitTrim(',', other_realms)) {
+ if (other_realms!=null) {
+ for (String r : Split.splitTrim(',', other_realms)) {
org.addSupportedRealm(r);
}
}
@@ -114,13 +114,13 @@ public class OrganizationFactory {
}
orgs.put(orgNS, org);
boolean isDefault;
- if((isDefault="true".equalsIgnoreCase(env.getProperty(orgNS+".default")))) {
+ if ((isDefault="true".equalsIgnoreCase(env.getProperty(orgNS+".default")))) {
defaultOrg = org;
}
env.init().printf("Instantiated %s with %s%s\n",orgNS,orgClass,(isDefault?" as default":""));
}
- if(org==null) {
- if(defaultOrg!=null) {
+ if (org==null) {
+ if (defaultOrg!=null) {
org=defaultOrg;
orgs.put(orgNS, org);
}
@@ -133,7 +133,7 @@ public class OrganizationFactory {
public static Organization get(AuthzTrans trans) throws OrganizationException {
String domain = FQI.reverseDomain(trans.user());
Organization org = orgs.get(domain);
- if(org==null) {
+ if (org==null) {
org = defaultOrg; // can be null, btw, unless set.
}
return org;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java
index 30924dd5..0e70e25e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java
@@ -46,16 +46,16 @@ class Acceptor<TRANS extends Trans> {
private boolean eval(HttpCode<TRANS,?> code, String str, List<String> props) {
// int plus = str.indexOf('+');
-// if(plus<0) {
+// if (plus<0) {
boolean ok = false;
boolean any = false;
- for(Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type : types) {
+ for (Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type : types) {
ok = true;
- if(type.x.equals(str)) {
- for(Iterator<String> iter = props.iterator();ok && iter.hasNext();) {
+ if (type.x.equals(str)) {
+ for (Iterator<String> iter = props.iterator();ok && iter.hasNext();) {
ok = props(type,iter.next(),iter.next());
}
- if(ok) {
+ if (ok) {
any = true;
acceptable.add(type);
}
@@ -65,11 +65,11 @@ class Acceptor<TRANS extends Trans> {
// int prev = str.indexOf('/')+1;
// String first = str.substring(0,prev);
// String nstr;
-// while(prev!=0) {
+// while (prev!=0) {
// nstr = first + (plus<0?str.substring(prev):str.substring(prev,plus));
//
-// for(Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type : types) {
-// if(type.x.equals(nstr)) {
+// for (Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type : types) {
+// if (type.x.equals(nstr)) {
// acceptable.add(type);
// return type;
// }
@@ -90,14 +90,14 @@ class Acceptor<TRANS extends Trans> {
*/
private boolean props(Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type, String tag, String value) {
boolean rv = false;
- if(type.y!=null) {
- for(Pair<String,Object> prop : type.y.y){
- if(tag.equals(prop.x)) {
- if(tag.equals("charset")) {
+ if (type.y!=null) {
+ for (Pair<String,Object> prop : type.y.y){
+ if (tag.equals(prop.x)) {
+ if (tag.equals("charset")) {
return prop.x==null?false:prop.y.equals(value.toLowerCase()); // return True if Matched
- } else if(tag.equals("version")) {
+ } else if (tag.equals("version")) {
return prop.y.equals(new Version(value)); // Note: Version Class knows Minor Version encoding
- } else if(tag.equals(Content.Q)) { // replace Q value
+ } else if (tag.equals(Content.Q)) { // replace Q value
try {
type.y.y.get(0).y=Float.parseFloat(value);
} catch (NumberFormatException e) {
@@ -135,34 +135,34 @@ class Acceptor<TRANS extends Trans> {
name=null;
cis = cie+1; // find comma start
- while(cis<bytes.length && Character.isSpaceChar(bytes[cis]))++cis;
+ while (cis<bytes.length && Character.isSpaceChar(bytes[cis]))++cis;
cie = cntnt.indexOf(',',cis); // find comma end
cend = cie<0?bytes.length:cie; // If no comma, set comma end to full length, else cie
- while(cend>cis && Character.isSpaceChar(bytes[cend-1]))--cend;
+ while (cend>cis && Character.isSpaceChar(bytes[cend-1]))--cend;
// Start SEMIS
sie=cis-1;
do {
sis = sie+1; // semi start is one after previous end
- while(sis<bytes.length && Character.isSpaceChar(bytes[sis]))++sis;
+ while (sis<bytes.length && Character.isSpaceChar(bytes[sis]))++sis;
sie = cntnt.indexOf(';',sis);
send = sie>cend || sie<0?cend:sie; // if the Semicolon is after the comma, or non-existent, use comma end, else keep
- while(send>sis && Character.isSpaceChar(bytes[send-1]))--send;
- if(name==null) { // first entry in Comma set is the name, not a property
+ while (send>sis && Character.isSpaceChar(bytes[send-1]))--send;
+ if (name==null) { // first entry in Comma set is the name, not a property
name = new String(bytes,sis,send-sis);
} else { // We've looped past the first Semi, now process as properties
// If there are additional elements (more entities within Semi Colons)
// apply Properties
int eq = cntnt.indexOf('=',sis);
- if(eq>sis && eq<send) {
+ if (eq>sis && eq<send) {
props.add(new String(bytes,sis,eq-sis));
props.add(new String(bytes,eq+1,send-(eq+1)));
}
}
// End Property
- } while(sie<=cend && sie>=cis); // End SEMI processing
+ } while (sie<=cend && sie>=cis); // End SEMI processing
// Now evaluate Comma set and return if true
- if(eval(code,name,props))return true; // else loop again to check next comma
- } while(cie>=0); // loop to next comma
+ if (eval(code,name,props))return true; // else loop again to check next comma
+ } while (cie>=0); // loop to next comma
return false; // didn't get even one match
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java
index 53511b40..9af11152 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java
@@ -66,12 +66,12 @@ import org.onap.aaf.misc.env.Trans;
*/
public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void> {
public static void setEnv(Store store, String[] args) {
- for(int i=0;i<args.length-1;i+=2) { // cover two parms required for each
- if(CFA_WEB_PATH.equals(args[i])) {
+ for (int i=0;i<args.length-1;i+=2) { // cover two parms required for each
+ if (CFA_WEB_PATH.equals(args[i])) {
store.put(store.staticSlot(CFA_WEB_PATH), args[i+1]);
- } else if(CFA_CACHE_CHECK_INTERVAL.equals(args[i])) {
+ } else if (CFA_CACHE_CHECK_INTERVAL.equals(args[i])) {
store.put(store.staticSlot(CFA_CACHE_CHECK_INTERVAL), Long.parseLong(args[i+1]));
- } else if(CFA_MAX_SIZE.equals(args[i])) {
+ } else if (CFA_MAX_SIZE.equals(args[i])) {
store.put(store.staticSlot(CFA_MAX_SIZE), Integer.parseInt(args[i+1]));
}
}
@@ -144,11 +144,11 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
env.init().log("CachingFileAccess path: " + new File(web_path).getCanonicalPath());
Object obj;
obj = env.get(env.staticSlot(CFA_CACHE_CHECK_INTERVAL),600000L); // Default is 10 mins
- if(obj instanceof Long) {checkInterval=(Long)obj;
+ if (obj instanceof Long) {checkInterval=(Long)obj;
} else {checkInterval=Long.parseLong((String)obj);}
obj = env.get(env.staticSlot(CFA_MAX_SIZE), 512000); // Default is max file 500k
- if(obj instanceof Integer) {maxItemSize=(Integer)obj;
+ if (obj instanceof Integer) {maxItemSize=(Integer)obj;
} else {maxItemSize =Integer.parseInt((String)obj);}
clear_command = env.getProperty(CFA_CLEAR_COMMAND,null);
@@ -160,9 +160,9 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
public void handle(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws IOException {
String key = pathParam(req, ":key");
String cmd = pathParam(req,":cmd");
- if(key.equals(clear_command)) {
+ if (key.equals(clear_command)) {
resp.setHeader("Content-Type",typeMap.get("txt"));
- if("clear".equals(cmd)) {
+ if ("clear".equals(cmd)) {
content.clear();
resp.setStatus(200/*HttpStatus.OK_200*/);
} else {
@@ -171,7 +171,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
return;
}
Content c = load(logT , web_path,cmd!=null && cmd.length()>0?key+'/'+cmd:key, null, checkInterval);
- if(c.attachmentOnly) {
+ if (c.attachmentOnly) {
resp.setHeader("Content-disposition", "attachment");
}
c.setHeader(resp);
@@ -214,12 +214,12 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
*/
public Content load(LogTarget logTarget, String dataRoot, String key, String mediaType, long _timeCheck) throws IOException {
long timeCheck = _timeCheck;
- if(timeCheck<0) {
+ if (timeCheck<0) {
timeCheck=checkInterval; // if time < 0, then use default
}
boolean isRoot;
String fileName;
- if("-".equals(key)) {
+ if ("-".equals(key)) {
fileName = dataRoot;
isRoot = true;
} else {
@@ -229,30 +229,30 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
Content c = content.get(key);
long systime = System.currentTimeMillis();
File f=null;
- if(c!=null) {
+ if (c!=null) {
// Don't check every hit... only after certain time value
- if(c.date < systime + timeCheck) {
+ if (c.date < systime + timeCheck) {
f = new File(fileName);
- if(f.lastModified()>c.date) {
+ if (f.lastModified()>c.date) {
c=null;
}
}
}
- if(c==null) {
- if(logTarget!=null) {
+ if (c==null) {
+ if (logTarget!=null) {
logTarget.log("File Read: ",key);
}
- if(f==null){
+ if (f==null){
f = new File(fileName);
}
boolean cacheMe;
- if(f.exists()) {
- if(f.isDirectory()) {
+ if (f.exists()) {
+ if (f.isDirectory()) {
cacheMe = false;
c = new DirectoryContent(f,isRoot);
} else {
- if(f.length() > maxItemSize) {
+ if (f.length() > maxItemSize) {
c = new DirectFileContent(f);
cacheMe = false;
} else {
@@ -260,10 +260,10 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
cacheMe = checkInterval>0;
}
- if(mediaType==null) { // determine from file Ending
+ if (mediaType==null) { // determine from file Ending
int idx = key.lastIndexOf('.');
String subkey = key.substring(++idx);
- if((c.contentType = idx<0?null:typeMap.get(subkey))==null) {
+ if ((c.contentType = idx<0?null:typeMap.get(subkey))==null) {
// if nothing else, just set to default type...
c.contentType = "application/octet-stream";
}
@@ -275,7 +275,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
c.date = f.lastModified();
- if(cacheMe) {
+ if (cacheMe) {
content.put(key, c);
}
}
@@ -283,7 +283,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
c=NULL;
}
} else {
- if(logTarget!=null)logTarget.log("Cache Read: ",key);
+ if (logTarget!=null)logTarget.log("Cache Read: ",key);
}
// refresh hit time
@@ -294,7 +294,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
public Content loadOrDefault(Trans trans, String targetDir, String targetFileName, String sourcePath, String mediaType) throws IOException {
try {
return load(trans.info(),targetDir,targetFileName,mediaType,0);
- } catch(FileNotFoundException e) {
+ } catch (FileNotFoundException e) {
String targetPath = targetDir + '/' + targetFileName;
TimeTaken tt = trans.start("File doesn't exist; copy " + sourcePath + " to " + targetPath, Env.SUB);
try {
@@ -374,7 +374,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
char[] buff = new char[1024];
try {
int read;
- while((read = fr.read(buff,0,1024))>=0) {
+ while ((read = fr.read(buff,0,1024))>=0) {
writer.write(buff,0,read);
}
} finally {
@@ -387,7 +387,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
byte[] buff = new byte[1024];
try {
int read;
- while((read = fis.read(buff,0,1024))>=0) {
+ while ((read = fis.read(buff,0,1024))>=0) {
os.write(buff,0,read);
}
} finally {
@@ -415,13 +415,13 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
// See if there are Numbers in the name
Matcher m1 = A_NUMBER.matcher(f1.getName());
Matcher m2 = A_NUMBER.matcher(f2.getName());
- if(m1.find() && m2.find()) {
+ if (m1.find() && m2.find()) {
// if numbers, are the numbers in the same start position
int i1 = m1.start();
int i2 = m2.start();
// If same start position and the text is the same, then reverse sort
- if(i1==i2 && f1.getName().startsWith(f2.getName().substring(0,i1))) {
+ if (i1==i2 && f1.getName().startsWith(f2.getName().substring(0,i1))) {
// reverse sort files that start similarly, but have numbers in them
return f2.compareTo(f1);
}
@@ -443,7 +443,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
w.append(H2);
for (File f : files) {
w.append("<li><a href=\"");
- if(notRoot) {
+ if (notRoot) {
w.append(name);
w.append('/');
}
@@ -490,7 +490,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
public void write(Writer writer) throws IOException {
synchronized(this) {
// do the String Transformation once, and only if actually used
- if(cdata==null) {
+ if (cdata==null) {
cdata = new char[end];
new String(data).getChars(0, end, cdata, 0);
}
@@ -538,21 +538,21 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
@Override
public void run() {
int size = content.size();
- if(size>maxSize) {
+ if (size>maxSize) {
ArrayList<Comp> scont = new ArrayList<>(size);
Object[] entries = content.entrySet().toArray();
- for(int i=0;i<size;++i) {
+ for (int i=0;i<size;++i) {
scont.add(i, new Comp((Map.Entry<String,Content>)entries[i]));
}
Collections.sort(scont);
int end = size - ((maxSize/4)*3); // reduce to 3/4 of max size
//System.out.println("------ Cleanup Cycle ------ " + new Date().toString() + " -------");
- for(int i=0;i<end;++i) {
+ for (int i=0;i<end;++i) {
Entry<String, Content> entry = scont.get(i).entry;
content.remove(entry.getKey());
//System.out.println("removed Cache Item " + entry.getKey() + "/" + new Date(entry.getValue().access).toString());
}
-// for(int i=end;i<size;++i) {
+// for (int i=end;i<size;++i) {
// Entry<String, Content> entry = scont.get(i).entry;
// //System.out.println("remaining Cache Item " + entry.getKey() + "/" + new Date(entry.getValue().access).toString());
// }
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java
index f8760ada..63a2eeaa 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java
@@ -80,13 +80,13 @@ public abstract class Content<TRANS extends Trans> {
sis = sie+1;
sie = cntnt.indexOf(';',sis);
send = sie>cend || sie<0?cend:sie;
- if(me==null) {
+ if (me==null) {
String semi = new String(bytes,sis,send-sis);
// trans.checkpoint(semi);
// Look at first entity within comma group
// Is this an acceptable Type?
me=types(code, semi);
- if(me==null) {
+ if (me==null) {
sie=-1; // skip the rest of the processing... not a type
} else {
contType=true;
@@ -95,20 +95,20 @@ public abstract class Content<TRANS extends Trans> {
// If there are additional elements (more entities within Semi Colons)
// apply Propertys
int eq = cntnt.indexOf('=',sis);
- if(eq>sis && eq<send) {
+ if (eq>sis && eq<send) {
String tag = new String(bytes,sis,eq-sis);
String value = new String(bytes,eq+1,send-(eq+1));
// trans.checkpoint(" Prop " + tag + "=" + value);
boolean bool = props(me,tag,value);
- if(!bool) {
+ if (!bool) {
contProp=false;
}
}
}
// End Property
- } while(sie<=cend && sie>=cis);
+ } while (sie<=cend && sie>=cis);
// End SEMIS
- } while(cie>=0);
+ } while (cie>=0);
return contType && contProp; // for use in finds, True if a type found AND all props matched
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java
index c5739e35..0768145f 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java
@@ -55,8 +55,8 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
// Evaluate for "*" once...
all = false;
- for(String srole : roles) {
- if("*".equals(srole)) {
+ for (String srole : roles) {
+ if ("*".equals(srole)) {
all = true;
break;
}
@@ -79,11 +79,11 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
*/
public String pathParam(HttpServletRequest req, String key) {
String rv = req.getParameter(key);
- if(rv==null) {
+ if (rv==null) {
rv = match.param(req.getPathInfo(), key);
- if(rv!=null) {
+ if (rv!=null) {
rv = rv.trim();
- if(rv.endsWith("/")) {
+ if (rv.endsWith("/")) {
rv = rv.substring(0, rv.length()-1);
}
}
@@ -102,10 +102,10 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
* @return
*/
public boolean isAuthorized(HttpServletRequest req) {
- if(all)return true;
- if(roles!=null) {
- for(String srole : roles) {
- if(req.isUserInRole(srole)) return true;
+ if (all)return true;
+ if (roles!=null) {
+ for (String srole : roles) {
+ if (req.isUserInRole(srole)) return true;
}
}
return false;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java
index 5a036551..599e45b2 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java
@@ -52,16 +52,16 @@ public class Match {
public Match(String path) {
// IF DEBUG: System.out.print("\n[" + path + "]");
params = new HashMap<>();
- if(path!=null) {
+ if (path!=null) {
String[] pa = path.split("/");
values = new byte[pa.length][];
vars = new Integer[pa.length];
int val = 0;
String key;
- for(int i=0;i<pa.length && !wildcard;++i) {
- if(pa[i].startsWith(":")) {
- if(pa[i].endsWith("*")) {
+ for (int i=0;i<pa.length && !wildcard;++i) {
+ if (pa[i].startsWith(":")) {
+ if (pa[i].endsWith("*")) {
val = i | pa.length<<16; // load end value in high order bits
key = pa[i].substring(0, pa[i].length()-1);// remove *
wildcard = true;
@@ -75,9 +75,9 @@ public class Match {
vars[i]=val;
} else {
values[i]=pa[i].getBytes();
- if(pa[i].endsWith("*")) {
+ if (pa[i].endsWith("*")) {
wildcard = true;
- if(pa[i].length()>1) {
+ if (pa[i].length()>1) {
/* remove * from value */
int newlength = values[i].length-1;
byte[] real = new byte[newlength];
@@ -107,25 +107,25 @@ public class Match {
*/
public String param(String path,String key) {
Integer val = params.get(key); // :key or key
- if(val!=null) {
+ if (val!=null) {
int start = val & 0xFFFF;
int end = (val >> 16) & 0xFFFF;
int idx = -1;
int i;
- for(i=0;i<start;++i) {
+ for (i=0;i<start;++i) {
idx = path.indexOf('/',idx+1);
- if(idx<0)break;
+ if (idx<0)break;
}
- if(i==start) {
+ if (i==start) {
++idx;
- if(end==0) {
+ if (end==0) {
end = path.indexOf('/',idx);
- if(end<0)end=path.length();
+ if (end<0)end=path.length();
} else {
end=path.length();
}
return path.substring(idx,end);
- } else if(i==start-1) { // if last spot was left blank, i.e. :key*
+ } else if (i==start-1) { // if last spot was left blank, i.e. :key*
return "";
}
}
@@ -133,8 +133,8 @@ public class Match {
}
public boolean match(String path) {
- if(path==null|| path.length()==0 || "/".equals(path) ) {
- if(values==null)return true;
+ if (path==null|| path.length()==0 || "/".equals(path) ) {
+ if (values==null)return true;
switch(values.length) {
case 0: return true;
case 1: return values[0].length==0;
@@ -150,58 +150,58 @@ public class Match {
int lastByte = pabytes.length;
boolean fieldMatched = false; // = lastByte>0?(pabytes[0]=='/'):false;
// IF DEBUG: System.out.println("\n -- " + path + " --");
- for(int i=0;rv && i<lastByte;++i) {
- if(field>=lastField) { // checking here allows there to be a non-functional ending /
+ for (int i=0;rv && i<lastByte;++i) {
+ if (field>=lastField) { // checking here allows there to be a non-functional ending /
rv = false;
break;
}
- if(values[field]==null) { // it's a variable, just look for /s
- if(wildcard && field==lastField-1) return true;// we've made it this far. We accept all remaining characters
+ if (values[field]==null) { // it's a variable, just look for /s
+ if (wildcard && field==lastField-1) return true;// we've made it this far. We accept all remaining characters
Integer val = vars[field];
int start = val & 0xFFFF;
int end = (val >> 16) & 0xFFFF;
- if(end==0)end=start+1;
+ if (end==0)end=start+1;
int k = i;
- for(int j=start; j<end && k<lastByte; ++k) {
+ for (int j=start; j<end && k<lastByte; ++k) {
// IF DEBUG: System.out.print((char)pabytes[k]);
- if(pabytes[k]=='/') {
+ if (pabytes[k]=='/') {
++field;
++j;
}
}
- if(k==lastByte && pabytes[k-1]!='/')++field;
- if(k>i)i=k-1; // if we've incremented, have to accommodate the outer for loop incrementing as well
+ if (k==lastByte && pabytes[k-1]!='/')++field;
+ if (k>i)i=k-1; // if we've incremented, have to accommodate the outer for loop incrementing as well
fieldMatched = false; // reset
fieldIdx = 0;
} else {
// IF DEBUG: System.out.print((char)pabytes[i]);
- if(pabytes[i]=='/') { // end of field, eval if Field is matched
+ if (pabytes[i]=='/') { // end of field, eval if Field is matched
// if double slash, check if supposed to be empty
- if(fieldIdx==0 && values[field].length==0) {
+ if (fieldIdx==0 && values[field].length==0) {
fieldMatched = true;
}
rv = fieldMatched && ++field<lastField;
// reset
fieldMatched = false;
fieldIdx = 0;
- } else if(values[field].length==0) {
+ } else if (values[field].length==0) {
// double slash in path, but content in field. We check specially here to avoid
// Array out of bounds issues.
rv = false;
} else {
- if(fieldMatched) {
+ if (fieldMatched) {
rv =false; // field is already matched, now there's too many bytes
} else {
rv = pabytes[i]==values[field][fieldIdx++]; // compare expected (pabytes[i]) with value for particular field
fieldMatched=values[field].length==fieldIdx; // are all the bytes match in the field?
- if(fieldMatched && (i==lastByte-1 || (wildcard && field==lastField-1)))
+ if (fieldMatched && (i==lastByte-1 || (wildcard && field==lastField-1)))
return true; // last field info
}
}
}
}
- if(field!=lastField || pabytes.length!=lastByte) rv = false; // have we matched all the fields and all the bytes?
+ if (field!=lastField || pabytes.length!=lastByte) rv = false; // have we matched all the fields and all the bytes?
return rv;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java
index 03264d56..c1bfd6ad 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java
@@ -64,7 +64,7 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
@SuppressWarnings("unchecked")
TRANS trans = (TRANS)req.getAttribute(TransFilter.TRANS_TAG);
- if(trans==null) {
+ if (trans==null) {
response.setStatus(404); // Not Found, because it didn't go through TransFilter
return;
}
@@ -79,7 +79,7 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
CodeSetter<TRANS> codesetter = new CodeSetter<TRANS>(trans,request,response);
// Find declared route
route = routes.derive(request, codesetter);
- if(route==null) {
+ if (route==null) {
String method = request.getMethod();
trans.checkpoint("No Route matches "+ method + ' ' + request.getPathInfo());
response.setStatus(404); // Not Found
@@ -91,12 +91,12 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
tt.done();
}
- if(route!=null && code!=null) {
+ if (route!=null && code!=null) {
StringBuilder sb = new StringBuilder(72);
sb.append(route.auditText);
sb.append(',');
sb.append(code.desc());
- if(ct!=null) {
+ if (ct!=null) {
sb.append(", ContentType: ");
sb.append(ct);
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java
index 81b3d0a2..b11916ef 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java
@@ -67,18 +67,18 @@ public class Route<TRANS extends Trans> {
// FYI, thought about this a long time before implementing this way.
String compare;
// String special[]; // todo, expose Charset (in special) to outside
- if(isGet) {
+ if (isGet) {
compare = req.getHeader("Accept"); // Accept is used for read, as we want to agree on what caller is ready to handle
} else {
compare = req.getContentType(); // Content type used to declare what data is being created, updated or deleted (might be used for key)
}
Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> hl = content.prep(trans, compare);
- if(hl==null) {
+ if (hl==null) {
resp.setStatus(406); // NOT_ACCEPTABLE
} else {
- if(isGet) { // Set Content Type to expected content
- if("*".equals(hl.x) || "*/*".equals(hl.x)) {// if wild-card, then choose first kind of type
+ if (isGet) { // Set Content Type to expected content
+ if ("*".equals(hl.x) || "*/*".equals(hl.x)) {// if wild-card, then choose first kind of type
resp.setContentType(content.first());
} else {
resp.setContentType(hl.x);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java
index 7c69d9b7..de42e26b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java
@@ -47,12 +47,12 @@ public class Routes<TRANS extends Trans> {
// Package on purpose
synchronized Route<TRANS> findOrCreate(HttpMethods meth, String path) {
Route<TRANS> rv = null;
- for(int i=0;i<end;++i) {
- if(routes[i].resolvesTo(meth,path))rv = routes[i];
+ for (int i=0;i<end;++i) {
+ if (routes[i].resolvesTo(meth,path))rv = routes[i];
}
- if(rv==null) {
- if(end>=routes.length) {
+ if (rv==null) {
+ if (end>=routes.length) {
@SuppressWarnings("unchecked")
Route<TRANS>[] temp = new Route[end+10];
System.arraycopy(routes, 0, temp, 0, routes.length);
@@ -69,9 +69,9 @@ public class Routes<TRANS extends Trans> {
String path = req.getPathInfo();
String meth = req.getMethod();
//TODO a TREE would be better
- for(int i=0;rv==null && i<end; ++i) {
+ for (int i=0;rv==null && i<end; ++i) {
rv = routes[i].matches(meth,path);
- if(rv!=null && !codeSetter.matches(rv)) { // potential match, check if has Code
+ if (rv!=null && !codeSetter.matches(rv)) { // potential match, check if has Code
rv = null; // not quite, keep going
}
}
@@ -81,7 +81,7 @@ public class Routes<TRANS extends Trans> {
public List<RouteReport> routeReport() {
ArrayList<RouteReport> ltr = new ArrayList<>();
- for(int i=0;i<end;++i) {
+ for (int i=0;i<end;++i) {
ltr.add(routes[i].api());
}
return ltr;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
index b36fd234..85b35ac7 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
@@ -70,7 +70,7 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
public TransFilter(Access access, Connector con, TrustChecker tc, Object ... additionalTafLurs) throws CadiException, LocatorException {
cadi = new CadiHTTPManip(access, con, tc, additionalTafLurs);
String no = access.getProperty(Config.CADI_NOAUTHN, null);
- if(no!=null) {
+ if (no!=null) {
no_authn = Split.split(':', no);
} else {
no_authn=null;
@@ -101,9 +101,9 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
try {
request.setAttribute(TRANS_TAG, trans);
- if(no_authn!=null) {
- for(String prefix : no_authn) {
- if(req.getPathInfo().startsWith(prefix)) {
+ if (no_authn!=null) {
+ for (String prefix : no_authn) {
+ if (req.getPathInfo().startsWith(prefix)) {
chain.doFilter(request, response);
return;
}
@@ -128,9 +128,9 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
security.done();
}
- if(r==RESP.IS_AUTHENTICATED) {
+ if (r==RESP.IS_AUTHENTICATED) {
trans.checkpoint(resp.desc());
- if(cadi.notCadi(cw, res)) {
+ if (cadi.notCadi(cw, res)) {
chain.doFilter(cw, response);
}
} else {
@@ -138,10 +138,10 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
// Would need Cached Counter objects that are cleaned up on
// use
trans.checkpoint(resp.desc(),Env.ALWAYS);
- if(resp.isFailedAttempt())
+ if (resp.isFailedAttempt())
trans.audit().log(resp.desc());
}
- } catch(Exception e) {
+ } catch (Exception e) {
trans.error().log(e);
trans.checkpoint("Error: " + e.getClass().getSimpleName() + ": " + e.getMessage());
throw new ServletException(e);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java
index 8c57838d..1a66cf7d 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java
@@ -72,8 +72,8 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
public TypedCode<TRANS> add(HttpCode<TRANS,?> code, String ... others) {
StringBuilder sb = new StringBuilder();
boolean first = true;
- for(String str : others) {
- if(first) {
+ for (String str : others) {
+ if (first) {
first = false;
} else {
sb.append(',');
@@ -94,7 +94,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
Pair<HttpCode<TRANS,?>, List<Pair<String,Object>>> cl = new Pair<HttpCode<TRANS,?>, List<Pair<String,Object>>>(code, props);
// // breakup "plus" stuff, i.e. application/xaml+xml
// int plus = str.indexOf('+');
-// if(plus<0) {
+// if (plus<0) {
type = new Pair<String, Pair<HttpCode<TRANS,?>,List<Pair<String,Object>>>>(str, cl);
types.add(type);
return type;
@@ -102,7 +102,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
// int prev = str.indexOf('/')+1;
// String first = str.substring(0,prev);
// String nstr;
-// while(prev!=0) {
+// while (prev!=0) {
// nstr = first + (plus>-1?str.substring(prev,plus):str.substring(prev));
// type = new Pair<String, Pair<HttpCode<TRANS,?>,List<Pair<String,Object>>>>(nstr, cl);
// types.add(type);
@@ -115,7 +115,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
@Override
protected boolean props(Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type, String tag, String value) {
- if(tag.equals(Q)) { // reset the Q value (first in array)
+ if (tag.equals(Q)) { // reset the Q value (first in array)
boolean rv = true;
try {
type.y.y.get(0).y=Float.parseFloat(value);
@@ -130,10 +130,10 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
public Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> prep(TRANS trans, String compare) throws IOException, ServletException {
Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> c,rv=null;
- if(types.size()==1 && "".equals((c=types.get(0)).x)) { // if there are no checks for type, skip
+ if (types.size()==1 && "".equals((c=types.get(0)).x)) { // if there are no checks for type, skip
rv = c;
} else {
- if(compare==null || compare.length()==0) {
+ if (compare==null || compare.length()==0) {
rv = types.get(0); // first code is used
} else {
Acceptor<TRANS> acc = new Acceptor<TRANS>(types);
@@ -144,7 +144,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
} finally {
tt.done();
}
- if(accepted) {
+ if (accepted) {
switch(acc.acceptable.size()) {
case 0:
// // TODO best Status Code?
@@ -156,16 +156,16 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
default: // compare Q values to get Best Match
float bestQ = -1.0f;
Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> bestT = null;
- for(Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type : acc.acceptable) {
+ for (Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type : acc.acceptable) {
Float f = (Float)type.y.y.get(0).y; // first property is always Q
- if(f>bestQ) {
+ if (f>bestQ) {
bestQ=f;
bestT = type;
}
}
- if(bestT!=null) {
+ if (bestT!=null) {
// When it is a GET, the matched type is what is returned, so set ContentType
-// if(isGet)resp.setContentType(bestT.x); // set ContentType of Code<TRANS,?>
+// if (isGet)resp.setContentType(bestT.x); // set ContentType of Code<TRANS,?>
// rv = bestT.y.x;
rv = bestT;
}
@@ -190,17 +190,17 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
*/
public StringBuilder relatedTo(HttpCode<TRANS, ?> code, StringBuilder sb) {
boolean first = true;
- for(Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
- if(code==null || pair.y.x == code) {
- if(first) {
+ for (Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
+ if (code==null || pair.y.x == code) {
+ if (first) {
first = false;
} else {
sb.append(',');
}
sb.append(pair.x);
- for(Pair<String,Object> prop : pair.y.y) {
+ for (Pair<String,Object> prop : pair.y.y) {
// Don't print "Q". it's there for internal use, but it is only meaningful for "Accepts"
- if(!prop.x.equals(Q) || !prop.y.equals(1f) ) {
+ if (!prop.x.equals(Q) || !prop.y.equals(1f) ) {
sb.append(';');
sb.append(prop.x);
sb.append('=');
@@ -213,8 +213,8 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
public List<Pair<String, Object>> getContent(HttpCode<TRANS,?> code) {
- for(Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
- if(pair.y.x == code) {
+ for (Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
+ if (pair.y.x == code) {
return pair.y.y;
}
}
@@ -232,11 +232,11 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
tr.desc = null;
// Read through Code/TypeCode trees for all accepted Typecodes
- for(Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> tc : types) {
+ for (Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> tc : types) {
// If new, then it's new Code set, create prefix content
- if((temp=psb.get(tc.y.x))==null) {
+ if ((temp=psb.get(tc.y.x))==null) {
psb.put(tc.y.x,temp=new StringBuilder());
- if(tr.desc==null) {
+ if (tr.desc==null) {
tr.desc = tc.y.x.desc();
}
} else {
@@ -245,7 +245,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
temp.append(tc.x);
// add all properties
- for(Pair<String, Object> props : tc.y.y) {
+ for (Pair<String, Object> props : tc.y.y) {
temp.append(';');
temp.append(props.x);
temp.append('=');
@@ -254,13 +254,13 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
// Gather all ContentType possibilities for the same code together
- for(StringBuilder sb : psb.values()) {
+ for (StringBuilder sb : psb.values()) {
tr.contextTypes.add(sb.toString());
}
}
public String first() {
- if(types.size()>0) {
+ if (types.size()>0) {
return types.get(0).x;
}
return null;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java
index f4818579..adf05380 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java
@@ -35,7 +35,7 @@ public class Version {
String sparts[] = v.split("\\.");
parts = new Object[sparts.length];
System.arraycopy(sparts, 0, parts, 0, sparts.length);
- if(parts.length>1) { // has at least a minor
+ if (parts.length>1) { // has at least a minor
try {
parts[1]=Integer.decode(sparts[1]); // minor elements need to be converted to Integer for comparison
} catch (NumberFormatException e) {
@@ -46,20 +46,20 @@ public class Version {
}
public boolean equals(Object obj) {
- if(obj instanceof Version) {
+ if (obj instanceof Version) {
Version ver = (Version)obj;
int length = Math.min(parts.length, ver.parts.length);
- for(int i=0;i<length;++i) { // match on declared parts
- if(i==1) {
- if(parts[1] instanceof Integer && ver.parts[1] instanceof Integer) {
+ for (int i=0;i<length;++i) { // match on declared parts
+ if (i==1) {
+ if (parts[1] instanceof Integer && ver.parts[1] instanceof Integer) {
// Match on Minor version if this Version is less than Version to be checked
- if(((Integer)parts[1])<((Integer)ver.parts[1])) {
+ if (((Integer)parts[1])<((Integer)ver.parts[1])) {
return false;
}
continue; // don't match next line
}
}
- if(!parts[i].equals(ver.parts[i])) {
+ if (!parts[i].equals(ver.parts[i])) {
return false; // other spots exact match
}
}
@@ -80,8 +80,8 @@ public class Version {
public String toString() {
StringBuilder sb = new StringBuilder();
boolean first = true;
- for(Object obj : parts) {
- if(first) {
+ for (Object obj : parts) {
+ if (first) {
first = false;
} else {
sb.append('.');
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
index 497860af..f2495440 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
@@ -65,17 +65,17 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
String component = access.getProperty(Config.AAF_COMPONENT, null);
final String[] locator_deploy;
- if(component == null) {
+ if (component == null) {
locator_deploy = null;
} else {
locator_deploy = Split.splitTrim(':', component);
}
- if(component == null || locator_deploy==null || locator_deploy.length<2) {
+ if (component == null || locator_deploy==null || locator_deploy.length<2) {
throw new CadiException("AAF Component must include the " + Config.AAF_COMPONENT + " property, <fully qualified service name>:<full deployed version (i.e. 2.1.3.13)");
}
final String[] version = Split.splitTrim('.', locator_deploy[1]);
- if(version==null || version.length<2) {
+ if (version==null || version.length<2) {
throw new CadiException("AAF Component Version must have at least Major.Minor version");
}
app_name = Define.varReplace(locator_deploy[0]);
@@ -83,7 +83,7 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
app_interface_version = version[0]+'.'+version[1];
// Print Cipher Suites Available
- if(access.willLog(Level.DEBUG)) {
+ if (access.willLog(Level.DEBUG)) {
SSLContext context;
try {
context = SSLContext.getDefault();
@@ -94,11 +94,11 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
StringBuilder sb = new StringBuilder("Available Cipher Suites: ");
boolean first = true;
int count=0;
- for( String cs : sf.getSupportedCipherSuites()) {
- if(first)first = false;
+ for ( String cs : sf.getSupportedCipherSuites()) {
+ if (first)first = false;
else sb.append(',');
sb.append(cs);
- if(++count%4==0){sb.append('\n');}
+ if (++count%4==0){sb.append('\n');}
}
access.log(Level.DEBUG,sb);
}
@@ -121,8 +121,8 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
// Lazy Instantiation
public synchronized AAFConHttp aafCon() throws CadiException, LocatorException {
- if(aafCon==null) {
- if(access.getProperty(Config.AAF_URL,null)!=null) {
+ if (aafCon==null) {
+ if (access.getProperty(Config.AAF_URL,null)!=null) {
aafCon = _newAAFConHttp();
} else {
throw new CadiException("AAFCon cannot be constructed without " + Config.AAF_URL);
@@ -137,7 +137,7 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
* @throws LocatorException
*/
protected synchronized AAFConHttp _newAAFConHttp() throws CadiException, LocatorException {
- if(aafCon==null) {
+ if (aafCon==null) {
aafCon = new AAFConHttp(access);
}
return aafCon;
@@ -165,20 +165,20 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
protected static final String loadFromArgOrSystem(final Properties props, final String tag, final String args[], final String def) {
String tagEQ = tag + '=';
String value;
- for(String arg : args) {
- if(arg.startsWith(tagEQ)) {
+ for (String arg : args) {
+ if (arg.startsWith(tagEQ)) {
props.put(tag, value=arg.substring(tagEQ.length()));
return value;
}
}
// check System.properties
value = System.getProperty(tag);
- if(value!=null) {
+ if (value!=null) {
props.put(tag, value);
return value;
}
- if(def!=null) {
+ if (def!=null) {
props.put(tag,def);
}
return def;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
index f14d6c32..29166b0b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
@@ -72,11 +72,11 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
@SafeVarargs
public final synchronized void register(final Registrant<ENV> ... registrants) {
- if(do_register) {
- if(registrar==null) {
+ if (do_register) {
+ if (registrar==null) {
registrar = new Registrar<ENV>(env(),false);
}
- for(Registrant<ENV> r : registrants) {
+ for (Registrant<ENV> r : registrants) {
registrar.register(r);
}
}
@@ -84,11 +84,11 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
@Override
public void shutdown() {
- if(registrar!=null) {
+ if (registrar!=null) {
registrar.close(env());
registrar=null;
}
- if(service!=null) {
+ if (service!=null) {
service.destroy();
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
index a0dafed1..c5849d05 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
@@ -78,15 +78,15 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
// Properties props = access().getProperties();
// Object temp = null;
// // Critical - if no Security Protocols set, then set it. We'll just get messed up if not
-// if((temp=props.get(Config.CADI_PROTOCOLS))==null) {
-// if((temp=props.get(Config.HTTPS_PROTOCOLS))==null) {
+// if ((temp=props.get(Config.CADI_PROTOCOLS))==null) {
+// if ((temp=props.get(Config.HTTPS_PROTOCOLS))==null) {
// props.put(Config.CADI_PROTOCOLS, SecurityInfo.HTTPS_PROTOCOLS_DEFAULT);
// } else {
// props.put(Config.CADI_PROTOCOLS, temp);
// }
// }
//
-// if("1.7".equals(System.getProperty("java.specification.version"))) {
+// if ("1.7".equals(System.getProperty("java.specification.version"))) {
// System.setProperty(Config.HTTPS_CIPHER_SUITES, Config.HTTPS_CIPHER_SUITES_DEFAULT);
// }
// System.setProperty(Config.HTTPS_CIPHER_SUITES, temp.toString());
@@ -98,15 +98,15 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
Properties props = access().getProperties();
Object httpproto = null;
// Critical - if no Security Protocols set, then set it. We'll just get messed up if not
- if((httpproto=props.get(Config.CADI_PROTOCOLS))==null) {
- if((httpproto=props.get(Config.HTTPS_PROTOCOLS))==null) {
+ if ((httpproto=props.get(Config.CADI_PROTOCOLS))==null) {
+ if ((httpproto=props.get(Config.HTTPS_PROTOCOLS))==null) {
props.put(Config.CADI_PROTOCOLS, (httpproto=SecurityInfo.HTTPS_PROTOCOLS_DEFAULT));
} else {
props.put(Config.CADI_PROTOCOLS, httpproto);
}
}
- if("1.7".equals(System.getProperty("java.specification.version")) && (httpproto==null || (httpproto instanceof String && ((String)httpproto).contains("TLSv1.2")))) {
+ if ("1.7".equals(System.getProperty("java.specification.version")) && (httpproto==null || (httpproto instanceof String && ((String)httpproto).contains("TLSv1.2")))) {
System.setProperty(Config.HTTPS_CIPHER_SUITES, Config.HTTPS_CIPHER_SUITES_DEFAULT);
}
}
@@ -114,7 +114,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
@Override
public void _start(RServlet<TRANS> rserv) throws Exception {
String hostname = access().getProperty(Config.HOSTNAME, null);
- if(hostname==null) {
+ if (hostname==null) {
hostname = Inet4Address.getLocalHost().getHostName();
}
final int port = Integer.parseInt(access().getProperty("port","0"));
@@ -124,14 +124,14 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
ServerConnector conn;
String protocol;
- if(!secure || keystore==null) {
+ if (!secure || keystore==null) {
conn = new ServerConnector(server);
protocol = "http";
} else {
protocol = "https";
String keystorePassword = access().getProperty(Config.CADI_KEYSTORE_PASSWORD, null);
- if(keystorePassword==null) {
+ if (keystorePassword==null) {
throw new CadiException("No Keystore Password configured for " + keystore);
}
SslContextFactory sslContextFactory = new SslContextFactory();
@@ -142,9 +142,9 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
temp=null; // don't leave lying around
String truststore = access().getProperty(Config.CADI_TRUSTSTORE, null);
- if(truststore!=null) {
+ if (truststore!=null) {
String truststorePassword = access().getProperty(Config.CADI_TRUSTSTORE_PASSWORD, null);
- if(truststorePassword==null) {
+ if (truststorePassword==null) {
throw new CadiException("No Truststore Password configured for " + truststore);
}
sslContextFactory.setTrustStorePath(truststore);
@@ -163,7 +163,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
// sslContextFactory.setEnableCRLDP(false);
// sslContextFactory.setEnableOCSP(false);
String certAlias = access().getProperty(Config.CADI_ALIAS, null);
- if(certAlias!=null) {
+ if (certAlias!=null) {
sslContextFactory.setCertAlias(certAlias);
}
@@ -232,7 +232,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
register(service.registrants(port));
access().printf(Level.INIT, "Starting Jetty Service for %s, version %s, on %s://%s:%d", service.app_name,service.app_version,protocol,hostname,port);
server.join();
- } catch(Exception e) {
+ } catch (Exception e) {
access().log(e,"Error registering " + service.app_name);
String doExit = access().getProperty("cadi_exitOnFailure", "true");
if (doExit == "true") {
@@ -246,7 +246,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
private FilterChain buildFilterChain(final AbsService<?,?> as, final FilterChain doLast) throws CadiException, LocatorException {
Filter[] filters = as.filters();
FilterChain fc = doLast;
- for(int i=filters.length-1;i>=0;--i) {
+ for (int i=filters.length-1;i>=0;--i) {
fc = new FCImpl(filters[i],fc);
}
return fc;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
index 31b76395..fd0691b6 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
@@ -55,14 +55,14 @@ public class Log4JLogIt implements LogIt {
String etc_dir = getArgOrVM(Config.CADI_ETCDIR,args,"/opt/app/osaaf/etc");
String log_level = getArgOrVM(Config.CADI_LOGLEVEL,args,"INFO");
File logs = new File(log_dir);
- if(!logs.isDirectory()) {
+ if (!logs.isDirectory()) {
logs.delete();
}
- if(!logs.exists()) {
+ if (!logs.exists()) {
logs.mkdirs();
}
- if(System.getProperty("log4j.configuration")==null) {
+ if (System.getProperty("log4j.configuration")==null) {
System.setProperty("log4j.configuration", etc_dir+'/'+propsFile);
}
LogFileNamer lfn = new LogFileNamer(log_dir,root);
@@ -86,14 +86,14 @@ public class Log4JLogIt implements LogIt {
private static final String getArgOrVM(final String tag, final String args[], final String def) {
String tagEQ = tag + '=';
String value;
- for(String arg : args) {
- if(arg.startsWith(tagEQ)) {
+ for (String arg : args) {
+ if (arg.startsWith(tagEQ)) {
return arg.substring(tagEQ.length());
}
}
// check System.properties
value = System.getProperty(tag);
- if(value!=null) {
+ if (value!=null) {
return value;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
index eb721285..1c9f4123 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
@@ -70,16 +70,16 @@ public class Validator {
}
public final Validator nullOrBlank(String name, String str) {
- if(str==null) {
+ if (str==null) {
msg(name + " is null.");
- } else if(str.length()==0) {
+ } else if (str.length()==0) {
msg(name + " is blank.");
}
return this;
}
public final Validator isNull(String name, Object o) {
- if(o==null) {
+ if (o==null) {
msg(name + " is null.");
}
return this;
@@ -93,10 +93,10 @@ public class Validator {
}
protected final void msg(String ... strs) {
- if(msgs==null) {
+ if (msgs==null) {
msgs=new StringBuilder();
}
- for(String str : strs) {
+ for (String str : strs) {
msgs.append(str);
}
msgs.append('\n');
@@ -107,23 +107,23 @@ public class Validator {
}
public final Validator notOK(Result<?> res) {
- if(res==null) {
+ if (res==null) {
msgs.append("Result object is blank");
- } else if(res.notOK()) {
+ } else if (res.notOK()) {
msgs.append(res.getClass().getSimpleName()).append(" is not OK");
}
return this;
}
protected Validator intRange(String text, int target, int start, int end) {
- if(target<start || target>end) {
+ if (target<start || target>end) {
msg(text + " is out of range (" + start + '-' + end + ')');
}
return this;
}
protected Validator floatRange(String text, float target, float start, float end) {
- if(target<start || target>end) {
+ if (target<start || target>end) {
msg(text + " is out of range (" + start + '-' + end + ')');
}
return this;
@@ -137,25 +137,25 @@ public class Validator {
}
public final Validator permType(String type) {
- if(nob(type,NAME_CHARS)) {
+ if (nob(type,NAME_CHARS)) {
msg("Perm Type [" +type + "] is invalid.");
}
return this;
}
public final Validator permType(String type, String ns) {
- if(type==null) {
+ if (type==null) {
msg("Perm Type is null");
- } else if(ns==null) {
+ } else if (ns==null) {
msg("Perm NS is null");
- } else if(nob(type,NAME_CHARS)) {
+ } else if (nob(type,NAME_CHARS)) {
msg("Perm Type [" + (ns+(type.length()==0?"":'.')) + type + "] is invalid.");
}
return this;
}
public final Validator permInstance(String instance) {
- if(nob(instance,instChars)) {
+ if (nob(instance,instChars)) {
msg("Perm Instance [" + instance + "] is invalid.");
}
return this;
@@ -163,28 +163,28 @@ public class Validator {
public final Validator permAction(String action) {
// TODO check for correct Splits? Type|Instance|Action ?
- if(nob(action, actionChars)) {
+ if (nob(action, actionChars)) {
msg("Perm Action [" + action + "] is invalid.");
}
return this;
}
public final Validator role(String role) {
- if(nob(role, NAME_CHARS)) {
+ if (nob(role, NAME_CHARS)) {
msg("Role [" + role + "] is invalid.");
}
return this;
}
public final Validator ns(String ns) {
- if(ns==null) {
+ if (ns==null) {
msg("NS is null");
return this;
- } else if(nob(ns,NAME_CHARS)) {
+ } else if (nob(ns,NAME_CHARS)) {
msg("NS [" + ns + "] is invalid.");
}
- for(String s : nsKeywords) {
- if(ns.endsWith(s)) {
+ for (String s : nsKeywords) {
+ if (ns.endsWith(s)) {
msg("NS [" + ns + "] may not be named with NS keywords");
break;
}
@@ -193,14 +193,14 @@ public class Validator {
}
public final Validator key(String key) {
- if(nob(key,NAME_CHARS)) {
+ if (nob(key,NAME_CHARS)) {
msg("NS Prop Key [" + key + "] is invalid");
}
return this;
}
public final Validator value(String value) {
- if(nob(value,ESSENTIAL_CHARS)) {
+ if (nob(value,ESSENTIAL_CHARS)) {
msg("NS Prop value [" + value + "] is invalid");
}
return this;
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java
index a88b005d..2bc7dfa0 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java
@@ -74,7 +74,7 @@ public class JU_AbsData {
FileOutputStream is = new FileOutputStream(keyfile);
OutputStreamWriter osw = new OutputStreamWriter(is);
BufferedWriter w = new BufferedWriter(osw);
- for(int i = 0; i< 10; i++) { //Write lines to file
+ for (int i = 0; i< 10; i++) { //Write lines to file
w.write("a\nsdfasdfxasdf" + i + "\n");
}
w.close();
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java
index 099a9f00..b0af89ce 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java
@@ -53,13 +53,13 @@ public class JU_DataFile {
// Token tok = df.new Token(1024000);
// Field fld = tok.new Field('|');
//
-// while(tok.nextLine()) {
+// while (tok.nextLine()) {
// ++count;
// fld.reset();
// list.add(fld.at(0));
// }
//// Collections.sort(list);
-// for(String s: list) {
+// for (String s: list) {
// System.out.println(s);
//
// }
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java
index fadc3b67..d4330296 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java
@@ -83,7 +83,7 @@ public class JU_TextIndex {
FileOutputStream is = new FileOutputStream(keyfile);
OutputStreamWriter osw = new OutputStreamWriter(is);
BufferedWriter w = new BufferedWriter(osw);
- for(int i = 0; i< 10; i++) { //Write lines to file
+ for (int i = 0; i< 10; i++) { //Write lines to file
w.write("a\nsdfasdfxasdf" + i + "\n");
}
w.close();
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java
index acbaa9c8..0786c134 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java
@@ -59,10 +59,10 @@ public class NSAttribCompare extends RosettaCompare<NsAttribRequest> {
@Override
public void compare(NsAttribRequest t1, NsAttribRequest t2) {
assertEquals(t1.getNs(),t2.getNs());
- for(Attrib a1 : t1.getAttrib()) {
+ for (Attrib a1 : t1.getAttrib()) {
boolean ok = false;
- for(Attrib a2 : t2.getAttrib()) {
- if(a1.getKey().equals(a2.getKey()) &&
+ for (Attrib a2 : t2.getAttrib()) {
+ if (a1.getKey().equals(a2.getKey()) &&
a1.getValue().equals(a2.getValue())) {
ok = true;
break;
@@ -70,10 +70,10 @@ public class NSAttribCompare extends RosettaCompare<NsAttribRequest> {
}
assertTrue("a2 Attribs in a1",ok);
}
- for(Attrib a2 : t2.getAttrib()) {
+ for (Attrib a2 : t2.getAttrib()) {
boolean ok = false;
- for(Attrib a1 : t1.getAttrib()) {
- if(a1.getKey().equals(a2.getKey()) &&
+ for (Attrib a1 : t1.getAttrib()) {
+ if (a1.getKey().equals(a2.getKey()) &&
a1.getValue().equals(a2.getValue())) {
ok = true;
break;
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java
index 53f78b7c..c3504216 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java
@@ -56,10 +56,10 @@ public class NSCompare extends RosettaCompare<NsRequest> {
public void compare(NsRequest t1, NsRequest t2) {
assertEquals(t1.getName(),t2.getName());
assertEquals(t1.getDescription(),t2.getDescription());
- for(String s : t1.getAdmin()) {
+ for (String s : t1.getAdmin()) {
assertTrue(t2.getAdmin().contains(s));
}
- for(String s : t2.getAdmin()) {
+ for (String s : t2.getAdmin()) {
assertTrue(t1.getAdmin().contains(s));
}
assertEquals(t1.getType(),t2.getType());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/validation/test/JU_Validator.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/validation/test/JU_Validator.java
index 5a581edc..c809c55f 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/validation/test/JU_Validator.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/validation/test/JU_Validator.java
@@ -286,7 +286,7 @@ public class JU_Validator {
assertFalse(Validator.INST_CHARS.matcher("").matches());
- for( char c=0x20;c<0x7F;++c) {
+ for ( char c=0x20;c<0x7F;++c) {
boolean b;
switch(c) {
case '?':
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
index d9336d4e..4f2d9676 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
@@ -62,11 +62,11 @@ public class DefaultOrg implements Organization {
String s;
NAME=env.getProperty(realm + ".name","Default Organization");
mailHost = env.getProperty(s=(realm + ".mailHost"), null);
- if(mailHost==null) {
+ if (mailHost==null) {
throw new OrganizationException(s + PROPERTY_IS_REQUIRED);
}
mailFrom = env.getProperty(s=(realm + ".mailFrom"), null);
- if(mailFrom==null) {
+ if (mailFrom==null) {
throw new OrganizationException(s + PROPERTY_IS_REQUIRED);
}
@@ -88,16 +88,16 @@ public class DefaultOrg implements Organization {
String defFile;
String temp=env.getProperty(defFile = (getClass().getName()+".file"));
File fIdentities=null;
- if(temp==null) {
+ if (temp==null) {
temp = env.getProperty(AAF_DATA_DIR);
- if(temp!=null) {
+ if (temp!=null) {
env.warn().log(defFile, " is not defined. Using default: ",temp+"/identities.dat");
File dir = new File(temp);
fIdentities=new File(dir,"identities.dat");
- if(!fIdentities.exists()) {
+ if (!fIdentities.exists()) {
env.warn().log("No",fIdentities.getCanonicalPath(),"exists. Creating.");
- if(!dir.exists()) {
+ if (!dir.exists()) {
dir.mkdirs();
}
fIdentities.createNewFile();
@@ -105,18 +105,18 @@ public class DefaultOrg implements Organization {
}
} else {
fIdentities = new File(temp);
- if(!fIdentities.exists()) {
+ if (!fIdentities.exists()) {
String dataDir = env.getProperty(AAF_DATA_DIR);
- if(dataDir!=null) {
+ if (dataDir!=null) {
fIdentities = new File(dataDir,temp);
}
}
}
- if(fIdentities!=null && fIdentities.exists()) {
+ if (fIdentities!=null && fIdentities.exists()) {
identities = new Identities(fIdentities);
} else {
- if(fIdentities==null) {
+ if (fIdentities==null) {
throw new OrganizationException("No Identities");
} else {
throw new OrganizationException(fIdentities.getCanonicalPath() + " does not exist.");
@@ -138,7 +138,7 @@ public class DefaultOrg implements Organization {
static {
typeSet = new HashSet<>();
- for(Types t : Types.values()) {
+ for (Types t : Types.values()) {
typeSet.add(t.name());
}
}
@@ -185,9 +185,9 @@ public class DefaultOrg implements Organization {
// have domain?
int at = id.indexOf('@');
String sid;
- if(at > 0) {
+ if (at > 0) {
// Use this to prevent passwords to any but THIS domain.
-// if(!id.regionMatches(at+1, domain, 0, id.length()-at-1)) {
+// if (!id.regionMatches(at+1, domain, 0, id.length()-at-1)) {
// return false;
// }
sid = id.substring(0,at);
@@ -198,7 +198,7 @@ public class DefaultOrg implements Organization {
return isValidID(trans, sid)==null;
// Check Pattern (if checking existing is too long)
- // if(id.endsWith(SUFFIX) && ID_PATTERN.matcher(id).matches()) {
+ // if (id.endsWith(SUFFIX) && ID_PATTERN.matcher(id).matches()) {
// return true;
// }
// return false;
@@ -232,13 +232,13 @@ public class DefaultOrg implements Organization {
*/
@Override
public String isValidPassword(final AuthzTrans trans, final String user, final String password, final String... prev) {
- for(String p : prev) {
- if(password.contains(p)) { // A more sophisticated algorithm might be better.
+ for (String p : prev) {
+ if (password.contains(p)) { // A more sophisticated algorithm might be better.
return "Password too similar to previous passwords";
}
}
// If you have an Organization user/Password scheme, replace the following
- if(PASS_PATTERN.matcher(password).matches()) {
+ if (PASS_PATTERN.matcher(password).matches()) {
return "";
}
return "Password does not match " + NAME + " Password Standards";
@@ -430,7 +430,7 @@ public class DefaultOrg implements Organization {
// Extending Password give 5 extra days, max 8 days from now
rv.add(GregorianCalendar.DATE, 5);
now.add(GregorianCalendar.DATE, 8);
- if(rv.after(now)) {
+ if (rv.after(now)) {
rv = now;
}
break;
@@ -453,7 +453,7 @@ public class DefaultOrg implements Organization {
// Delegations expire max in 2 months, renewable to 3
rv.add(GregorianCalendar.MONTH, 2);
now.add(GregorianCalendar.MONTH, 3);
- if(rv.after(now)) {
+ if (rv.after(now)) {
rv = now;
}
break;
@@ -483,9 +483,9 @@ public class DefaultOrg implements Organization {
public List<Identity> getApprovers(AuthzTrans trans, String user) throws OrganizationException {
Identity orgIdentity = getIdentity(trans, user);
List<Identity> orgIdentitys = new ArrayList<>();
- if(orgIdentity!=null) {
+ if (orgIdentity!=null) {
Identity supervisor = orgIdentity.responsibleTo();
- if(supervisor!=null) {
+ if (supervisor!=null) {
orgIdentitys.add(supervisor);
}
}
@@ -519,15 +519,15 @@ public class DefaultOrg implements Organization {
switch(policy) {
case OWNS_MECHID:
case CREATE_MECHID:
- if(vars.length>0) {
+ if (vars.length>0) {
DefaultOrgIdentity thisID = getIdentity(trans,vars[0]);
- if("a".equals(thisID.identity.status)) { // MechID
+ if ("a".equals(thisID.identity.status)) { // MechID
DefaultOrgIdentity requestor = getIdentity(trans, trans.user());
- if(requestor!=null) {
+ if (requestor!=null) {
Identity mechid = getIdentity(trans, vars[0]);
- if(mechid!=null) {
+ if (mechid!=null) {
Identity sponsor = mechid.responsibleTo();
- if(sponsor!=null && requestor.fullID().equals(sponsor.fullID())) {
+ if (sponsor!=null && requestor.fullID().equals(sponsor.fullID())) {
return null;
} else {
return trans.user() + " is not the Sponsor of MechID " + vars[0];
@@ -558,19 +558,19 @@ public class DefaultOrg implements Organization {
private String extractRealm(final String r) {
int at;
- if((at=r.indexOf('@'))>=0) {
+ if ((at=r.indexOf('@'))>=0) {
return FQI.reverseDomain(r.substring(at+1));
}
return r;
}
@Override
public boolean supportsRealm(final String r) {
- if(r.endsWith(realm)) {
+ if (r.endsWith(realm)) {
return true;
} else {
String erealm = extractRealm(r);
- for(String sr : supportedRealms) {
- if(erealm.startsWith(sr)) {
+ for (String sr : supportedRealms) {
+ if (erealm.startsWith(sr)) {
return true;
}
}
@@ -588,8 +588,8 @@ public class DefaultOrg implements Organization {
Boolean urgent) throws OrganizationException {
if (mailer!=null) {
List<String> to = new ArrayList<>();
- for(String em : toList) {
- if(em.indexOf('@')<0) {
+ for (String em : toList) {
+ if (em.indexOf('@')<0) {
to.add(new DefaultOrgIdentity(trans, em, this).email());
} else {
to.add(em);
@@ -597,11 +597,11 @@ public class DefaultOrg implements Organization {
}
List<String> cc = new ArrayList<>();
- if(ccList!=null) {
- if(!ccList.isEmpty()) {
+ if (ccList!=null) {
+ if (!ccList.isEmpty()) {
- for(String em : ccList) {
- if(em.indexOf('@')<0) {
+ for (String em : ccList) {
+ if (em.indexOf('@')<0) {
cc.add(new DefaultOrgIdentity(trans, em, this).email());
} else {
cc.add(em);
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java
index 25832620..ba616ade 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java
@@ -62,7 +62,7 @@ public class DefaultOrgIdentity implements Identity {
Reuse r = org.identities.reuse();
int at = key.indexOf(dorg.getDomain());
String search;
- if(at>=0) {
+ if (at>=0) {
search = key.substring(0,at);
} else {
search = key;
@@ -71,7 +71,7 @@ public class DefaultOrgIdentity implements Identity {
- if(identity==null) {
+ if (identity==null) {
identity = Identities.NO_DATA;
}
} finally {
@@ -84,7 +84,7 @@ public class DefaultOrgIdentity implements Identity {
@Override
public boolean equals(Object b) {
- if(b instanceof DefaultOrgIdentity) {
+ if (b instanceof DefaultOrgIdentity) {
return identity.id.equals(((DefaultOrgIdentity)b).identity.id);
}
return false;
@@ -120,7 +120,7 @@ public class DefaultOrgIdentity implements Identity {
@Override
public Identity responsibleTo() throws OrganizationException {
- if("".equals(identity.responsibleTo) && isFound()) { // cover the situation of Top Dog... reports to no-one.
+ if ("".equals(identity.responsibleTo) && isFound()) { // cover the situation of Top Dog... reports to no-one.
return this;
} else {
return org.getIdentity(trans, identity.responsibleTo);
@@ -151,9 +151,9 @@ public class DefaultOrgIdentity implements Identity {
@Override
public String mayOwn() {
// Assume only Employees are responsible for Resources.
- if(identity.status==null|| identity.status.length()==0) {
+ if (identity.status==null|| identity.status.length()==0) {
return "Identity must have valid status";
- } else if(EMPLOYEE.equals(identity.status)) {
+ } else if (EMPLOYEE.equals(identity.status)) {
return null; // This is "Yes, is Responsible"
} else {
return "Reponsible Party must be an Employee";
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java
index 345e6e82..9f65b418 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java
@@ -134,7 +134,7 @@ public class Identities extends AbsData {
r.reset();
// These are new, to allow for Thread Safety
int rec = ti.find(key,r,0);
- if(rec<0) {
+ if (rec<0) {
return null;
}
r.pos(rec);
diff --git a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java
index b8069ccc..ce34e2a1 100644
--- a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java
+++ b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java
@@ -56,7 +56,7 @@ public class JU_Identities {
// AuthzTrans trans = env.newTransNoAvg();
// // Note: utilize TimeTaken, from trans.start if you want to time.
// fids = new File(DATA_IDENTITIES);
-// if(fids.exists()) {
+// if (fids.exists()) {
// ids = new Identities(fids);
// ids.open(trans, 5000);
// } else {
@@ -72,7 +72,7 @@ public class JU_Identities {
// @AfterClass
// public static void tearDownAfterClass() throws Exception {
// AuthzTrans trans = env.newTransNoAvg();
-// if(ids!=null) {
+// if (ids!=null) {
// ids.close(trans);
// }
// }
diff --git a/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java b/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
index 128c1f9b..e316e015 100644
--- a/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
+++ b/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
@@ -62,7 +62,7 @@ public class AAF_FS extends AbsService<AuthzEnv, AuthzTrans> {
route(env,GET,"/:key", cfa);
route(env,GET,"/:key/:cmd", cfa);
final String aaf_locate_url = access.getProperty(Config.AAF_LOCATE_URL, null);
- if(aaf_locate_url == null) {
+ if (aaf_locate_url == null) {
access.printf(Level.WARN, "Redirection requires property %s",Config.AAF_LOCATE_URL);
} else {
route(env,GET,"/", new Redirect(this,aaf_locate_url));
diff --git a/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java b/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java
index 9915082b..40105c6e 100644
--- a/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java
+++ b/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java
@@ -112,14 +112,14 @@ public class JU_AAF_FS {
String[] strArr = {"aaf_component=aaf_com:po.nent"};
try {
//AAF_FS.main(strArr); //Timeout caused in Jenkins but not in local
- } catch(Exception e) {
+ } catch (Exception e) {
//Failure expected until we understand how code is.
}
}
@After
public void cleanUp() {
- for(File f : d.listFiles()) {
+ for (File f : d.listFiles()) {
f.delete();
}
d.delete();
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java
index ecbd0a25..e533abbe 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java
@@ -51,7 +51,7 @@ public class CUI extends HttpCode<AuthzTrans, Void> {
int c;
StringBuilder cmd = new StringBuilder();
- while((c=isr.read())>=0) {
+ while ((c=isr.read())>=0) {
cmd.append((char)c);
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
index 84ad1b1f..48164227 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
@@ -124,7 +124,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
slot_httpServletRequest = env.slot(HTTP_SERVLET_REQUEST);
String[] component = Split.split(':', access.getProperty(Config.AAF_COMPONENT, "N/A:2.x"));
- if(component.length>1) {
+ if (component.length>1) {
deployedVersion =component[1];
} else {
deployedVersion = "2.x";
@@ -217,7 +217,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
}
public void writeError(AuthzTrans trans, Future<?> fp, HTMLGen hgen, int indent) {
- if(hgen!=null) {
+ if (hgen!=null) {
String msg = aafCon.readableErrMsg(fp);
hgen.incr(HTMLGen.P,"style=text-indent:"+indent*10+"px")
.text("<font color=\"red\"><i>Error</i>:</font> ")
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java
index c5c14d3f..4f1a7e82 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java
@@ -55,18 +55,18 @@ public class BreadCrumbs extends NamedCode {
HttpServletRequest req = trans.get(gui.slot_httpServletRequest, null);
StringBuilder key = new StringBuilder();
String value, hidden;
- for(Page p : breadcrumbs) {
+ for (Page p : breadcrumbs) {
hidden="";
// Add keys for page from commandline, where possible.
- if(p.fields().length>0) {
+ if (p.fields().length>0) {
boolean first = true;
key.setLength(0);
- for(String field : p.fields()) {
- if((value=req.getParameter(field))==null) {
+ for (String field : p.fields()) {
+ if ((value=req.getParameter(field))==null) {
hidden="style=display:none;";
break;
}
- if(first) {
+ if (first) {
first = false;
key.append('?');
} else {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java
index d1817531..c25d6641 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java
@@ -38,7 +38,7 @@ public class Display {
final String[] fields = page.fields();
final Slot slots[] = new Slot[fields.length];
String prefix = page.name() + '.';
- for(int i=0;i<slots.length;++i) {
+ for (int i=0;i<slots.length;++i) {
slots[i] = gui.env.slot(prefix + fields[i]);
}
@@ -49,26 +49,26 @@ public class Display {
* we turn such names into arrays with same index number. Then, we place them in the Transaction "Properties" so that
* it can be transferred to subclasses easily.
*/
- if(meth.equals(HttpMethods.POST)) {
+ if (meth.equals(HttpMethods.POST)) {
// Here, we'll expect FORM URL Encoded Data, which we need to get from the body
gui.route(gui.env, meth, page.url(),
new HttpCode<AuthzTrans,AAF_GUI>(gui,page.name()) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
trans.put(gui.slot_httpServletRequest, req);
- for(int i=0; i<fields.length;++i) {
+ for (int i=0; i<fields.length;++i) {
int idx = fields[i].indexOf("[]");
- if(idx<0) { // single value
+ if (idx<0) { // single value
trans.put(slots[i], req.getParameter(fields[i])); // assume first value
} else { // multi value - Expect Values to be set with Field root name "field.<int>" corresponding to an array of types
String field=fields[i].substring(0, idx)+'.';
String[] array = new String[16];
- for(Enumeration<String> names = req.getParameterNames(); names.hasMoreElements();) {
+ for (Enumeration<String> names = req.getParameterNames(); names.hasMoreElements();) {
String key = names.nextElement();
- if(key.startsWith(field)) {
+ if (key.startsWith(field)) {
try {
int x = Integer.parseInt(key.substring(field.length()));
- if(x>=array.length) {
+ if (x>=array.length) {
String[] temp = new String[x+10];
System.arraycopy(temp, 0, temp, 0, array.length);
array = temp;
@@ -95,20 +95,20 @@ public class Display {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
trans.put(gui.slot_httpServletRequest, req);
- for(int i=0; i<slots.length;++i) {
+ for (int i=0; i<slots.length;++i) {
int idx = fields[i].indexOf("[]");
- if(idx<0) { // single value
+ if (idx<0) { // single value
trans.put(slots[i], req.getParameter(fields[i]));
} else { // multi value
String[] array = new String[30];
String field=fields[i].substring(0, idx);
- for(Enumeration<String> mm = req.getParameterNames();mm.hasMoreElements();) {
+ for (Enumeration<String> mm = req.getParameterNames();mm.hasMoreElements();) {
String key = mm.nextElement();
- if(key.startsWith(field)) {
+ if (key.startsWith(field)) {
try {
int x = Integer.parseInt(key.substring(field.length()));
- if(x>=array.length) {
+ if (x>=array.length) {
String[] temp = new String[x+10];
System.arraycopy(temp, 0, temp, 0, array.length);
array = temp;
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java
index cc51983b..40aef8fb 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java
@@ -45,7 +45,7 @@ public class Form extends NamedCode {
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
- if(preamble!=null) {
+ if (preamble!=null) {
hgen.incr("p","class=preamble").text(preamble).end();
}
hgen.incr("form","method=post");
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java
index 37576008..435197c8 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java
@@ -51,7 +51,7 @@ public abstract class NamedCode implements ContentCode {
public void addAttr(boolean first, String attr) {
String[] temp = new String[idattrs.length+1];
- if(first) {
+ if (first) {
temp[0] = attr;
System.arraycopy(idattrs, 0, temp, 1, idattrs.length);
} else {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java
index 6010dd8b..deed77c0 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java
@@ -48,16 +48,16 @@ public class OrgLookupFilter implements Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain fc) throws IOException, ServletException {
final AuthzTrans trans = (AuthzTrans) req.getAttribute(TransFilter.TRANS_TAG);
- if(req instanceof HttpServletRequest) {
+ if (req instanceof HttpServletRequest) {
Principal p = ((HttpServletRequest)req).getUserPrincipal();
- if(p instanceof TaggedPrincipal) {
+ if (p instanceof TaggedPrincipal) {
((TaggedPrincipal)p).setTagLookup(new TaggedPrincipal.TagLookup() {
@Override
public String lookup() throws CadiException {
Identity id;
try {
id = trans.org().getIdentity(trans, p.getName());
- if(id!=null && id.isFound()) {
+ if (id!=null && id.isFound()) {
return id.firstName();
}
} catch (OrganizationException e) {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java
index a44a4846..1e067c44 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java
@@ -102,7 +102,7 @@ public class Page extends HTMLCacheGen {
super(CacheGen.PRETTY, new PageCode(env, 1, content));
fields = new String[en.length];
int i=-1;
- for(Enum<?> p : en) {
+ for (Enum<?> p : en) {
fields[++i]=p.name();
}
@@ -110,8 +110,8 @@ public class Page extends HTMLCacheGen {
bcUrl = url;
// Mark which fields must be "no_cache"
boolean no_cacheTemp=false;
- for(NamedCode nc : content) {
- if(nc.no_cache()) {
+ for (NamedCode nc : content) {
+ if (nc.no_cache()) {
no_cacheTemp=true;
break;
}
@@ -124,7 +124,7 @@ public class Page extends HTMLCacheGen {
public Page(AuthzEnv env, String name, String url, int backdots, String [] fields, final NamedCode ... content) throws APIException,IOException {
super(CacheGen.PRETTY, new PageCode(env, backdots, content));
- if(fields==null) {
+ if (fields==null) {
this.fields = new String[0];
} else {
this.fields = fields;
@@ -133,8 +133,8 @@ public class Page extends HTMLCacheGen {
bcUrl = url;
// Mark which fields must be "no_cache"
boolean no_cacheTemp=false;
- for(NamedCode nc : content) {
- if(nc.no_cache()) {
+ for (NamedCode nc : content) {
+ if (nc.no_cache()) {
no_cacheTemp=true;
break;
}
@@ -220,7 +220,7 @@ public class Page extends HTMLCacheGen {
// Obtain User Info, and print
TaggedPrincipal p = trans.getUserPrincipal();
String user,secured;
- if(p==null) {
+ if (p==null) {
user = "please choose a Login Authority";
secured = "NOT Secure!";
} else {
@@ -251,7 +251,7 @@ public class Page extends HTMLCacheGen {
int cIdx;
ContentCode nc;
// If BreadCrumbs, put here
- if(content.length>0 && content[0] instanceof BreadCrumbs) {
+ if (content.length>0 && content[0] instanceof BreadCrumbs) {
nc = content[0];
Mark ctnt = hgen.divID(nc.idattrs());
nc.code(cache, hgen);
@@ -265,7 +265,7 @@ public class Page extends HTMLCacheGen {
Mark inner = hgen.divID("inner");
// Content
- for(int i=cIdx;i<content.length;++i) {
+ for (int i=cIdx;i<content.length;++i) {
nc = content[i];
Mark ctnt = hgen.divID(nc.idattrs());
nc.code(cache, hgen);
@@ -280,28 +280,28 @@ public class Page extends HTMLCacheGen {
hgen.incr("h2").text("Related Links").end();
hgen.incr(UL);
String aaf_help = env.getProperty(AAF_URL_AAF_HELP,null);
- if(aaf_help!=null) {
+ if (aaf_help!=null) {
hgen.leaf(LI).leaf(A,"href="+env.getProperty(AAF_URL_AAF_HELP),"target=_blank").text("AAF WIKI").end(2);
String sub = env.getProperty(AAF_URL_AAF_HELP+".sub");
- if(sub!=null) {
+ if (sub!=null) {
hgen.incr(UL,"style=margin-left:5%");
- for(String s : Split.splitTrim(',', sub)) {
+ for (String s : Split.splitTrim(',', sub)) {
hgen.leaf(LI).leaf(A,"href="+env.getProperty(AAF_URL_AAF_HELP+".sub."+s),"target=_blank").text(s.replace('+', ' ')).end(2);
}
hgen.end();
}
}
aaf_help = env.getProperty(AAF_URL_CADI_HELP,null);
- if(aaf_help!=null) {
+ if (aaf_help!=null) {
hgen.leaf(LI).leaf(A,"href="+aaf_help,"target=_blank").text("CADI WIKI").end(2);
}
String tools = env.getProperty(AAFURL_TOOLS);
- if(tools!=null) {
+ if (tools!=null) {
hgen.hr()
.incr(HTMLGen.UL,"style=margin-left:5%")
.leaf(HTMLGen.H3).text("Related Tools").end();
- for(String tool : Split.splitTrim(',',tools)) {
+ for (String tool : Split.splitTrim(',',tools)) {
hgen.leaf(LI).leaf(A,"href="+env.getProperty(AAF_URL_TOOL_DOT+tool),"target=_blank").text(tool.replace('+', ' ')).end(2);
}
hgen.end();
@@ -350,10 +350,10 @@ public class Page extends HTMLCacheGen {
*/
public static BROWSER browser(AuthzTrans trans, Slot slot) {
BROWSER br = trans.get(slot, null);
- if(br==null) {
+ if (br==null) {
String agent = trans.agent();
int msie;
- if(agent.contains("iPhone") /* other phones? */) {
+ if (agent.contains("iPhone") /* other phones? */) {
br=BROWSER.iPhone;
} else if ((msie = agent.indexOf("MSIE"))>=0) {
msie+=5;
@@ -379,14 +379,14 @@ public class Page extends HTMLCacheGen {
protected static synchronized Permission getPerm(String instance, String action) {
Map<String,Permission> msp = perms.get(instance);
Permission p;
- if(msp==null) {
+ if (msp==null) {
msp = new HashMap<>();
perms.put(instance, msp);
p=null;
} else {
p = msp.get(instance);
}
- if(p==null) {
+ if (p==null) {
p=new AAFPermission(PERM_NS, PERM_CA_TYPE,instance,action);
msp.put(action, p);
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java
index 844270ed..7462de80 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java
@@ -31,7 +31,7 @@ public abstract class SlotCode<TRANS extends TransStore> extends NamedCode {
public SlotCode(boolean no_cache,EnvStore<?> env, String root, Enum<?> ... params) {
super(no_cache,root);
slots = new Slot[params.length];
- for(int i=0;i<params.length;++i) {
+ for (int i=0;i<params.length;++i) {
slots[i] = env.slot(root + '.' + params[i].name());
}
}
@@ -41,7 +41,7 @@ public abstract class SlotCode<TRANS extends TransStore> extends NamedCode {
}
public<T> T get(TRANS trans,int idx, T dflt) {
- if(idx>slots.length) {
+ if (idx>slots.length) {
return dflt;
}
return trans.get(slots[idx],dflt);
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java
index 079593c9..6451c4e7 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java
@@ -57,15 +57,15 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
public Table(String title, TRANS trans, Data<S,TRANS> data, String name, String ... attrs) {
super(true,name);
// prefix=postfix=null;
- for(String a : attrs) {
+ for (String a : attrs) {
addAttr(false, a);
}
ROW_MSG_SLOT=trans.slot("TABLE_ROW_MSG");
EMPTY_TABLE_SLOT=trans.slot("TABLE_EMPTY");
this.columns = data.headers();
boolean alt = false;
- for(String s : attrs) {
- if("class=std".equals(s) || "class=stdform".equals(s)) {
+ for (String s : attrs) {
+ if ("class=std".equals(s) || "class=stdform".equals(s)) {
alt=true;
}
}
@@ -89,7 +89,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
Mark tr = new Mark();
hgen.incr(table,TABLE);
- if(title==null) {
+ if (title==null) {
cache.dynamic(hgen, new DynamicCode<HTMLGen,S,TRANS>() {
@Override
public void code(S state, TRANS trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
@@ -100,7 +100,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
hgen.leaf("caption", "class=title").text(title).end();
}
hgen.incr(tr,TR);
- for(String column : columns) {
+ for (String column : columns) {
hgen.leaf("th").text(column).end();
}
hgen.end(tr);
@@ -110,7 +110,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
// End Table
hgen.end(table);
- if(other!=null) {
+ if (other!=null) {
other.code(cache,hgen);
}
@@ -119,10 +119,10 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
@Override
public void code(S state, TRANS trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
String msg;
- if((msg = trans.get(EMPTY_TABLE_SLOT, null))!=null) {
+ if ((msg = trans.get(EMPTY_TABLE_SLOT, null))!=null) {
hgen.incr("style").text("#inner tr,caption,input,p.preamble {display: none;}#inner p.notfound {margin: 0px 0px 0px 20px}").end();
hgen.incr(HTMLGen.P,"class=notfound").text(msg).end().br();
- } else if((msg=trans.get(ROW_MSG_SLOT,null))!=null) {
+ } else if ((msg=trans.get(ROW_MSG_SLOT,null))!=null) {
hgen.p(msg).br();
}
}
@@ -181,9 +181,9 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
int alt = this.alt;
Cells cells = data.get(trans,state);
- if(cells.cells.length>0) {
- for(AbsCell[] row : cells.cells) {
- if(row.length==0) {
+ if (cells.cells.length>0) {
+ for (AbsCell[] row : cells.cells) {
+ if (row.length==0) {
hgen.text("</table>")
.hr()
.text("<table>");
@@ -198,7 +198,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
alt=1;
hgen.incr(tr,TR,"class=alt");
}
- for(AbsCell cell :row) {
+ for (AbsCell cell :row) {
hgen.leaf(td, TD,cell.attrs());
cell.write(hgen);
hgen.end(td);
@@ -207,7 +207,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
}
}
// Pass Msg back to Table code, in order to place after Table Complete
- if(cells.msg!=null) {
+ if (cells.msg!=null) {
trans.put(ROW_MSG_SLOT,cells.msg);
}
} else {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java
index f362418e..cf3a6715 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java
@@ -52,7 +52,7 @@ public class XFrameFilter implements Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain fc) throws IOException, ServletException {
- if(resp instanceof HttpServletResponse) {
+ if (resp instanceof HttpServletResponse) {
@SuppressWarnings("unused")
HttpServletResponse hresp = (HttpServletResponse)resp;
((HttpServletResponse)resp).addHeader("X-Frame-Options", xframe);
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 235683d5..7d57b3d8 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
@@ -176,11 +176,11 @@ public class ApiDocs extends Page {
@Override
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Api> fa = client.read("/api",gui.getDF(Api.class));
- if(fa.get(5000)) {
+ if (fa.get(5000)) {
tt.done();
TimeTaken tt2 = trans.start("Load Data", Env.SUB);
try {
- if(fa.value!=null)for(Route r : fa.value.getRoute()) {
+ if (fa.value!=null)for (Route r : fa.value.getRoute()) {
String path = r.getPath();
// Build info
StringBuilder desc = new StringBuilder();
@@ -188,39 +188,39 @@ public class ApiDocs extends Page {
desc.append("<p class=double>");
desc.append(r.getDesc());
- if(r.getComments().size()>0) {
- for(String ct : r.getComments()) {
+ if (r.getComments().size()>0) {
+ for (String ct : r.getComments()) {
desc.append("</p><p class=api_comment>");
desc.append(ct);
}
}
- if(r.getParam().size()>0) {
+ if (r.getParam().size()>0) {
desc.append("<hr><p class=api_label>Parameters</p>");
- for(String params : r.getParam()) {
+ for (String params : r.getParam()) {
String param[] = params.split("\\s*\\|\\s*");
desc.append("</p><p class=api_contentType>");
desc.append(param[0]);
desc.append(" : ");
desc.append(param[1]);
- if("true".equalsIgnoreCase(param[2])) {
+ if ("true".equalsIgnoreCase(param[2])) {
desc.append(" (Required)");
}
}
}
- if(r.getExpected()!=0) {
+ 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().size()!=0) {
desc.append("</p><p class=api_label>Explicit HTTP Error Codes</p><p class=api_comment>");
boolean first = true;
- for(int ee : r.getExplicitErr()) {
- if(first) {
+ for (int ee : r.getExplicitErr()) {
+ if (first) {
first = false;
} else {
desc.append(", ");
@@ -232,11 +232,11 @@ public class ApiDocs extends Page {
desc.append("</p><p class=api_label>");
desc.append("GET".equals(r.getMeth())?"Accept:":"ContentType:");
Collections.sort(r.getContentType());
- if(r.getPath().startsWith("/authn/basicAuth")) {
+ if (r.getPath().startsWith("/authn/basicAuth")) {
desc.append("</p><p class=api_contentType>text/plain");
}
- for(String ct : r.getContentType()) {
- if(ct.contains("version=2")) {
+ for (String ct : r.getContentType()) {
+ if (ct.contains("version=2")) {
desc.append("</p><p class=api_contentType><a href=\"./example/");
try {
desc.append(Symm.base64noSplit.encode(ct));
@@ -258,16 +258,16 @@ public class ApiDocs extends Page {
new TextCell(desc.toString()),
};
- if(path.startsWith("/authz/perm")) {
+ if (path.startsWith("/authz/perm")) {
sa[0] = perms.size()==0?new TextCell("PERMISSION"):BLANK;
perms.add(sa);
- } else if(path.startsWith("/authz/role") || path.startsWith("/authz/userRole")) {
+ } else if (path.startsWith("/authz/role") || path.startsWith("/authz/userRole")) {
sa[0] = roles.size()==0?new TextCell("ROLE"):BLANK;
roles.add(sa);
- } else if(path.startsWith("/authz/ns")) {
+ } else if (path.startsWith("/authz/ns")) {
sa[0] = ns.size()==0?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;
@@ -277,7 +277,7 @@ public class ApiDocs extends Page {
aafOnly.add(sa);
}
}
- //TODO if(trans.fish(p))
+ //TODO if (trans.fish(p))
prepare(rv, perms,roles,ns,user);
} finally {
tt2.done();
@@ -301,8 +301,8 @@ public class ApiDocs extends Page {
private void prepare(ArrayList<AbsCell[]> rv, ArrayList<AbsCell[]> ... all) {
AbsCell lead;
AbsCell[] row;
- for(ArrayList<AbsCell[]> al : all) {
- if(al.size()>1) {
+ for (ArrayList<AbsCell[]> al : all) {
+ if (al.size()>1) {
row = al.get(0);
lead = row[0];
row[0]=BLANK;
@@ -312,7 +312,7 @@ public class ApiDocs extends Page {
public int compare(AbsCell[] ca1, AbsCell[] ca2) {
int meth = ((TextCell)ca1[2]).name.compareTo(
((TextCell)ca2[2]).name);
- if(meth == 0) {
+ if (meth == 0) {
return (HttpMethods.valueOf(((TextCell)ca1[1]).name).compareTo(
HttpMethods.valueOf(((TextCell)ca2[1]).name)));
} else {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java
index 3beed563..7da77607 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java
@@ -79,7 +79,7 @@ public class ApiExample extends Page {
"application/Void+json"
);
Future<String> fs2;
- if(typecode.contains("Request+")) {
+ if (typecode.contains("Request+")) {
fs2 = gui.client().read("/api/example/" + encoded+"?optional=true",
"application/Void+json"
);
@@ -88,19 +88,19 @@ public class ApiExample extends Page {
}
- if(fp.get(5000)) {
+ if (fp.get(5000)) {
xgen.incr(HTMLGen.H1).text("Sample Code").end()
.incr(HTMLGen.H5).text(typecode).end();
xgen.incr("pre");
- if(typecode.contains("+xml")) {
+ if (typecode.contains("+xml")) {
xgen.xml(fp.body());
- if(fs2!=null && fs2.get(5000)) {
+ if (fs2!=null && fs2.get(5000)) {
xgen.text(WITH_OPTIONAL_PARAMETERS);
xgen.xml(fs2.body());
}
} else {
xgen.text(fp.body());
- if(fs2!=null && fs2.get(5000)) {
+ if (fs2!=null && fs2.get(5000)) {
xgen.text(WITH_OPTIONAL_PARAMETERS);
xgen.text(fs2.body());
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java
index 507cb21a..8c90b491 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java
@@ -63,16 +63,16 @@ public class ApprovalAction extends Page {
lastPage += "?user="+user;
}
- if(appr==null) {
+ if (appr==null) {
hgen.p("No Approvals have been selected.");
} else {
Approval app;
final Approvals apps = new Approvals();
int count = 0;
- for(String a : appr) {
- if(a!=null) {
+ for (String a : appr) {
+ if (a!=null) {
int idx = a.indexOf('|');
- if(idx>=0) {
+ if (idx>=0) {
app = new Approval();
app.setStatus(a.substring(0,idx));
app.setTicket(a.substring(++idx));
@@ -82,7 +82,7 @@ public class ApprovalAction extends Page {
}
}
}
- if(apps.getApprovals().isEmpty()) {
+ if (apps.getApprovals().isEmpty()) {
hgen.p("No Approvals have been sent.");
} else {
TimeTaken tt = trans.start("AAF Update Approvals",Env.REMOTE);
@@ -93,7 +93,7 @@ public class ApprovalAction extends Page {
public Boolean code(Rcli<?> client) throws APIException, CadiException {
boolean fail2 = true;
Future<Approvals> fa = client.update("/authz/approval",gui.getDF(Approvals.class),apps);
- if(fa.get(AAF_GUI.TIMEOUT)) {
+ if (fa.get(AAF_GUI.TIMEOUT)) {
// Do Remote Call
fail2 = false;
hgen.p(total + (total==1?" Approval has":" Approvals have") + " been Saved");
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java
index 14d434cb..27fd5274 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java
@@ -146,9 +146,9 @@ public class ApprovalForm extends Page {
public Integer code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Approvals> fa = client.read("/authz/approval/approver/"+trans.user(),gui.getDF(Approvals.class));
int numLeft = 0;
- if(fa.get(AAF_GUI.TIMEOUT)) {
+ if (fa.get(AAF_GUI.TIMEOUT)) {
- if(fa.value!=null) {
+ if (fa.value!=null) {
for (Approval appr : fa.value.getApprovals()) {
if ("pending".equals(appr.getStatus())) {
if (userParam!=null && !appr.getUser().equalsIgnoreCase(userParam)) {
@@ -227,23 +227,23 @@ public class ApprovalForm extends Page {
boolean userOK=true;
for (Approval appr : currApproverList) {
- if(++line<MAX_LINE) { // limit number displayed at one time.
+ if (++line<MAX_LINE) { // limit number displayed at one time.
AbsCell userCell;
String user = appr.getUser();
- if(user.equals(prevUser)) {
+ if (user.equals(prevUser)) {
userCell = AbsCell.Null;
} else if (user.endsWith(DOMAIN_OF_USER)){
userOK=true;
String title;
Organization org = OrganizationFactory.obtain(trans.env(), user);
- if(org==null) {
+ if (org==null) {
title="";
} else {
Identity au = org.getIdentity(trans, user);
- if(au!=null) {
- if("MECHID".equals(au.type())) {
+ if (au!=null) {
+ if ("MECHID".equals(au.type())) {
Identity managedBy = au.responsibleTo();
- if(managedBy==null) {
+ if (managedBy==null) {
title ="title=" + au.type();
} else {
title="title=Sponsor is " + managedBy.fullName();
@@ -276,10 +276,10 @@ public class ApprovalForm extends Page {
}
}
}
- if(numLeft>0) {
+ if (numLeft>0) {
msg = "After these, there will be " + numLeft + " approvals left to process";
}
- if(rv.isEmpty()) {
+ if (rv.isEmpty()) {
if (numLeft>0) {
msg = "No Approvals to process at this time for user " + userParam +". You have "
+ numLeft + " other approvals to process.";
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java
index 8088a700..d32c7dc3 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java
@@ -77,34 +77,34 @@ trans.info().log("Step 1");
final String machine = trans.get(sMachine,null);
final String ca = trans.get(sCA, null);
final String sans = ((String)trans.get(sSans,null));
- if(sans!=null) {
- for(String s: Split.splitTrim(',', sans)) {
+ if (sans!=null) {
+ for (String s: Split.splitTrim(',', sans)) {
arti.getSans().add(s);
}
}
// Disallow IP entries, except by special Permission
- if(!trans.fish(getPerm(ca,"ip"))) {
+ if (!trans.fish(getPerm(ca,"ip"))) {
boolean ok=true;
- if(IPValidator.ip(machine)) {
+ if (IPValidator.ip(machine)) {
ok=false;
}
- if(ok) {
- for(String s: arti.getSans()) {
- if(IPValidator.ip(s)) {
+ if (ok) {
+ for (String s: arti.getSans()) {
+ if (IPValidator.ip(s)) {
ok=false;
break;
}
}
}
- if(!ok) {
+ if (!ok) {
hgen.p("Policy Failure: IPs in certificates are only allowed by Exception.");
return;
}
}
// Disallow Domain based Definitions without exception
- if(machine.startsWith("*")) { // Domain set
- if(!trans.fish(getPerm(ca, "domain"))) {
+ if (machine.startsWith("*")) { // Domain set
+ if (!trans.fish(getPerm(ca, "domain"))) {
hgen.p("Policy Failure: Domain Artifact Declarations are only allowed by Exception.");
return;
}
@@ -119,8 +119,8 @@ trans.info().log("Step 1");
arti.setRenewDays(Integer.parseInt((String)trans.get(sRenewal, null)));
arti.setNotification((String)trans.get(sNotify, null));
String[] checkbox = trans.get(sType,null);
- for(int i=0;i<CMArtiChangeForm.types.length;++i) {
- if("on".equals(checkbox[i])) {
+ for (int i=0;i<CMArtiChangeForm.types.length;++i) {
+ if ("on".equals(checkbox[i])) {
arti.getType().add(CMArtiChangeForm.types[i]);
}
}
@@ -144,14 +144,14 @@ trans.info().log("Step 1");
case CMArtiChangeForm.CREATE:
Future<Artifacts> fc;
rv = fc = client.create("/cert/artifacts", gui.artifactsDF, artifacts);
- if(fc.get(AAFcli.timeout())) {
+ if (fc.get(AAFcli.timeout())) {
hgen.p("Created Artifact " + arti.getMechid() + " on " + arti.getMachine());
ok.set(true);
}
break;
case CMArtiChangeForm.UPDATE:
Future<Artifacts> fu = client.update("/cert/artifacts", gui.artifactsDF, artifacts);
- if((rv=fu).get(AAFcli.timeout())) {
+ if ((rv=fu).get(AAFcli.timeout())) {
hgen.p("Artifact " + arti.getMechid() + " on " + arti.getMachine() + " is updated");
ok.set(true);
}
@@ -159,12 +159,12 @@ trans.info().log("Step 1");
case CMArtiChangeForm.COPY:
Future<Artifacts> future = client.read("/cert/artifacts/"+arti.getMechid()+'/'+arti.getMachine(), gui.artifactsDF);
rv = future;
- if(future.get(AAFcli.timeout())) {
- for(Artifact a : future.value.getArtifact()) { // only one, because these two are key
- for(String newMachine :Split.split(',', trans.get(sOther, ""))) {
+ if (future.get(AAFcli.timeout())) {
+ for (Artifact a : future.value.getArtifact()) { // only one, because these two are key
+ for (String newMachine :Split.split(',', trans.get(sOther, ""))) {
a.setMachine(newMachine);
Future<Artifacts> fup = client.update("/cert/artifacts", gui.artifactsDF, future.value);
- if(fup.get(AAFcli.timeout())) {
+ if (fup.get(AAFcli.timeout())) {
hgen.p("Copied to " + newMachine);
ok.set(true);
}
@@ -175,7 +175,7 @@ trans.info().log("Step 1");
case CMArtiChangeForm.DELETE:
Future<Void> fv;
rv = fv = client.delete("/cert/artifacts/"+arti.getMechid()+"/"+arti.getMachine(),"application/json");
- if(fv.get(AAFcli.timeout())) {
+ if (fv.get(AAFcli.timeout())) {
hgen.p("Deleted " + arti.getMechid() + " on " + arti.getMachine());
ok.set(true);
deleted.set(true);
@@ -185,11 +185,11 @@ trans.info().log("Step 1");
return rv;
}
});
- if(!ok.get()) {
- if(f==null) {
+ if (!ok.get()) {
+ if (f==null) {
hgen.p("Unknown Command");
} else {
- if(f.body().contains("%")) {
+ if (f.body().contains("%")) {
Error err = gui.getDF(Error.class).newData().in(TYPE.JSON).load(f.body()).asObject();
hgen.p(Vars.convert(err.getText(),err.getVariables()));
} else {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java
index 0268f498..ee55fdbc 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java
@@ -138,25 +138,25 @@ public class CMArtiChangeForm extends Page {
@Override
public Artifact code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Artifacts> fa = client.read("/cert/artifacts/"+incomingID+'/'+incomingMach, gui.artifactsDF);
- if(fa.get(AAFcli.timeout())) {
- for(Artifact arti : fa.value.getArtifact()) {
+ if (fa.get(AAFcli.timeout())) {
+ for (Artifact arti : fa.value.getArtifact()) {
return arti; // just need the first one
}
}
return null;
}
});
- if(arti==null) {
+ if (arti==null) {
Organization org = OrganizationFactory.get(trans);
Identity user = org.getIdentity(trans, incomingID);
- if(user==null) {
+ if (user==null) {
hgen.p("The mechID you typed, \"" + incomingID + "\", is not a valid " + org.getName() + " ID");
return;
}
arti = new Artifact();
arti.setMechid(incomingID);
Identity managedBy = user.responsibleTo();
- if(managedBy == null) {
+ if (managedBy == null) {
arti.setSponsor("Unknown Sponsor");
} else {
arti.setSponsor(managedBy.fullID());
@@ -173,7 +173,7 @@ public class CMArtiChangeForm extends Page {
submitText = CREATE;
delete = false;
} else {
- if(arti.getNotification()==null) {
+ if (arti.getNotification()==null) {
Organization org = OrganizationFactory.get(trans);
Identity user = org.getIdentity(trans, incomingID);
arti.setNotification("mailto:"+user.email());
@@ -184,15 +184,15 @@ public class CMArtiChangeForm extends Page {
.input(fields[0],"AppID*",true,"value="+arti.getMechid())
.input("sponsor", "Sponsor",false,"value="+arti.getSponsor(),"readonly","style=border:none;background-color:white;")
.input(fields[1],"FQDN*",true,"value="+arti.getMachine(),"style=width:130%;");
-// if(maySans) {
+// if (maySans) {
hgen.incr(HTMLGen.TR).incr(HTMLGen.TD).end()
.incr(HTMLGen.TD,"class=subtext").text("Use Fully Qualified Domain Names (that will be in DNS), ");
- if(!trans.fish(getPerm(arti.getCa(),"ip"))) {
+ if (!trans.fish(getPerm(arti.getCa(),"ip"))) {
hgen.text("NO ");
}
StringBuilder sb = null;
- for(String s: arti.getSans()) {
- if(sb==null) {
+ for (String s: arti.getSans()) {
+ if (sb==null) {
sb = new StringBuilder();
} else {
sb.append(", ");
@@ -212,7 +212,7 @@ public class CMArtiChangeForm extends Page {
.incr(HTMLGen.TR)
.incr(HTMLGen.TD).leaf("label","for=types","required").text("Artifact Types").end(2)
.incr(HTMLGen.TD);
- for(int i=0;i<types.length;++i) {
+ for (int i=0;i<types.length;++i) {
hgen.leaf("input","type=checkbox","name=types."+i,arti.getType().contains(types[i])?"checked":"").text(types[i]).end().br();
}
@@ -232,7 +232,7 @@ public class CMArtiChangeForm extends Page {
hgen.tagOnly("input","id="+fields[8],"name="+fields[8],"value="+submitText,"style=display:none;");
hgen.tagOnly("input","id=theButton","type=submit", "orig="+submitText,"value="+submitText);
- } catch(CadiException | LocatorException | OrganizationException e) {
+ } catch (CadiException | LocatorException | OrganizationException e) {
throw new APIException(e);
}
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java
index 0992ad3d..85797cb5 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java
@@ -118,11 +118,11 @@ public class CMArtifactShow extends Page {
@Override
protected String title(AuthzTrans trans) {
StringBuilder sb = new StringBuilder("X509 Certificates");
- if(sc!=null) { // initialized
+ if (sc!=null) { // initialized
sb.append(" for ");
String id = sc.get(trans,Params.id,"");
sb.append(id);
- if(id.indexOf('@')<0) {
+ if (id.indexOf('@')<0) {
sb.append('@');
sb.append(FQI.reverseDomain(sc.get(trans, Params.ns,"missingDomain")));
}
@@ -155,7 +155,7 @@ public class CMArtifactShow extends Page {
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
String str = sc.get(trans,Params.id, null);
- if(str==null) {
+ if (str==null) {
return Cells.EMPTY;
}
final String id = str.indexOf('@')>=0?str:str + '@' + FQI.reverseDomain(sc.get(trans,Params.ns, ""));
@@ -169,7 +169,7 @@ public class CMArtifactShow extends Page {
Future<Artifacts> fuArt = client.read("/cert/artifacts?mechid="+id, gui.artifactsDF);
X509Certificate[] lc;
- if(fuCI.get(AAFcli.timeout())) {
+ if (fuCI.get(AAFcli.timeout())) {
TimeTaken tt1 = trans.start("x509Certificate", Env.SUB);
try {
Collection<? extends Certificate> xcs = Factory.toX509Certificate(fuCI.value.getCerts());
@@ -185,8 +185,8 @@ public class CMArtifactShow extends Page {
lc = null;
trans.error().log("Cannot retrieve Certificates for " + id);
}
- if(fuArt.get(AAFcli.timeout())) {
- for(Artifact arti : fuArt.value.getArtifact()) {
+ if (fuArt.get(AAFcli.timeout())) {
+ for (Artifact arti : fuArt.value.getArtifact()) {
StringWriter sw = new StringWriter();
HTMLGen hgen = cas.clone(sw);
Mark mark = new Mark();
@@ -195,17 +195,17 @@ public class CMArtifactShow extends Page {
.text("Details")
.end(mark);
Date last = null;
- if(lc!=null) {
- for(X509Certificate xc : lc) {
- if(xc.getSubjectDN().getName().contains("CN="+arti.getMachine())) {
- if(last==null || last.before(xc.getNotAfter())) {
+ if (lc!=null) {
+ for (X509Certificate xc : lc) {
+ if (xc.getSubjectDN().getName().contains("CN="+arti.getMachine())) {
+ if (last==null || last.before(xc.getNotAfter())) {
last = xc.getNotAfter();
}
}
}
}
GregorianCalendar renew;
- if(last!=null) {
+ if (last!=null) {
renew = new GregorianCalendar();
renew.setTime(last);
renew.add(GregorianCalendar.DAY_OF_MONTH,arti.getRenewDays()*-1);
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java
index 7daee3dd..00e58c87 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java
@@ -90,13 +90,13 @@ public class CredDetail extends Page {
Mark js = new Mark(), fn=new Mark();
hgen.js(js).function(fn,"newArtifact")
.text("id=document.getElementById('id');")
- .text("if(id.value=='') {alert('Enter the id in box');} else {")
+ .text("if (id.value=='') {alert('Enter the id in box');} else {")
.text("window.open('"+CMArtiChangeForm.HREF+"?id='+id.value+'&ns="+ns+"','_self');}"
)
.end(fn)
.function("newPassword")
.text("id=document.getElementById('id');")
- .text("if(id.value=='') {alert('Enter the id in box');} else {")
+ .text("if (id.value=='') {alert('Enter the id in box');} else {")
.text("window.open('"+PassChangeForm.HREF+"?id='+id.value+'@"+domain+"&ns="+ns+"','_self');}"
)
.end(js);
@@ -145,7 +145,7 @@ public class CredDetail extends Page {
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final String ns = sc.get(trans, Params.ns, "");
final String id = sc.get(trans, Params.id, "");
- if(ns==null) {
+ if (ns==null) {
return Cells.EMPTY;
}
final ArrayList<AbsCell[]> rv = new ArrayList<>();
@@ -156,7 +156,7 @@ public class CredDetail extends Page {
@Override
public List<Artifact> code(Rcli<?> client)throws CadiException, ConnectException, APIException {
Future<Artifacts> fa = client.read("/cert/artifacts?ns="+ns,gui.artifactsDF);
- if(fa.get(AAFcli.timeout())) {
+ if (fa.get(AAFcli.timeout())) {
return fa.value.getArtifact();
} else {
return null;
@@ -165,8 +165,8 @@ public class CredDetail extends Page {
});
final Set<String> lns = new HashSet<>();
- if(la!=null) {
- for(Artifact a : la){
+ if (la!=null) {
+ for (Artifact a : la){
lns.add(a.getMechid());
}
}
@@ -174,7 +174,7 @@ public class CredDetail extends Page {
@Override
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Users> fu = client.read("/authn/creds/ns/"+ns,gui.getDF(Users.class));
- if(fu.get(AAFcli.timeout())) {
+ if (fu.get(AAFcli.timeout())) {
// Organize User entries
Map<String,List<Map<Integer,List<User>>>> users = new HashMap<>();
@@ -183,26 +183,26 @@ public class CredDetail extends Page {
List<User> lu = null;
for (User u : fu.value.getUser()) {
- if(u.getType() == 200) {
+ if (u.getType() == 200) {
lns.remove(u.getId());
}
lmu = users.get(u.getId());
- if(lmu==null) {
+ if (lmu==null) {
users.put(u.getId(),lmu=new ArrayList<>());
}
mu=null;
- for(Map<Integer,List<User>> xmu : lmu) {
- if(xmu.containsKey(u.getType())) {
+ for (Map<Integer,List<User>> xmu : lmu) {
+ if (xmu.containsKey(u.getType())) {
mu = xmu;
}
}
- if(mu==null) {
+ if (mu==null) {
lmu.add(mu=new HashMap<>());
}
lu = mu.get(u.getType());
- if(lu==null) {
+ if (lu==null) {
mu.put(u.getType(),lu = new ArrayList<>());
}
lu.add(u);
@@ -218,7 +218,7 @@ public class CredDetail extends Page {
StringWriter creds = new StringWriter();
hgen = cd.clone(creds);
Mark div = hgen.divID(key,ulm.getKey().equals(id)?"":"style=display:none;");
- for(Map<Integer, List<User>> miu : ulm.getValue()) {
+ for (Map<Integer, List<User>> miu : ulm.getValue()) {
Mark utable = new Mark();
hgen.leaf(utable,HTMLGen.TABLE);
@@ -226,7 +226,7 @@ public class CredDetail extends Page {
String cls;
boolean first = true;
- for( Entry<Integer, List<User>> es : miu.entrySet()) {
+ for ( Entry<Integer, List<User>> es : miu.entrySet()) {
Collections.sort(es.getValue(),new Comparator<User>() {
@Override
public int compare(User u1, User u2) {
@@ -237,22 +237,22 @@ public class CredDetail extends Page {
int xcnt = 0;
XMLGregorianCalendar oldest=null, newest=null;
String id = null;
- for(User u: es.getValue()) {
- if(id==null) {
+ for (User u: es.getValue()) {
+ if (id==null) {
id = u.getId();
}
// Need to compile entries for Certificates on this screen
- if(es.getKey()==200) {
+ if (es.getKey()==200) {
++xcnt;
- if(oldest==null || oldest.compare(u.getExpires())<0) {
+ if (oldest==null || oldest.compare(u.getExpires())<0) {
oldest = u.getExpires();
}
- if(newest==null || newest.compare(u.getExpires())<0) {
+ if (newest==null || newest.compare(u.getExpires())<0) {
newest = u.getExpires();
}
} else {
hgen.leaf(uRow,HTMLGen.TR);
- if(first) {
+ if (first) {
hgen.leaf(HTMLGen.TD,cls="class=detailFirst",STYLE_WIDTH_10);
switch(es.getKey()) {
case 1:
@@ -274,7 +274,7 @@ public class CredDetail extends Page {
"&amp;date="+u.getExpires().toXMLFormat() +
"&amp;type="+u.getType())
.text("Delete").end();
- if(first && es.getKey()<10) { // Change Password Screen
+ if (first && es.getKey()<10) { // Change Password Screen
hgen.leaf(HTMLGen.A,"class=button","href="+PassChangeForm.HREF+"?id="+id+"&amp;ns="+ns)
.text("Add")
.end();
@@ -287,7 +287,7 @@ public class CredDetail extends Page {
hgen.end(uRow);
}
}
- if(xcnt>0) { // print compilations, if any, of Certificate
+ if (xcnt>0) { // print compilations, if any, of Certificate
hgen.leaf(uRow,HTMLGen.TR)
.leaf(HTMLGen.TD,cls="class=detailFirst",STYLE_WIDTH_10).text("x509").end()
.leaf(HTMLGen.TD, cls,STYLE_WIDTH_20)
@@ -316,7 +316,7 @@ public class CredDetail extends Page {
new TextCell(creds.toString(),STYLE_WIDTH_70)
});
}
- for(String missing : lns) {
+ for (String missing : lns) {
StringWriter buttons = new StringWriter();
HTMLGen hgen = cd.clone(buttons);
hgen.leaf(HTMLGen.A,"class=button","href="+CMArtifactShow.HREF+"?id="+missing+"&amp;ns="+ns)
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java
index 5b614edc..3fd69aca 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java
@@ -56,10 +56,10 @@ public class LoginLanding extends Page {
@Override
public void code(AAF_GUI authGUI, AuthzTrans trans, Cache<HTMLGen> cache, HTMLGen xgen) throws APIException, IOException {
HttpServletRequest req = trans.get(gui.slot_httpServletRequest, null);
- if(req!=null) {
+ if (req!=null) {
String query = req.getQueryString();
- if(query!=null) {
- for(String qs : query.split("&")) {
+ if (query!=null) {
+ for (String qs : query.split("&")) {
int equals = qs.indexOf('=');
xgen.leaf(HTMLGen.A, "href="+URLDecoder.decode(qs.substring(equals+1),Config.UTF_8)).text(qs.substring(0,equals).replace('_', ' ')).end();
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java
index faf657e7..c7515e00 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java
@@ -76,7 +76,7 @@ public class NsDetail extends Page {
model.set(this);
keySlot = gui.env.slot(NAME+".ns");
gw_url = gui.env.getProperty(Config.GW_URL);
- if(gw_url==null) {
+ if (gw_url==null) {
gw_url="";
} else {
gw_url+="/aaf/2.0";
@@ -101,12 +101,12 @@ public class NsDetail extends Page {
final String nsName = trans.get(keySlot, null);
Validator v = new Validator();
v.ns(nsName);
- if(v.err()) {
+ if (v.err()) {
trans.warn().printf("Error in NsDetail Request: %s", v.errs());
return Cells.EMPTY;
}
- if(nsName==null) {
+ if (nsName==null) {
return Cells.EMPTY;
}
final ArrayList<AbsCell[]> rv = new ArrayList<>();
@@ -119,12 +119,12 @@ public class NsDetail extends Page {
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Nss> fn = client.read("/authz/nss/"+nsName,gui.getDF(Nss.class));
- if(fn.get(AAF_GUI.TIMEOUT)) {
+ if (fn.get(AAF_GUI.TIMEOUT)) {
tt.done();
try {
// TimeTaken tt = trans.start("Load Data", Env.SUB);
- for(Ns n : fn.value.getNs()) {
+ for (Ns n : fn.value.getNs()) {
String desc = (n.getDescription()!=null?n.getDescription():BLANK);
rv.add(new AbsCell[]{new TextCell("Description:"),new TextCell(desc)});
@@ -145,7 +145,7 @@ public class NsDetail extends Page {
gui.getDF(Roles.class)
);
List<String> roles = new ArrayList<>();
- if(fr.get(AAFcli.timeout())) {
+ if (fr.get(AAFcli.timeout())) {
for (Role r : fr.value.getRole()) {
roles.add(r.getName());
}
@@ -159,7 +159,7 @@ public class NsDetail extends Page {
);
List<String> perms = new ArrayList<>();
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
for (Perm p : fp.value.getPerm()) {
perms.add(p.getType() + "|" + p.getInstance() + "|" + p.getAction());
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java
index 7d11e66f..bca6c92c 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java
@@ -164,7 +164,7 @@ public class NsHistory extends Page {
final String oName = trans.get(name,null);
final String oDates = trans.get(dates,null);
- if(oName==null) {
+ if (oName==null) {
return Cells.EMPTY;
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java
index 8a2da3d3..cb942c6c 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java
@@ -71,9 +71,9 @@ public class NsInfoAction extends Page {
if (id==null || id.indexOf('@')<=0) {
hgen.p("Data Entry Failure: Please enter a valid ID, including domain.");
- } else if(password == null || password2 == null || currPass == null) {
+ } else if (password == null || password2 == null || currPass == null) {
hgen.p("Data Entry Failure: Both Password Fields need entries.");
- } else if(!password.equals(password2)) {
+ } else if (!password.equals(password2)) {
hgen.p("Data Entry Failure: Passwords do not match.");
} else { // everything else is checked by Server
final CredRequest cred = new CredRequest();
@@ -93,21 +93,21 @@ public class NsInfoAction extends Page {
boolean go;
boolean fail = true;
fcr.get(5000);
- if(fcr.code() == 200) {
+ if (fcr.code() == 200) {
hgen.p("Current Password validated");
go = true;
} else {
hgen.p(String.format("Invalid Current Password: %d %s",fcr.code(),fcr.body()));
go = false;
}
- if(go) {
+ if (go) {
tt.done();
tt = trans.start("AAF Change Password",Env.REMOTE);
try {
// Change over Cred to reset mode
cred.setPassword(password);
String start = trans.get(startDate, null);
- if(start!=null) {
+ if (start!=null) {
try {
cred.setStart(Chrono.timeStamp(Chrono.dateOnlyFmt.parse(start)));
} catch (ParseException e) {
@@ -121,7 +121,7 @@ public class NsInfoAction extends Page {
cred
);
- if(fcr.get(5000)) {
+ if (fcr.get(5000)) {
// Do Remote Call
hgen.p("New Password has been added.");
fail = false;
@@ -145,7 +145,7 @@ public class NsInfoAction extends Page {
}
}
hgen.br();
- if(fail) {
+ if (fail) {
hgen.incr("a",true,"href="+PassChangeForm.HREF+"?id="+id).text("Try again").end();
} else {
hgen.incr("a",true,"href="+Home.HREF).text("Home").end();
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java
index 2447c98b..2306a1a5 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java
@@ -80,21 +80,21 @@ public class NsInfoForm extends Page {
final String incomingID= trans.get(sID, "");
final String[] info = new String[fields.length];
final Object own_adm[] = new Object[2];
- for(int i=0;i<info.length;++i) {
+ for (int i=0;i<info.length;++i) {
info[i]="";
}
- if(incomingID.length()>0) {
+ if (incomingID.length()>0) {
TimeTaken tt = trans.start("AAF Namespace Info",Env.REMOTE);
try {
gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
@Override
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Nss> fn = client.read("/authz/nss/"+incomingID,gui.getDF(Nss.class));
- if(fn.get(AAF_GUI.TIMEOUT)) {
- for(Ns ns : fn.value.getNs()) {
+ if (fn.get(AAF_GUI.TIMEOUT)) {
+ for (Ns ns : fn.value.getNs()) {
info[0]=ns.getName();
info[1]=ns.getDescription();
- for(Ns.Attrib attr: ns.getAttrib()) {
+ for (Ns.Attrib attr: ns.getAttrib()) {
switch(attr.getKey()) {
case "mots":
info[2]=attr.getValue();
@@ -128,8 +128,8 @@ public class NsInfoForm extends Page {
.end(endTD)
.incr(endTD,HTMLGen.TD)
.tagOnly("input","id="+fields[3],"title=Owner of App, must be an Non-Bargained Employee");
- if(own_adm[0]!=null) {
- for(String s : (List<String>)own_adm[0]) {
+ if (own_adm[0]!=null) {
+ for (String s : (List<String>)own_adm[0]) {
hgen.incr("label",true).text(s).end();
}
}
@@ -142,8 +142,8 @@ public class NsInfoForm extends Page {
.end(endTD)
.incr(endTD,HTMLGen.TD)
.tagOnly("input","id="+fields[4],"title=Admins may be employees, contractors or mechIDs");
- if(own_adm[1]!=null) {
- for(String s : (List<String>)own_adm[1]) {
+ if (own_adm[1]!=null) {
+ for (String s : (List<String>)own_adm[1]) {
hgen.incr(HTMLGen.P,true).text(s).end();
}
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java
index b2a6e368..6f090a49 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java
@@ -85,7 +85,7 @@ public class NssShow extends Page {
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
ArrayList<AbsCell[]> rv = new ArrayList<>();
List<Ns> nss = trans.get(sNssByUser, null);
- if(nss==null) {
+ if (nss==null) {
TimeTaken tt = trans.start("AAF Nss by User for " + privilege,Env.REMOTE);
try {
nss = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<List<Ns>>() {
@@ -93,10 +93,10 @@ public class NssShow extends Page {
public List<Ns> code(Rcli<?> client) throws CadiException, ConnectException, APIException {
List<Ns> nss = null;
Future<Nss> fp = client.read("/authz/nss/either/" + trans.user(),gui.getDF(Nss.class));
- if(fp.get(AAF_GUI.TIMEOUT)) {
+ if (fp.get(AAF_GUI.TIMEOUT)) {
TimeTaken tt = trans.start("Load Data for " + privilege, Env.SUB);
try {
- if(fp.value!=null) {
+ if (fp.value!=null) {
nss = fp.value.getNs();
Collections.sort(nss, new Comparator<Ns>() {
public int compare(Ns ns1, Ns ns2) {
@@ -121,9 +121,9 @@ public class NssShow extends Page {
}
}
- if(nss!=null) {
- for(Ns n : nss) {
- if((isAdmin && !n.getAdmin().isEmpty())
+ if (nss!=null) {
+ for (Ns n : nss) {
+ if ((isAdmin && !n.getAdmin().isEmpty())
|| (!isAdmin && !n.getResponsible().isEmpty())) {
AbsCell[] sa = new AbsCell[] {
new RefCell(n.getName(),NsDetail.HREF
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java
index aafd0c96..10af074a 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java
@@ -82,9 +82,9 @@ public class PassChangeAction extends Page {
if (id==null || id.indexOf('@')<=0) {
hgen.p("Data Entry Failure: Please enter a valid ID, including domain.");
- } else if(password == null || password2 == null) {
+ } else if (password == null || password2 == null) {
hgen.p("Data Entry Failure: Both Password Fields need entries.");
- } else if(!password.equals(password2)) {
+ } else if (!password.equals(password2)) {
hgen.p("Data Entry Failure: Passwords do not match.");
} else { // everything else is checked by Server
final CredRequest cred = new CredRequest();
@@ -98,30 +98,30 @@ public class PassChangeAction extends Page {
boolean go = false;
try {
Organization org = OrganizationFactory.obtain(trans.env(), id);
- if(org!=null) {
+ if (org!=null) {
go = PassChangeForm.skipCurrent(trans, org.getIdentity(trans, id));
}
- } catch(OrganizationException e) {
+ } catch (OrganizationException e) {
trans.error().log(e);
}
- if(cred.getPassword()==null) {
+ if (cred.getPassword()==null) {
try {
- if(!go) {
+ if (!go) {
go=gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Boolean>() {
@Override
public Boolean code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Users> fc = client.read("/authn/creds/id/"+id,gui.getDF(Users.class));
- if(fc.get(AAFcli.timeout())) {
+ if (fc.get(AAFcli.timeout())) {
GregorianCalendar now = new GregorianCalendar();
- for(aaf.v2_0.Users.User u : fc.value.getUser()) {
- if(u.getType()<10 && u.getExpires().toGregorianCalendar().after(now)) {
+ for (aaf.v2_0.Users.User u : fc.value.getUser()) {
+ if (u.getType()<10 && u.getExpires().toGregorianCalendar().after(now)) {
return false; // an existing, non expired, password type exists
}
}
return true; // no existing, no expired password
} else {
- if(fc.code()==404) { // not found...
+ if (fc.code()==404) { // not found...
return true;
} else {
trans.error().log(gui.aafCon.readableErrMsg(fc));
@@ -131,7 +131,7 @@ public class PassChangeAction extends Page {
}
});
}
- if(!go) {
+ if (!go) {
hgen.p("Current Password required").br();
}
} catch (LocatorException e) {
@@ -144,7 +144,7 @@ public class PassChangeAction extends Page {
// Note: Need "Post", because of hiding password in SSL Data
Future<CredRequest> fcr = client.create("/authn/validate",gui.getDF(CredRequest.class),cred);
fcr.get(5000);
- if(fcr.code() == 200) {
+ if (fcr.code() == 200) {
hgen.p("Current Password validated").br();
go = true;
} else {
@@ -156,13 +156,13 @@ public class PassChangeAction extends Page {
tt.done();
}
}
- if(go) {
+ if (go) {
TimeTaken tt = trans.start("AAF Change Password",Env.REMOTE);
try {
// Change over Cred to reset mode
cred.setPassword(password);
String start = trans.get(startDate, null);
- if(start!=null) {
+ if (start!=null) {
try {
cred.setStart(Chrono.timeStamp(Chrono.dateOnlyFmt.parse(start)));
} catch (ParseException e) {
@@ -171,7 +171,7 @@ public class PassChangeAction extends Page {
}
Future<CredRequest> fcr = gui.clientAsUser(trans.getUserPrincipal()).create("/authn/cred",gui.getDF(CredRequest.class),cred);
- if(fcr.get(AAFcli.timeout())) {
+ if (fcr.get(AAFcli.timeout())) {
// Do Remote Call
hgen.p("New Password has been added. The previous one is still valid until Expiration.");
fail = false;
@@ -194,10 +194,10 @@ public class PassChangeAction extends Page {
}
hgen.br();
- if(fail) {
+ if (fail) {
hgen.incr(HTMLGen.A,true,"class=greenbutton","href="+PassChangeForm.HREF+"?id="+id).text("Try again").end();
} else {
- if(ns==null) {
+ if (ns==null) {
hgen.incr(HTMLGen.A,true,"class=greenbutton","href="+Home.HREF).text("Back").end();
} else {
hgen.incr(HTMLGen.A,true,"class=greenbutton","href="+CredDetail.HREF+"?id="+id+"&ns="+ns).text("Back").end();
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java
index dcaed047..499c02dd 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java
@@ -81,14 +81,14 @@ public class PassChangeForm extends Page {
public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
String incomingID= trans.get(sID, "");
boolean skipCurrent = false;
- if(incomingID.length()>0) {
+ if (incomingID.length()>0) {
try {
Organization org = OrganizationFactory.obtain(trans.env(), incomingID);
- if(org==null) {
+ if (org==null) {
hgen.incr(HTMLGen.H4,"style=color:red;").text("Error: There is no supported company for ").text(incomingID).end();
} else {
Identity user = org.getIdentity(trans, incomingID);
- if(user==null) {
+ if (user==null) {
int at = incomingID.indexOf('@');
hgen.incr(HTMLGen.H4,"style=color:red;").text("Error: You are not the sponsor of '").text(at<0?incomingID:incomingID.substring(0,at))
.text("' defined at ").text(org.getName()).end();
@@ -97,23 +97,23 @@ public class PassChangeForm extends Page {
// Owners/or the IDs themselves are allowed to reset password without previous one
skipCurrent=skipCurrent(trans, user);
- if(!skipCurrent) {
+ if (!skipCurrent) {
final String id = incomingID;
try {
skipCurrent=gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Boolean>() {
@Override
public Boolean code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Users> fc = client.read("/authn/creds/id/"+id,gui.getDF(Users.class));
- if(fc.get(AAFcli.timeout())) {
+ if (fc.get(AAFcli.timeout())) {
GregorianCalendar now = new GregorianCalendar();
- for(aaf.v2_0.Users.User u : fc.value.getUser()) {
- if(u.getType()<10 && u.getType()>=1 && u.getExpires().toGregorianCalendar().after(now)) {
+ for (aaf.v2_0.Users.User u : fc.value.getUser()) {
+ if (u.getType()<10 && u.getType()>=1 && u.getExpires().toGregorianCalendar().after(now)) {
return false; // an existing, non expired, password type exists
}
}
return true; // no existing, no expired password
} else {
- if(fc.code()==404) { // not found...
+ if (fc.code()==404) { // not found...
return true;
} else {
trans.error().log(gui.aafCon.readableErrMsg(fc));
@@ -135,10 +135,10 @@ public class PassChangeForm extends Page {
}
hgen.input(fields[0],"ID*",true,"value="+incomingID,(incomingID.length()==0?"":"readonly"));
- if(!skipCurrent) {
+ if (!skipCurrent) {
hgen.input(fields[1],"Current Password*",true,"type=password");
}
- if(skipCurrent) {
+ if (skipCurrent) {
hgen.input(fields[1],"",false,"type=hidden", "value=").end();
}
@@ -166,10 +166,10 @@ public class PassChangeForm extends Page {
public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
try {
Organization org = OrganizationFactory.obtain(trans.env(),trans.getUserPrincipal().getName());
- if(org!=null) {
+ if (org!=null) {
hgen.incr(HTMLGen.H4).text("Password Rules for ").text(org.getName()).end()
.incr(HTMLGen.UL);
- for(String line : org.getPasswordRules()) {
+ for (String line : org.getPasswordRules()) {
hgen.leaf(HTMLGen.LI).text(line).end();
}
hgen.end();
@@ -187,14 +187,14 @@ public class PassChangeForm extends Page {
// Package on Purpose
static boolean skipCurrent(AuthzTrans trans, Identity user) throws OrganizationException {
- if(user!=null) {
+ if (user!=null) {
// Should this be an abstractable Policy?
String tuser = trans.user();
- if(user.fullID().equals(trans.user())) {
+ if (user.fullID().equals(trans.user())) {
return true;
} else {
Identity manager = user.responsibleTo();
- if(tuser.equals(user.fullID()) || manager.isFound()) {
+ if (tuser.equals(user.fullID()) || manager.isFound()) {
return true;
}
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java
index 2ad7ca5e..f66e8bcb 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java
@@ -65,13 +65,13 @@ public class PassDeleteAction extends Page {
@Override
public String code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<CredRequest> fcr = client.delete("/authn/cred", gui.getDF(CredRequest.class),cr);
- if(!fcr.get(AAFcli.timeout())) {
+ if (!fcr.get(AAFcli.timeout())) {
return gui.aafCon.readableErrMsg(fcr);
}
return null;
}
});
- if(err==null) {
+ if (err==null) {
hgen.p("Password " + cr.getId() + ", " + cr.getEntry() + " is Deleted");
} else {
hgen.p(err);
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java
index a4970e3c..22c3fd4d 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java
@@ -125,10 +125,10 @@ public class PendingRequestsShow extends Page {
TimeTaken tt = trans.start("AAF Get Approvals by User",Env.REMOTE);
try {
Future<Approvals> fa = client.read("/authz/approval/user/"+trans.user(),gui.getDF(Approvals.class));
- if(fa.get(5000)) {
+ if (fa.get(5000)) {
tt.done();
tt = trans.start("Load Data", Env.SUB);
- if(fa.value!=null) {
+ if (fa.value!=null) {
List<Approval> approvals = fa.value.getApprovals();
Collections.sort(approvals, new Comparator<Approval>() {
@Override
@@ -140,7 +140,7 @@ public class PendingRequestsShow extends Page {
});
String prevTicket = null;
- for(Approval a : approvals) {
+ for (Approval a : approvals) {
String approver = a.getApprover();
String approverShort = approver.substring(0,approver.indexOf('@'));
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java
index 750f725f..7d31d0e4 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java
@@ -92,7 +92,7 @@ public class PermDetail extends Page {
.permInstance(pInstance)
.permAction(pAction);
- if(v.err()) {
+ if (v.err()) {
trans.warn().printf("Error in PermDetail Request: %s", v.errs());
return Cells.EMPTY;
}
@@ -108,17 +108,17 @@ public class PermDetail extends Page {
try {
Future<Perms> fp= client.read("/authz/perms/"+pType + '/' + pInstance + '/' + pAction,gui.getDF(Perms.class));
- if(fp.get(AAF_GUI.TIMEOUT)) {
+ if (fp.get(AAF_GUI.TIMEOUT)) {
tt.done();
tt = trans.start("Load Data", Env.SUB);
List<Perm> ps = fp.value.getPerm();
- if(!ps.isEmpty()) {
+ if (!ps.isEmpty()) {
Perm perm = fp.value.getPerm().get(0);
String desc = (perm.getDescription()!=null?perm.getDescription():BLANK);
rv.add(new AbsCell[]{new TextCell("Description:"),new TextCell(desc)});
boolean first=true;
- for(String r : perm.getRoles()) {
- if(first){
+ for (String r : perm.getRoles()) {
+ if (first){
first=false;
rv.add(new AbsCell[] {
new TextCell("Associated Roles:"),
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java
index 8839ed81..9d53c535 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java
@@ -94,7 +94,7 @@ public class PermGrantAction extends Page {
grantReq
);
- if(fgrant.get(5000)) {
+ if (fgrant.get(5000)) {
hgen.p("Permission has been granted to role.");
fail = false;
} else {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java
index 1ecf3d30..71958060 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java
@@ -108,7 +108,7 @@ public class PermGrantForm extends Page {
hgen
.incr("option", "value=").text("Other").end()
.end(selectRow);
- if(roleValue==null) {
+ if (roleValue==null) {
hgen.input(fields[3],"Role", true, "placeholder=or type a role here");
} else {
hgen.input(fields[3],"Role",true, "value="+roleValue);
@@ -133,7 +133,7 @@ public class PermGrantForm extends Page {
TimeTaken tt = trans.start("AAF get my roles",Env.REMOTE);
try {
Future<Roles> fr = client.read("/authz/roles/user/"+trans.user(),gui.getDF(Roles.class));
- if(fr.get(5000)) {
+ if (fr.get(5000)) {
tt.done();
tt = trans.start("Load Data", Env.SUB);
if (fr.value != null) for (Role r : fr.value.getRole()) {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java
index f3464bf9..bbaf419f 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java
@@ -171,7 +171,7 @@ public class PermHistory extends Page {
final String oName = trans.get(sType,null);
final String oDates = trans.get(sDates,null);
- if(oName==null) {
+ if (oName==null) {
return Cells.EMPTY;
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java
index 22ba95b9..7dff0815 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java
@@ -84,11 +84,11 @@ public class PermsShow extends Page {
@Override
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Perms> fp = client.read("/authz/perms/user/"+trans.user(), gui.getDF(Perms.class));
- if(fp.get(5000)) {
+ if (fp.get(5000)) {
TimeTaken ttld = trans.start("Load Data", Env.SUB);
try {
- if(fp.value!=null) {
- for(Perm p : fp.value.getPerm()) {
+ if (fp.value!=null) {
+ for (Perm p : fp.value.getPerm()) {
AbsCell[] sa = new AbsCell[] {
new RefCell(p.getType(),PermDetail.HREF
+"?type="+p.getType()
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java
index 0d0d03ad..090b6e3c 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java
@@ -80,7 +80,7 @@ public class RequestDetail extends Page {
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
Cells rv=Cells.EMPTY;
final String ticket = trans.get(sTicket, null);
- if(ticket!=null) {
+ if (ticket!=null) {
try {
rv = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Cells>() {
@Override
@@ -93,7 +93,7 @@ public class RequestDetail extends Page {
gui.getDF(Approvals.class)
);
- if(fa.get(AAF_GUI.TIMEOUT)) {
+ if (fa.get(AAF_GUI.TIMEOUT)) {
if (!trans.user().equals(fa.value.getApprovals().get(0).getUser())) {
return Cells.EMPTY;
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java
index d5a89c2c..bfc258bc 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java
@@ -107,7 +107,7 @@ public class RoleDetail extends Page {
final String pRole = trans.get(sRoleName, null);
Validator v = new Validator();
v.role(pRole);
- if(v.err()) {
+ if (v.err()) {
trans.warn().printf("Error in PermDetail Request: %s", v.errs());
return;
}
@@ -121,9 +121,9 @@ public class RoleDetail extends Page {
try {
Future<Roles> fr = client.read("/authz/roles/"+pRole+"?ns",gui.getDF(Roles.class));
Future<UserRoles> fur = client.read("/authz/userRoles/role/"+pRole,gui.getDF(UserRoles.class));
- if(fr.get(AAF_GUI.TIMEOUT)) {
+ if (fr.get(AAF_GUI.TIMEOUT)) {
List<Role> roles = fr.value.getRole();
- if(!roles.isEmpty()) {
+ if (!roles.isEmpty()) {
Role role = fr.value.getRole().get(0);
trans.put(sRole, role);
Boolean mayWrite = trans.fish(new AAFPermission(role.getNs(),ACCESS,":role:"+role.getName(),"write"));
@@ -131,7 +131,7 @@ public class RoleDetail extends Page {
Boolean mayApprove = trans.fish(new AAFPermission(role.getNs(),ACCESS,":role:"+role.getName(),"approve"));
trans.put(sMayApprove, mayApprove);
- if(mayWrite || mayApprove) {
+ if (mayWrite || mayApprove) {
Mark js = new Mark();
Mark fn = new Mark();
hgen.js(js)
@@ -160,7 +160,7 @@ public class RoleDetail extends Page {
return false;
}
- if(fur.get(AAF_GUI.TIMEOUT)) {
+ if (fur.get(AAF_GUI.TIMEOUT)) {
trans.put(sUserRole, fur.value.getUserRole());
} else {
trans.error().printf("Error calling AAF for UserRoles in GUI, Role Detail %d: %s",fr.code(),fr.body());
@@ -184,7 +184,7 @@ public class RoleDetail extends Page {
final Role role = trans.get(sRole,null);
ArrayList<AbsCell[]> rv = new ArrayList<>();
- if(role!=null) {
+ if (role!=null) {
boolean mayWrite = trans.get(sMayWrite, false);
boolean mayApprove = trans.get(sMayApprove, false);
@@ -192,7 +192,7 @@ public class RoleDetail extends Page {
rv.add(new AbsCell[]{
new TextCell("Role:","width=45%"),
new TextCell(pRole)});
- if(mayWrite) {
+ if (mayWrite) {
rv.add(new AbsCell[]{
new TextCell("Description:","width=45%"),
new TextInputCell("description","textInput",desc,"id=descText","onkeypress=touchedDesc()"),
@@ -211,9 +211,9 @@ public class RoleDetail extends Page {
boolean protectedRole = role.getName().endsWith(".owner") ||
role.getName().endsWith(".admin");
boolean first = true;
- for(Pkey r : role.getPerms()) {
+ for (Pkey r : role.getPerms()) {
String key=r.getType() + '|' + r.getInstance() + '|' + r.getAction();
- if(mayWrite) {
+ if (mayWrite) {
rv.add(new AbsCell[] {
AbsCell.Null,
protectedRole && r.getType().endsWith(".access")
@@ -223,7 +223,7 @@ public class RoleDetail extends Page {
new TextCell(key)
});
} else {
- if(first) {
+ if (first) {
rv.add(new AbsCell[] {
new TextCell("Associated Permissions:","width=45%"),
new TextCell(key)
@@ -238,7 +238,7 @@ public class RoleDetail extends Page {
}
}
- if(mayApprove) {
+ if (mayApprove) {
rv.add(AbsCell.HLINE);
//
@@ -249,8 +249,8 @@ public class RoleDetail extends Page {
});
List<UserRole> userroles = trans.get(sUserRole,null);
- if(userroles!=null) {
- for(UserRole ur : userroles) {
+ if (userroles!=null) {
+ for (UserRole ur : userroles) {
String tag = "userrole";
rv.add(new AbsCell[] {
@@ -284,10 +284,10 @@ public class RoleDetail extends Page {
@Override
public void postfix(AAF_GUI state, AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) {
final Mark mark = trans.get(sMark, null);
- if(mark!=null) {
+ if (mark!=null) {
hgen.tagOnly("input", "type=submit", "value=Submit");
final String pNS = trans.get(sNS, null);
- if(pNS!=null && pNS.length()>0) {
+ if (pNS!=null && pNS.length()>0) {
hgen.leaf(mark,HTMLGen.A,"href="+NsDetail.HREF+"?ns="+pNS,"class=greenbutton").text("Back").end(mark);
}
hgen.end(mark);
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java
index 1f00d955..fb64cd6e 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java
@@ -67,7 +67,7 @@ public class RoleDetailAction extends Page {
public void code(final AAF_GUI gui, final AuthzTrans trans,final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
final HttpServletRequest req = trans.get(sReq, null);
final String role = getSingleParam(req,"role");
- if(role==null) {
+ if (role==null) {
hgen.text("Parameter 'role' is required").end();
} else {
// Run Validations
@@ -79,14 +79,14 @@ public class RoleDetailAction extends Page {
List<TypedFuture> ltf = new ArrayList<>();
String text;
Map<String, String[]> pm = (Map<String, String[]>)req.getParameterMap();
- for(final Entry<String, String[]> es : pm.entrySet()) {
- for(final String v : es.getValue()) {
+ for (final Entry<String, String[]> es : pm.entrySet()) {
+ for (final String v : es.getValue()) {
TimeTaken tt = null;
try {
switch(es.getKey()) {
case "desc": // Check box set
String desc = getSingleParam(req, "description");
- if(desc!=null) {
+ if (desc!=null) {
text = "Setting Description on " + role + " to " + desc;
tt = trans.start(text, Env.REMOTE);
RoleRequest rr = new RoleRequest();
@@ -102,7 +102,7 @@ public class RoleDetailAction extends Page {
text = "Ungranting Permission '" + v + "' from '" + role + '\'';
tt = trans.start(text, Env.REMOTE);
String[] pf = Split.splitTrim('|', v);
- if(pf.length==3) {
+ if (pf.length==3) {
Pkey perm = new Pkey();
perm.setType(pf[0]);
perm.setInstance(pf[1]);
@@ -135,7 +135,7 @@ public class RoleDetailAction extends Page {
// System.out.println(es.getKey() + "=" + v);
}
} finally {
- if(tt!=null) {
+ if (tt!=null) {
tt.done();
tt=null;
}
@@ -143,11 +143,11 @@ public class RoleDetailAction extends Page {
}
}
- if(ltf.isEmpty()) {
+ if (ltf.isEmpty()) {
hgen.p("No Changes");
} else {
- for(TypedFuture tf : ltf) {
- if(tf.future.get(5000)) {
+ for (TypedFuture tf : ltf) {
+ if (tf.future.get(5000)) {
hgen.p("<font color=\"green\"><i>Success</i>:</font> " + tf.text);
} else {
// Note: if handling of special Error codes is required, use
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java
index 234b82c2..fdf6f9e3 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java
@@ -165,7 +165,7 @@ public class RoleHistory extends Page {
final String oDates = trans.get(dates,null);
Cells rv = Cells.EMPTY;
- if(oName!=null) {
+ if (oName!=null) {
try {
rv = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Cells>() {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java
index ffa8e3c2..414c4161 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java
@@ -95,7 +95,7 @@ public class RolesShow extends Page {
try {
Future<UserRoles> fur = client.read("/authz/userRoles/user/"+trans.user(),gui.getDF(UserRoles.class));
if (fur.get(5000) && fur.value != null) for (UserRole u : fur.value.getUserRole()) {
- if(u.getExpires().compare(Chrono.timeStamp()) < 0) {
+ if (u.getExpires().compare(Chrono.timeStamp()) < 0) {
AbsCell[] sa = new AbsCell[] {
new TextCell(u.getRole() + "*", CLASS_EXPIRED),
new TextCell(new SimpleDateFormat(DATE_TIME_FORMAT).format(u.getExpires().toGregorianCalendar().getTime()),CLASS_EXPIRED),
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java
index 04e0e845..ed4c19d9 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java
@@ -68,7 +68,7 @@ public class UserRoleExtend extends Page {
@Override
public Void code(Rcli<?> client)throws CadiException, ConnectException, APIException {
Future<Void> fv = client.update("/authz/userRole/extend/"+user+"/"+role+"?request=true");
- if(fv.get(5000)) {
+ if (fv.get(5000)) {
// not sure if we'll ever hit this
hgen.p("Extended User ["+ user+"] in Role [" +role+"]");
} else {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java
index 73aa3e9f..11126f89 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java
@@ -70,7 +70,7 @@ public class UserRoleRemove extends Page {
Future<Void> fv = client.delete(
"/authz/userRole/"+user+"/"+role+"?request=true",Void.class);
- if(fv.get(5000)) {
+ if (fv.get(5000)) {
// not sure if we'll ever hit this
hgen.p("User ["+ user+"] Removed from Role [" +role+"]");
} else {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java
index 5fc82140..759d87f4 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java
@@ -36,7 +36,7 @@ public class RefCell extends AbsCell {
public RefCell(String name, String href, boolean newWindow, String... attributes) {
this.name = name;
- if(newWindow) {
+ if (newWindow) {
str = new String[attributes.length+2];
str[attributes.length]="target=_blank";
} else {
diff --git a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
index 34371a1f..9190c665 100644
--- a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
+++ b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
@@ -70,7 +70,7 @@ public class AAF_Hello extends AbsService<AuthzEnv,AuthzTrans> {
aafAuthn = aafCon().newAuthn(aafLurPerm);
String aaf_env = env.getProperty(Config.AAF_ENV);
- if(aaf_env==null) {
+ if (aaf_env==null) {
throw new APIException("aaf_env needs to be set");
}
diff --git a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java
index 234dfe14..7fef0ba2 100644
--- a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java
+++ b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java
@@ -68,12 +68,12 @@ public class API_Hello {
ServletOutputStream os = resp.getOutputStream();
os.print("Hello AAF ");
String perm = pathParam(req, "perm");
- if(perm!=null && perm.length()>0) {
+ if (perm!=null && perm.length()>0) {
os.print('(');
os.print(req.getUserPrincipal().getName());
TimeTaken tt = trans.start("Authorize perm", Env.REMOTE);
try {
- if(req.isUserInRole(perm)) {
+ if (req.isUserInRole(perm)) {
os.print(" has ");
} else {
os.print(" does not have ");
@@ -103,12 +103,12 @@ public class API_Hello {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(req.getInputStream()));
StringBuilder sb = new StringBuilder();
- while(br.ready()) {
+ while (br.ready()) {
sb.append(br.readLine());
}
String content = sb.toString();
trans.info().printf("Content from %s: %s\n", pathParam(req, ":id"),content);
- if(content.startsWith("{") && content.endsWith("}")) {
+ if (content.startsWith("{") && content.endsWith("}")) {
resp.setStatus(201 /* OK */);
} else {
resp.getOutputStream().write(NOT_JSON);
@@ -130,7 +130,7 @@ public class API_Hello {
sb.append('"');
String perm = pathParam(req, "perm");
trans.info().printf("Read request from %s: %s\n", pathParam(req, ":id"),perm);
- if(perm!=null && perm.length()>0) {
+ if (perm!=null && perm.length()>0) {
TimeTaken tt = trans.start("Authorize perm", Env.REMOTE);
try {
sb.append(",\"validation\": { \"permission\" : \"");
@@ -157,12 +157,12 @@ public class API_Hello {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(req.getInputStream()));
StringBuilder sb = new StringBuilder();
- while(br.ready()) {
+ while (br.ready()) {
sb.append(br.readLine());
}
String content = sb.toString();
trans.info().printf("Content from %s: %s\n", pathParam(req, ":id"),content);
- if(content.startsWith("{") && content.endsWith("}")) {
+ if (content.startsWith("{") && content.endsWith("}")) {
resp.setStatus(200 /* OK */);
resp.getOutputStream().print(content);
} else {
diff --git a/auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java b/auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java
index f41826d9..e85431d3 100644
--- a/auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java
+++ b/auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java
@@ -46,7 +46,7 @@ public class HelloTester {
try {
Define.set(access);
String uriPrefix = access.getProperty("locatorURI",null);
- if(uriPrefix==null) {
+ if (uriPrefix==null) {
System.out.println("You must add \"locatorURI=<uri>\" to the command line or VM_Args");
} else {
SecurityInfoC<HttpURLConnection> si = SecurityInfoC.instance(access, HttpURLConnection.class);
@@ -57,12 +57,12 @@ public class HelloTester {
String pathinfo = "/hello";
final int iterations = Integer.parseInt(access.getProperty("iterations","5"));
System.out.println("Calling " + loc + " with Path " + pathinfo + ' ' + iterations + " time" + (iterations==1?"":"s"));
- for(int i=0;i<iterations;++i) {
+ for (int i=0;i<iterations;++i) {
aafcon.best(new Retryable<Void> () {
@Override
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<String> fs = client.read("/hello","text/plain");
- if(fs.get(5000)) {
+ if (fs.get(5000)) {
System.out.print(fs.body());
} else {
System.err.println("Ooops, missed one: " + fs.code() + ": " + fs.body());
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
index 545b6b47..bd44dfce 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
@@ -120,7 +120,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
facade_1_1_XML = LocateFacadeFactory.v1_1(env,this,trans,Data.TYPE.XML);
synchronized(env) {
- if(cacheUser == null) {
+ if (cacheUser == null) {
cacheUser = Cache.obtain(USER_PERMS);
Cache.startCleansing(env, USER_PERMS);
}
@@ -163,7 +163,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
String version = "1.0";
// Get Correct API Class from Mapper
Class<?> respCls = facade.mapper().getClass(api);
- if(respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
+ if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
// setup Application API HTML ContentTypes for JSON and Route
String application = applicationJSON(respCls, version);
route(env,meth,path,code,application,"application/json;version="+version,"*/*","*");
@@ -186,7 +186,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
@Override
protected AAFConHttp _newAAFConHttp() throws CadiException {
try {
- if(dal==null) {
+ if (dal==null) {
dal = AbsAAFLocator.create(aaf_service_name,Config.AAF_DEFAULT_VERSION);
}
// utilize pre-constructed DirectAAFLocator
@@ -197,7 +197,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
}
public Locator<URI> getGUILocator() throws LocatorException {
- if(gui_locator==null) {
+ if (gui_locator==null) {
gui_locator = AbsAAFLocator.create(aaf_gui_name,Config.AAF_DEFAULT_VERSION);
}
return gui_locator;
@@ -228,7 +228,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
@Override
public void destroy() {
Cache.stopTimer();
- if(cluster!=null) {
+ if (cluster!=null) {
cluster.close();
}
super.destroy();
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java
index c5239a5a..30258d80 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java
@@ -45,7 +45,7 @@ public class BasicAuthCode extends LocateCode {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Principal p = trans.getUserPrincipal();
- if(p == null) {
+ if (p == null) {
trans.error().log("Transaction not Authenticated... no Principal");
} else if (p instanceof BasicPrincipal) {
// the idea is that if call is made with this credential, and it's a BasicPrincipal, it's ok
@@ -55,12 +55,12 @@ public class BasicAuthCode extends LocateCode {
} else if (p instanceof X509Principal) {
// Since X509Principal has priority, BasicAuth Info might be there, but not validated.
String ba;
- if((ba=req.getHeader("Authorization"))!=null && ba.startsWith("Basic ")) {
+ if ((ba=req.getHeader("Authorization"))!=null && ba.startsWith("Basic ")) {
ba = Symm.base64noSplit.decode(ba.substring(6));
int colon = ba.indexOf(':');
- if(colon>=0) {
+ if (colon>=0) {
String err;
- if((err=authn.validate(ba.substring(0, colon), ba.substring(colon+1),trans))==null) {
+ if ((err=authn.validate(ba.substring(0, colon), ba.substring(colon+1),trans))==null) {
resp.setStatus(HttpStatus.OK_200);
} else {
trans.audit().log(ba.substring(0,colon),": ",err);
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java
index 85cee82f..b5ab4351 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java
@@ -78,7 +78,7 @@ public class API_AAFAccess {
try {
final String accept = req.getHeader("ACCEPT");
final String user = pathParam(req,":user");
- if(!user.contains("@")) {
+ if (!user.contains("@")) {
context.error(trans,resp,Result.ERR_BadData,"User [%s] must be fully qualified with domain",user);
return;
}
@@ -91,14 +91,14 @@ public class API_AAFAccess {
tt2.done();
}
- if(d==null || d.data.isEmpty()) {
+ if (d==null || d.data.isEmpty()) {
tt2 = trans.start("AAF Service Call",Env.REMOTE);
try {
gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
@Override
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<String> fp = client.read("/authz/perms/user/"+user,accept);
- if(fp.get(5000)) {
+ if (fp.get(5000)) {
gwAPI.cacheUser.put(key, new Dated(new User(fp.code(),fp.body()),gwAPI.expireIn));
resp.setStatus(HttpStatus.OK_200);
ServletOutputStream sos;
@@ -159,7 +159,7 @@ public class API_AAFAccess {
pathParam(req,":instance"),
pathParam(req,":action"))));
resp.setStatus(HttpStatus.OK_200);
- } catch(Exception e) {
+ } catch (Exception e) {
context.error(trans, resp, Result.ERR_General, e.getMessage());
}
}
@@ -258,14 +258,14 @@ public class API_AAFAccess {
private static void redirect(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, LocateFacade context, Locator<URI> loc, String path) throws IOException {
try {
- if(loc.hasItems()) {
+ if (loc.hasItems()) {
Item item = loc.best();
URI uri = loc.get(item);
StringBuilder redirectURL = new StringBuilder(uri.toString());
redirectURL.append('/');
redirectURL.append(path);
String str = req.getQueryString();
- if(str!=null) {
+ if (str!=null) {
redirectURL.append('?');
redirectURL.append(str);
}
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java
index 7ff1fceb..88fcc079 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java
@@ -62,7 +62,7 @@ public class API_Find {
String service = pathParam(req, ":service");
String version = pathParam(req, ":version");
String other = pathParam(req, ":other");
- if(service.indexOf(':')>=0) {
+ if (service.indexOf(':')>=0) {
String split[] = Split.split(':', service);
switch(split.length) {
case 3:
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java
index 8bdf479f..19c09ff0 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java
@@ -62,7 +62,7 @@ public class API_Proxy {
public static void init(final AAF_Locate gwAPI, LocateFacade facade) throws Exception {
String aafurl = gwAPI.access.getProperty(Config.AAF_URL,null);
- if(aafurl==null) {
+ if (aafurl==null) {
} else {
////////
// Transferring APIs
@@ -73,7 +73,7 @@ public class API_Proxy {
gwAPI.routeAll(HttpMethods.GET,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy GET", true) {
@Override
public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
- if("/proxy/authn/basicAuth".equals(req.getPathInfo()) && !(req.getUserPrincipal() instanceof OAuth2Principal)) {
+ if ("/proxy/authn/basicAuth".equals(req.getPathInfo()) && !(req.getUserPrincipal() instanceof OAuth2Principal)) {
bac.handle(trans, req, resp);
} else {
TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE);
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java
index f41fcd91..fc73047c 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java
@@ -119,7 +119,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
public void error(AuthzTrans trans, HttpServletResponse response, Result<?> result) {
String msg = result.details==null?"":result.details.trim();
String[] detail;
- if(result.variables==null) {
+ if (result.variables==null) {
detail = new String[1];
} else {
int l = result.variables.length;
@@ -132,7 +132,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
@Override
public void error(AuthzTrans trans, HttpServletResponse response, int status, String msg, String ... _detail) {
String[] detail = _detail;
- if(detail.length==0) {
+ if (detail.length==0) {
detail=new String[1];
}
boolean hidemsg = false;
@@ -199,7 +199,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
"] " +
holder.toString(),
Env.ALWAYS);
- if(hidemsg) {
+ if (hidemsg) {
holder.setLength(0);
em = mapper().errorFromMessage(holder, msgId, "Server had an issue processing this request");
}
@@ -221,25 +221,25 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
Api api = new Api();
Api.Route ar;
Method[] meths = LocateServiceImpl.class.getDeclaredMethods();
- for(RouteReport rr : rservlet.routeReport()) {
+ for (RouteReport rr : rservlet.routeReport()) {
api.getRoute().add(ar = new Api.Route());
ar.setMeth(rr.meth.name());
ar.setPath(rr.path);
ar.setDesc(rr.desc);
ar.getContentType().addAll(rr.contextTypes);
- for(Method m : meths) {
+ for (Method m : meths) {
ApiDoc ad;
- if((ad = m.getAnnotation(ApiDoc.class))!=null &&
+ if ((ad = m.getAnnotation(ApiDoc.class))!=null &&
rr.meth.equals(ad.method()) &&
rr.path.equals(ad.path())) {
- for(String param : ad.params()) {
+ for (String param : ad.params()) {
ar.getParam().add(param);
}
- for(String text : ad.text()) {
+ for (String text : ad.text()) {
ar.getComments().add(text);
}
ar.setExpected(ad.expectedCode());
- for(int ec : ad.errorCodes()) {
+ for (int ec : ad.errorCodes()) {
ar.getExplicitErr().add(ec);
}
}
@@ -289,20 +289,20 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
String output=null;
long temp=System.currentTimeMillis();
synchronized(LOCK) {
- if(cacheClear<temp) {
+ if (cacheClear<temp) {
epsCache.clear();
cacheClear = temp+1000*60*2; // 2 mins standard cache clear
} else {
output = epsCache.get(key);
- if("{}".equals(output) && emptyCheck<temp) {
+ if ("{}".equals(output) && emptyCheck<temp) {
output = null;
emptyCheck = temp+5000; // 5 second check
}
}
}
- if(output==null) {
+ if (output==null) {
Result<ENDPOINTS> reps = this.service.getEndPoints(trans,service,version,other);
- if(reps.notOK()) {
+ if (reps.notOK()) {
return Result.err(reps);
} else {
output = epDF.newData(trans).load(reps.value).asString();
@@ -334,7 +334,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
try {
RosettaData<MGMT_ENDPOINTS> data = mepDF.newData().load(req.getInputStream());
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,PUT_MGMT_ENDPOINTS);
return Result.err(Status.ERR_BadData,"Invalid Input");
@@ -370,7 +370,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
try {
RosettaData<MGMT_ENDPOINTS> data = mepDF.newData().load(req.getInputStream());
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,DELETE_MGMT_ENDPOINTS);
return Result.err(Status.ERR_BadData,"Invalid Input");
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java
index d2eeb632..0d50f5d2 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java
@@ -75,7 +75,7 @@ public class Mapper_1_1 implements Mapper<InRequest,Out,Endpoints,MgmtEndpoints,
err.setMessageId(msgID);
// AT&T Restful Error Format requires numbers "%" placements
err.setText(Vars.convert(holder, text, var));
- for(String s : var) {
+ for (String s : var) {
err.getVariables().add(s);
}
return err;
@@ -86,25 +86,25 @@ public class Mapper_1_1 implements Mapper<InRequest,Out,Endpoints,MgmtEndpoints,
*/
@Override
public Result<Endpoints> endpoints(Result<List<Data>> resultDB, String version, String other) {
- if(resultDB.notOK()) {
+ if (resultDB.notOK()) {
return Result.err(resultDB);
}
int major=-1, minor=-1, patch=-1, pkg=-1;
- if(version!=null) {
+ if (version!=null) {
try {
String[] v = Split.split('.',version);
- if(v.length>0) {major = Integer.parseInt(v[0]);}
- if(v.length>1) {minor = Integer.parseInt(v[1]);}
- if(v.length>2) {patch = Integer.parseInt(v[2]);}
- if(v.length>3) {pkg = Integer.parseInt(v[3]);}
+ if (v.length>0) {major = Integer.parseInt(v[0]);}
+ if (v.length>1) {minor = Integer.parseInt(v[1]);}
+ if (v.length>2) {patch = Integer.parseInt(v[2]);}
+ if (v.length>3) {pkg = Integer.parseInt(v[3]);}
} catch (NumberFormatException e) {
return Result.err(Result.ERR_BadData,"Invalid Version String " + version);
}
}
Endpoints eps = new Endpoints();
List<Endpoint> leps = eps.getEndpoint();
- for(Data d : resultDB.value) {
- if((major<0 || major==d.major) &&
+ for (Data d : resultDB.value) {
+ if ((major<0 || major==d.major) &&
(minor<0 || minor<=d.minor) &&
(patch<0 || patch==d.patch) &&
(pkg<0 || pkg ==d.pkg)) {
@@ -119,7 +119,7 @@ public class Mapper_1_1 implements Mapper<InRequest,Out,Endpoints,MgmtEndpoints,
ep.setLatitude(d.latitude);
ep.setLongitude(d.longitude);
ep.setProtocol(d.protocol);
- for(String s : d.subprotocol(false)) {
+ for (String s : d.subprotocol(false)) {
ep.getSubprotocol().add(s);
}
leps.add(ep);
@@ -144,7 +144,7 @@ public class Mapper_1_1 implements Mapper<InRequest,Out,Endpoints,MgmtEndpoints,
data.latitude = me.getLatitude();
data.longitude = me.getLongitude();
data.protocol = me.getProtocol();
- for(String s : me.getSubprotocol()) {
+ for (String s : me.getSubprotocol()) {
data.subprotocol(true).add(s);
}
return data;
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java
index d0aae466..6d96ded3 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java
@@ -68,28 +68,28 @@ public class LocateServiceImpl<IN,OUT,ERROR>
@Override
public Result<Void> putMgmtEndPoints(AuthzTrans trans, MgmtEndpoints meps) {
LocateValidator v = new LocateValidator().mgmt_endpoints(meps, false);
- if(v.err()) {
+ if (v.err()) {
return Result.err(Result.ERR_BadData,v.errs());
}
int count = 0;
- for(MgmtEndpoint me : meps.getMgmtEndpoint()) {
- if(permToRegister) {
+ for (MgmtEndpoint me : meps.getMgmtEndpoint()) {
+ if (permToRegister) {
int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName()
AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getName(),"write");
- if(trans.fish(p)) {
+ if (trans.fish(p)) {
LocateDAO.Data data = mapper.locateData(me);
locateDAO.update(trans, data, true);
++count;
} else {
return Result.err(Result.ERR_Denied,"May not register service (needs " + p.getKey() + ')');
}
- } else { //TODO if(MechID is part of Namespace) {
+ } else { //TODO if (MechID is part of Namespace) {
LocateDAO.Data data = mapper.locateData(me);
locateDAO.update(trans, data, true);
++count;
}
}
- if(count>0) {
+ if (count>0) {
return Result.ok();
} else {
return Result.err(Result.ERR_NotFound, "No endpoints found");
@@ -102,14 +102,14 @@ public class LocateServiceImpl<IN,OUT,ERROR>
@Override
public Result<Void> removeMgmtEndPoints(AuthzTrans trans, MgmtEndpoints meps) {
LocateValidator v = new LocateValidator().mgmt_endpoint_key(meps);
- if(v.err()) {
+ if (v.err()) {
return Result.err(Result.ERR_BadData,v.errs());
}
int count = 0;
- for(MgmtEndpoint me : meps.getMgmtEndpoint()) {
+ for (MgmtEndpoint me : meps.getMgmtEndpoint()) {
int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName()
AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
- if(trans.fish(p)) {
+ if (trans.fish(p)) {
LocateDAO.Data data = mapper.locateData(me);
data.port_key = UUID.randomUUID();
locateDAO.delete(trans, data, false);
@@ -118,7 +118,7 @@ public class LocateServiceImpl<IN,OUT,ERROR>
return Result.err(Result.ERR_Denied,"May not register service (needs " + p.getKey() + ')');
}
}
- if(count>0) {
+ if (count>0) {
return Result.ok();
} else {
return Result.err(Result.ERR_NotFound, "No endpoints found");
@@ -136,8 +136,8 @@ public class LocateServiceImpl<IN,OUT,ERROR>
c.setName(type);
Props p;
- if(dr.isOKhasData()) {
- for(ConfigDAO.Data data : dr.value) {
+ if (dr.isOKhasData()) {
+ for (ConfigDAO.Data data : dr.value) {
p = new Props();
p.setTag(data.tag);
p.setValue(data.value);
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
index 6dd3d92a..4f3884d2 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
@@ -40,13 +40,13 @@ import locate.v1_0.MgmtEndpoints;
*/
public class LocateValidator extends Validator {
private LocateValidator endpoint_key(Endpoint e) {
- if(e==null) {
+ if (e==null) {
msg("Endpoint Data is null.");
} else {
nullOrBlank("Endpoint Name", e.getName());
- if(e.getName()!=null) {
+ if (e.getName()!=null) {
int idx = e.getName().indexOf('.');
- if(idx<=0) {
+ if (idx<=0) {
msg("Endpoint Name must prefixed by Namespace");
}
}
@@ -59,7 +59,7 @@ public class LocateValidator extends Validator {
public LocateValidator endpoint(Endpoint e) {
endpoint_key(e);
- if(e!=null) {
+ if (e!=null) {
intRange("Endpoint Major Version",e.getMajor(),0,2000);
intRange("Endpoint Minor Version",e.getMinor(),0,2000);
intRange("Endpoint Patch Version",e.getPatch(),0,2000);
@@ -67,7 +67,7 @@ public class LocateValidator extends Validator {
floatRange("Endpoint Latitude",e.getLatitude(),-90f,90f);
floatRange("Endpoint Longitude",e.getLongitude(),-180f,180f);
nullOrBlank("Endpoint Protocol", e.getProtocol());
- for(String s : e.getSubprotocol()) {
+ for (String s : e.getSubprotocol()) {
nullOrBlank("Endpoint Subprotocol", s);
}
}
@@ -75,13 +75,13 @@ public class LocateValidator extends Validator {
}
public LocateValidator endpoints(Endpoints e, boolean emptyNotOK) {
- if(e==null) {
+ if (e==null) {
msg("Endpoints Data is null.");
} else {
- if(emptyNotOK && e.getEndpoint().size()==0) {
+ if (emptyNotOK && e.getEndpoint().size()==0) {
msg("Endpoints contains no endpoints");
} else {
- for(Endpoint ep : e.getEndpoint()) {
+ for (Endpoint ep : e.getEndpoint()) {
endpoint(ep);
}
}
@@ -90,10 +90,10 @@ public class LocateValidator extends Validator {
}
public LocateValidator mgmt_endpoint_key(MgmtEndpoints meps) {
- if(meps==null) {
+ if (meps==null) {
msg("MgmtEndpoints Data is null.");
} else {
- for(MgmtEndpoint ep : meps.getMgmtEndpoint()) {
+ for (MgmtEndpoint ep : meps.getMgmtEndpoint()) {
endpoint_key(ep);
}
}
@@ -101,13 +101,13 @@ public class LocateValidator extends Validator {
}
public LocateValidator mgmt_endpoints(MgmtEndpoints me, boolean emptyOK) {
- if(me==null) {
+ if (me==null) {
msg("MgmtEndpoints Data is null.");
} else {
- if(!emptyOK && me.getMgmtEndpoint().size()==0) {
+ if (!emptyOK && me.getMgmtEndpoint().size()==0) {
msg("MgmtEndpoints contains no data");
} else {
- for(MgmtEndpoint ep : me.getMgmtEndpoint()) {
+ for (MgmtEndpoint ep : me.getMgmtEndpoint()) {
mgmt_endpoint(ep);
}
}
@@ -117,21 +117,21 @@ public class LocateValidator extends Validator {
private LocateValidator mgmt_endpoint(MgmtEndpoint ep) {
endpoint(ep);
- for(SpecialPorts sp : ep.getSpecialPorts()) {
+ for (SpecialPorts sp : ep.getSpecialPorts()) {
specialPorts(sp);
}
return this;
}
private LocateValidator specialPorts(SpecialPorts sp) {
- if(sp==null) {
+ if (sp==null) {
msg("Special Ports is null.");
} else {
nullOrBlank("Special Port Name",sp.getName());
nullOrBlank("Special Port Protocol",sp.getProtocol());
intRange("Special Port",sp.getPort(),0,1000000);
- for(String s : sp.getProtocolVersions()) {
+ for (String s : sp.getProtocolVersions()) {
nullOrBlank("Special Port Protocol Version", s);
}
}
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
index 3ae80e3c..4104c34b 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
@@ -89,7 +89,7 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
super(env.access(),env);
String aaf_env = env.getProperty(Config.AAF_ENV);
- if(aaf_env==null) {
+ if (aaf_env==null) {
throw new APIException("aaf_env needs to be set");
}
@@ -129,10 +129,10 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
String version = "1.0";
// Get Correct API Class from Mapper
Class<?> respCls = facade1_0.mapper().getClass(api);
- if(respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
+ if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
// setup Application API HTML ContentTypes for JSON and Route
String application = applicationJSON(respCls, version);
- if(meth.equals(HttpMethods.POST)) {
+ if (meth.equals(HttpMethods.POST)) {
route(env,meth,path,code,application,"application/json;version="+version,"application/x-www-form-urlencoded","*/*");
} else {
route(env,meth,path,code,application,"application/json;version="+version,"*/*");
@@ -147,7 +147,7 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
atl[0] = doat;
atl[1] = doat.directUserPass();
- if(additionalTafLurs.length>0) {
+ if (additionalTafLurs.length>0) {
System.arraycopy(additionalTafLurs, 0, atl, 2, additionalTafLurs.length);
}
@@ -176,10 +176,10 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
@Override
public void destroy() {
Cache.stopTimer();
- if(service!=null) {
+ if (service!=null) {
service.close();
}
- if(cluster!=null) {
+ if (cluster!=null) {
cluster.close();
}
super.destroy();
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java
index bb882367..3d863824 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java
@@ -74,7 +74,7 @@ public class DirectOAuthTAF implements HttpTaf {
tkMgr = TokenMgr.getInstance(access,"dbToken","dbIntrospect");
String alt_url = access.getProperty(Config.AAF_ALT_OAUTH2_INTROSPECT_URL,null);
TokenClientFactory tcf;
- if(alt_url!=null) {
+ if (alt_url!=null) {
try {
tcf = TokenClientFactory.instance(access);
String[] split = Split.split(',', alt_url);
@@ -94,42 +94,42 @@ public class DirectOAuthTAF implements HttpTaf {
public TafResp validate(LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
String value;
String token;
- if((value=req.getHeader("Authorization"))!=null && value.startsWith("Bearer ")) {
+ if ((value=req.getHeader("Authorization"))!=null && value.startsWith("Bearer ")) {
token = value.substring(7);
} else {
token = null;
}
- if("application/x-www-form-urlencoded".equals(req.getContentType())) {
+ if ("application/x-www-form-urlencoded".equals(req.getContentType())) {
Map<String, String[]> map = req.getParameterMap();
String client_id=null,client_secret=null,username=null,password=null;
- for(Map.Entry<String, String[]> es : map.entrySet()) {
+ for (Map.Entry<String, String[]> es : map.entrySet()) {
switch(es.getKey()) {
case "client_id":
- for(String s : es.getValue()) {
+ for (String s : es.getValue()) {
client_id=s;
}
break;
case "client_secret":
- for(String s : es.getValue()) {
+ for (String s : es.getValue()) {
client_secret=s;
}
break;
case "username":
- for(String s : es.getValue()) {
+ for (String s : es.getValue()) {
username=s;
}
break;
case "password":
- for(String s : es.getValue()) {
+ for (String s : es.getValue()) {
password=s;
}
break;
case "token":
- if(token!=null) { // Defined as both Bearer and Form Encoded - Error
+ if (token!=null) { // Defined as both Bearer and Form Encoded - Error
return new OAuth2HttpTafResp(access, null, "Token Info found as both Bearer Token and Form Info", RESP.FAIL, resp, true);
}
- for(String s : es.getValue()) {
+ for (String s : es.getValue()) {
token=s;
}
break;
@@ -137,22 +137,22 @@ public class DirectOAuthTAF implements HttpTaf {
}
}
- if(client_id==null || client_secret==null) {
+ if (client_id==null || client_secret==null) {
return new OAuth2HttpTafResp(access, null, "client_id and client_secret required", RESP.TRY_ANOTHER_TAF, resp, false);
}
- if(token==null) { // No Token to work with, use only Client_ID and Client_Secret
+ if (token==null) { // No Token to work with, use only Client_ID and Client_Secret
AuthzTrans trans = (AuthzTrans)req.getAttribute(TransFilter.TRANS_TAG);
- if(directUserPass.validate(client_id, Type.PASSWORD, client_secret.getBytes(), trans)) {
+ if (directUserPass.validate(client_id, Type.PASSWORD, client_secret.getBytes(), trans)) {
// Client_ID is valid
- if(username==null) { // Validating just the Client_ID
+ if (username==null) { // Validating just the Client_ID
return new OAuth2FormHttpTafResp(access,new OAuth2FormPrincipal(client_id,client_id),"OAuth client_id authenticated",RESP.IS_AUTHENTICATED,resp,false);
} else {
//TODO - Does a clientID need specific Authorization to pair authentication with user name? At the moment, no.
// username is ok.
- if(password!=null) {
- if(directUserPass.validate(username, Type.PASSWORD, password.getBytes(), trans)) {
+ if (password!=null) {
+ if (directUserPass.validate(username, Type.PASSWORD, password.getBytes(), trans)) {
return new OAuth2FormHttpTafResp(access,new OAuth2FormPrincipal(client_id, username),"OAuth username authenticated",RESP.IS_AUTHENTICATED,resp,false);
} else {
return new OAuth2HttpTafResp(access,null,"OAuth username " + username + " not authenticated ",RESP.FAIL,resp,true);
@@ -169,14 +169,14 @@ public class DirectOAuthTAF implements HttpTaf {
}
// OK, have only a Token to validate
- if(token!=null) {
+ if (token!=null) {
AuthzTrans trans = (AuthzTrans)req.getAttribute(TransFilter.TRANS_TAG);
try {
Result<Introspect> ri = oaFacade.mappedIntrospect(trans, token);
- if(ri.isOK()) {
+ if (ri.isOK()) {
TokenPerm tp = tkMgr.putIntrospect(ri.value, Hash.hashSHA256(token.getBytes()));
- if(tp==null) {
+ if (tp==null) {
return new OAuth2HttpTafResp(access, null, "TokenPerm persistence failure", RESP.FAIL, resp, false);
} else {
return new OAuth2HttpTafResp(access,new OAuth2Principal(tp,Hash.hashSHA256(token.getBytes())),"Token Authenticated",RESP.IS_AUTHENTICATED,resp,false);
@@ -209,7 +209,7 @@ public class DirectOAuthTAF implements HttpTaf {
@Override
public org.onap.aaf.cadi.client.Result<TokenPerm> load(String accessToken, byte[] cred) throws APIException, CadiException, LocatorException {
Result<Introspect> ri = oaFacade.mappedIntrospect(trans, accessToken);
- if(ri.notOK()) {
+ if (ri.notOK()) {
//TODO what should the status mapping be?
return org.onap.aaf.cadi.client.Result.err(ri.status,ri.errorString());
}
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java
index 161f6095..9777f564 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java
@@ -45,11 +45,11 @@ public class OAuth2Filter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest hreq = (HttpServletRequest)request;
Principal p = hreq.getUserPrincipal();
- if(request.getContentType().equals("application/x-www-form-urlencoded")) {
+ if (request.getContentType().equals("application/x-www-form-urlencoded")) {
- } else if(p instanceof BearerPrincipal) {
- for(String authz : Split.splitTrim(';', hreq.getHeader("Authorization"))) {
- if(authz.startsWith("Bearer ")) {
+ } else if (p instanceof BearerPrincipal) {
+ for (String authz : Split.splitTrim(';', hreq.getHeader("Authorization"))) {
+ if (authz.startsWith("Bearer ")) {
((BearerPrincipal)p).setBearer(authz.substring(7));
}
}
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java
index f795dfd3..0ed4fbed 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java
@@ -58,7 +58,7 @@ public class API_Token {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.createBearerToken(trans,req, resp);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(201/*HttpStatus.CREATED_201*/);
} else {
context.error(trans,resp,r);
@@ -70,7 +70,7 @@ public class API_Token {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.introspect(trans,req, resp);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(200 /*HttpStatus.OK_200*/);
} else {
context.error(trans,resp,r);
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java
index 2935ea3d..36f08b15 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java
@@ -44,9 +44,9 @@ public class DirectIntrospectImpl<INTROSPECT> extends FacadeImpl implements Dire
public Result<INTROSPECT> mappedIntrospect(AuthzTrans trans, String token) {
Result<INTROSPECT> rti;
Result<OAuthTokenDAO.Data> rs = service.introspect(trans,token);
- if(rs.notOK()) {
+ if (rs.notOK()) {
rti = Result.err(rs);
- } else if(rs.isEmpty()) {
+ } else if (rs.isEmpty()) {
rti = Result.err(Result.ERR_NotFound,"No Token %s found",token);
} else {
rti = mapper.introspect(rs);
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java
index cd1d7df1..e5e12bd6 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java
@@ -119,27 +119,27 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
TOKEN_REQ request;
try {
request = mapper.tokenReqFromParams(req);
- if(request==null) {
+ if (request==null) {
Data<TOKEN_REQ> rd = tokenReqDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,rd.asString());
}
request = rd.asObject();
}
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log(INVALID_INPUT,IN,CREATE_TOKEN);
return Result.err(Status.ERR_BadData,INVALID_INPUT);
}
// Already validated for Oauth2FormPrincipal
// Result<Void> rv = service.validate(trans,mapper.credsFromReq(request));
-// if(rv.notOK()) {
+// if (rv.notOK()) {
// return rv;
// }
Holder<GRANT_TYPE> hgt = new Holder<GRANT_TYPE>(GRANT_TYPE.unknown);
Result<OAuthTokenDAO.Data> rs = service.createToken(trans,req,mapper.clientTokenReq(request,hgt),hgt);
Result<TOKEN> rp;
- if(rs.isOKhasData()) {
+ if (rs.isOKhasData()) {
rp = mapper.tokenFromData(rs);
} else {
rp = Result.err(rs);
@@ -147,7 +147,7 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
switch(rp.status) {
case OK:
RosettaData<TOKEN> data = tokenDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -175,30 +175,30 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
try {
Principal p = req.getUserPrincipal();
String token=null;
- if(p != null) {
- if(p instanceof OAuth2Principal) {
+ if (p != null) {
+ if (p instanceof OAuth2Principal) {
RosettaData<INTROSPECT> data = introspectDF.newData(trans).load(mapper.fromPrincipal((OAuth2Principal)p));
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
resp.getOutputStream().print('\n');
setContentType(resp,tokenDF.getOutType());
return Result.ok();
- } else if(p instanceof OAuth2FormPrincipal) {
+ } else if (p instanceof OAuth2FormPrincipal) {
token = req.getParameter("token");
}
}
- if(token==null) {
+ if (token==null) {
token = req.getParameter("access_token");
- if(token==null || token.isEmpty()) {
+ if (token==null || token.isEmpty()) {
token = req.getHeader("Authorization");
- if(token != null && token.startsWith("Bearer ")) {
+ if (token != null && token.startsWith("Bearer ")) {
token = token.substring(7);
} else {
token = req.getParameter("token");
- if(token==null) {
+ if (token==null) {
return Result.err(Result.ERR_Security,"token is required");
}
}
@@ -209,7 +209,7 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
switch(rti.status) {
case OK:
RosettaData<INTROSPECT> data = introspectDF.newData(trans).load(rti.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -308,7 +308,7 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
"] " +
holder.toString(),
Env.ALWAYS);
- if(hidemsg) {
+ if (hidemsg) {
holder.setLength(0);
em = mapper.errorFromMessage(holder, msgId, "Server had an issue processing this request");
}
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java
index 4be079e4..027a51a7 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java
@@ -78,7 +78,7 @@ public class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
err.setMessageId(msgID);
// AT&T Restful Error Format requires numbers "%" placements
err.setText(Vars.convert(holder, text, var));
- for(String s : var) {
+ for (String s : var) {
err.getVariables().add(s);
}
return err;
@@ -89,46 +89,46 @@ public class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
TokenRequest tr = new TokenRequest();
boolean data = false;
Map<String, String[]> map = req.getParameterMap();
- for(Entry<String, String[]> es : map.entrySet()) {
+ for (Entry<String, String[]> es : map.entrySet()) {
switch(es.getKey()) {
case "client_id":
- if(es.getValue().length==1) {
+ if (es.getValue().length==1) {
tr.setClientId(es.getValue()[0]);
data = true;
}
break;
case "client_secret":
- if(es.getValue().length==1) {
+ if (es.getValue().length==1) {
tr.setClientSecret(es.getValue()[0]);
data = true;
}
break;
case "username":
- if(es.getValue().length==1) {
+ if (es.getValue().length==1) {
tr.setUsername(es.getValue()[0]);
data = true;
}
break;
case "password":
- if(es.getValue().length==1) {
+ if (es.getValue().length==1) {
tr.setPassword(es.getValue()[0]);
data = true;
}
break;
case "scope":
- if(es.getValue().length==1) {
+ if (es.getValue().length==1) {
tr.setScope(es.getValue()[0]);
data = true;
}
break;
case "grant_type":
- if(es.getValue().length==1) {
+ if (es.getValue().length==1) {
tr.setGrantType(es.getValue()[0]);
data = true;
}
break;
case "refresh_token":
- if(es.getValue().length==1) {
+ if (es.getValue().length==1) {
tr.setRefreshToken(es.getValue()[0]);
data = true;
}
@@ -158,12 +158,12 @@ public class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
OAuthTokenDAO.Data tdd = new OAuthTokenDAO.Data();
tdd.client_id = tokReq.getClientId();
tdd.user = tokReq.getUsername();
- if(tokReq.getRefreshToken()!=null) {
+ if (tokReq.getRefreshToken()!=null) {
tdd.refresh=tokReq.getRefreshToken();
}
- for(GRANT_TYPE ttt : GRANT_TYPE.values()) {
- if(ttt.name().equals(tokReq.getGrantType())) {
+ for (GRANT_TYPE ttt : GRANT_TYPE.values()) {
+ if (ttt.name().equals(tokReq.getGrantType())) {
hgt.set(ttt);
break;
}
@@ -180,9 +180,9 @@ public class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
break;
}
String scopes=tokReq.getScope();
- if(scopes!=null) {
+ if (scopes!=null) {
Set<String> ss = tdd.scopes(true);
- for(String s: Split.split(' ', tokReq.getScope())) {
+ for (String s: Split.split(' ', tokReq.getScope())) {
ss.add(s);
}
}
@@ -193,12 +193,12 @@ public class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
@Override
public Result<Token> tokenFromData(Result<Data> rd) {
- if(rd.notOK()) {
+ if (rd.notOK()) {
return Result.err(rd);
}
Data d = rd.value;
Token token = new Token();
- if(OAuthService.TOKEN_TYPE.values().length>d.type) {
+ if (OAuthService.TOKEN_TYPE.values().length>d.type) {
token.setTokenType(OAuthService.TOKEN_TYPE.values()[d.type].name());
} else {
token.setTokenType("Invalid");
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java
index ac015c81..33df05fa 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java
@@ -32,19 +32,19 @@ import aafoauth.v2_0.Introspect;
public class MapperIntrospect1_0 implements MapperIntrospect<Introspect> {
public Result<Introspect> introspect(Result<Data> rs) {
- if(rs.isOKhasData()) {
+ if (rs.isOKhasData()) {
Data data = rs.value;
Introspect ti = new Introspect();
ti.setAccessToken(data.id);
ti.setActive(data.active);
ti.setClientId(data.client_id);
- for(CLIENT_TYPE ct : CLIENT_TYPE.values()) {
- if(data.type==ct.ordinal()) {
+ for (CLIENT_TYPE ct : CLIENT_TYPE.values()) {
+ if (data.type==ct.ordinal()) {
ti.setClientType(ct.name());
break;
}
}
- if(ti.getClientType()==null) {
+ if (ti.getClientType()==null) {
ti.setClientType(CLIENT_TYPE.unknown.name());
}
ti.setActive(data.active);
@@ -60,8 +60,8 @@ public class MapperIntrospect1_0 implements MapperIntrospect<Introspect> {
protected static String getScopes(Set<String> scopes) {
StringBuilder sb = new StringBuilder();
boolean start = true;
- for(String s : scopes) {
- if(start) {
+ for (String s : scopes) {
+ if (start) {
start = false;
} else {
sb.append(' ');
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java
index 886b06c5..8bceb2ab 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java
@@ -52,8 +52,8 @@ public class JSONPermLoaderFactory {
pathinfo.append(user);
pathinfo.append("?scopes=");
boolean first = true;
- for(String s : scopes) {
- if(first) {
+ for (String s : scopes) {
+ if (first) {
first = false;
} else {
pathinfo.append(':');
@@ -63,9 +63,9 @@ public class JSONPermLoaderFactory {
TimeTaken tt = trans.start("Call AAF Service", Env.REMOTE);
try {
Future<String> fs = c.read(pathinfo.toString(), "application/Perms+json;charset=utf-8;version=2.0");
- if(fs.get(timeout)) {
+ if (fs.get(timeout)) {
return Result.ok(fs.body());
- } else if(fs.code()==404) {
+ } else if (fs.code()==404) {
return Result.err(Result.ERR_NotFound,fs.body());
} else {
return Result.err(Result.ERR_Backend,"Error accessing AAF %s: %s",Integer.toString(fs.code()),fs.body());
@@ -86,15 +86,15 @@ public class JSONPermLoaderFactory {
} finally {
tt.done();
}
- if(pd.notOK()) {
+ if (pd.notOK()) {
return Result.err(pd);
}
// Since we know it is
StringBuilder sb = new StringBuilder("{\"perm\":[");
boolean first = true;
- for(PermDAO.Data d : pd.value) {
- if(scopes.contains(d.ns)) {
- if(first) {
+ for (PermDAO.Data d : pd.value) {
+ if (scopes.contains(d.ns)) {
+ if (first) {
first = false;
} else {
sb.append(',');
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java
index 1d926a74..e3aed80c 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java
@@ -82,7 +82,7 @@ public class OAuthService {
};
try {
String alt_url = access.getProperty(Config.AAF_ALT_OAUTH2_INTROSPECT_URL,null);
- if(alt_url!=null) {
+ if (alt_url!=null) {
tcf = TokenClientFactory.instance(access);
String[] split = Split.split(',', alt_url);
int timeout = split.length>1?Integer.parseInt(split[1]):3000;
@@ -101,7 +101,7 @@ public class OAuthService {
}
public Result<Void> validate(AuthzTrans trans, OCreds creds) {
- if(directUserPass.validate(creds.username, Type.PASSWORD, creds.password, trans)) {
+ if (directUserPass.validate(creds.username, Type.PASSWORD, creds.password, trans)) {
return Result.ok();
} else {
return Result.err(Result.ERR_Security, "Invalid Credential for ",creds.username);
@@ -121,7 +121,7 @@ public class OAuthService {
}
private Result<Data> createBearerToken(AuthzTrans trans, OAuthTokenDAO.Data odd) {
- if(odd.user==null) {
+ if (odd.user==null) {
odd.user = trans.user();
}
odd.id = AAFToken.toToken(UUID.randomUUID());
@@ -134,7 +134,7 @@ public class OAuthService {
try {
Result<Data> rd = loadToken(trans, odd);
- if(rd.notOK()) {
+ if (rd.notOK()) {
return rd;
}
} catch (APIException | CadiException e) {
@@ -145,11 +145,11 @@ public class OAuthService {
private Result<Data> loadToken(AuthzTrans trans, Data odd) throws APIException, CadiException {
Result<String> rs = permLoader.loadJSONPerms(trans,odd.user,odd.scopes(false));
- if(rs.isOK()) {
+ if (rs.isOK()) {
odd.content = rs.value;
odd.type = TOKEN_TYPE.bearer.ordinal();
return Result.ok(odd);
- } else if(rs.status == Result.ERR_NotFound || rs.status==Status.ERR_UserRoleNotFound) {
+ } else if (rs.status == Result.ERR_NotFound || rs.status==Status.ERR_UserRoleNotFound) {
odd.type = TOKEN_TYPE.bearer.ordinal();
return Result.ok(odd);
} else {
@@ -161,28 +161,28 @@ public class OAuthService {
private Result<Data> refreshBearerToken(AuthzTrans trans, Data odd) {
Result<List<Data>> rld = tokenDAO.readByUser(trans, trans.user());
- if(rld.notOK()) {
+ if (rld.notOK()) {
return Result.err(rld);
}
- if(rld.isEmpty()) {
+ if (rld.isEmpty()) {
return Result.err(Result.ERR_NotFound,"Data not Found for %1 %2",trans.user(),odd.refresh==null?"":odd.refresh.toString());
}
Data token = null;
- for(Data d : rld.value) {
- if(d.refresh.equals(odd.refresh)) {
+ for (Data d : rld.value) {
+ if (d.refresh.equals(odd.refresh)) {
token = d;
boolean scopesNE = false;
Set<String> scopes = odd.scopes(false);
- if(scopes.size()>0) { // only check if Scopes listed, RFC 6749, Section 6
- if(scopesNE=!(scopes.size() == d.scopes(false).size())) {
- for(String s : odd.scopes(false)) {
- if(!d.scopes(false).contains(s)) {
+ if (scopes.size()>0) { // only check if Scopes listed, RFC 6749, Section 6
+ if (scopesNE=!(scopes.size() == d.scopes(false).size())) {
+ for (String s : odd.scopes(false)) {
+ if (!d.scopes(false).contains(s)) {
scopesNE=true;
break;
}
}
}
- if(scopesNE) {
+ if (scopesNE) {
return Result.err(Result.ERR_BadData,"Requested Scopes do not match existing Token");
}
}
@@ -190,7 +190,7 @@ public class OAuthService {
}
}
- if(token==null) {
+ if (token==null) {
trans.audit().printf("Duplicate Refresh Token (%s) attempted for %s. Possible Replay Attack",odd.refresh.toString(),trans.user());
return Result.err(Result.ERR_Security,"Invalid Refresh Token");
} else {
@@ -205,11 +205,11 @@ public class OAuthService {
token.exp_sec = exp/1000;
token.req_ip = trans.ip();
Result<Data> rd = tokenDAO.create(trans, token);
- if(rd.notOK()) {
+ if (rd.notOK()) {
return Result.err(rd);
}
Result<Void> rv = tokenDAO.delete(trans, deleteMe,false);
- if(rv.notOK()) {
+ if (rv.notOK()) {
trans.error().log("Unable to delete token", token);
}
}
@@ -220,22 +220,22 @@ public class OAuthService {
Result<List<Data>> rld;
try {
UUID uuid = AAFToken.fromToken(token);
- if(uuid==null) { // not an AAF Token
+ if (uuid==null) { // not an AAF Token
// Attempt to get Alternative Token
- if(altIntrospectClient!=null) {
+ if (altIntrospectClient!=null) {
org.onap.aaf.cadi.client.Result<Introspect> rai = altIntrospectClient.introspect(token);
- if(rai.isOK()) {
+ if (rai.isOK()) {
Introspect in = rai.value;
- if(in.getExp()==null) {
+ if (in.getExp()==null) {
trans.audit().printf("Alt OAuth sent back inactive, empty token: requesting_id,%s,access_token=%s,ip=%s\n",trans.user(),token,trans.ip());
}
long expires = in.getExp()*1000;
- if(in.isActive() && expires>System.currentTimeMillis()) {
+ if (in.isActive() && expires>System.currentTimeMillis()) {
// We have a good Token, modify to be Fully Qualified
String fqid = in.getUsername()+altDomain;
// read contents
rld = tokenDAO.read(trans, token);
- if(rld.isOKhasData()) {
+ if (rld.isOKhasData()) {
Data td = rld.value.get(0);
in.setContent(td.content);
} else {
@@ -248,8 +248,8 @@ public class OAuthService {
td.expires = new Date(expires);
td.exp_sec = in.getExp();
Set<String> scopes = td.scopes(true);
- if(in.getScope()!=null) {
- for(String s : Split.split(' ', in.getScope())) {
+ if (in.getScope()!=null) {
+ for (String s : Split.split(' ', in.getScope())) {
scopes.add(s);
}
}
@@ -277,13 +277,13 @@ public class OAuthService {
public Result<Data> dbIntrospect(final AuthzTrans trans, final String token) {
Result<List<Data>> rld = tokenDAO.read(trans, token);
- if(rld.notOKorIsEmpty()) {
+ if (rld.notOKorIsEmpty()) {
return Result.err(rld);
}
OAuthTokenDAO.Data odd = rld.value.get(0);
trans.checkpoint(odd.user + ':' + odd.client_id + ", " + odd.id);
- if(odd.active) {
- if(odd.expires.before(trans.now())) {
+ if (odd.active) {
+ if (odd.expires.before(trans.now())) {
return Result.err(Result.ERR_Policy,"Token %1 has expired",token);
}
return Result.ok(rld.value.get(0)); // ok keyed on id/token.
@@ -293,7 +293,7 @@ public class OAuthService {
}
public void close() {
- for(DAO<AuthzTrans,?> dao : daos) {
+ for (DAO<AuthzTrans,?> dao : daos) {
dao.close(NullTrans.singleton());
}
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
index 69cde411..4a592651 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
@@ -104,8 +104,8 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
// Initialize Organizations... otherwise, first pass may miss
int org_size = ORGANIZATION.length();
- for(String n : env.existingStaticSlotNames()) {
- if(n.startsWith(ORGANIZATION)) {
+ for (String n : env.existingStaticSlotNames()) {
+ if (n.startsWith(ORGANIZATION)) {
OrganizationFactory.obtain(env, n.substring(org_size));
}
}
@@ -122,7 +122,7 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
// Print results and cleanup
StringBuilder sb = new StringBuilder();
trans.auditTrail(0, sb);
- if(sb.length()>0)env.init().log(sb);
+ if (sb.length()>0)env.init().log(sb);
trans = null;
sb = null;
@@ -167,7 +167,7 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
domain,Long.parseLong(env.getProperty(Config.AAF_CLEAN_INTERVAL, Config.AAF_CLEAN_INTERVAL_DEF)),
false);
- if(additionalTafLurs.length>0) {
+ if (additionalTafLurs.length>0) {
System.arraycopy(additionalTafLurs, 0, atl, 2, additionalTafLurs.length);
}
@@ -194,7 +194,7 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
@Override
public void destroy() {
Cache.stopTimer();
- if(cluster!=null) {
+ if (cluster!=null) {
cluster.close();
}
super.destroy();
@@ -211,7 +211,7 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
public void route(HttpMethods meth, String path, API api, Code code) throws Exception {
String version = "2.0";
Class<?> respCls = facade.mapper().getClass(api);
- if(respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
+ if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
String application = applicationJSON(respCls, version);
route(env,meth,path,code,application,"application/json;version=2.0","*/*");
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 c3e92df4..789a2e65 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
@@ -160,16 +160,16 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> createNS(final AuthzTrans trans, REQUEST from, NsType type) {
final Result<Namespace> rnamespace = mapper.ns(trans, from);
final ServiceValidator v = new ServiceValidator();
- if(v.ns(rnamespace).err()) {
+ if (v.ns(rnamespace).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
final Namespace namespace = rnamespace.value;
final Result<NsDAO.Data> parentNs = ques.deriveNs(trans,namespace.name);
- if(parentNs.notOK()) {
+ if (parentNs.notOK()) {
return Result.err(parentNs);
}
- if(namespace.name.lastIndexOf('.')<0) { // Root Namespace... Function will check if allowed
+ if (namespace.name.lastIndexOf('.')<0) { // Root Namespace... Function will check if allowed
return func.createNS(trans, namespace, false);
}
@@ -184,7 +184,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<NsDAO.Data> rnd;
@Override
public Result<?> mayChange() {
- if(rnd==null) {
+ if (rnd==null) {
rnd = ques.mayUser(trans, trans.user(), parentNs.value,Access.write);
}
return rnd;
@@ -193,7 +193,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(fd.status) {
case OK:
Result<String> rfc = func.createFuture(trans, fd.value, namespace.name, trans.user(),parentNs.value, FUTURE_OP.C);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "NS [%s] is saved for future processing",namespace.name);
} else {
return Result.err(rfc);
@@ -293,7 +293,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
// Check inputs
final Validator v = new ServiceValidator();
- if(v.ns(ns).err() ||
+ if (v.ns(ns).err() ||
v.key(key).err() ||
v.value(value).err()) {
return Result.err(Status.ERR_BadData,v.errs());
@@ -301,18 +301,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Check if exists already
Result<List<Data>> rlnsd = ques.nsDAO.read(trans, ns);
- if(rlnsd.notOKorIsEmpty()) {
+ if (rlnsd.notOKorIsEmpty()) {
return Result.err(rlnsd);
}
NsDAO.Data nsd = rlnsd.value.get(0);
// Check for Existence
- if(nsd.attrib.get(key)!=null) {
+ if (nsd.attrib.get(key)!=null) {
return Result.err(Status.ERR_ConflictAlreadyExists, "NS Property %s:%s exists", ns, key);
}
// Check if User may put
- if(!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
+ if (!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
":"+trans.org().getDomain()+".*:"+key, Access.write.name())) {
return Result.err(Status.ERR_Denied, "%s may not create NS Attrib [%s:%s]", trans.user(),ns, key);
}
@@ -340,18 +340,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<KEYS> readNsByAttrib(AuthzTrans trans, String key) {
// Check inputs
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Key",key).err()) {
+ if (v.nullOrBlank("Key",key).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
// May Read
- if(!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
+ if (!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
":"+trans.org().getDomain()+".*:"+key, Question.READ)) {
return Result.err(Status.ERR_Denied,"%s may not read NS by Attrib '%s'",trans.user(),key);
}
Result<Set<String>> rsd = ques.nsDAO.dao().readNsByAttrib(trans, key);
- if(rsd.notOK()) {
+ if (rsd.notOK()) {
return Result.err(rsd);
}
return mapper().keys(rsd.value);
@@ -376,7 +376,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
// Check inputs
final Validator v = new ServiceValidator();
- if(v.ns(ns).err() ||
+ if (v.ns(ns).err() ||
v.key(key).err() ||
v.value(value).err()) {
return Result.err(Status.ERR_BadData,v.errs());
@@ -384,18 +384,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Check if exists already (NS must exist)
Result<List<Data>> rlnsd = ques.nsDAO.read(trans, ns);
- if(rlnsd.notOKorIsEmpty()) {
+ if (rlnsd.notOKorIsEmpty()) {
return Result.err(rlnsd);
}
NsDAO.Data nsd = rlnsd.value.get(0);
// Check for Existence
- if(nsd.attrib.get(key)==null) {
+ if (nsd.attrib.get(key)==null) {
return Result.err(Status.ERR_NotFound, "NS Property %s:%s exists", ns, key);
}
// Check if User may put
- if(!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
+ if (!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
":"+trans.org().getDomain()+".*:"+key, Access.write.name())) {
return Result.err(Status.ERR_Denied, "%s may not create NS Attrib [%s:%s]", trans.user(),ns, key);
}
@@ -428,25 +428,25 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
// Check inputs
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("NS",ns).err() ||
+ if (v.nullOrBlank("NS",ns).err() ||
v.nullOrBlank("Key",key).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
// Check if exists already
Result<List<Data>> rlnsd = ques.nsDAO.read(trans, ns);
- if(rlnsd.notOKorIsEmpty()) {
+ if (rlnsd.notOKorIsEmpty()) {
return Result.err(rlnsd);
}
NsDAO.Data nsd = rlnsd.value.get(0);
// Check for Existence
- if(nsd.attrib.get(key)==null) {
+ if (nsd.attrib.get(key)==null) {
return Result.err(Status.ERR_NotFound, "NS Property [%s:%s] does not exist", ns, key);
}
// Check if User may del
- if(!ques.isGranted(trans, trans.user(), ROOT_NS, "attrib", ":" + ROOT_COMPANY + ".*:"+key, Access.write.name())) {
+ if (!ques.isGranted(trans, trans.user(), ROOT_NS, "attrib", ":" + ROOT_COMPANY + ".*:"+key, Access.write.name())) {
return Result.err(Status.ERR_Denied, "%s may not delete NS Attrib [%s:%s]", trans.user(),ns, key);
}
@@ -473,28 +473,28 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<NSS> getNSbyName(AuthzTrans trans, String ns) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("NS", ns).err()) {
+ if (v.nullOrBlank("NS", ns).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<NsDAO.Data>> rlnd = ques.nsDAO.read(trans, ns);
- if(rlnd.isOK()) {
- if(rlnd.isEmpty()) {
+ if (rlnd.isOK()) {
+ if (rlnd.isEmpty()) {
return Result.err(Status.ERR_NotFound, "No data found for %s",ns);
}
Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), rlnd.value.get(0), Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
Namespace namespace = new Namespace(rnd.value);
Result<List<String>> rd = func.getOwners(trans, namespace.name, false);
- if(rd.isOK()) {
+ if (rd.isOK()) {
namespace.owner = rd.value;
}
rd = func.getAdmins(trans, namespace.name, false);
- if(rd.isOK()) {
+ if (rd.isOK()) {
namespace.admin = rd.value;
}
@@ -523,7 +523,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Collection<Namespace>> rn = loadNamepace(trans, user, ".admin", full);
- if(rn.notOK()) {
+ if (rn.notOK()) {
return Result.err(rn);
}
if (rn.isEmpty()) {
@@ -552,7 +552,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Collection<Namespace>> rn = loadNamepace(trans, user, null, full);
- if(rn.notOK()) {
+ if (rn.notOK()) {
return Result.err(rn);
}
if (rn.isEmpty()) {
@@ -565,55 +565,55 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<Collection<Namespace>> loadNamepace(AuthzTrans trans, String user, String endsWith, boolean full) {
Result<List<UserRoleDAO.Data>> urd = ques.userRoleDAO.readByUser(trans, user);
- if(urd.notOKorIsEmpty()) {
+ if (urd.notOKorIsEmpty()) {
return Result.err(urd);
}
Map<String, Namespace> lm = new HashMap<>();
Map<String, Namespace> other = full || endsWith==null?null:new TreeMap<>();
- for(UserRoleDAO.Data urdd : urd.value) {
- if(full) {
- if(endsWith==null || urdd.role.endsWith(endsWith)) {
+ for (UserRoleDAO.Data urdd : urd.value) {
+ if (full) {
+ if (endsWith==null || urdd.role.endsWith(endsWith)) {
RoleDAO.Data rd = RoleDAO.Data.decode(urdd);
Result<NsDAO.Data> nsd = ques.mayUser(trans, user, rd, Access.read);
- if(nsd.isOK()) {
+ if (nsd.isOK()) {
Namespace namespace = lm.get(nsd.value.name);
- if(namespace==null) {
+ if (namespace==null) {
namespace = new Namespace(nsd.value);
lm.put(namespace.name,namespace);
}
Result<List<String>> rls = func.getAdmins(trans, namespace.name, false);
- if(rls.isOK()) {
+ if (rls.isOK()) {
namespace.admin=rls.value;
}
rls = func.getOwners(trans, namespace.name, false);
- if(rls.isOK()) {
+ if (rls.isOK()) {
namespace.owner=rls.value;
}
}
}
} else { // Shortened version. Only Namespace Info available from Role.
- if(Question.ADMIN.equals(urdd.rname) || Question.OWNER.equals(urdd.rname)) {
+ if (Question.ADMIN.equals(urdd.rname) || Question.OWNER.equals(urdd.rname)) {
RoleDAO.Data rd = RoleDAO.Data.decode(urdd);
Result<NsDAO.Data> nsd = ques.mayUser(trans, user, rd, Access.read);
- if(nsd.isOK()) {
+ if (nsd.isOK()) {
Namespace namespace = lm.get(nsd.value.name);
- if(namespace==null) {
- if(other!=null) {
+ if (namespace==null) {
+ if (other!=null) {
namespace = other.remove(nsd.value.name);
}
- if(namespace==null) {
+ if (namespace==null) {
namespace = new Namespace(nsd.value);
namespace.admin=new ArrayList<>();
namespace.owner=new ArrayList<>();
}
- if(endsWith==null || urdd.role.endsWith(endsWith)) {
+ if (endsWith==null || urdd.role.endsWith(endsWith)) {
lm.put(namespace.name,namespace);
} else {
other.put(namespace.name,namespace);
}
}
- if(Question.OWNER.equals(urdd.rname)) {
+ if (Question.OWNER.equals(urdd.rname)) {
namespace.owner.add(urdd.user);
} else {
namespace.admin.add(urdd.user);
@@ -642,7 +642,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Status.ERR_BadData, v.errs());
}
Result<Collection<Namespace>> rn = loadNamepace(trans, user, ".owner",full);
- if(rn.notOK()) {
+ if (rn.notOK()) {
return Result.err(rn);
}
if (rn.isEmpty()) {
@@ -666,34 +666,34 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<NSS> getNSsChildren(AuthzTrans trans, String parent) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("NS", parent).err()) {
+ if (v.nullOrBlank("NS", parent).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<NsDAO.Data> rnd = ques.deriveNs(trans, parent);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
Set<Namespace> lm = new HashSet<>();
Result<List<NsDAO.Data>> rlnd = ques.nsDAO.dao().getChildren(trans, parent);
- if(rlnd.isOK()) {
- if(rlnd.isEmpty()) {
+ if (rlnd.isOK()) {
+ if (rlnd.isEmpty()) {
return Result.err(Status.ERR_NotFound, "No data found for %s",parent);
}
- for(NsDAO.Data ndd : rlnd.value) {
+ for (NsDAO.Data ndd : rlnd.value) {
Namespace namespace = new Namespace(ndd);
Result<List<String>> rls = func.getAdmins(trans, namespace.name, false);
- if(rls.isOK()) {
+ if (rls.isOK()) {
namespace.admin=rls.value;
}
rls = func.getOwners(trans, namespace.name, false);
- if(rls.isOK()) {
+ if (rls.isOK()) {
namespace.owner=rls.value;
}
@@ -720,17 +720,17 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> updateNsDescription(AuthzTrans trans, REQUEST from) {
final Result<Namespace> nsd = mapper.ns(trans, from);
final ServiceValidator v = new ServiceValidator();
- if(v.ns(nsd).err()) {
+ if (v.ns(nsd).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
- if(v.nullOrBlank("description", nsd.value.description).err()) {
+ if (v.nullOrBlank("description", nsd.value.description).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Namespace namespace = nsd.value;
Result<List<NsDAO.Data>> rlnd = ques.nsDAO.read(trans, namespace.name);
- if(rlnd.notOKorIsEmpty()) {
+ if (rlnd.notOKorIsEmpty()) {
return Result.err(Status.ERR_NotFound, "Namespace [%s] does not exist",namespace.name);
}
@@ -739,7 +739,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Void> rdr = ques.nsDAO.dao().addDescription(trans, namespace.name, namespace.description);
- if(rdr.isOK()) {
+ if (rdr.isOK()) {
return Result.ok();
} else {
return Result.err(rdr);
@@ -799,7 +799,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> createPerm(final AuthzTrans trans,REQUEST rreq) {
final Result<PermDAO.Data> newPd = mapper.perm(trans, rreq);
final ServiceValidator v = new ServiceValidator();
- if(v.perm(newPd).err()) {
+ if (v.perm(newPd).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -817,14 +817,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<NsDAO.Data> nsd;
@Override
public Result<?> mayChange() {
- if(nsd==null) {
+ if (nsd==null) {
nsd = ques.mayUser(trans, trans.user(), newPd.value, Access.write);
}
return nsd;
}
});
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, newPd.value.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
switch(fd.status) {
@@ -834,7 +834,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
trans.user(),
nsr.value.get(0),
FUTURE_OP.C);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Perm [%s.%s|%s|%s] is saved for future processing",
newPd.value.ns,
newPd.value.type,
@@ -861,21 +861,21 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<PERMS> getPermsByType(AuthzTrans trans, final String permType) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("PermType", permType).err()) {
+ if (v.nullOrBlank("PermType", permType).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<PermDAO.Data>> rlpd = ques.getPermsByType(trans, permType);
- if(rlpd.notOK()) {
+ if (rlpd.notOK()) {
return Result.err(rlpd);
}
// We don't have instance & action for mayUserView... do we want to loop through all returned here as well as in mapper?
// Result<NsDAO.Data> r;
-// if((r = ques.mayUserViewPerm(trans, trans.user(), permType)).notOK())return Result.err(r);
+// if ((r = ques.mayUserViewPerm(trans, trans.user(), permType)).notOK())return Result.err(r);
PERMS perms = mapper.newInstance(API.PERMS);
- if(!rlpd.isEmpty()) {
+ if (!rlpd.isEmpty()) {
// Note: Mapper will restrict what can be viewed
return mapper.perms(trans, rlpd.value, perms, true);
}
@@ -895,19 +895,19 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<PERMS> getPermsByName(AuthzTrans trans, String type, String instance, String action) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("PermType", type).err()
+ if (v.nullOrBlank("PermType", type).err()
|| v.nullOrBlank("PermInstance", instance).err()
|| v.nullOrBlank("PermAction", action).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<PermDAO.Data>> rlpd = ques.getPermsByName(trans, type, instance, action);
- if(rlpd.notOK()) {
+ if (rlpd.notOK()) {
return Result.err(rlpd);
}
PERMS perms = mapper.newInstance(API.PERMS);
- if(!rlpd.isEmpty()) {
+ if (!rlpd.isEmpty()) {
// Note: Mapper will restrict what can be viewed
return mapper.perms(trans, rlpd.value, perms, true);
}
@@ -926,19 +926,19 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<PERMS> getPermsByUser(AuthzTrans trans, String user) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("User", user).err()) {
+ if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<PermDAO.Data>> rlpd = ques.getPermsByUser(trans, user,
trans.requested(force));
- if(rlpd.notOK()) {
+ if (rlpd.notOK()) {
return Result.err(rlpd);
}
PERMS perms = mapper.newInstance(API.PERMS);
- if(rlpd.isEmpty()) {
+ if (rlpd.isEmpty()) {
return Result.ok(perms);
}
// Note: Mapper will restrict what can be viewed
@@ -962,18 +962,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<PERMS> getPermsByUserScope(AuthzTrans trans, String user, String[] scopes) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("User", user).err()) {
+ if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<PermDAO.Data>> rlpd = ques.getPermsByUser(trans, user, trans.requested(force));
- if(rlpd.notOK()) {
+ if (rlpd.notOK()) {
return Result.err(rlpd);
}
PERMS perms = mapper.newInstance(API.PERMS);
- if(rlpd.isEmpty()) {
+ if (rlpd.isEmpty()) {
return Result.ok(perms);
}
// Note: Mapper will restrict what can be viewed
@@ -1014,13 +1014,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<PERMS> getPermsByUser(AuthzTrans trans, PERMS _perms, String user) {
PERMS perms = _perms;
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("User", user).err()) {
+ if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
//////////////
Result<List<PermDAO.Data>> rlpd = ques.getPermsByUser(trans, user,trans.requested(force));
- if(rlpd.notOK()) {
+ if (rlpd.notOK()) {
return Result.err(rlpd);
}
@@ -1029,25 +1029,25 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
2) See if User is allowed
*/
Result<List<PermDAO.Data>> in = mapper.perms(trans, perms);
- if(in.isOKhasData()) {
+ if (in.isOKhasData()) {
List<PermDAO.Data> out = rlpd.value;
boolean ok;
- for(PermDAO.Data pdd : in.value) {
+ for (PermDAO.Data pdd : in.value) {
ok = false;
- if("access".equals(pdd.type)) {
+ if ("access".equals(pdd.type)) {
Access access = Access.valueOf(pdd.action);
String[] mdkey = Split.splitTrim(':',pdd.instance);
- if(mdkey.length>1) {
+ if (mdkey.length>1) {
String type = mdkey[1];
- if("role".equals(type)) {
- if(mdkey.length>2) {
+ if ("role".equals(type)) {
+ if (mdkey.length>2) {
RoleDAO.Data rdd = new RoleDAO.Data();
rdd.ns=pdd.ns;
rdd.name=mdkey[2];
ok = ques.mayUser(trans, trans.user(), rdd, Access.read).isOK() && ques.mayUser(trans, user, rdd , access).isOK();
}
- } else if("perm".equals(type)) {
- if(mdkey.length>4) { // also need instance/action
+ } else if ("perm".equals(type)) {
+ if (mdkey.length>4) { // also need instance/action
PermDAO.Data p = new PermDAO.Data();
p.ns=pdd.ns;
p.type=mdkey[2];
@@ -1055,21 +1055,21 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
p.action=mdkey[4];
ok = ques.mayUser(trans, trans.user(), p, Access.read).isOK() && ques.mayUser(trans, user, p , access).isOK();
}
- } else if("ns".equals(type)) {
+ } else if ("ns".equals(type)) {
NsDAO.Data ndd = new NsDAO.Data();
ndd.name=pdd.ns;
ok = ques.mayUser(trans, trans.user(), ndd, Access.read).isOK() && ques.mayUser(trans, user, ndd , access).isOK();
}
}
}
- if(ok) {
+ if (ok) {
out.add(pdd);
}
}
}
perms = mapper.newInstance(API.PERMS);
- if(rlpd.isEmpty()) {
+ if (rlpd.isEmpty()) {
return Result.ok(perms);
}
// Note: Mapper will restrict what can be viewed
@@ -1090,24 +1090,24 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<PERMS> getPermsByRole(AuthzTrans trans,String role) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Role", role).err()) {
+ if (v.nullOrBlank("Role", role).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, ques,role);
- if(rrdd.notOK()) {
+ if (rrdd.notOK()) {
return Result.err(rrdd);
}
Result<NsDAO.Data> r = ques.mayUser(trans, trans.user(), rrdd.value, Access.read);
- if(r.notOK()) {
+ if (r.notOK()) {
return Result.err(r);
}
PERMS perms = mapper.newInstance(API.PERMS);
Result<List<PermDAO.Data>> rlpd = ques.getPermsByRole(trans, role, trans.requested(force));
- if(rlpd.isOKhasData()) {
+ if (rlpd.isOKhasData()) {
// Note: Mapper will restrict what can be viewed
return mapper.perms(trans, rlpd.value, perms, true);
}
@@ -1125,27 +1125,27 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<PERMS> getPermsByNS(AuthzTrans trans,String ns) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("NS", ns).err()) {
+ if (v.nullOrBlank("NS", ns).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<NsDAO.Data> rnd = ques.deriveNs(trans, ns);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
Result<List<PermDAO.Data>> rlpd = ques.permDAO.readNS(trans, ns);
- if(rlpd.notOK()) {
+ if (rlpd.notOK()) {
return Result.err(rlpd);
}
PERMS perms = mapper.newInstance(API.PERMS);
- if(!rlpd.isEmpty()) {
+ if (!rlpd.isEmpty()) {
// Note: Mapper will restrict what can be viewed
return mapper.perms(trans, rlpd.value,perms, true);
}
@@ -1167,7 +1167,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> renamePerm(final AuthzTrans trans,REQUEST rreq, String origType, String origInstance, String origAction) {
final Result<PermDAO.Data> newPd = mapper.perm(trans, rreq);
final ServiceValidator v = new ServiceValidator();
- if(v.perm(newPd).err()) {
+ if (v.perm(newPd).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -1179,7 +1179,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<NsSplit> nss = ques.deriveNsSplit(trans, origType);
Result<List<PermDAO.Data>> origRlpd = ques.permDAO.read(trans, nss.value.ns, nss.value.name, origInstance, origAction);
- if(origRlpd.notOKorIsEmpty()) {
+ if (origRlpd.notOKorIsEmpty()) {
return Result.err(Status.ERR_PermissionNotFound,
"Permission [%s|%s|%s] does not exist",
origType,origInstance,origAction);
@@ -1229,14 +1229,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> updatePermDescription(AuthzTrans trans, REQUEST from) {
final Result<PermDAO.Data> pd = mapper.perm(trans, from);
final ServiceValidator v = new ServiceValidator();
- if(v.perm(pd).err()) {
+ if (v.perm(pd).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
- if(v.nullOrBlank("description", pd.value.description).err()) {
+ if (v.nullOrBlank("description", pd.value.description).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
final PermDAO.Data perm = pd.value;
- if(ques.permDAO.read(trans, perm.ns, perm.type, perm.instance,perm.action).notOKorIsEmpty()) {
+ if (ques.permDAO.read(trans, perm.ns, perm.type, perm.instance,perm.action).notOKorIsEmpty()) {
return Result.err(Status.ERR_NotFound, "Permission [%s.%s|%s|%s] does not exist",
perm.ns,perm.type,perm.instance,perm.action);
}
@@ -1247,13 +1247,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, pd.value.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
Result<Void> rdr = ques.permDAO.addDescription(trans, perm.ns, perm.type, perm.instance,
perm.action, perm.description);
- if(rdr.isOK()) {
+ if (rdr.isOK()) {
return Result.ok();
} else {
return Result.err(rdr);
@@ -1273,12 +1273,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> resetPermRoles(final AuthzTrans trans, REQUEST rreq) {
final Result<PermDAO.Data> updt = mapper.permFromRPRequest(trans, rreq);
- if(updt.notOKorIsEmpty()) {
+ if (updt.notOKorIsEmpty()) {
return Result.err(updt);
}
final ServiceValidator v = new ServiceValidator();
- if(v.perm(updt).err()) {
+ if (v.perm(updt).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -1294,7 +1294,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
updt.value.instance,
updt.value.action);
- if(rcurr.notOKorIsEmpty()) {
+ if (rcurr.notOKorIsEmpty()) {
return Result.err(Status.ERR_PermissionNotFound,
"Permission [%s.%s|%s|%s] does not exist",
updt.value.ns,updt.value.type,updt.value.instance,updt.value.action);
@@ -1303,9 +1303,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Create a set of Update Roles, which are in Internal Format
Set<String> updtRoles = new HashSet<>();
Result<NsSplit> nss;
- for(String role : updt.value.roles(false)) {
+ for (String role : updt.value.roles(false)) {
nss = ques.deriveNsSplit(trans, role);
- if(nss.isOK()) {
+ if (nss.isOK()) {
updtRoles.add(nss.value.ns + '|' + nss.value.name);
} else {
trans.error().log(nss.errorString());
@@ -1314,17 +1314,17 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<Void> rv = null;
- for(PermDAO.Data curr : rcurr.value) {
+ for (PermDAO.Data curr : rcurr.value) {
Set<String> currRoles = curr.roles(false);
// must add roles to this perm, and add this perm to each role
// in the update, but not in the current
for (String role : updtRoles) {
if (!currRoles.contains(role)) {
Result<RoleDAO.Data> key = RoleDAO.Data.decode(trans, ques, role);
- if(key.isOKhasData()) {
+ if (key.isOKhasData()) {
Result<List<RoleDAO.Data>> rrd = ques.roleDAO.read(trans, key.value);
- if(rrd.isOKhasData()) {
- for(RoleDAO.Data r : rrd.value) {
+ if (rrd.isOKhasData()) {
+ for (RoleDAO.Data r : rrd.value) {
rv = func.addPermToRole(trans, r, curr, false);
if (rv.notOK() && rv.status!=Result.ERR_ConflictAlreadyExists) {
return Result.err(rv);
@@ -1341,10 +1341,10 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
for (String role : currRoles) {
if (!updtRoles.contains(role)) {
Result<RoleDAO.Data> key = RoleDAO.Data.decode(trans, ques, role);
- if(key.isOKhasData()) {
+ if (key.isOKhasData()) {
Result<List<RoleDAO.Data>> rdd = ques.roleDAO.read(trans, key.value);
- if(rdd.isOKhasData()) {
- for(RoleDAO.Data r : rdd.value) {
+ if (rdd.isOKhasData()) {
+ for (RoleDAO.Data r : rdd.value) {
rv = func.delPermFromRole(trans, r, curr, true);
if (rv.notOK() && rv.status!=Status.ERR_PermissionNotFound) {
return Result.err(rv);
@@ -1373,11 +1373,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> deletePerm(final AuthzTrans trans, REQUEST from) {
Result<PermDAO.Data> pd = mapper.perm(trans, from);
- if(pd.notOK()) {
+ if (pd.notOK()) {
return Result.err(pd);
}
final ServiceValidator v = new ServiceValidator();
- if(v.nullOrBlank(pd.value).err()) {
+ if (v.nullOrBlank(pd.value).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
final PermDAO.Data perm = pd.value;
@@ -1397,7 +1397,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<NsDAO.Data> nsd;
@Override
public Result<?> mayChange() {
- if(nsd==null) {
+ if (nsd==null) {
nsd = ques.mayUser(trans, trans.user(), perm, Access.write);
}
return nsd;
@@ -1407,13 +1407,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(fd.status) {
case OK:
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, perm.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
Result<String> rfc = func.createFuture(trans, fd.value,
perm.encode(), trans.user(),nsr.value.get(0),FUTURE_OP.D);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Perm Deletion [%s] is saved for future processing",perm.encode());
} else {
return Result.err(rfc);
@@ -1442,7 +1442,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> deletePerm(AuthzTrans trans, String type, String instance, String action) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Type",type)
+ if (v.nullOrBlank("Type",type)
.nullOrBlank("Instance",instance)
.nullOrBlank("Action",action)
.err()) {
@@ -1450,7 +1450,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<PermDAO.Data> pd = ques.permFrom(trans, type, instance, action);
- if(pd.isOK()) {
+ if (pd.isOK()) {
return func.deletePerm(trans, pd.value, trans.requested(force), false);
} else {
return Result.err(pd);
@@ -1485,11 +1485,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> createRole(final AuthzTrans trans, REQUEST from) {
final Result<RoleDAO.Data> rd = mapper.role(trans, from);
final ServiceValidator v = new ServiceValidator();
- if(v.role(rd).err()) {
+ if (v.role(rd).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
final RoleDAO.Data role = rd.value;
- if(ques.roleDAO.read(trans, role.ns, role.name).isOKhasData()) {
+ if (ques.roleDAO.read(trans, role.ns, role.name).isOKhasData()) {
return Result.err(Status.ERR_ConflictAlreadyExists, "Role [" + role.fullName() + "] already exists");
}
@@ -1506,7 +1506,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<NsDAO.Data> nsd;
@Override
public Result<?> mayChange() {
- if(nsd==null) {
+ if (nsd==null) {
nsd = ques.mayUser(trans, trans.user(), role, Access.write);
}
return nsd;
@@ -1514,7 +1514,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
});
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, rd.value.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
@@ -1522,7 +1522,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
case OK:
Result<String> rfc = func.createFuture(trans, fd.value,
role.encode(), trans.user(),nsr.value.get(0),FUTURE_OP.C);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Role [%s.%s] is saved for future processing",
rd.value.ns,
rd.value.name);
@@ -1531,7 +1531,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
case Status.ACC_Now:
Result<RoleDAO.Data> rdr = ques.roleDAO.create(trans, role);
- if(rdr.isOK()) {
+ if (rdr.isOK()) {
return Result.ok();
} else {
return Result.err(rdr);
@@ -1557,15 +1557,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<ROLES> getRolesByName(AuthzTrans trans, String role) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Role", role).err()) {
+ if (v.nullOrBlank("Role", role).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
// Determine if User can ask this question
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, ques, role);
- if(rrdd.isOKhasData()) {
+ if (rrdd.isOKhasData()) {
Result<NsDAO.Data> r;
- if((r = ques.mayUser(trans, trans.user(), rrdd.value, Access.read)).notOK()) {
+ if ((r = ques.mayUser(trans, trans.user(), rrdd.value, Access.read)).notOK()) {
return Result.err(r);
}
} else {
@@ -1575,7 +1575,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Look up data
int query = role.indexOf('?');
Result<List<RoleDAO.Data>> rlrd = ques.getRolesByName(trans, query<0?role:role.substring(0, query));
- if(rlrd.isOK()) {
+ if (rlrd.isOK()) {
// Note: Mapper will restrict what can be viewed
ROLES roles = mapper.newInstance(API.ROLES);
return mapper.roles(trans, rlrd.value, roles, true);
@@ -1602,7 +1602,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<ROLES> getRolesByUser(AuthzTrans trans, String user) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("User", user).err()) {
+ if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -1610,12 +1610,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Get list of roles per user, then add to Roles as we go
Result<List<RoleDAO.Data>> rlrd;
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readByUser(trans, user);
- if(rlurd.isOKhasData()) {
- for(UserRoleDAO.Data urd : rlurd.value ) {
+ if (rlurd.isOKhasData()) {
+ for (UserRoleDAO.Data urd : rlurd.value ) {
rlrd = ques.roleDAO.read(trans, urd.ns,urd.rname);
// Note: Mapper will restrict what can be viewed
// if user is the same as that which is looked up, no filtering is required
- if(rlrd.isOKhasData()) {
+ if (rlrd.isOKhasData()) {
mapper.roles(trans, rlrd.value,roles, !user.equals(trans.user()));
}
}
@@ -1641,17 +1641,17 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<ROLES> getRolesByNS(AuthzTrans trans, String ns) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("NS", ns).err()) {
+ if (v.nullOrBlank("NS", ns).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
// check if user is allowed to view NS
Result<NsDAO.Data> rnsd = ques.deriveNs(trans, ns);
- if(rnsd.notOK()) {
+ if (rnsd.notOK()) {
return Result.err(rnsd);
}
rnsd = ques.mayUser(trans, trans.user(), rnsd.value, Access.read);
- if(rnsd.notOK()) {
+ if (rnsd.notOK()) {
return Result.err(rnsd);
}
@@ -1660,8 +1660,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
ROLES roles = mapper.newInstance(API.ROLES);
// Get list of roles per user, then add to Roles as we go
Result<List<RoleDAO.Data>> rlrd = ques.roleDAO.readNS(trans, ns);
- if(rlrd.isOK()) {
- if(!rlrd.isEmpty()) {
+ if (rlrd.isOK()) {
+ if (!rlrd.isEmpty()) {
// Note: Mapper doesn't need to restrict what can be viewed, because we did it already.
mapper.roles(trans,rlrd.value,roles,false);
}
@@ -1691,7 +1691,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<ROLES> getRolesByNameOnly(AuthzTrans trans, String name) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Name", name).err()) {
+ if (v.nullOrBlank("Name", name).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -1702,8 +1702,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
ROLES roles = mapper.newInstance(API.ROLES);
// Get list of roles per user, then add to Roles as we go
Result<List<RoleDAO.Data>> rlrd = ques.roleDAO.readName(trans, name);
- if(rlrd.isOK()) {
- if(!rlrd.isEmpty()) {
+ if (rlrd.isOK()) {
+ if (!rlrd.isEmpty()) {
// Note: Mapper will restrict what can be viewed
mapper.roles(trans,rlrd.value,roles,true);
}
@@ -1739,7 +1739,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<ROLES> getRolesByPerm(AuthzTrans trans, String type, String instance, String action) {
final Validator v = new ServiceValidator();
- if(v.permType(type)
+ if (v.permType(type)
.permInstance(instance)
.permAction(action)
.err()) {
@@ -1751,22 +1751,22 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
ROLES roles = mapper.newInstance(API.ROLES);
// Get list of roles per user, then add to Roles as we go
Result<NsSplit> nsSplit = ques.deriveNsSplit(trans, type);
- if(nsSplit.isOK()) {
+ if (nsSplit.isOK()) {
PermDAO.Data pdd = new PermDAO.Data(nsSplit.value, instance, action);
Result<?> res;
- if((res=ques.mayUser(trans, trans.user(), pdd, Question.Access.read)).notOK()) {
+ if ((res=ques.mayUser(trans, trans.user(), pdd, Question.Access.read)).notOK()) {
return Result.err(res);
}
Result<List<PermDAO.Data>> pdlr = ques.permDAO.read(trans, pdd);
- if(pdlr.isOK())for(PermDAO.Data pd : pdlr.value) {
+ if (pdlr.isOK())for (PermDAO.Data pd : pdlr.value) {
Result<List<RoleDAO.Data>> rlrd;
- for(String r : pd.roles) {
+ for (String r : pd.roles) {
Result<String[]> rs = RoleDAO.Data.decodeToArray(trans, ques, r);
- if(rs.isOK()) {
+ if (rs.isOK()) {
rlrd = ques.roleDAO.read(trans, rs.value[0],rs.value[1]);
// Note: Mapper will restrict what can be viewed
- if(rlrd.isOKhasData()) {
+ if (rlrd.isOKhasData()) {
mapper.roles(trans,rlrd.value,roles,true);
}
}
@@ -1792,15 +1792,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> updateRoleDescription(AuthzTrans trans, REQUEST from) {
final Result<RoleDAO.Data> rd = mapper.role(trans, from);
final ServiceValidator v = new ServiceValidator();
- if(v.role(rd).err()) {
+ if (v.role(rd).err()) {
return Result.err(Status.ERR_BadData,v.errs());
} {
- if(v.nullOrBlank("description", rd.value.description).err()) {
+ if (v.nullOrBlank("description", rd.value.description).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
}
final RoleDAO.Data role = rd.value;
- if(ques.roleDAO.read(trans, role.ns, role.name).notOKorIsEmpty()) {
+ if (ques.roleDAO.read(trans, role.ns, role.name).notOKorIsEmpty()) {
return Result.err(Status.ERR_NotFound, "Role [" + role.fullName() + "] does not exist");
}
@@ -1809,12 +1809,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, rd.value.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
Result<Void> rdr = ques.roleDAO.addDescription(trans, role.ns, role.name, role.description);
- if(rdr.isOK()) {
+ if (rdr.isOK()) {
return Result.ok();
} else {
return Result.err(rdr);
@@ -1846,24 +1846,24 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> addPermToRole(final AuthzTrans trans, REQUEST rreq) {
// Translate Request into Perm and Role Objects
final Result<PermDAO.Data> rpd = mapper.permFromRPRequest(trans, rreq);
- if(rpd.notOKorIsEmpty()) {
+ if (rpd.notOKorIsEmpty()) {
return Result.err(rpd);
}
final Result<RoleDAO.Data> rrd = mapper.roleFromRPRequest(trans, rreq);
- if(rrd.notOKorIsEmpty()) {
+ if (rrd.notOKorIsEmpty()) {
return Result.err(rrd);
}
// Validate Role and Perm values
final ServiceValidator v = new ServiceValidator();
- if(v.perm(rpd.value)
+ if (v.perm(rpd.value)
.role(rrd.value)
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<RoleDAO.Data>> rlrd = ques.roleDAO.read(trans, rrd.value.ns, rrd.value.name);
- if(rlrd.notOKorIsEmpty()) {
+ if (rlrd.notOKorIsEmpty()) {
return Result.err(Status.ERR_RoleNotFound, "Role [%s] does not exist", rrd.value.fullName());
}
@@ -1871,8 +1871,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<List<PermDAO.Data>> rlpd = ques.permDAO.read(trans, rpd.value.ns,
rpd.value.type, rpd.value.instance, rpd.value.action);
PermDAO.Data createPerm = null; // if not null, create first
- if(rlpd.notOKorIsEmpty()) { // Permission doesn't exist
- if(trans.requested(force)) {
+ if (rlpd.notOKorIsEmpty()) { // Permission doesn't exist
+ if (trans.requested(force)) {
// Remove roles from perm data object so we just create the perm here
createPerm = rpd.value;
createPerm.roles.clear();
@@ -1903,14 +1903,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<NsDAO.Data> nsd;
@Override
public Result<?> mayChange() {
- if(nsd==null) {
+ if (nsd==null) {
nsd = ques.mayUser(trans, trans.user(), rpd.value, Access.write);
}
return nsd;
}
});
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, rpd.value.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
switch(fd.status) {
@@ -1920,7 +1920,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
trans.user(),
nsr.value.get(0),
FUTURE_OP.G);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Perm [%s.%s|%s|%s] is saved for future processing",
rpd.value.ns,
rpd.value.type,
@@ -1931,10 +1931,10 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
case Status.ACC_Now:
Result<Void> rv = null;
- if(createPerm!=null) {// has been validated for creating
+ if (createPerm!=null) {// has been validated for creating
rv = func.createPerm(trans, createPerm, false);
}
- if(rv==null || rv.isOK()) {
+ if (rv==null || rv.isOK()) {
rv = func.addPermToRole(trans, rrd.value, rpd.value, false);
}
return rv;
@@ -1962,16 +1962,16 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> delPermFromRole(final AuthzTrans trans, REQUEST rreq) {
final Result<PermDAO.Data> updt = mapper.permFromRPRequest(trans, rreq);
- if(updt.notOKorIsEmpty()) {
+ if (updt.notOKorIsEmpty()) {
return Result.err(updt);
}
final Result<RoleDAO.Data> rrd = mapper.roleFromRPRequest(trans, rreq);
- if(rrd.notOKorIsEmpty()) {
+ if (rrd.notOKorIsEmpty()) {
return Result.err(rrd);
}
final ServiceValidator v = new ServiceValidator();
- if(v.nullOrBlank(updt.value)
+ if (v.nullOrBlank(updt.value)
.nullOrBlank(rrd.value)
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
@@ -1984,7 +1984,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<List<PermDAO.Data>> rlpd = ques.permDAO.read(trans, pdd.ns, pdd.type,
pdd.instance, pdd.action);
- if(rlpd.notOKorIsEmpty()) {
+ if (rlpd.notOKorIsEmpty()) {
return Result.err(Status.ERR_PermissionNotFound,
"Permission [%s.%s|%s|%s] does not exist",
pdd.ns,pdd.type,pdd.instance,pdd.action);
@@ -2002,14 +2002,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<NsDAO.Data> nsd;
@Override
public Result<?> mayChange() {
- if(nsd==null) {
+ if (nsd==null) {
nsd = ques.mayUser(trans, trans.user(), pdd, Access.write);
}
return nsd;
}
});
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, pdd.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
switch(fd.status) {
@@ -2020,7 +2020,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
nsr.value.get(0),
FUTURE_OP.UG
);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Perm [%s.%s|%s|%s] is saved for future processing",
pdd.ns,
pdd.type,
@@ -2053,12 +2053,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> delPermFromRole(AuthzTrans trans, String role, String type, String instance, String action) {
Result<Data> rpns = ques.deriveNs(trans, type);
- if(rpns.notOKorIsEmpty()) {
+ if (rpns.notOKorIsEmpty()) {
return Result.err(rpns);
}
final Validator v = new ServiceValidator();
- if(v.role(role)
+ if (v.role(role)
.permType(rpns.value.name,rpns.value.parent)
.permInstance(instance)
.permAction(action)
@@ -2067,17 +2067,17 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Data> rrns = ques.deriveNs(trans, role);
- if(rrns.notOKorIsEmpty()) {
+ if (rrns.notOKorIsEmpty()) {
return Result.err(rrns);
}
final Result<List<RoleDAO.Data>> rrd = ques.roleDAO.read(trans, rrns.value.parent, rrns.value.name);
- if(rrd.notOKorIsEmpty()) {
+ if (rrd.notOKorIsEmpty()) {
return Result.err(rrd);
}
final Result<List<PermDAO.Data>> rpd = ques.permDAO.read(trans, rpns.value.parent, rpns.value.name, instance, action);
- if(rpd.notOKorIsEmpty()) {
+ if (rpd.notOKorIsEmpty()) {
return Result.err(rpd);
}
@@ -2097,9 +2097,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> deleteRole(AuthzTrans trans, String role) {
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,ques,role);
- if(rrdd.isOKhasData()) {
+ if (rrdd.isOKhasData()) {
final ServiceValidator v = new ServiceValidator();
- if(v.nullOrBlank(rrdd.value).err()) {
+ if (v.nullOrBlank(rrdd.value).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
return func.deleteRole(trans, rrdd.value, false, false);
@@ -2125,14 +2125,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> deleteRole(final AuthzTrans trans, REQUEST from) {
final Result<RoleDAO.Data> rd = mapper.role(trans, from);
final ServiceValidator v = new ServiceValidator();
- if(rd==null) {
+ if (rd==null) {
return Result.err(Status.ERR_BadData,"Request does not contain Role");
}
- if(v.nullOrBlank(rd.value).err()) {
+ if (v.nullOrBlank(rd.value).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
final RoleDAO.Data role = rd.value;
- if(ques.roleDAO.read(trans, role).notOKorIsEmpty() && !trans.requested(force)) {
+ if (ques.roleDAO.read(trans, role).notOKorIsEmpty() && !trans.requested(force)) {
return Result.err(Status.ERR_RoleNotFound, "Role [" + role.fullName() + "] does not exist");
}
@@ -2148,7 +2148,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<NsDAO.Data> nsd;
@Override
public Result<?> mayChange() {
- if(nsd==null) {
+ if (nsd==null) {
nsd = ques.mayUser(trans, trans.user(), role, Access.write);
}
return nsd;
@@ -2158,13 +2158,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(fd.status) {
case OK:
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, rd.value.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
Result<String> rfc = func.createFuture(trans, fd.value,
role.encode(), trans.user(),nsr.value.get(0),FUTURE_OP.D);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Role Deletion [%s.%s] is saved for future processing",
rd.value.ns,
rd.value.name);
@@ -2196,18 +2196,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<?> mayChange() {
- if(nsd==null) {
+ if (nsd==null) {
nsd = ques.validNSOfDomain(trans, cred.id);
}
// is Ns of CredID valid?
- if(nsd.isOK()) {
+ if (nsd.isOK()) {
try {
// Check Org Policy
- if(trans.org().validate(trans,Policy.CREATE_MECHID, exec, cred.id)==null) {
+ if (trans.org().validate(trans,Policy.CREATE_MECHID, exec, cred.id)==null) {
return Result.ok();
} else {
Result<?> rmc = ques.mayUser(trans, trans.user(), nsd.value, Access.write);
- if(rmc.isOKhasData()) {
+ if (rmc.isOKhasData()) {
return rmc;
}
}
@@ -2234,21 +2234,21 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<?> mayChange() {
// User can change himself (but not create)
- if(trans.user().equals(cred.id)) {
+ if (trans.user().equals(cred.id)) {
return Result.ok();
}
- if(nsd==null) {
+ if (nsd==null) {
nsd = ques.validNSOfDomain(trans, cred.id);
}
// Get the Namespace
- if(nsd.isOK()) {
- if(ques.mayUser(trans, trans.user(), nsd.value,Access.write).isOK()) {
+ if (nsd.isOK()) {
+ if (ques.mayUser(trans, trans.user(), nsd.value,Access.write).isOK()) {
return Result.ok();
}
String user[] = Split.split('.',trans.user());
- if(user.length>2) {
+ if (user.length>2) {
String company = user[user.length-1] + '.' + user[user.length-2];
- if(ques.isGranted(trans, trans.user(), ROOT_NS,"password",company,"reset")) {
+ if (ques.isGranted(trans, trans.user(), ROOT_NS,"password",company,"reset")) {
return Result.ok();
}
}
@@ -2282,13 +2282,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<CredDAO.Data> rcred = mapper.cred(trans, from, true);
- if(rcred.isOKhasData()) {
+ if (rcred.isOKhasData()) {
byte[] rawCred = rcred.value.cred.array();
rcred = ques.userCredSetup(trans, rcred.value);
final ServiceValidator v = new ServiceValidator();
- if(v.cred(trans, trans.org(),rcred,true).err()) { // Note: Creates have stricter Validations
+ if (v.cred(trans, trans.org(),rcred,true).err()) { // Note: Creates have stricter Validations
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -2301,12 +2301,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} catch (Exception e1) {
trans.error().log(e1,rcred.value.id,"cannot be validated at this time");
}
- if(mechID==null || !mechID.isFound()) {
+ if (mechID==null || !mechID.isFound()) {
return Result.err(Status.ERR_Policy,"MechIDs must be registered with %s before provisioning in AAF",org.getName());
}
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, rcred.value.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(Status.ERR_NsNotFound,"Cannot provision %s on non-existent Namespace %s",mechID.id(),rcred.value.ns);
}
@@ -2327,9 +2327,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// password to validate char differences.
rb = ques.userCredCheck(trans, curr, rawCred);
- if(rb.notOK()) {
+ if (rb.notOK()) {
return Result.err(rb);
- } else if(rb.value){
+ } else if (rb.value){
return Result.err(Status.ERR_Policy, "Credential content cannot be reused.");
} else if (Chrono.dateOnlyStamp(curr.expires).equals(Chrono.dateOnlyStamp(rcred.value.expires)) && curr.type==rcred.value.type) {
return Result.err(Status.ERR_ConflictAlreadyExists, "Credential with same Expiration Date exists, use 'reset'");
@@ -2341,15 +2341,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
String theMechID = rcred.value.id;
Boolean otherMechIDs = false;
// find out if this is the only mechID. other MechIDs mean special handling (not automated)
- for(CredDAO.Data cd : ques.credDAO.readNS(trans,nsr.value.get(0).name).value) {
- if(!cd.id.equals(theMechID)) {
+ for (CredDAO.Data cd : ques.credDAO.readNS(trans,nsr.value.get(0).name).value) {
+ if (!cd.id.equals(theMechID)) {
otherMechIDs = true;
break;
}
}
String reason;
// We can say "ID does not exist" here
- if((reason=org.validate(trans, Policy.CREATE_MECHID, exec, theMechID,trans.user(),otherMechIDs.toString()))!=null) {
+ if ((reason=org.validate(trans, Policy.CREATE_MECHID, exec, theMechID,trans.user(),otherMechIDs.toString()))!=null) {
return Result.err(Status.ERR_Denied, reason);
}
firstID=true;
@@ -2378,7 +2378,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<String> rfc = func.createFuture(trans, fd.value,
rcred.value.id + '|' + rcred.value.type.toString() + '|' + rcred.value.expires,
trans.user(), nsr.value.get(0), FUTURE_OP.C);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Credential Request [%s|%s|%s] is saved for future processing",
rcred.value.id,
Integer.toString(rcred.value.type),
@@ -2388,13 +2388,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
case Status.ACC_Now:
try {
- if(firstID) {
+ if (firstID) {
// && !nsr.value.get(0).isAdmin(trans.getUserPrincipal().getName())) {
Result<List<String>> admins = func.getAdmins(trans, nsr.value.get(0).name, false);
// OK, it's a first ID, and not by NS Admin, so let's set TempPassword length
// Note, we only do this on First time, because of possibility of
// prematurely expiring a production id
- if(admins.isOKhasData() && !admins.value.contains(trans.user())) {
+ if (admins.isOKhasData() && !admins.value.contains(trans.user())) {
rcred.value.expires = org.expiration(null, Expiration.TempPassword).getTime();
}
}
@@ -2402,7 +2402,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
trans.error().log(e, "While setting expiration to TempPassword");
}
Result<?>udr = ques.credDAO.create(trans, rcred.value);
- if(udr.isOK()) {
+ if (udr.isOK()) {
return Result.ok();
}
return Result.err(udr);
@@ -2430,17 +2430,17 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<USERS> getCredsByNS(AuthzTrans trans, String ns) {
final Validator v = new ServiceValidator();
- if(v.ns(ns).err()) {
+ if (v.ns(ns).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
// check if user is allowed to view NS
Result<NsDAO.Data> rnd = ques.deriveNs(trans,ns);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
@@ -2449,8 +2449,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
USERS users = mapper.newInstance(API.USERS);
Result<List<CredDAO.Data>> rlcd = ques.credDAO.readNS(trans, ns);
- if(rlcd.isOK()) {
- if(!rlcd.isEmpty()) {
+ if (rlcd.isOK()) {
+ if (!rlcd.isEmpty()) {
return mapper.cred(rlcd.value, users);
}
return Result.ok(users);
@@ -2476,18 +2476,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<USERS> getCredsByID(AuthzTrans trans, String id) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("ID",id).err()) {
+ if (v.nullOrBlank("ID",id).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
String ns = Question.domain2ns(id);
// check if user is allowed to view NS
Result<NsDAO.Data> rnd = ques.deriveNs(trans,ns);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
@@ -2496,8 +2496,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
USERS users = mapper.newInstance(API.USERS);
Result<List<CredDAO.Data>> rlcd = ques.credDAO.readID(trans, id);
- if(rlcd.isOK()) {
- if(!rlcd.isEmpty()) {
+ if (rlcd.isOK()) {
+ if (!rlcd.isEmpty()) {
return mapper.cred(rlcd.value, users);
}
return Result.ok(users);
@@ -2526,8 +2526,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
CERTS certs = mapper.newInstance(API.CERTS);
Result<List<CertDAO.Data>> rlcd = ques.certDAO.readID(trans, id);
- if(rlcd.isOK()) {
- if(!rlcd.isEmpty()) {
+ if (rlcd.isOK()) {
+ if (!rlcd.isEmpty()) {
return mapper.cert(rlcd.value, certs);
}
return Result.ok(certs);
@@ -2557,16 +2557,16 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(cmdDescription, Env.SUB);
try {
Result<CredDAO.Data> rcred = mapper.cred(trans, from, true);
- if(rcred.isOKhasData()) {
+ if (rcred.isOKhasData()) {
rcred = ques.userCredSetup(trans, rcred.value);
final ServiceValidator v = new ServiceValidator();
- if(v.cred(trans, trans.org(),rcred,false).err()) {// Note: Creates have stricter Validations
+ if (v.cred(trans, trans.org(),rcred,false).err()) {// Note: Creates have stricter Validations
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<CredDAO.Data>> rlcd = ques.credDAO.readID(trans, rcred.value.id);
- if(rlcd.notOKorIsEmpty()) {
+ if (rlcd.notOKorIsEmpty()) {
return Result.err(Status.ERR_UserNotFound, "Credential does not exist");
}
@@ -2577,7 +2577,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Integer> ri = selectEntryIfMultiple((CredRequest)from, rlcd.value);
- if(ri.notOK()) {
+ if (ri.notOK()) {
return Result.err(ri);
}
int entry = ri.value;
@@ -2598,7 +2598,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
mc);
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, rcred.value.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
@@ -2607,7 +2607,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<String> rfc = func.createFuture(trans, fd.value,
rcred.value.id + '|' + rcred.value.type.toString() + '|' + rcred.value.expires,
trans.user(), nsr.value.get(0), FUTURE_OP.U);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Credential Request [%s|%s|%s]",
rcred.value.id,
Integer.toString(rcred.value.type),
@@ -2620,7 +2620,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// If we are Resetting Password on behalf of someone else (am not the Admin)
// use TempPassword Expiration time.
Expiration exp;
- if(ques.isAdmin(trans, trans.user(), nsr.value.get(0).name)) {
+ if (ques.isAdmin(trans, trans.user(), nsr.value.get(0).name)) {
exp = Expiration.Password;
} else {
exp = Expiration.TempPassword;
@@ -2642,7 +2642,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
rcred.value.notes=current.notes;
udr = ques.credDAO.create(trans, rcred.value);
- if(udr.isOK()) {
+ if (udr.isOK()) {
udr = ques.credDAO.delete(trans, rlcd.value.get(entry),false);
}
if (udr.isOK()) {
@@ -2701,7 +2701,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<CredDAO.Data> cred = mapper.cred(trans, from, false);
Organization org = trans.org();
final ServiceValidator v = new ServiceValidator();
- if(v.notOK(cred).err() ||
+ if (v.notOK(cred).err() ||
v.nullOrBlank(cred.value.id, "Invalid ID").err() ||
v.user(org,cred.value.id).err()) {
return Result.err(Status.ERR_BadData,v.errs());
@@ -2720,13 +2720,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Get the list of Cred Entries
Result<List<CredDAO.Data>> rlcd = ques.credDAO.readID(trans, cred.value.id);
- if(rlcd.notOKorIsEmpty()) {
+ if (rlcd.notOKorIsEmpty()) {
return Result.err(Status.ERR_UserNotFound, "Credential does not exist");
}
//Need to do the "Pick Entry" mechanism
Result<Integer> ri = selectEntryIfMultiple((CredRequest)from, rlcd.value);
- if(ri.notOK()) {
+ if (ri.notOK()) {
return Result.err(ri);
}
@@ -2742,7 +2742,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
cd.expires = org.expiration(null, Expiration.ExtendPassword,days).getTime();
cred = ques.credDAO.create(trans, cd);
- if(cred.isOK()) {
+ if (cred.isOK()) {
return Result.ok();
}
return Result.err(cred);
@@ -2779,7 +2779,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
errMessage.append(' ');
}
errMessage.append(" Type Expires" + '\n');
- for(int i=0;i<value.size();++i) {
+ for (int i=0;i<value.size();++i) {
errMessage.append(" %s\n");
}
errMessage.append("Run same command again with chosen entry as last parameter");
@@ -2803,16 +2803,16 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> deleteUserCred(AuthzTrans trans, REQUEST from) {
final Result<CredDAO.Data> cred = mapper.cred(trans, from, false);
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("cred", cred.value.id).err()) {
+ if (v.nullOrBlank("cred", cred.value.id).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<CredDAO.Data>> rlcd = ques.credDAO.readID(trans, cred.value.id);
- if(rlcd.notOKorIsEmpty()) {
+ if (rlcd.notOKorIsEmpty()) {
// Empty Creds should have no user_roles.
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readByUser(trans, cred.value.id);
- if(rlurd.isOK()) {
- for(UserRoleDAO.Data data : rlurd.value) {
+ if (rlurd.isOK()) {
+ for (UserRoleDAO.Data data : rlurd.value) {
ques.userRoleDAO.delete(trans, data, false);
}
}
@@ -2827,7 +2827,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
int entry = 0;
- if(!trans.requested(force)) {
+ if (!trans.requested(force)) {
if (rlcd.value.size() > 1) {
CredRequest cr = (CredRequest)from;
String inputOption = cr.getEntry();
@@ -2837,11 +2837,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Status.ERR_ChoiceNeeded, message, variables);
} else {
try {
- if(inputOption.length()>5) { // should be a date
+ if (inputOption.length()>5) { // should be a date
Date d = Chrono.xmlDatatypeFactory.newXMLGregorianCalendar(inputOption).toGregorianCalendar().getTime();
entry = 0;
- for(CredDAO.Data cd : rlcd.value) {
- if(cd.type.equals(cr.getType()) && cd.expires.equals(d)) {
+ for (CredDAO.Data cd : rlcd.value) {
+ if (cd.type.equals(cr.getType()) && cd.expires.equals(d)) {
break;
}
++entry;
@@ -2849,9 +2849,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} else {
entry = Integer.parseInt(inputOption) - 1;
}
- } catch(NullPointerException e) {
+ } catch (NullPointerException e) {
return Result.err(Status.ERR_BadData, "Invalid Date Format for Entry");
- } catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
return Result.err(Status.ERR_BadData, "User chose invalid credential selection");
}
}
@@ -2876,7 +2876,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
mc);
Result<List<NsDAO.Data>> nsr = ques.nsDAO.read(trans, cred.value.ns);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
@@ -2885,7 +2885,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<String> rfc = func.createFuture(trans, fd.value, cred.value.id,
trans.user(), nsr.value.get(0), FUTURE_OP.D);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Credential Delete [%s] is saved for future processing",cred.value.id);
} else {
return Result.err(rfc);
@@ -2893,7 +2893,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
case Status.ACC_Now:
Result<?>udr = null;
if (!trans.requested(force)) {
- if(entry<0 || entry >= rlcd.value.size()) {
+ if (entry<0 || entry >= rlcd.value.size()) {
return Result.err(Status.ERR_BadData,"Invalid Choice [" + entry + "] chosen for Delete [%s] is saved for future processing",cred.value.id);
}
udr = ques.credDAO.delete(trans, rlcd.value.get(entry),false);
@@ -2905,15 +2905,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
}
- if(isLastCred) {
+ if (isLastCred) {
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readByUser(trans, cred.value.id);
- if(rlurd.isOK()) {
- for(UserRoleDAO.Data data : rlurd.value) {
+ if (rlurd.isOK()) {
+ for (UserRoleDAO.Data data : rlurd.value) {
ques.userRoleDAO.delete(trans, data, false);
}
}
}
- if(udr==null) {
+ if (udr==null) {
return Result.err(Result.ERR_NotFound,"No User Data found");
}
if (udr.isOK()) {
@@ -2933,11 +2933,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
// Note: Mapper assigns RAW type
Result<CredDAO.Data> data = mapper.cred(trans, credReq,false);
- if(data.notOKorIsEmpty()) {
+ if (data.notOKorIsEmpty()) {
return Result.err(data);
}
CredDAO.Data cred = data.value; // of the Mapped Cred
- if(cred.cred==null) {
+ if (cred.cred==null) {
return Result.err(Result.ERR_BadData,"No Password");
} else {
return ques.doesUserCredMatch(trans, cred.id, cred.cred.array());
@@ -2984,7 +2984,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
BasicPrincipal bp = new BasicPrincipal(basicAuth,trans.org().getRealm());
Result<Date> rq = ques.doesUserCredMatch(trans, bp.getName(), bp.getCred());
// Note: Only want to log problem, don't want to send back to end user
- if(rq.isOK()) {
+ if (rq.isOK()) {
return rq;
} else {
trans.audit().log(rq.errorString());
@@ -3018,13 +3018,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start("Create UserRole", Env.SUB);
try {
Result<UserRoleDAO.Data> urr = mapper.userRole(trans, from);
- if(urr.notOKorIsEmpty()) {
+ if (urr.notOKorIsEmpty()) {
return Result.err(urr);
}
final UserRoleDAO.Data userRole = urr.value;
final ServiceValidator v = new ServiceValidator();
- if(v.user_role(userRole).err() ||
+ if (v.user_role(userRole).err() ||
v.user(trans.org(), userRole.user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -3045,7 +3045,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<NsDAO.Data> nsd;
@Override
public Result<?> mayChange() {
- if(nsd==null) {
+ if (nsd==null) {
RoleDAO.Data r = RoleDAO.Data.decode(userRole);
nsd = ques.mayUser(trans, trans.user(), r, Access.write);
}
@@ -3053,7 +3053,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
});
Result<NsDAO.Data> nsr = ques.deriveNs(trans, userRole.role);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
@@ -3061,7 +3061,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
case OK:
Result<String> rfc = func.createFuture(trans, fd.value, userRole.user+'|'+userRole.ns + '.' + userRole.rname,
userRole.user, nsr.value, FUTURE_OP.C);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "UserRole [%s - %s.%s] is saved for future processing",
userRole.user,
userRole.ns,
@@ -3094,13 +3094,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<USERROLES> getUserRolesByRole(AuthzTrans trans, String role) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Role",role).err()) {
+ if (v.nullOrBlank("Role",role).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<RoleDAO.Data> rrdd;
rrdd = RoleDAO.Data.decode(trans,ques,role);
- if(rrdd.notOK()) {
+ if (rrdd.notOK()) {
return Result.err(rrdd);
}
// May Requester see result?
@@ -3116,8 +3116,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Get list of roles per user, then add to Roles as we go
HashSet<UserRoleDAO.Data> userSet = new HashSet<>();
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readByRole(trans, role);
- if(rlurd.isOK()) {
- for(UserRoleDAO.Data data : rlurd.value) {
+ if (rlurd.isOK()) {
+ for (UserRoleDAO.Data data : rlurd.value) {
userSet.add(data);
}
}
@@ -3143,13 +3143,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<USERROLES> getUserRolesByUser(AuthzTrans trans, String user) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("User",user).err()) {
+ if (v.nullOrBlank("User",user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
// Get list of roles per user, then add to Roles as we go
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readByUser(trans, user);
- if(rlurd.notOK()) {
+ if (rlurd.notOK()) {
return Result.err(rlurd);
}
@@ -3164,16 +3164,16 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
String callingUser = trans.getUserPrincipal().getName();
NsDAO.Data ndd = new NsDAO.Data();
- if(user.equals(callingUser)) {
+ if (user.equals(callingUser)) {
mustFilter = false;
} else {
Organization org = trans.org();
try {
Identity orgID = org.getIdentity(trans, user);
Identity manager = orgID==null?null:orgID.responsibleTo();
- if(orgID!=null && (manager!=null && callingUser.equals(manager.fullID()))) {
+ if (orgID!=null && (manager!=null && callingUser.equals(manager.fullID()))) {
mustFilter = false;
- } else if(ques.isGranted(trans, callingUser, ROOT_NS, Question.ACCESS, "*", Access.read.name())) {
+ } else if (ques.isGranted(trans, callingUser, ROOT_NS, Question.ACCESS, "*", Access.read.name())) {
mustFilter=false;
} else {
mustFilter = true;
@@ -3185,13 +3185,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
List<UserRoleDAO.Data> content;
- if(mustFilter) {
+ if (mustFilter) {
content = new ArrayList<>(rlurd.value.size()); // avoid multi-memory redos
- for(UserRoleDAO.Data data : rlurd.value) {
+ for (UserRoleDAO.Data data : rlurd.value) {
ndd.name=data.ns;
Result<Data> mur = ques.mayUser(trans, callingUser, ndd, Access.read);
- if(mur.isOK()){
+ if (mur.isOK()){
content.add(data);
}
}
@@ -3224,7 +3224,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> resetRolesForUser(AuthzTrans trans, REQUEST rreq) {
Result<UserRoleDAO.Data> rurdd = mapper.userRole(trans, rreq);
final ServiceValidator v = new ServiceValidator();
- if(rurdd.notOKorIsEmpty()) {
+ if (rurdd.notOKorIsEmpty()) {
return Result.err(rurdd);
}
if (v.user(trans.org(), rurdd.value.user).err()) {
@@ -3233,15 +3233,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Set<String> currRoles = new HashSet<>();
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readByUser(trans, rurdd.value.user);
- if(rlurd.isOK()) {
- for(UserRoleDAO.Data data : rlurd.value) {
+ if (rlurd.isOK()) {
+ for (UserRoleDAO.Data data : rlurd.value) {
currRoles.add(data.role);
}
}
Result<Void> rv = null;
String[] roles;
- if(rurdd.value.role==null) {
+ if (rurdd.value.role==null) {
roles = new String[0];
} else {
roles = rurdd.value.role.split(",");
@@ -3252,7 +3252,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Status.ERR_BadData,v.errs());
}
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, ques, role);
- if(rrdd.notOK()) {
+ if (rrdd.notOK()) {
return Result.err(rrdd);
}
@@ -3263,11 +3263,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(nsd);
}
Result<NsDAO.Data> nsr = ques.deriveNs(trans, role);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
- if(currRoles.contains(role)) {
+ if (currRoles.contains(role)) {
currRoles.remove(role);
} else {
rv = func.addUserRole(trans, rurdd.value);
@@ -3280,7 +3280,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
for (String role : currRoles) {
rurdd.value.role(trans,ques,role);
rv = ques.userRoleDAO.delete(trans, rurdd.value, false);
- if(rv.notOK()) {
+ if (rv.notOK()) {
trans.info().log(rurdd.value.user,"/",rurdd.value.role, "expected to be deleted, but does not exist");
// return rv; // if it doesn't exist, don't error out
}
@@ -3305,7 +3305,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> resetUsersForRole(AuthzTrans trans, REQUEST rreq) {
Result<UserRoleDAO.Data> rurdd = mapper.userRole(trans, rreq);
- if(rurdd.notOKorIsEmpty()) {
+ if (rurdd.notOKorIsEmpty()) {
return Result.err(rurdd);
}
final ServiceValidator v = new ServiceValidator();
@@ -3321,14 +3321,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<NsDAO.Data> nsr = ques.deriveNs(trans, rurdd.value.role);
- if(nsr.notOKorIsEmpty()) {
+ if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
Set<String> currUsers = new HashSet<>();
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readByRole(trans, rurdd.value.role);
- if(rlurd.isOK()) {
- for(UserRoleDAO.Data data : rlurd.value) {
+ if (rlurd.isOK()) {
+ for (UserRoleDAO.Data data : rlurd.value) {
currUsers.add(data.user);
}
}
@@ -3352,7 +3352,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
rurdd.value.user = user;
- if(currUsers.contains(user)) {
+ if (currUsers.contains(user)) {
currUsers.remove(user);
} else {
rv = func.addUserRole(trans, rurdd.value);
@@ -3365,7 +3365,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
for (String user : currUsers) {
rurdd.value.user = user;
rv = ques.userRoleDAO.delete(trans, rurdd.value, false);
- if(rv.notOK()) {
+ if (rv.notOK()) {
trans.info().log(rurdd.value, "expected to be deleted, but not exists");
return rv;
}
@@ -3390,29 +3390,29 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> extendUserRole(AuthzTrans trans, String user, String role) {
Organization org = trans.org();
final ServiceValidator v = new ServiceValidator();
- if(v.user(org, user)
+ if (v.user(org, user)
.role(role)
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,ques,role);
- if(rrdd.notOK()) {
+ if (rrdd.notOK()) {
return Result.err(rrdd);
}
Result<NsDAO.Data> rcr = ques.mayUser(trans, trans.user(), rrdd.value, Access.write);
boolean mayNotChange;
- if((mayNotChange = rcr.notOK()) && !trans.requested(future)) {
+ if ((mayNotChange = rcr.notOK()) && !trans.requested(future)) {
return Result.err(rcr);
}
Result<List<UserRoleDAO.Data>> rr = ques.userRoleDAO.read(trans, user,role);
- if(rr.notOK()) {
+ if (rr.notOK()) {
return Result.err(rr);
}
- for(UserRoleDAO.Data userRole : rr.value) {
- if(mayNotChange) { // Function exited earlier if !trans.futureRequested
+ for (UserRoleDAO.Data userRole : rr.value) {
+ if (mayNotChange) { // Function exited earlier if !trans.futureRequested
FutureDAO.Data fto = new FutureDAO.Data();
fto.target=UserRoleDAO.TABLE;
fto.memo = "Extend User ["+userRole.user+"] in Role ["+userRole.role+"]";
@@ -3428,7 +3428,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<String> rfc = func.createFuture(trans, fto,
userRole.user+'|'+userRole.role, userRole.user, rcr.value, FUTURE_OP.U);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "UserRole [%s - %s] is saved for future processing",
userRole.user,
userRole.role);
@@ -3456,14 +3456,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> deleteUserRole(AuthzTrans trans, String usr, String role) {
Validator val = new ServiceValidator();
- if(val.nullOrBlank("User", usr)
+ if (val.nullOrBlank("User", usr)
.nullOrBlank("Role", role).err()) {
return Result.err(Status.ERR_BadData, val.errs());
}
boolean mayNotChange;
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,ques,role);
- if(rrdd.notOK()) {
+ if (rrdd.notOK()) {
return Result.err(rrdd);
}
@@ -3471,24 +3471,24 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<NsDAO.Data> rns = ques.mayUser(trans, trans.user(), rdd, Access.write);
// Make sure we don't delete the last owner of valid NS
- if(rns.isOKhasData() && Question.OWNER.equals(rdd.name) && ques.countOwner(trans,rdd.ns)<=1) {
+ if (rns.isOKhasData() && Question.OWNER.equals(rdd.name) && ques.countOwner(trans,rdd.ns)<=1) {
return Result.err(Status.ERR_Denied,"You may not delete the last Owner of " + rdd.ns );
}
- if(mayNotChange=rns.notOK()) {
- if(!trans.requested(future)) {
+ if (mayNotChange=rns.notOK()) {
+ if (!trans.requested(future)) {
return Result.err(rns);
}
}
Result<List<UserRoleDAO.Data>> rulr;
- if((rulr=ques.userRoleDAO.read(trans, usr, role)).notOKorIsEmpty()) {
+ if ((rulr=ques.userRoleDAO.read(trans, usr, role)).notOKorIsEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound, "User [ "+usr+" ] is not "
+ "Assigned to the Role [ " + role + " ]");
}
UserRoleDAO.Data userRole = rulr.value.get(0);
- if(mayNotChange) { // Function exited earlier if !trans.futureRequested
+ if (mayNotChange) { // Function exited earlier if !trans.futureRequested
FutureDAO.Data fto = new FutureDAO.Data();
fto.target=UserRoleDAO.TABLE;
fto.memo = "Remove User ["+userRole.user+"] from Role ["+userRole.role+"]";
@@ -3498,7 +3498,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<String> rfc = func.createFuture(trans, fto,
userRole.user+'|'+userRole.role, userRole.user, rns.value, FUTURE_OP.D);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "UserRole [%s - %s] is saved for future processing",
userRole.user,
userRole.role);
@@ -3523,7 +3523,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<USERS> getUserInRole(AuthzTrans trans, String user, String role) {
final Validator v = new ServiceValidator();
- if(v.role(role).nullOrBlank("User", user).err()) {
+ if (v.role(role).nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -3533,18 +3533,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), ns.value, Access.write);
// May calling user see by virtue of the Role
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, ques, role);
- if(rrdd.notOK()) {
+ if (rrdd.notOK()) {
return Result.err(rrdd);
}
Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), rrdd.value,Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
HashSet<UserRoleDAO.Data> userSet = new HashSet<>();
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readUserInRole(trans, user, role);
- if(rlurd.isOK()) {
- for(UserRoleDAO.Data data : rlurd.value) {
+ if (rlurd.isOK()) {
+ for (UserRoleDAO.Data data : rlurd.value) {
userSet.add(data);
}
}
@@ -3568,7 +3568,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<USERS> getUsersByRole(AuthzTrans trans, String role) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Role",role).err()) {
+ if (v.nullOrBlank("Role",role).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -3578,15 +3578,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), ns.value, Access.write);
// May calling user see by virtue of the Role
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, ques, role);
- if(rrdd.notOK()) {
+ if (rrdd.notOK()) {
return Result.err(rrdd);
}
boolean contactOnly = false;
// Allow the request of any valid user to find the contact of the NS (Owner)
Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), rrdd.value,Access.read);
- if(rnd.notOK()) {
- if(Question.OWNER.equals(rrdd.value.name)) {
+ if (rnd.notOK()) {
+ if (Question.OWNER.equals(rrdd.value.name)) {
contactOnly = true;
} else {
return Result.err(rnd);
@@ -3595,9 +3595,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
HashSet<UserRoleDAO.Data> userSet = new HashSet<>();
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readByRole(trans, role);
- if(rlurd.isOK()) {
- for(UserRoleDAO.Data data : rlurd.value) {
- if(contactOnly) { //scrub data
+ if (rlurd.isOK()) {
+ for (UserRoleDAO.Data data : rlurd.value) {
+ if (contactOnly) { //scrub data
// Can't change actual object, or will mess up the cache.
UserRoleDAO.Data scrub = new UserRoleDAO.Data();
scrub.ns = data.ns;
@@ -3635,7 +3635,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<USERS> getUsersByPermission(AuthzTrans trans, String type, String instance, String action) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Type",type)
+ if (v.nullOrBlank("Type",type)
.nullOrBlank("Instance",instance)
.nullOrBlank("Action",action)
.err()) {
@@ -3643,7 +3643,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<NsSplit> nss = ques.deriveNsSplit(trans, type);
- if(nss.notOK()) {
+ if (nss.notOK()) {
return Result.err(nss);
}
@@ -3660,19 +3660,19 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Set<String> roleUsed = new HashSet<>();
Set<UserRoleDAO.Data> userSet = new HashSet<>();
- if(!nss.isEmpty()) {
+ if (!nss.isEmpty()) {
Result<List<PermDAO.Data>> rlp = ques.permDAO.readByType(trans, nss.value.ns, nss.value.name);
- if(rlp.isOKhasData()) {
- for(PermDAO.Data pd : rlp.value) {
- if((allInstance || pd.instance.equals(instance)) &&
+ if (rlp.isOKhasData()) {
+ for (PermDAO.Data pd : rlp.value) {
+ if ((allInstance || pd.instance.equals(instance)) &&
(allAction || pd.action.equals(action))) {
- if(ques.mayUser(trans, trans.user(),pd,Access.read).isOK()) {
- for(String role : pd.roles) {
- if(!roleUsed.contains(role)) { // avoid evaluating Role many times
+ if (ques.mayUser(trans, trans.user(),pd,Access.read).isOK()) {
+ for (String role : pd.roles) {
+ if (!roleUsed.contains(role)) { // avoid evaluating Role many times
roleUsed.add(role);
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO.readByRole(trans, role.replace('|', '.'));
- if(rlurd.isOKhasData()) {
- for(UserRoleDAO.Data urd : rlurd.value) {
+ if (rlurd.isOKhasData()) {
+ for (UserRoleDAO.Data urd : rlurd.value) {
userSet.add(urd);
}
}
@@ -3695,37 +3695,37 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<HISTORY> getHistoryByUser(final AuthzTrans trans, String user, final int[] yyyymm, final int sort) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("User",user).err()) {
+ if (v.nullOrBlank("User",user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<NsDAO.Data> rnd;
// Users may look at their own data
- if(trans.user().equals(user)) {
+ if (trans.user().equals(user)) {
// Users may look at their own data
} else {
int at = user.indexOf('@');
- if(at>=0 && trans.org().getRealm().equals(user.substring(at+1))) {
+ if (at>=0 && trans.org().getRealm().equals(user.substring(at+1))) {
NsDAO.Data nsd = new NsDAO.Data();
nsd.name = Question.domain2ns(user);
rnd = ques.mayUser(trans, trans.user(), nsd, Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
} else {
rnd = ques.validNSOfDomain(trans, user);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
}
}
Result<List<HistoryDAO.Data>> resp = ques.historyDAO.readByUser(trans, user, yyyymm);
- if(resp.notOK()) {
+ if (resp.notOK()) {
return Result.err(resp);
}
return mapper.history(trans, resp.value,sort);
@@ -3734,21 +3734,21 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<HISTORY> getHistoryByRole(AuthzTrans trans, String role, int[] yyyymm, final int sort) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Role",role).err()) {
+ if (v.nullOrBlank("Role",role).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, ques, role);
- if(rrdd.notOK()) {
+ if (rrdd.notOK()) {
return Result.err(rrdd);
}
Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), rrdd.value, Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
Result<List<HistoryDAO.Data>> resp = ques.historyDAO.readBySubject(trans, role, "role", yyyymm);
- if(resp.notOK()) {
+ if (resp.notOK()) {
return Result.err(resp);
}
return mapper.history(trans, resp.value,sort);
@@ -3757,23 +3757,23 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<HISTORY> getHistoryByPerm(AuthzTrans trans, String type, int[] yyyymm, final int sort) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Type",type)
+ if (v.nullOrBlank("Type",type)
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
// May user see Namespace of Permission (since it's only one piece... we can't check for "is permission part of")
Result<NsDAO.Data> rnd = ques.deriveNs(trans,type);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
Result<List<HistoryDAO.Data>> resp = ques.historyDAO.readBySubject(trans, type, "perm", yyyymm);
- if(resp.notOK()) {
+ if (resp.notOK()) {
return Result.err(resp);
}
return mapper.history(trans, resp.value,sort);
@@ -3782,22 +3782,22 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<HISTORY> getHistoryByNS(AuthzTrans trans, String ns, int[] yyyymm, final int sort) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("NS",ns)
+ if (v.nullOrBlank("NS",ns)
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<NsDAO.Data> rnd = ques.deriveNs(trans,ns);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
- if(rnd.notOK()) {
+ if (rnd.notOK()) {
return Result.err(rnd);
}
Result<List<HistoryDAO.Data>> resp = ques.historyDAO.readBySubject(trans, ns, "ns", yyyymm);
- if(resp.notOK()) {
+ if (resp.notOK()) {
return Result.err(resp);
}
return mapper.history(trans, resp.value,sort);
@@ -3820,20 +3820,20 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<Void> createOrUpdateDelegate(final AuthzTrans trans, REQUEST base, final Access access) {
final Result<DelegateDAO.Data> rd = mapper.delegate(trans, base);
final ServiceValidator v = new ServiceValidator();
- if(v.delegate(trans.org(),rd).err()) {
+ if (v.delegate(trans.org(),rd).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
final DelegateDAO.Data dd = rd.value;
Result<List<DelegateDAO.Data>> ddr = ques.delegateDAO.read(trans, dd);
- if(access==Access.create && ddr.isOKhasData()) {
+ if (access==Access.create && ddr.isOKhasData()) {
return Result.err(Status.ERR_ConflictAlreadyExists, "[%s] already delegates to [%s]", dd.user, ddr.value.get(0).delegate);
- } else if(access!=Access.create && ddr.notOKorIsEmpty()) {
+ } else if (access!=Access.create && ddr.notOKorIsEmpty()) {
return Result.err(Status.ERR_NotFound, "[%s] does not have a Delegate Record to [%s].",dd.user,access.name());
}
Result<Void> rv = ques.mayUser(trans, dd, access);
- if(rv.notOK()) {
+ if (rv.notOK()) {
return rv;
}
@@ -3864,16 +3864,16 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
case OK:
Result<String> rfc = func.createFuture(trans, fd.value,
dd.user, trans.user(),null, access==Access.create?FUTURE_OP.C:FUTURE_OP.U);
- if(rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Delegate for [%s]",
dd.user);
} else {
return Result.err(rfc);
}
case Status.ACC_Now:
- if(access==Access.create) {
+ if (access==Access.create) {
Result<DelegateDAO.Data> rdr = ques.delegateDAO.create(trans, dd);
- if(rdr.isOK()) {
+ if (rdr.isOK()) {
return Result.ok();
} else {
return Result.err(rdr);
@@ -3890,17 +3890,17 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> deleteDelegate(AuthzTrans trans, REQUEST base) {
final Result<DelegateDAO.Data> rd = mapper.delegate(trans, base);
final Validator v = new ServiceValidator();
- if(v.notOK(rd).nullOrBlank("User", rd.value.user).err()) {
+ if (v.notOK(rd).nullOrBlank("User", rd.value.user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<DelegateDAO.Data>> ddl;
- if((ddl=ques.delegateDAO.read(trans, rd.value)).notOKorIsEmpty()) {
+ if ((ddl=ques.delegateDAO.read(trans, rd.value)).notOKorIsEmpty()) {
return Result.err(Status.ERR_DelegateNotFound,"Cannot delete non-existent Delegate");
}
final DelegateDAO.Data dd = ddl.value.get(0);
Result<Void> rv = ques.mayUser(trans, dd, Access.write);
- if(rv.notOK()) {
+ if (rv.notOK()) {
return rv;
}
@@ -3911,17 +3911,17 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> deleteDelegate(AuthzTrans trans, String userName) {
DelegateDAO.Data dd = new DelegateDAO.Data();
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("User", userName).err()) {
+ if (v.nullOrBlank("User", userName).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
dd.user = userName;
Result<List<DelegateDAO.Data>> ddl;
- if((ddl=ques.delegateDAO.read(trans, dd)).notOKorIsEmpty()) {
+ if ((ddl=ques.delegateDAO.read(trans, dd)).notOKorIsEmpty()) {
return Result.err(Status.ERR_DelegateNotFound,"Cannot delete non-existent Delegate");
}
dd = ddl.value.get(0);
Result<Void> rv = ques.mayUser(trans, dd, Access.write);
- if(rv.notOK()) {
+ if (rv.notOK()) {
return rv;
}
@@ -3931,7 +3931,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<DELGS> getDelegatesByUser(AuthzTrans trans, String user) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("User", user).err()) {
+ if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -3939,7 +3939,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
ddd.user = user;
ddd.delegate = null;
Result<Void> rv = ques.mayUser(trans, ddd, Access.read);
- if(rv.notOK()) {
+ if (rv.notOK()) {
return Result.err(rv);
}
@@ -3960,14 +3960,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<DELGS> getDelegatesByDelegate(AuthzTrans trans, String delegate) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Delegate", delegate).err()) {
+ if (v.nullOrBlank("Delegate", delegate).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
DelegateDAO.Data ddd = new DelegateDAO.Data();
ddd.user = delegate;
Result<Void> rv = ques.mayUser(trans, ddd, Access.read);
- if(rv.notOK()) {
+ if (rv.notOK()) {
return Result.err(rv);
}
@@ -3992,11 +3992,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> updateApproval(AuthzTrans trans, APPROVALS approvals) {
Result<List<ApprovalDAO.Data>> rlad = mapper.approvals(approvals);
- if(rlad.notOK()) {
+ if (rlad.notOK()) {
return Result.err(rlad);
}
int numApprs = rlad.value.size();
- if(numApprs<1) {
+ if (numApprs<1) {
return Result.err(Status.ERR_NoApprovals,"No Approvals sent for Updating");
}
int numProcessed = 0;
@@ -4004,10 +4004,10 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<List<ApprovalDAO.Data>> curr;
Lookup<List<ApprovalDAO.Data>> apprByTicket=null;
- for(ApprovalDAO.Data updt : rlad.value) {
- if(updt.ticket!=null) {
+ for (ApprovalDAO.Data updt : rlad.value) {
+ if (updt.ticket!=null) {
curr = ques.approvalDAO.readByTicket(trans, updt.ticket);
- if(curr.isOKhasData()) {
+ if (curr.isOKhasData()) {
final List<ApprovalDAO.Data> add = curr.value;
apprByTicket = new Lookup<List<ApprovalDAO.Data>>() { // Store a Pre-Lookup
@Override
@@ -4016,29 +4016,29 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
};
}
- } else if(updt.id!=null) {
+ } else if (updt.id!=null) {
curr = ques.approvalDAO.read(trans, updt);
- } else if(updt.approver!=null) {
+ } else if (updt.approver!=null) {
curr = ques.approvalDAO.readByApprover(trans, updt.approver);
} else {
return Result.err(Status.ERR_BadData,"Approvals need ID, Ticket or Approval data to update");
}
- if(curr.isOKhasData()) {
+ if (curr.isOKhasData()) {
Map<String, Result<List<DelegateDAO.Data>>> delegateCache = new HashMap<>();
Map<UUID, FutureDAO.Data> futureCache = new HashMap<>();
FutureDAO.Data hasDeleted = new FutureDAO.Data();
- for(ApprovalDAO.Data cd : curr.value) {
- if("pending".equals(cd.status)) {
+ for (ApprovalDAO.Data cd : curr.value) {
+ if ("pending".equals(cd.status)) {
// Check for right record. Need ID, or (Ticket&Trans.User==Appr)
// If Default ID
boolean delegatedAction = ques.isDelegated(trans, user, cd.approver, delegateCache);
String delegator = cd.approver;
- if(updt.id!=null ||
+ if (updt.id!=null ||
(updt.ticket!=null && user.equals(cd.approver)) ||
(updt.ticket!=null && delegatedAction)) {
- if(updt.ticket.equals(cd.ticket)) {
+ if (updt.ticket.equals(cd.ticket)) {
Changed ch = new Changed();
cd.id = ch.changed(cd.id,updt.id);
// cd.ticket = changed(cd.ticket,updt.ticket);
@@ -4049,29 +4049,29 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
cd.memo = ch.changed(cd.memo,updt.memo);
cd.operation = ch.changed(cd.operation,updt.operation);
cd.updated = ch.changed(cd.updated,updt.updated==null?new Date():updt.updated);
- if(updt.status.equals("denied")) {
+ if (updt.status.equals("denied")) {
cd.last_notified = null;
}
- if(cd.ticket!=null) {
+ if (cd.ticket!=null) {
FutureDAO.Data fdd = futureCache.get(cd.ticket);
- if(fdd==null) { // haven't processed ticket yet
+ if (fdd==null) { // haven't processed ticket yet
Result<FutureDAO.Data> rfdd = ques.futureDAO.readPrimKey(trans, cd.ticket);
- if(rfdd.isOK()) {
+ if (rfdd.isOK()) {
fdd = rfdd.value; // null is ok
} else {
fdd = hasDeleted;
}
futureCache.put(cd.ticket, fdd); // processed this Ticket... don't do others on this ticket
}
- if(fdd==hasDeleted) { // YES, by Object
+ if (fdd==hasDeleted) { // YES, by Object
cd.ticket = null;
cd.status = "ticketDeleted";
ch.hasChanged(true);
} else {
FUTURE_OP fop = FUTURE_OP.toFO(cd.operation);
- if(fop==null) {
+ if (fop==null) {
trans.info().printf("Approval Status %s is not actionable",cd.status);
- } else if(apprByTicket!=null) {
+ } else if (apprByTicket!=null) {
Result<OP_STATUS> rv = func.performFutureOp(trans, fop, fdd, apprByTicket,func.urDBLookup);
if (rv.isOK()) {
switch(rv.value) {
@@ -4097,7 +4097,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
++numProcessed;
}
- if(ch.hasChanged()) {
+ if (ch.hasChanged()) {
ques.approvalDAO.update(trans, cd, true);
}
}
@@ -4107,7 +4107,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
- if(numApprs==numProcessed) {
+ if (numApprs==numProcessed) {
return Result.ok();
}
return Result.err(Status.ERR_ActionNotCompleted,numProcessed + " out of " + numApprs + " completed");
@@ -4118,7 +4118,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private boolean hasChanged = false;
public<T> T changed(T src, T proposed) {
- if(proposed==null || (src!=null && src.equals(proposed))) {
+ if (proposed==null || (src!=null && src.equals(proposed))) {
return src;
}
hasChanged=true;
@@ -4137,12 +4137,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<APPROVALS> getApprovalsByUser(AuthzTrans trans, String user) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("User", user).err()) {
+ if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<ApprovalDAO.Data>> rapd = ques.approvalDAO.readByUser(trans, user);
- if(rapd.isOK()) {
+ if (rapd.isOK()) {
return mapper.approvals(rapd.value);
} else {
return Result.err(rapd);
@@ -4152,7 +4152,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<APPROVALS> getApprovalsByTicket(AuthzTrans trans, String ticket) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Ticket", ticket).err()) {
+ if (v.nullOrBlank("Ticket", ticket).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
UUID uuid;
@@ -4163,7 +4163,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<List<ApprovalDAO.Data>> rapd = ques.approvalDAO.readByTicket(trans, uuid);
- if(rapd.isOK()) {
+ if (rapd.isOK()) {
return mapper.approvals(rapd.value);
} else {
return Result.err(rapd);
@@ -4173,14 +4173,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<APPROVALS> getApprovalsByApprover(AuthzTrans trans, String approver) {
final Validator v = new ServiceValidator();
- if(v.nullOrBlank("Approver", approver).err()) {
+ if (v.nullOrBlank("Approver", approver).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
List<ApprovalDAO.Data> listRapds = new ArrayList<>();
Result<List<ApprovalDAO.Data>> myRapd = ques.approvalDAO.readByApprover(trans, approver);
- if(myRapd.notOK()) {
+ if (myRapd.notOK()) {
return Result.err(myRapd);
}
@@ -4211,7 +4211,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
*/
@Override
public Result<Void> cacheClear(AuthzTrans trans, String cname) {
- if(ques.isGranted(trans,trans.user(),ROOT_NS,CACHE,cname,"clear")) {
+ if (ques.isGranted(trans,trans.user(),ROOT_NS,CACHE,cname,"clear")) {
return ques.clearCache(trans,cname);
}
return Result.err(Status.ERR_Denied, "%s does not have AAF Permission '%s.%s|%s|clear",
@@ -4223,12 +4223,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
*/
@Override
public Result<Void> cacheClear(AuthzTrans trans, String cname, int[] segment) {
- if(ques.isGranted(trans,trans.user(),ROOT_NS,CACHE,cname,"clear")) {
+ if (ques.isGranted(trans,trans.user(),ROOT_NS,CACHE,cname,"clear")) {
Result<Void> v=null;
- for(int i: segment) {
+ for (int i: segment) {
v=ques.cacheClear(trans,cname,i);
}
- if(v!=null) {
+ if (v!=null) {
return v;
}
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java
index 5213a6e9..70d131a5 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java
@@ -58,7 +58,7 @@ public class API_Api {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.getAPI(trans,resp,authzAPI);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -80,7 +80,7 @@ public class API_Api {
Result<Void> r = context.getAPIExample(trans,resp,nameOrContextType,
question>=0 && "optional=true".equalsIgnoreCase(req.getPathInfo().substring(question+1))
);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java
index c0836038..7c74be1b 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java
@@ -49,7 +49,7 @@ public class API_Approval {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.getApprovalsByUser(trans, resp, pathParam(req,"user"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -64,7 +64,7 @@ public class API_Approval {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.getApprovalsByTicket(trans, resp, pathParam(req,"ticket"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -79,7 +79,7 @@ public class API_Approval {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.getApprovalsByApprover(trans, resp, pathParam(req,"approver"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -95,7 +95,7 @@ public class API_Approval {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.updateApproval(trans, req, resp);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java
index 68e0f145..a8830c93 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java
@@ -91,13 +91,13 @@ public class API_Creds {
} else if (p instanceof X509Principal) {
// have to check Basic Auth here, because it might be CSP.
String authz = req.getHeader("Authorization");
- if(authz.startsWith("Basic ")) {
+ if (authz.startsWith("Basic ")) {
BasicHttpTaf bht = ((X509Principal)p).getBasicHttpTaf();
- if(bht!=null) {
+ if (bht!=null) {
BasicPrincipal bp = new BasicPrincipal(authz,"");
CredVal cv = bht.getCredVal(bp.getDomain());
- if(cv!=null) {
- if(cv.validate(bp.getName(), Type.PASSWORD, bp.getCred(), null) ) {
+ if (cv!=null) {
+ if (cv.validate(bp.getName(), Type.PASSWORD, bp.getCred(), null) ) {
resp.setStatus(HttpStatus.OK_200);
} else {
resp.setStatus(HttpStatus.FORBIDDEN_403);
@@ -108,7 +108,7 @@ public class API_Creds {
int colon = decoded.indexOf(':');
TimeTaken tt = trans.start("Direct Validation", Env.REMOTE);
try {
- if(directAAFUserPass.validate(
+ if (directAAFUserPass.validate(
decoded.substring(0,colon),
CredVal.Type.PASSWORD ,
decoded.substring(colon+1).getBytes(),trans)) {
@@ -124,7 +124,7 @@ public class API_Creds {
}
}
}
- } else if(p == null) {
+ } else if (p == null) {
trans.error().log("Transaction not Authenticated... no Principal");
resp.setStatus(HttpStatus.FORBIDDEN_403);
} else {
@@ -146,7 +146,7 @@ public class API_Creds {
HttpServletResponse resp) throws Exception {
Result<Date> r = context.doesCredentialMatch(trans, req, resp);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
// For Security, we don't give any info out on why failed, other than forbidden
@@ -167,7 +167,7 @@ public class API_Creds {
HttpServletResponse resp) throws Exception {
Result<Void> r = context.getCertInfoByID(trans, req, resp, pathParam(req,":id") );
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
// For Security, we don't give any info out on why failed, other than forbidden
@@ -195,7 +195,7 @@ public class API_Creds {
authzAPI.route(POST,"/authn/cred",API.CRED_REQ,new Code(facade,"Add a New ID/Credential", true) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result<Void> r = context.createUserCred(trans, req);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.CREATED_201);
} else {
context.error(trans,resp,r);
@@ -214,7 +214,7 @@ public class API_Creds {
HttpServletResponse resp) throws Exception {
Result<Void> r = context.getCredsByNS(trans, resp, pathParam(req, "ns"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -234,7 +234,7 @@ public class API_Creds {
HttpServletResponse resp) throws Exception {
Result<Void> r = context.getCredsByID(trans, resp, pathParam(req, "id"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -252,7 +252,7 @@ public class API_Creds {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.changeUserCred(trans, req);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -273,7 +273,7 @@ public class API_Creds {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.extendUserCred(trans, req, pathParam(req, "days"));
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
@@ -288,7 +288,7 @@ public class API_Creds {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.deleteUserCred(trans, req);
- if(r.isOK()) {
+ if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java
index e0911937..2c868d3d 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java
@@ -74,7 +74,7 @@ public class API_History {
try {
years = getYears(req);
descend = decending(req);
- } catch(Exception e) {
+ } catch (Exception e) {
context.error(trans, resp, Result.err(Status.ERR_BadData, e.getMessage()));
return;
}
@@ -101,7 +101,7 @@ public class API_History {
try {
years = getYears(req);
descend = decending(req);
- } catch(Exception e) {
+ } catch (Exception e) {
context.error(trans, resp, Result.err(Status.ERR_BadData, e.getMessage()));
return;
}
@@ -128,7 +128,7 @@ public class API_History {
try {
years = getYears(req);
descend = decending(req);
- } catch(Exception e) {
+ } catch (Exception e) {
context.error(trans, resp, Result.err(Status.ERR_BadData, e.getMessage()));
return;
}
@@ -155,7 +155,7 @@ public class API_History {
try {
years = getYears(req);
descend = decending(req);
- } catch(Exception e) {
+ } catch (Exception e) {
context.error(trans, resp, Result.err(Status.ERR_BadData, e.getMessage()));
return;
}
@@ -174,8 +174,8 @@ public class API_History {
// Check if Ascending
private static int decending(HttpServletRequest req) {
- if("true".equalsIgnoreCase(req.getParameter("desc")))return -1;
- if("true".equalsIgnoreCase(req.getParameter("asc")))return 1;
+ if ("true".equalsIgnoreCase(req.getParameter("desc")))return -1;
+ if ("true".equalsIgnoreCase(req.getParameter("asc")))return 1;
return 0;
}
@@ -186,21 +186,21 @@ public class API_History {
SimpleDateFormat FMT = new SimpleDateFormat("yyyyMM");
String yyyymm = req.getParameter("yyyymm");
ArrayList<Integer> ai= new ArrayList<>();
- if(yyyymm==null) {
+ if (yyyymm==null) {
GregorianCalendar gc = new GregorianCalendar();
// three months is the default
- for(int i=0;i<3;++i) {
+ for (int i=0;i<3;++i) {
ai.add(Integer.parseInt(FMT.format(gc.getTime())));
gc.add(GregorianCalendar.MONTH, -1);
}
} else {
- for(String ym : yyyymm.split(",")) {
+ for (String ym : yyyymm.split(",")) {
String range[] = ym.split("\\s*-\\s*");
switch(range.length) {
case 0:
break;
case 1:
- if(!ym.endsWith("-")) {
+ if (!ym.endsWith("-")) {
ai.add(getNum(ym));
break;
} else {
@@ -214,26 +214,26 @@ public class API_History {
gc.set(GregorianCalendar.MONTH, Integer.parseInt(range[0].substring(4,6))-1);
gc.set(GregorianCalendar.YEAR, Integer.parseInt(range[0].substring(0,4)));
- for(int i=getNum(FMT.format(gc.getTime()));i<=end;gc.add(GregorianCalendar.MONTH, 1),i=getNum(FMT.format(gc.getTime()))) {
+ for (int i=getNum(FMT.format(gc.getTime()));i<=end;gc.add(GregorianCalendar.MONTH, 1),i=getNum(FMT.format(gc.getTime()))) {
ai.add(i);
}
}
}
}
- if(ai.size()==0) {
+ if (ai.size()==0) {
throw new NumberFormatException(yyyymm + " is an invalid number or range");
}
Collections.sort(ai);
int ym[] = new int[ai.size()];
- for(int i=0;i<ym.length;++i) {
+ for (int i=0;i<ym.length;++i) {
ym[i]=ai.get(i);
}
return ym;
}
private static int getNum(String n) {
- if(n==null || n.length()!=6) throw new NumberFormatException(n + " is not in YYYYMM format");
+ if (n==null || n.length()!=6) throw new NumberFormatException(n + " is not in YYYYMM format");
return Integer.parseInt(n);
}
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java
index be608df5..d99e1ada 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java
@@ -109,7 +109,7 @@ public class API_Mgmt {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- if(req.isUserInRole(PERM_DB_POOL_CLEAR)) {
+ if (req.isUserInRole(PERM_DB_POOL_CLEAR)) {
context.dbReset(trans);
trans.audit().log("DB Sessions have been cleared by "+trans.user());
@@ -119,7 +119,7 @@ public class API_Mgmt {
return;
}
context.error(trans,resp,Result.err(Result.ERR_Denied,"%s is not allowed to clear dbsessions",trans.user()));
- } catch(Exception e) {
+ } catch (Exception e) {
trans.error().log(e, "clearing dbsession");
context.error(trans,resp,Result.err(e));
}
@@ -133,8 +133,8 @@ public class API_Mgmt {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String ip = pathParam(req,":ip");
- if(req.isUserInRole(PERM_DENY_IP)) {
- if(DenialOfServiceTaf.denyIP(ip)) {
+ if (req.isUserInRole(PERM_DENY_IP)) {
+ if (DenialOfServiceTaf.denyIP(ip)) {
trans.audit().log(ip+" has been set to deny by "+trans.user());
trans.checkpoint(SUCCESS,Trans.ALWAYS);
@@ -158,8 +158,8 @@ public class API_Mgmt {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String ip = pathParam(req,":ip");
- if(req.isUserInRole(PERM_DENY_IP)) {
- if(DenialOfServiceTaf.removeDenyIP(ip)) {
+ if (req.isUserInRole(PERM_DENY_IP)) {
+ if (DenialOfServiceTaf.removeDenyIP(ip)) {
trans.audit().log(ip+" has been removed from denial by "+trans.user());
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.OK_200);
@@ -182,8 +182,8 @@ public class API_Mgmt {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String id = pathParam(req,":id");
- if(req.isUserInRole(PERM_DENY_ID)) {
- if(DenialOfServiceTaf.denyID(id)) {
+ if (req.isUserInRole(PERM_DENY_ID)) {
+ if (DenialOfServiceTaf.denyID(id)) {
trans.audit().log(id+" has been set to deny by "+trans.user());
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.CREATED_201);
@@ -206,8 +206,8 @@ public class API_Mgmt {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String id = pathParam(req,":id");
- if(req.isUserInRole(PERM_DENY_ID)) {
- if(DenialOfServiceTaf.removeDenyID(id)) {
+ if (req.isUserInRole(PERM_DENY_ID)) {
+ if (DenialOfServiceTaf.removeDenyID(id)) {
trans.audit().log(id+" has been removed from denial by " + trans.user());
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.OK_200);
@@ -230,8 +230,8 @@ public class API_Mgmt {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String id = pathParam(req,":id");
- if(req.isUserInRole(PERM_LOG_ID)) {
- if(Question.specialLogOn(trans,id)) {
+ if (req.isUserInRole(PERM_LOG_ID)) {
+ if (Question.specialLogOn(trans,id)) {
trans.audit().log(id+" has been set to special Log by "+trans.user());
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.CREATED_201);
@@ -254,8 +254,8 @@ public class API_Mgmt {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String id = pathParam(req,":id");
- if(req.isUserInRole(PERM_LOG_ID)) {
- if(Question.specialLogOff(trans,id)) {
+ if (req.isUserInRole(PERM_LOG_ID)) {
+ if (Question.specialLogOff(trans,id)) {
trans.audit().log(id+" has been removed from special Logging by " + trans.user());
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.OK_200);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java
index 5f2a823e..ae94553c 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java
@@ -55,7 +55,7 @@ public class API_Perms {
String scopes = req.getParameter("scopes");
Result<Void> r;
- if(scopes==null) {
+ if (scopes==null) {
r = context.getPermsByUser(trans, resp, pathParam(req, "user"));
} else {
r = context.getPermsByUserScope(trans, resp, pathParam(req, "user"),Split.split(':', scopes));
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java
index 0e1479c4..1a016be6 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java
@@ -169,7 +169,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
String msgId;
String[] detail;
boolean hidemsg = false;
- if(result.variables==null) {
+ if (result.variables==null) {
detail = new String[1];
} else {
int l = result.variables.length;
@@ -307,7 +307,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
"] " +
holder.toString(),
Env.ALWAYS);
- if(hidemsg) {
+ if (hidemsg) {
holder.setLength(0);
em = mapper().errorFromMessage(holder, msgId, "Server had an issue processing this request");
}
@@ -344,11 +344,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST request;
try {
Data<REQUEST> rd = nsRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,rd.asString());
}
request = rd.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,CREATE_NS);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
@@ -476,7 +476,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -505,7 +505,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -534,7 +534,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -564,7 +564,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -593,7 +593,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -617,11 +617,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = nsRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,UPDATE_NS_DESC);
return Result.err(Status.ERR_BadData,"Invalid Input");
@@ -706,7 +706,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<KEYS> data = keysDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -799,11 +799,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = permRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,CREATE_PERMISSION);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
@@ -836,7 +836,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -866,7 +866,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -895,7 +895,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -924,7 +924,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -954,11 +954,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
PERMS perms;
try {
RosettaData<PERMS> data = permsDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
perms = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,GET_PERMISSIONS_BY_USER_WITH_QUERY);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
@@ -967,7 +967,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -997,7 +997,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1023,7 +1023,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1054,11 +1054,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = permRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,cmdDescription);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
@@ -1086,11 +1086,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = permRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,UPDATE_PERM_DESC);
return Result.err(Status.ERR_BadData,"Invalid Input");
@@ -1119,11 +1119,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = rolePermRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN, SET_PERMISSION_ROLES_TO);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
@@ -1152,11 +1152,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = permRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,DELETE_PERMISSION);
return Result.err(Status.ERR_BadData,"Invalid Input");
@@ -1218,11 +1218,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = roleRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,CREATE_ROLE);
return Result.err(Status.ERR_BadData,"Invalid Input");
@@ -1254,7 +1254,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1283,7 +1283,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1311,9 +1311,9 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<ROLES> rp = service.getRolesByNS(trans, ns);
switch(rp.status) {
case OK:
- if(!rp.isEmpty()) {
+ if (!rp.isEmpty()) {
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1345,9 +1345,9 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<ROLES> rp = service.getRolesByNameOnly(trans, nameOnly);
switch(rp.status) {
case OK:
- if(!rp.isEmpty()) {
+ if (!rp.isEmpty()) {
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1379,7 +1379,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1408,11 +1408,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = roleRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,UPDATE_ROLE_DESC);
return Result.err(Status.ERR_BadData,"Invalid Input");
@@ -1440,11 +1440,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = rolePermRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,ADD_PERM_TO_ROLE);
return Result.err(Status.ERR_BadData,"Invalid Input");
@@ -1473,11 +1473,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = rolePermRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,DELETE_PERM_FROM_ROLE);
return Result.err(Status.ERR_BadData,"Invalid Input");
@@ -1551,11 +1551,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = roleRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN,CREATE_ROLE);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
@@ -1596,11 +1596,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(CREATE_CRED, Env.SUB|Env.ALWAYS);
try {
RosettaData<REQUEST> data = credRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
return service.createUserCred(trans, data.asObject());
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log(e,"Bad Input data");
return Result.err(Status.ERR_BadData, e.getLocalizedMessage());
} catch (Exception e) {
@@ -1616,12 +1616,12 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(UPDATE_CRED, Env.SUB|Env.ALWAYS);
try {
RosettaData<REQUEST> data = credRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
return service.changeUserCred(trans, data.asObject());
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log(e,"Bad Input data");
return Result.err(Status.ERR_BadData, e.getLocalizedMessage());
} catch (Exception e) {
@@ -1640,12 +1640,12 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(EXTEND_CRED, Env.SUB|Env.ALWAYS);
try {
RosettaData<REQUEST> data = credRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
return service.extendUserCred(trans, data.asObject(), days);
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log(e,"Bad Input data");
return Result.err(Status.ERR_BadData, e.getLocalizedMessage());
} catch (Exception e) {
@@ -1665,7 +1665,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(ru.status) {
case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
- if(Question.willSpecialLog(trans,trans.user())) {
+ if (Question.willSpecialLog(trans,trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1696,7 +1696,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(ru.status) {
case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1719,12 +1719,12 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(DELETE_CRED, Env.SUB|Env.ALWAYS);
try {
RosettaData<REQUEST> data = credRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
return service.deleteUserCred(trans, data.asObject());
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log(e,"Bad Input data");
return Result.err(Status.ERR_BadData, e.getLocalizedMessage());
} catch (Exception e) {
@@ -1741,12 +1741,12 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(DOES_CRED_MATCH, Env.SUB|Env.ALWAYS);
try {
RosettaData<REQUEST> data = credRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
return service.doesCredentialMatch(trans, data.asObject());
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log(e,"Bad Input data");
return Result.err(Status.ERR_BadData, e.getLocalizedMessage());
} catch (IOException e) {
@@ -1788,7 +1788,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rci.status) {
case OK:
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
RosettaData<CERTS> data = certsDF.newData(trans).load(rci.value);
Question.logEncryptTrace(trans,data.asString());
data.to(resp.getOutputStream());
@@ -1819,7 +1819,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(CREATE_DELEGATE, Env.SUB|Env.ALWAYS);
try {
Data<REQUEST> data = delgRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -1837,7 +1837,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(UPDATE_DELEGATE, Env.SUB|Env.ALWAYS);
try {
Data<REQUEST> data = delgRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -1855,7 +1855,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(DELETE_DELEGATE, Env.SUB|Env.ALWAYS);
try {
Data<REQUEST> data = delgRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -1890,7 +1890,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rd.status) {
case OK:
RosettaData<DELGS> data = delgDF.newData(trans).load(rd.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1915,7 +1915,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rd.status) {
case OK:
RosettaData<DELGS> data = delgDF.newData(trans).load(rd.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -1947,12 +1947,12 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST request;
try {
Data<REQUEST> data = userRoleRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
request = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
return Result.err(Status.ERR_BadData,"Invalid Input");
}
@@ -1980,7 +1980,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(ru.status) {
case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2008,7 +2008,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(ru.status) {
case OK:
RosettaData<USERROLES> data = userrolesDF.newData(trans).load(ru.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2036,7 +2036,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(ru.status) {
case OK:
RosettaData<USERROLES> data = userrolesDF.newData(trans).load(ru.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2064,11 +2064,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = userRoleRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN, SET_USERS_FOR_ROLE);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
@@ -2098,12 +2098,12 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
REQUEST rreq;
try {
RosettaData<REQUEST> data = userRoleRequestDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
rreq = data.asObject();
- } catch(APIException e) {
+ } catch (APIException e) {
trans.error().log("Invalid Input",IN, SET_ROLES_FOR_USER);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
@@ -2172,7 +2172,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(UPDATE_APPROVAL, Env.SUB|Env.ALWAYS);
try {
Data<APPROVALS> data = approvalDF.newData().load(req.getInputStream());
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2201,7 +2201,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<APPROVALS> data = approvalDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
@@ -2227,7 +2227,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<APPROVALS> data = approvalDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2253,7 +2253,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rp.status) {
case OK:
RosettaData<APPROVALS> data = approvalDF.newData(trans).load(rp.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2287,7 +2287,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(ru.status) {
case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2317,7 +2317,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(ru.status) {
case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2351,8 +2351,8 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
sb.append(user);
sb.append(" for ");
boolean first = true;
- for(int i : yyyymm) {
- if(first) {
+ for (int i : yyyymm) {
+ if (first) {
first = false;
} else {
sb.append(',');
@@ -2366,7 +2366,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rh.status) {
case OK:
RosettaData<HISTORY> data = historyDF.newData(trans).load(rh.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2395,8 +2395,8 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
sb.append(role);
sb.append(" for ");
boolean first = true;
- for(int i : yyyymm) {
- if(first) {
+ for (int i : yyyymm) {
+ if (first) {
first = false;
} else {
sb.append(',');
@@ -2409,7 +2409,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rh.status) {
case OK:
RosettaData<HISTORY> data = historyDF.newData(trans).load(rh.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2438,8 +2438,8 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
sb.append(ns);
sb.append(" for ");
boolean first = true;
- for(int i : yyyymm) {
- if(first) {
+ for (int i : yyyymm) {
+ if (first) {
first = false;
} else {
sb.append(',');
@@ -2452,7 +2452,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rh.status) {
case OK:
RosettaData<HISTORY> data = historyDF.newData(trans).load(rh.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2481,8 +2481,8 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
sb.append(perm);
sb.append(" for ");
boolean first = true;
- for(int i : yyyymm) {
- if(first) {
+ for (int i : yyyymm) {
+ if (first) {
first = false;
} else {
sb.append(',');
@@ -2495,7 +2495,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(rh.status) {
case OK:
RosettaData<HISTORY> data = historyDF.newData(trans).load(rh.value);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
@@ -2541,10 +2541,10 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
String[] segs = segments.split("\\s*,\\s*");
int isegs[] = new int[segs.length];
- for(int i=0;i<segs.length;++i) {
+ for (int i=0;i<segs.length;++i) {
try {
isegs[i] = Integer.parseInt(segs[i]);
- } catch(NumberFormatException nfe) {
+ } catch (NumberFormatException nfe) {
isegs[i] = -1;
}
}
@@ -2576,32 +2576,32 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Api api = new Api();
Api.Route ar;
Method[] meths = AuthzCassServiceImpl.class.getDeclaredMethods();
- for(RouteReport rr : rservlet.routeReport()) {
+ for (RouteReport rr : rservlet.routeReport()) {
api.getRoute().add(ar = new Api.Route());
ar.setMeth(rr.meth.name());
ar.setPath(rr.path);
ar.setDesc(rr.desc);
ar.getContentType().addAll(rr.contextTypes);
- for(Method m : meths) {
+ for (Method m : meths) {
ApiDoc ad;
- if((ad = m.getAnnotation(ApiDoc.class))!=null &&
+ if ((ad = m.getAnnotation(ApiDoc.class))!=null &&
rr.meth.equals(ad.method()) &&
rr.path.equals(ad.path())) {
- for(String param : ad.params()) {
+ for (String param : ad.params()) {
ar.getParam().add(param);
}
- for(String text : ad.text()) {
+ for (String text : ad.text()) {
ar.getComments().add(text);
}
ar.setExpected(ad.expectedCode());
- for(int ec : ad.errorCodes()) {
+ for (int ec : ad.errorCodes()) {
ar.getExplicitErr().add(ec);
}
}
}
}
RosettaData<Api> data = apiDF.newData(trans).load(api);
- if(Question.willSpecialLog(trans, trans.user())) {
+ if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
index 5f6f30e4..55c3bc86 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
@@ -117,10 +117,10 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
trans.checkpoint(namespace.name, Env.ALWAYS);
NsType nt = NsType.fromString(from.getType());
- if(nt.equals(NsType.UNKNOWN)) {
+ if (nt.equals(NsType.UNKNOWN)) {
String ns = namespace.name;
int count = 0;
- for(int i=ns.indexOf('.');
+ for (int i=ns.indexOf('.');
i>=0;
i=ns.indexOf('.',i+1)) {
++count;
@@ -141,10 +141,10 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
List<Ns> nss = to.getNs();
Ns ns = new Ns();
ns.setName(from.name);
- if(from.admin!=null)ns.getAdmin().addAll(from.admin);
- if(from.owner!=null)ns.getResponsible().addAll(from.owner);
- if(from.attrib!=null) {
- for(Pair<String,String> attrib : from.attrib) {
+ if (from.admin!=null)ns.getAdmin().addAll(from.admin);
+ if (from.owner!=null)ns.getResponsible().addAll(from.owner);
+ if (from.attrib!=null) {
+ for (Pair<String,String> attrib : from.attrib) {
Ns.Attrib toAttrib = new Ns.Attrib();
toAttrib.setKey(attrib.x);
toAttrib.setValue(attrib.y);
@@ -163,18 +163,18 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
@Override
public Result<Nss> nss(AuthzTrans trans, Collection<Namespace> from, Nss to) {
List<Ns> nss = to.getNs();
- for(Namespace nd : from) {
+ for (Namespace nd : from) {
Ns ns = new Ns();
ns.setName(nd.name);
- if(nd.admin!=null) {
+ if (nd.admin!=null) {
ns.getAdmin().addAll(nd.admin);
}
- if(nd.owner!=null) {
+ if (nd.owner!=null) {
ns.getResponsible().addAll(nd.owner);
}
ns.setDescription(nd.description);
- if(nd.attrib!=null) {
- for(Pair<String,String> attrib : nd.attrib) {
+ if (nd.attrib!=null) {
+ for (Pair<String,String> attrib : nd.attrib) {
Ns.Attrib toAttrib = new Ns.Attrib();
toAttrib.setKey(attrib.x);
toAttrib.setValue(attrib.y);
@@ -193,18 +193,18 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
final boolean addNS = trans.requested(REQD_TYPE.ns);
TimeTaken tt = trans.start("Filter Perms before return", Env.SUB);
try {
- if(from!=null) {
+ if (from!=null) {
for (PermDAO.Data data : from) {
- if(!filter || q.mayUser(trans, trans.user(), data, Access.read).isOK()) {
+ if (!filter || q.mayUser(trans, trans.user(), data, Access.read).isOK()) {
Perm perm = new Perm();
perm.setType(data.fullType());
perm.setInstance(data.instance);
perm.setAction(data.action);
perm.setDescription(data.description);
- if(addNS) {
+ if (addNS) {
perm.setNs(data.ns);
}
- for(String role : data.roles(false)) {
+ for (String role : data.roles(false)) {
perm.getRoles().add(role);
}
perms.add(perm);
@@ -242,21 +242,21 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
List<Perm> perms = to.getPerm();
TimeTaken tt = trans.start("Filter Perms before return", Env.SUB);
try {
- if(from!=null) {
+ if (from!=null) {
boolean inNSS;
for (PermDAO.Data data : from) {
inNSS=false;
- for(int i=0;!inNSS && i<nss.length;++i) {
- if(nss[i].equals(data.ns)) {
+ for (int i=0;!inNSS && i<nss.length;++i) {
+ if (nss[i].equals(data.ns)) {
inNSS=true;
}
}
- if(inNSS && (!filter || q.mayUser(trans, trans.user(), data, Access.read).isOK())) {
+ if (inNSS && (!filter || q.mayUser(trans, trans.user(), data, Access.read).isOK())) {
Perm perm = new Perm();
perm.setType(data.fullType());
perm.setInstance(data.instance);
perm.setAction(data.action);
- for(String role : data.roles(false)) {
+ for (String role : data.roles(false)) {
perm.getRoles().add(role);
}
perm.setDescription(data.description);
@@ -296,7 +296,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
for (Perm p : perms.getPerm()) {
Result<NsSplit> nss = q.deriveNsSplit(trans, p.getType());
PermDAO.Data pd = new PermDAO.Data();
- if(nss.isOK()) {
+ if (nss.isOK()) {
pd.ns=nss.value.ns;
pd.type = nss.value.name;
pd.instance = p.getInstance();
@@ -322,10 +322,10 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
public Result<PermDAO.Data> permFromRPRequest(AuthzTrans trans, Request req) {
RolePermRequest from = (RolePermRequest)req;
Pkey perm = from.getPerm();
- if(perm==null)return Result.err(Status.ERR_NotFound, "Permission not found");
+ if (perm==null)return Result.err(Status.ERR_NotFound, "Permission not found");
Result<NsSplit> nss = q.deriveNsSplit(trans, perm.getType());
PermDAO.Data pd = new PermDAO.Data();
- if(nss.isOK()) {
+ if (nss.isOK()) {
pd.ns=nss.value.ns;
pd.type = nss.value.name;
pd.instance = from.getPerm().getInstance();
@@ -351,7 +351,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
RolePermRequest from = (RolePermRequest)req;
Result<NsSplit> nss = q.deriveNsSplit(trans, from.getRole());
RoleDAO.Data rd = new RoleDAO.Data();
- if(nss.isOK()) {
+ if (nss.isOK()) {
rd.ns = nss.value.ns;
rd.name = nss.value.name;
trans.checkpoint(rd.fullName(), Env.ALWAYS);
@@ -366,7 +366,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
PermRequest from = (PermRequest)req;
Result<NsSplit> nss = q.deriveNsSplit(trans, from.getType());
PermDAO.Data pd = new PermDAO.Data();
- if(nss.isOK()) {
+ if (nss.isOK()) {
pd.ns=nss.value.ns;
pd.type = nss.value.name;
pd.instance = from.getInstance();
@@ -396,7 +396,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
public Result<RoleDAO.Data> role(AuthzTrans trans, Request base) {
RoleRequest from = (RoleRequest)base;
Result<NsSplit> nss = q.deriveNsSplit(trans, from.getName());
- if(nss.isOK()) {
+ if (nss.isOK()) {
RoleDAO.Data to = new RoleDAO.Data();
to.ns = nss.value.ns;
to.name = nss.value.name;
@@ -415,18 +415,18 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
@Override
public Result<Roles> roles(AuthzTrans trans, List<RoleDAO.Data> from, Roles to, boolean filter) {
final boolean needNS = trans.requested(REQD_TYPE.ns);
- for(RoleDAO.Data frole : from) {
+ for (RoleDAO.Data frole : from) {
// Only Add Data to view if User is allowed to see this Role
- if(!filter || q.mayUser(trans, trans.user(), frole,Access.read).isOK()) {
+ if (!filter || q.mayUser(trans, trans.user(), frole,Access.read).isOK()) {
Role role = new Role();
role.setName(frole.ns + '.' + frole.name);
role.setDescription(frole.description);
- if(needNS) {
+ if (needNS) {
role.setNs(frole.ns);
}
- for(String p : frole.perms(false)) { // can see any Perms in the Role he has permission for
+ for (String p : frole.perms(false)) { // can see any Perms in the Role he has permission for
Result<String[]> rpa = PermDAO.Data.decodeToArray(trans,q,p);
- if(rpa.notOK())
+ if (rpa.notOK())
return Result.err(rpa);
String[] pa = rpa.value;
@@ -451,10 +451,10 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
@Override
public Result<Users> users(AuthzTrans trans, Collection<UserRoleDAO.Data> from, Users to) {
List<User> cu = to.getUser();
- for(UserRoleDAO.Data urd : from) {
+ for (UserRoleDAO.Data urd : from) {
User user = new User();
user.setId(urd.user);
- if(urd.expires!=null) {
+ if (urd.expires!=null) {
user.setExpires(Chrono.timeStamp(urd.expires));
}
cu.add(user);
@@ -471,7 +471,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
@Override
public Result<UserRoles> userRoles(AuthzTrans trans, Collection<UserRoleDAO.Data> from, UserRoles to) {
List<UserRole> cu = to.getUserRole();
- for(UserRoleDAO.Data urd : from) {
+ for (UserRoleDAO.Data urd : from) {
UserRole ur = new UserRole();
ur.setUser(urd.user);
ur.setRole(urd.role);
@@ -510,15 +510,15 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
to.id=from.getId();
to.ns = Question.domain2ns(to.id);
String passwd = from.getPassword();
- if(requiresPass) {
+ if (requiresPass) {
String ok = trans.org().isValidPassword(trans, to.id,passwd);
- if(ok.length()>0) {
+ if (ok.length()>0) {
return Result.err(Status.ERR_BadData,ok);
}
} else {
to.type=0;
}
- if(passwd != null) {
+ if (passwd != null) {
to.cred = ByteBuffer.wrap(passwd.getBytes());
to.type = CredDAO.RAW;
} else {
@@ -536,7 +536,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
@Override
public Result<Users> cred(List<CredDAO.Data> from, Users to) {
List<User> cu = to.getUser();
- for(CredDAO.Data cred : from) {
+ for (CredDAO.Data cred : from) {
User user = new User();
user.setId(cred.id);
user.setExpires(Chrono.timeStamp(cred.expires));
@@ -549,7 +549,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
@Override
public Result<Certs> cert(List<CertDAO.Data> from, Certs to) {
List<Cert> lc = to.getCert();
- for(CertDAO.Data fcred : from) {
+ for (CertDAO.Data fcred : from) {
Cert cert = new Cert();
cert.setId(fcred.id);
cert.setX500(fcred.x500);
@@ -573,9 +573,9 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
Bytification content, boolean enableApproval, Memo memo, MayChange mc) {
Result<?> rMayChange;
boolean needsAppr = enableApproval?trans.requested(REQD_TYPE.future):false;
- if(!needsAppr && (needsAppr = (rMayChange=mc.mayChange()).notOK())) {
- if(enableApproval) {
- if(!trans.requested(AuthzTrans.REQD_TYPE.future)) {
+ if (!needsAppr && (needsAppr = (rMayChange=mc.mayChange()).notOK())) {
+ if (enableApproval) {
+ if (!trans.requested(AuthzTrans.REQD_TYPE.future)) {
return Result.err(rMayChange);
}
} else {
@@ -587,31 +587,31 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
GregorianCalendar expires = trans.org().expiration(start, Expiration.Future);
XMLGregorianCalendar xgc;
- if((xgc=from.getEnd())!=null) {
+ if ((xgc=from.getEnd())!=null) {
GregorianCalendar fgc = xgc.toGregorianCalendar();
expires = expires.before(fgc)?expires:fgc; // Min of desired expiration, and Org expiration
}
//TODO needs two answers from this. What's the NSS, and may Change.
FutureDAO.Data fto;
- if(start.after(now) || needsAppr ) {
+ if (start.after(now) || needsAppr ) {
//String user = trans.user();
fto = new FutureDAO.Data();
fto.target=table;
fto.memo = memo.get();
fto.start = start.getTime();
fto.expires = expires.getTime();
- if(needsAppr) { // Need to add Approvers...
+ if (needsAppr) { // Need to add Approvers...
/*
Result<Data> rslt = mc.getNsd();
- if(rslt.notOKorIsEmpty())return Result.err(rslt);
+ if (rslt.notOKorIsEmpty())return Result.err(rslt);
appr.addAll(mc.getNsd().value.responsible);
try {
//Note from 2013 Is this getting Approvers for user only? What about Delegates?
// 3/25/2014. Approvers are set by Corporate policy. We don't have to worry here about what that means.
// It is important to get Delegates, if necessary, at notification time
// If we add delegates now, it will get all confused as to who is actually responsible.
- for(Organization.User ou : org.getApprovers(trans, user)) {
+ for (Organization.User ou : org.getApprovers(trans, user)) {
appr.add(ou.email);
}
} catch (Exception e) {
@@ -638,7 +638,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
public Result<History> history(AuthzTrans trans, List<HistoryDAO.Data> history, final int sort) {
History hist = new History();
List<Item> items = hist.getItem();
- for(HistoryDAO.Data data : history) {
+ for (HistoryDAO.Data data : history) {
History.Item item = new History.Item();
item.setYYYYMM(Integer.toString(data.yr_mon));
Date date = Chrono.uuidToDate(data.id);
@@ -651,7 +651,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
items.add(item);
}
- if(sort != 0) {
+ if (sort != 0) {
TimeTaken tt = trans.start("Sort ", Env.SUB);
try {
java.util.Collections.sort(items, new Comparator<Item>() {
@@ -673,7 +673,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
err.setMessageId(msgID);
// AT&T Restful Error Format requires numbers "%" placements
err.setText(Vars.convert(holder, text, var));
- for(String s : var) {
+ for (String s : var) {
err.getVariables().add(s);
}
return err;
@@ -761,10 +761,10 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
Approvals apprs = new Approvals();
List<Approval> lappr = apprs.getApprovals();
Approval a;
- for(ApprovalDAO.Data appr : lAppr) {
+ for (ApprovalDAO.Data appr : lAppr) {
a = new Approval();
a.setId(appr.id.toString());
- if(appr.ticket==null) {
+ if (appr.ticket==null) {
a.setTicket(null);
} else {
a.setTicket(appr.ticket.toString());
@@ -784,12 +784,12 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
@Override
public Result<List<ApprovalDAO.Data>> approvals(Approvals apprs) {
List<ApprovalDAO.Data> lappr = new ArrayList<>();
- for(Approval a : apprs.getApprovals()) {
+ for (Approval a : apprs.getApprovals()) {
ApprovalDAO.Data ad = new ApprovalDAO.Data();
String str = a.getId();
- if(str!=null)ad.id=UUID.fromString(str);
+ if (str!=null)ad.id=UUID.fromString(str);
str = a.getTicket();
- if(str!=null)ad.ticket=UUID.fromString(str);
+ if (str!=null)ad.ticket=UUID.fromString(str);
ad.user=a.getUser();
ad.approver=a.getApprover();
ad.type=a.getType();
@@ -798,7 +798,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
ad.memo=a.getMemo();
XMLGregorianCalendar xgc = a.getUpdated();
- if(xgc!=null)ad.updated=xgc.toGregorianCalendar().getTime();
+ if (xgc!=null)ad.updated=xgc.toGregorianCalendar().getTime();
lappr.add(ad);
}
return Result.ok(lappr);
@@ -809,11 +809,11 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
Delgs delgs = new Delgs();
List<Delg> ldelg = delgs.getDelgs();
Delg d;
- for(DelegateDAO.Data del: lDelg) {
+ for (DelegateDAO.Data del: lDelg) {
d = new Delg();
d.setUser(del.user);
d.setDelegate(del.delegate);
- if(del.expires!=null)d.setExpires(Chrono.timeStamp(del.expires));
+ if (del.expires!=null)d.setExpires(Chrono.timeStamp(del.expires));
ldelg.add(d);
}
return Result.ok(delgs);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
index 4a088abc..128fdcd1 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
@@ -44,7 +44,7 @@ import org.onap.aaf.auth.validation.Validator;
*/
public class ServiceValidator extends Validator {
public ServiceValidator perm(Result<PermDAO.Data> rpd) {
- if(rpd.notOK()) {
+ if (rpd.notOK()) {
msg(rpd.details);
} else {
perm(rpd.value);
@@ -54,20 +54,20 @@ public class ServiceValidator extends Validator {
public ServiceValidator perm(PermDAO.Data pd) {
- if(pd==null) {
+ if (pd==null) {
msg("Perm Data is null.");
} else {
ns(pd.ns);
permType(pd.type,pd.ns);
permInstance(pd.instance);
permAction(pd.action);
- if(pd.roles!=null) {
- for(String role : pd.roles) {
+ if (pd.roles!=null) {
+ for (String role : pd.roles) {
role(role);
}
}
- if(pd.roles!=null) {
- for(String r : pd.roles) {
+ if (pd.roles!=null) {
+ for (String r : pd.roles) {
role(r);
}
}
@@ -77,7 +77,7 @@ public class ServiceValidator extends Validator {
}
public ServiceValidator role(Result<RoleDAO.Data> rrd) {
- if(rrd.notOK()) {
+ if (rrd.notOK()) {
msg(rrd.details);
} else {
role(rrd.value);
@@ -86,15 +86,15 @@ public class ServiceValidator extends Validator {
}
public ServiceValidator role(RoleDAO.Data pd) {
- if(pd==null) {
+ if (pd==null) {
msg("Role Data is null.");
} else {
ns(pd.ns);
role(pd.name);
- if(pd.perms!=null) {
- for(String perm : pd.perms) {
+ if (pd.perms!=null) {
+ for (String perm : pd.perms) {
String[] ps = perm.split("\\|");
- if(ps.length!=3) {
+ if (ps.length!=3) {
msg("Perm [" + perm + "] in Role [" + pd.fullName() + "] is not correctly separated with '|'");
} else {
permType(ps[0],null);
@@ -109,7 +109,7 @@ public class ServiceValidator extends Validator {
}
public ServiceValidator delegate(Organization org, Result<DelegateDAO.Data> rdd) {
- if(rdd.notOK()) {
+ if (rdd.notOK()) {
msg(rdd.details);
} else {
delegate(org, rdd.value);
@@ -118,7 +118,7 @@ public class ServiceValidator extends Validator {
}
public ServiceValidator delegate(Organization org, DelegateDAO.Data dd) {
- if(dd==null) {
+ if (dd==null) {
msg("Delegate Data is null.");
} else {
user(org,dd.user);
@@ -129,7 +129,7 @@ public class ServiceValidator extends Validator {
public ServiceValidator cred(AuthzTrans trans, Organization org, Result<CredDAO.Data> rcd, boolean isNew) {
- if(rcd.notOK()) {
+ if (rcd.notOK()) {
msg(rcd.details);
} else {
cred(trans, org,rcd.value,isNew);
@@ -138,26 +138,26 @@ public class ServiceValidator extends Validator {
}
public ServiceValidator cred(AuthzTrans trans, Organization org, CredDAO.Data cd, boolean isNew) {
- if(cd==null) {
+ if (cd==null) {
msg("Cred Data is null.");
} else {
- if(!org.isValidCred(trans, cd.id)) {
+ if (!org.isValidCred(trans, cd.id)) {
msg("ID [" + cd.id + "] is invalid in " + org.getName());
}
String str = cd.id;
int idx = str.indexOf('@');
- if(idx>0) {
+ if (idx>0) {
str = str.substring(0,idx);
}
- if(org.supportsRealm(cd.id)) {
+ if (org.supportsRealm(cd.id)) {
String resp = org.isValidID(trans, str);
- if(isNew && (resp!=null && resp.length()>0)) {
+ if (isNew && (resp!=null && resp.length()>0)) {
msg(cd.id,str);
}
}
- if(cd.type==null) {
+ if (cd.type==null) {
msg("Credential Type must be set");
} else {
switch(cd.type) {
@@ -174,7 +174,7 @@ public class ServiceValidator extends Validator {
public ServiceValidator user(Organization org, String user) {
- if(nob(user,ID_CHARS)) {
+ if (nob(user,ID_CHARS)) {
msg("User [",user,"] is invalid.");
}
return this;
@@ -188,25 +188,25 @@ public class ServiceValidator extends Validator {
public ServiceValidator ns(Namespace ns) {
ns(ns.name);
- for(String s : ns.admin) {
- if(nob(s,ID_CHARS)) {
+ for (String s : ns.admin) {
+ if (nob(s,ID_CHARS)) {
msg("Admin [" + s + "] is invalid.");
}
}
- for(String s : ns.owner) {
- if(nob(s,ID_CHARS)) {
+ for (String s : ns.owner) {
+ if (nob(s,ID_CHARS)) {
msg("Responsible [" + s + "] is invalid.");
}
}
- if(ns.attrib!=null) {
- for(Pair<String, String> at : ns.attrib) {
- if(nob(at.x,NAME_CHARS)) {
+ if (ns.attrib!=null) {
+ for (Pair<String, String> at : ns.attrib) {
+ if (nob(at.x,NAME_CHARS)) {
msg("Attribute tag [" + at.x + "] is invalid.");
}
- if(nob(at.x,NAME_CHARS)) {
+ if (nob(at.x,NAME_CHARS)) {
msg("Attribute value [" + at.y + "] is invalid.");
}
}
@@ -217,7 +217,7 @@ public class ServiceValidator extends Validator {
}
public ServiceValidator user_role(UserRoleDAO.Data urdd) {
- if(urdd==null) {
+ if (urdd==null) {
msg("UserRole is null");
} else {
role(urdd.role);
@@ -228,7 +228,7 @@ public class ServiceValidator extends Validator {
}
public ServiceValidator nullOrBlank(PermDAO.Data pd) {
- if(pd==null) {
+ if (pd==null) {
msg("Permission is null");
} else {
nullOrBlank("NS",pd.ns).
@@ -240,7 +240,7 @@ public class ServiceValidator extends Validator {
}
public ServiceValidator nullOrBlank(RoleDAO.Data rd) {
- if(rd==null) {
+ if (rd==null) {
msg("Role is null");
} else {
nullOrBlank("NS",rd.ns).
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/authz/service/mapper/JU_Mapper_2_0.java b/auth/auth-service/src/test/java/org/onap/aaf/authz/service/mapper/JU_Mapper_2_0.java
index 355da9a9..31fdde1f 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/authz/service/mapper/JU_Mapper_2_0.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/authz/service/mapper/JU_Mapper_2_0.java
@@ -370,7 +370,7 @@ public class JU_Mapper_2_0 {
assertTrue(result.isOK());
assertEquals("Alls Perms added",5,result.value.getPerm().size());
List<Perm> mappedPerms = result.value.getPerm();
- for(int i=0; i<5; i++) {
+ for (int i=0; i<5; i++) {
comparePerm(correctOrderPerms.get(i), mappedPerms.get(i));
}
}
@@ -492,7 +492,7 @@ public class JU_Mapper_2_0 {
assertEquals(2, result.value.getRole().size());
result.value.getRole().stream().forEach( role -> {
assertTrue(role.getPerms().isEmpty());
- if(namespaceRequested) {
+ if (namespaceRequested) {
assertEquals(namespace, role.getNs());
} else {
assertNull(role.getNs());