@@ -147,7 +147,7 @@ public Pair<List<? extends NetworkACL>, Integer> listNetworkACLs(final ListNetwo
147147 sc .setParameters ("display" , display );
148148 }
149149
150- if (id != null ){
150+ if (id != null ) {
151151 sc .setParameters ("id" , id );
152152 }
153153
@@ -174,10 +174,8 @@ public Pair<List<? extends NetworkACL>, Integer> listNetworkACLs(final ListNetwo
174174 final String accountName = cmd .getAccountName ();
175175 final Long projectId = cmd .getProjectId ();
176176 final boolean listAll = cmd .listAll ();
177- final Ternary <Long , Boolean , ListProjectResourcesCriteria > domainIdRecursiveListProject = new Ternary <Long , Boolean ,
178- ListProjectResourcesCriteria >(domainId , isRecursive , null );
179- _accountMgr .buildACLSearchParameters (caller , id , accountName , projectId , permittedAccounts , domainIdRecursiveListProject ,
180- listAll , false );
177+ final Ternary <Long , Boolean , ListProjectResourcesCriteria > domainIdRecursiveListProject = new Ternary <Long , Boolean , ListProjectResourcesCriteria >(domainId , isRecursive , null );
178+ _accountMgr .buildACLSearchParameters (caller , id , accountName , projectId , permittedAccounts , domainIdRecursiveListProject , listAll , false );
181179 domainId = domainIdRecursiveListProject .first ();
182180 isRecursive = domainIdRecursiveListProject .second ();
183181 final ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject .third ();
@@ -200,7 +198,7 @@ public Pair<List<? extends NetworkACL>, Integer> listNetworkACLs(final ListNetwo
200198 }
201199
202200 final Filter filter = new Filter (NetworkACLVO .class , "id" , false , null , null );
203- final Pair <List <NetworkACLVO >, Integer > acls = _networkACLDao .searchAndCount (sc , filter );
201+ final Pair <List <NetworkACLVO >, Integer > acls = _networkACLDao .searchAndCount (sc , filter );
204202 return new Pair <List <? extends NetworkACL >, Integer >(acls .first (), acls .second ());
205203 }
206204
@@ -262,7 +260,7 @@ public boolean replaceNetworkACLonPrivateGw(final long aclId, final long private
262260 final PrivateGateway privateGateway = _vpcSvc .getVpcPrivateGateway (gateway .getId ());
263261 _accountMgr .checkAccess (caller , null , true , privateGateway );
264262
265- return _networkAclMgr .replaceNetworkACLForPrivateGw (acl , privateGateway );
263+ return _networkAclMgr .replaceNetworkACLForPrivateGw (acl , privateGateway );
266264
267265 }
268266
@@ -377,12 +375,11 @@ public NetworkACLItem createNetworkACLItem(final CreateNetworkACLCmd aclItemCmd)
377375 }
378376 }
379377
380- validateNetworkACLItem (aclItemCmd .getSourcePortStart (), aclItemCmd .getSourcePortEnd (), aclItemCmd .getSourceCidrList (), aclItemCmd .getProtocol (),
381- aclItemCmd .getIcmpCode (), aclItemCmd . getIcmpType (), aclItemCmd .getAction (), aclItemCmd .getNumber ());
378+ validateNetworkACLItem (aclItemCmd .getSourcePortStart (), aclItemCmd .getSourcePortEnd (), aclItemCmd .getSourceCidrList (), aclItemCmd .getProtocol (), aclItemCmd . getIcmpCode (),
379+ aclItemCmd .getIcmpType (), aclItemCmd .getAction (), aclItemCmd .getNumber ());
382380
383- return _networkAclMgr .createNetworkACLItem (aclItemCmd .getSourcePortStart (), aclItemCmd .getSourcePortEnd (), aclItemCmd .getProtocol (),
384- aclItemCmd .getSourceCidrList (), aclItemCmd .getIcmpCode (), aclItemCmd .getIcmpType (), aclItemCmd .getTrafficType (), aclId , aclItemCmd .getAction (),
385- aclItemCmd .getNumber (), aclItemCmd .getDisplay ());
381+ return _networkAclMgr .createNetworkACLItem (aclItemCmd .getSourcePortStart (), aclItemCmd .getSourcePortEnd (), aclItemCmd .getProtocol (), aclItemCmd .getSourceCidrList (), aclItemCmd .getIcmpCode (),
382+ aclItemCmd .getIcmpType (), aclItemCmd .getTrafficType (), aclId , aclItemCmd .getAction (), aclItemCmd .getNumber (), aclItemCmd .getDisplay ());
386383 }
387384
388385 private void validateNetworkACLItem (final Integer portStart , final Integer portEnd , final List <String > sourceCidrList , final String protocol , final Integer icmpCode , final Integer icmpType ,
@@ -447,8 +444,7 @@ private void validateNetworkACLItem(final Integer portStart, final Integer portE
447444 }
448445 if (icmpCode != null ) {
449446 if (icmpCode .longValue () != -1 && !NetUtils .validateIcmpCode (icmpCode .longValue ())) {
450- throw new InvalidParameterValueException ("Invalid icmp code; should belong to [0-15] range and can"
451- + " be defined when icmpType belongs to [0-40] range" );
447+ throw new InvalidParameterValueException ("Invalid icmp code; should belong to [0-15] range and can" + " be defined when icmpType belongs to [0-40] range" );
452448 }
453449 }
454450 }
@@ -525,7 +521,7 @@ public Pair<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(final L
525521 if (networkId != null ) {
526522 final Network network = _networkDao .findById (networkId );
527523 aclId = network .getNetworkACLId ();
528- if ( aclId == null ){
524+ if ( aclId == null ) {
529525 // No aclId associated with the network.
530526 //Return empty list
531527 return new Pair (new ArrayList <NetworkACLItem >(), 0 );
@@ -550,7 +546,6 @@ public Pair<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(final L
550546 } else {
551547 //ToDo: Add accountId to network_acl_item table for permission check
552548
553-
554549 // aclId is not specified
555550 // List permitted VPCs and filter aclItems
556551 final List <Long > permittedAccounts = new ArrayList <Long >();
@@ -559,10 +554,8 @@ public Pair<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(final L
559554 final String accountName = cmd .getAccountName ();
560555 final Long projectId = cmd .getProjectId ();
561556 final boolean listAll = cmd .listAll ();
562- final Ternary <Long , Boolean , ListProjectResourcesCriteria > domainIdRecursiveListProject = new Ternary <Long , Boolean ,
563- ListProjectResourcesCriteria >(domainId , isRecursive , null );
564- _accountMgr .buildACLSearchParameters (caller , id , accountName , projectId , permittedAccounts , domainIdRecursiveListProject ,
565- listAll , false );
557+ final Ternary <Long , Boolean , ListProjectResourcesCriteria > domainIdRecursiveListProject = new Ternary <Long , Boolean , ListProjectResourcesCriteria >(domainId , isRecursive , null );
558+ _accountMgr .buildACLSearchParameters (caller , id , accountName , projectId , permittedAccounts , domainIdRecursiveListProject , listAll , false );
566559 domainId = domainIdRecursiveListProject .first ();
567560 isRecursive = domainIdRecursiveListProject .second ();
568561 final ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject .third ();
@@ -600,7 +593,7 @@ public Pair<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(final L
600593
601594 final Pair <List <NetworkACLItemVO >, Integer > result = _networkACLItemDao .searchAndCount (sc , filter );
602595 final List <NetworkACLItemVO > aclItemVOs = result .first ();
603- for (final NetworkACLItemVO item : aclItemVOs ) {
596+ for (final NetworkACLItemVO item : aclItemVOs ) {
604597 _networkACLItemDao .loadCidrs (item );
605598 }
606599 return new Pair <List <? extends NetworkACLItem >, Integer >(aclItemVOs , result .second ());
@@ -610,12 +603,12 @@ public Pair<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(final L
610603 @ ActionEvent (eventType = EventTypes .EVENT_NETWORK_ACL_ITEM_DELETE , eventDescription = "Deleting Network ACL Item" , async = true )
611604 public boolean revokeNetworkACLItem (final long ruleId ) {
612605 final NetworkACLItemVO aclItem = _networkACLItemDao .findById (ruleId );
613- if (aclItem != null ){
606+ if (aclItem != null ) {
614607 final NetworkACL acl = _networkAclMgr .getNetworkACL (aclItem .getAclId ());
615608
616609 final Vpc vpc = _entityMgr .findById (Vpc .class , acl .getVpcId ());
617610
618- if (aclItem .getAclId () == NetworkACL .DEFAULT_ALLOW || aclItem .getAclId () == NetworkACL .DEFAULT_DENY ){
611+ if (aclItem .getAclId () == NetworkACL .DEFAULT_ALLOW || aclItem .getAclId () == NetworkACL .DEFAULT_DENY ) {
619612 throw new InvalidParameterValueException ("ACL Items in default ACL cannot be deleted" );
620613 }
621614
@@ -629,7 +622,8 @@ public boolean revokeNetworkACLItem(final long ruleId) {
629622
630623 @ Override
631624 public NetworkACLItem updateNetworkACLItem (final Long id , final String protocol , final List <String > sourceCidrList , final NetworkACLItem .TrafficType trafficType , final String action ,
632- final Integer number , final Integer sourcePortStart , final Integer sourcePortEnd , final Integer icmpCode , final Integer icmpType , final String newUUID , final Boolean forDisplay ) throws ResourceUnavailableException {
625+ final Integer number , final Integer sourcePortStart , final Integer sourcePortEnd , final Integer icmpCode , final Integer icmpType , final String newUUID , final Boolean forDisplay )
626+ throws ResourceUnavailableException {
633627 final NetworkACLItemVO aclItem = _networkACLItemDao .findById (id );
634628 if (aclItem == null ) {
635629 throw new InvalidParameterValueException ("Unable to find ACL Item cannot be found" );
@@ -655,8 +649,8 @@ public NetworkACLItem updateNetworkACLItem(final Long id, final String protocol,
655649 }
656650 }
657651
658- validateNetworkACLItem (sourcePortStart == null ? aclItem .getSourcePortStart () : sourcePortStart , sourcePortEnd == null ? aclItem .getSourcePortEnd ()
659- : sourcePortEnd , sourceCidrList , protocol , icmpCode , icmpType == null ? aclItem .getIcmpType () : icmpType , action , number );
652+ validateNetworkACLItem (sourcePortStart == null ? aclItem .getSourcePortStart () : sourcePortStart , sourcePortEnd == null ? aclItem .getSourcePortEnd () : sourcePortEnd , sourceCidrList , protocol ,
653+ icmpCode , icmpType == null ? aclItem .getIcmpType () : icmpType , action , number );
660654
661655 return _networkAclMgr .updateNetworkACLItem (id , protocol , sourceCidrList , trafficType , action , number , sourcePortStart , sourcePortEnd , icmpCode , icmpType , newUUID , forDisplay );
662656 }
@@ -688,6 +682,6 @@ public NetworkACL updateNetworkACL(UpdateNetworkACLListCmd updateNetworkACLListC
688682 }
689683 _networkACLDao .update (id , acl );
690684 return _networkACLDao .findById (id );
691- }
685+ }
692686
693687}
0 commit comments