if (memberOf == null) memberOf = new ArrayList();
if (memberOf == null) memberOf = new ArrayList<String>();
    public void setSecurityGroup(boolean enabled) throws ServiceException    {        boolean updateOC =  (enabled && !hasZimbraSecurityGroupObjectClass()) ||                            (!enabled && hasZimbraSecurityGroupObjectClass());                String groupId = getGroupId();        if (updateOC) {            HashMap<String, Object> attrs = new HashMap<String, Object>();            attrs.put((enabled ? "+" : "-")+Provisioning.A_objectClass, Provisioning.OC_zimbraSecurityGroup);            if (!enabled) {                attrs.put(Provisioning.A_zimbraMemberOf, "");                modifyAttrs(attrs);                            } else {                // need to do a search for all DLs this DL is on that are also security groups, and update                // our zimbraMemberOf attr with their zimbraIds                // assign one only if we don't have one                String gid = getAttr(Provisioning.A_zimbraGroupId);                if (gid == null) {                    groupId = UUID.randomUUID().toString();                    attrs.put(Provisioning.A_zimbraGroupId, groupId);                }                modifyAttrs(attrs);                                String addrs[] = LdapProvisioning.getAllAddrsForDistributionList(this);                List<DistributionList> lists = Provisioning.getInstance().getAllDistributionListsForAddresses(addrs);                ArrayList memberOf = null;                for (DistributionList list: lists) {                     if (list.isSecurityGroup()) {                        if (memberOf == null) memberOf = new ArrayList();                        memberOf.add(list.getGroupId());                    }                }                if (memberOf != null) {                    String members[] = (String[]) memberOf.toArray(new String[memberOf.size()]);                    attrs.put(Provisioning.A_zimbraMemberOf, members);                }            }        }                String members[] = getAllMembers();        if (members == null || members.length == 0) return;        for (int i=0; i < members.length; i++)            updateZimbraMemberOf(members[i], groupId, enabled);    }