~ubuntu-branches/ubuntu/wily/389-ds-console/wily-proposed

« back to all changes in this revision

Viewing changes to src/com/netscape/admin/dirserv/account/RoleActivationModel.java

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-03-15 19:58:37 UTC
  • Revision ID: package-import@ubuntu.com-20120315195837-296zyft51thld8q7
Tags: upstream-1.2.6
ImportĀ upstreamĀ versionĀ 1.2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** BEGIN COPYRIGHT BLOCK
 
2
 * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
 
3
 * Copyright (C) 2005 Red Hat, Inc.
 
4
 * All rights reserved.
 
5
 * 
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation version 2 of the License.
 
9
 * 
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 * 
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 * END COPYRIGHT BLOCK **/
 
19
package com.netscape.admin.dirserv.account;
 
20
 
 
21
import java.util.Vector;
 
22
import netscape.ldap.LDAPConnection;
 
23
import netscape.ldap.LDAPException;
 
24
import com.netscape.management.client.util.Debug;
 
25
import com.netscape.management.client.ug.ResourceEditor;
 
26
import com.netscape.management.client.ug.ResourcePageObservable;
 
27
import com.netscape.admin.dirserv.DSUtil;
 
28
 
 
29
 
 
30
/**
 
31
 * The specialized version of BuiltinActivationModel for
 
32
 * role entries.
 
33
 */
 
34
public class RoleActivationModel extends BuiltinActivationModel {
 
35
 
 
36
 
 
37
        /**
 
38
         * Save the activation/inactivation state for a role
 
39
         */
 
40
        public boolean afterSave(ResourcePageObservable o, ResourceEditor ed) 
 
41
        throws LDAPException
 
42
        {
 
43
                if (_modified) {
 
44
                        LDAPConnection ldc = ed.getConsoleInfo().getLDAPConnection();
 
45
                        try {
 
46
                                if (! _activator.isLockingInfrastructureCreated(ldc)) {
 
47
                                        Debug.println(0, "RoleActivationModel.afterSave: creating the locking infrastructure");
 
48
                                        _activator.createLockingInfrastructure(ldc);
 
49
                                }
 
50
                                if (_activated)
 
51
                                        _activator.modifyRolesToActivateRole(ldc);
 
52
                                else
 
53
                                        _activator.modifyRolesToInactivateRole(ldc);
 
54
                                Debug.println("RoleActivationModel.afterSave: committed activation = " + _activated);
 
55
                        }
 
56
                        catch(LDAPException x) {
 
57
                                Debug.println(0, "RoleActivationModel.afterSave: " + x);
 
58
                                if (Debug.getTrace())
 
59
                                        x.printStackTrace();
 
60
                                DSUtil.showLDAPErrorDialog(ed.getFrame(), x, "updating-directory-title");
 
61
                        }
 
62
                        _modified = false;
 
63
                }
 
64
                else {
 
65
                        Debug.println("RoleActivationModel.afterSave: no change, nothing to do");
 
66
                }
 
67
                return true;
 
68
        }
 
69
}