private void updateShareAcl(NetAppClusterApi ncApi,String shareName,List<ShareACL> inputAcls,AclOperation action){
  if (inputAcls.isEmpty()) {
    return;
  }
  List<CifsAcl> acls=new ArrayList<CifsAcl>();
  for (  ShareACL newAcl : inputAcls) {
    CifsAcl cif_new=new CifsAcl();
    String domain=newAcl.getDomain();
    String userOrGroup=newAcl.getGroup() == null ? newAcl.getUser() : newAcl.getGroup();
    if (domain != null && !domain.isEmpty()) {
      userOrGroup=domain + "\\" + userOrGroup;
    }
    cif_new.setUserName(userOrGroup);
    cif_new.setAccess(getAccessEnum(newAcl.getPermission()));
    acls.add(cif_new);
  }
switch (action) {
case ADD:
    ncApi.addCIFSShareAcl(shareName,acls);
  break;
case MODIFY:
ncApi.modifyCIFSShareAcl(shareName,acls);
break;
case DELETE:
ncApi.deleteCIFSShareAcl(shareName,acls);
break;
case FORCE_ADD:
for (CifsAcl cifsAcl : acls) {
try {
List<CifsAcl> singleACL=new ArrayList<CifsAcl>();
singleACL.add(cifsAcl);
ncApi.addCIFSShareAcl(shareName,singleACL);
}
 catch (Exception e) {
_log.error("NetAppClusterModeDevice:: Force add of ACL for user [" + cifsAcl.getUserName() + "] failed with an Exception",e);
}
}
break;
case FORCE_DELETE:
for (CifsAcl cifsAcl : acls) {
try {
List<CifsAcl> singleACL=new ArrayList<CifsAcl>();
singleACL.add(cifsAcl);
ncApi.deleteCIFSShareAcl(shareName,singleACL);
}
 catch (Exception e) {
_log.error("NetAppClusterModeDevice:: Force delete of ACL for user [" + cifsAcl.getUserName() + "] failed with an Exception",e);
}
}
break;
default :
throw new IllegalArgumentException(action + " is not a valid action for acl");
}
}

private void updateShareAcl ( NetAppClusterApi ncApi , String shareName , List < ShareACL > inputAcls , AclOperation action ) { if ( inputAcls . isEmpty ( ) ) { return ; } List < CifsAcl > acls = new ArrayList < CifsAcl > ( ) ; for ( ShareACL newAcl : inputAcls ) { CifsAcl cif_new = new CifsAcl ( ) ; String domain = newAcl . getDomain ( ) ; String userOrGroup = newAcl . getGroup ( ) == null ? newAcl . getUser ( ) : newAcl . getGroup ( ) ; if ( domain != null && ! domain . isEmpty ( ) ) { userOrGroup = domain + "\\" + userOrGroup ; } cif_new . setUserName ( userOrGroup ) ; cif_new . setAccess ( getAccessEnum ( newAcl . getPermission ( ) ) ) ; acls . add ( cif_new ) ; } switch ( action ) { case ADD : ncApi . addCIFSShareAcl ( shareName , acls ) ; break ; case MODIFY : ncApi . modifyCIFSShareAcl ( shareName , acls ) ; break ; case DELETE : ncApi . deleteCIFSShareAcl ( shareName , acls ) ; break ; case FORCE_ADD : for ( CifsAcl cifsAcl : acls ) { try { List < CifsAcl > singleACL = new ArrayList < CifsAcl > ( ) ; singleACL . add ( cifsAcl ) ; ncApi . addCIFSShareAcl ( shareName , singleACL ) ; } catch ( Exception e ) { _log . error ( "NetAppClusterModeDevice:: Force add of ACL for user [" + cifsAcl . getUserName ( ) + "] failed with an Exception" , e ) ; } } break ; case FORCE_DELETE : for ( CifsAcl cifsAcl : acls ) { try { List < CifsAcl > singleACL = new ArrayList < CifsAcl > ( ) ; singleACL . add ( cifsAcl ) ; ncApi . deleteCIFSShareAcl ( shareName , singleACL ) ; } catch ( Exception e ) { _log . error ( "NetAppClusterModeDevice:: Force delete of ACL for user [" + cifsAcl . getUserName ( ) + "] failed with an Exception" , e ) ; } } break ; default : throw new IllegalArgumentException ( action + " is not a valid action for acl" ) ; } }
updateshareacl is method to perform add , modify and delete acl operation based on the param action
