• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.server
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • Last Change
  • Annotate
  • Revision Log

root/trunk/components/common/src/ome/system/Principal.java

Revision 2243, 2.0 kB (checked in by jmoore, 11 months ago)

Setting unpassed values to null in Principal

  • Property svn:keywords set to
    Date
    Revision
    Id
    URL
Line 
1/*
2 * ome.system.Principal
3 *
4 *   Copyright 2006 University of Dundee. All rights reserved.
5 *   Use is subject to license terms supplied in LICENSE.txt
6 */
7
8package ome.system;
9
10// Java imports
11import java.io.Serializable;
12
13import ome.model.enums.EventType;
14import ome.model.internal.Permissions;
15import ome.model.meta.ExperimenterGroup;
16
17/**
18 * implementation of {@link java.security.Principal}. Specialized for Omero to
19 * carry a {@link ExperimenterGroup group}, an {@link EventType event type} and
20 * a {@link Permissions umask}.
21 *
22 * @author Josh Moore, josh.moore at gmx.de
23 * @version $Revision$, $Date$
24 * @see EventType
25 * @see ExperimenterGroup
26 * @see Permissions
27 * @since 3.0
28 */
29public class Principal implements java.security.Principal, Serializable {
30
31    private static final long serialVersionUID = 3761954018296933086L;
32
33    protected String name;
34
35    protected String group;
36
37    protected String type;
38
39    protected Permissions umask;
40
41    /**
42     * Creates a Principal with null group and event type. These must be taken
43     * from the session.
44     *
45     * @param name
46     */
47    public Principal(String name) {
48        this(name, null, null);
49    }
50
51    public Principal(String name, String group, String eventType) {
52        this.name = name;
53        this.group = group;
54        this.type = eventType;
55    }
56
57    // IMMUTABLE
58
59    public String getName() {
60        return this.name;
61    }
62
63    public String getGroup() {
64        return this.group;
65    }
66
67    public String getEventType() {
68        return this.type;
69    }
70
71    // MUTABLE
72
73    public boolean hasUmask() {
74        return this.umask != null;
75    }
76
77    public Permissions getUmask() {
78        return this.umask;
79    }
80
81    public void setUmask(Permissions mask) {
82        this.umask = mask;
83    }
84
85    /**
86     * returns only the name of the instance because that is the expected
87     * behavior of {@link java.security.Principal} implementations
88     *
89     * @return value of {@link #name}
90     */
91    @Override
92    public String toString() {
93        return this.name;
94    }
95
96}
Note: See TracBrowser for help on using the browser.

Download in other formats:

  • Plain Text
  • Original Format

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/