edu.internet2.middleware.grouper.externalSubjects
Class ExternalSubject

java.lang.Object
  extended by edu.internet2.middleware.grouper.GrouperAPI
      extended by edu.internet2.middleware.grouper.externalSubjects.ExternalSubject
All Implemented Interfaces:
HibGrouperLifecycle, Hib3GrouperVersioned, GrouperCloneable, GrouperHasContext, GrouperUtil.FieldValuable, Serializable, org.hibernate.classic.Lifecycle

public class ExternalSubject
extends GrouperAPI
implements GrouperHasContext, Hib3GrouperVersioned

database object for external subject

Author:
mchyzer
See Also:
Serialized Form

Field Summary
static String COLUMN_CONTEXT_ID
          column name for context id
static String COLUMN_CREATE_TIME
          column name for create time
static String COLUMN_CREATOR_MEMBER_ID
          column name for creator member id
static String COLUMN_DESCRIPTION
          column name for description
static String COLUMN_DISABLED_TIME
          column name for disabled time
static String COLUMN_EMAIL
          column name for email
static String COLUMN_ENABLED
          column name for enabled
static String COLUMN_IDENTIFIER
          column name for identifier
static String COLUMN_INSTITUTION
          column name for institution
static String COLUMN_MODIFIER_MEMBER_ID
          column name for modifier member id
static String COLUMN_MODIFY_TIME
          column name for modify time
static String COLUMN_NAME
          column name for name
static String COLUMN_SEARCH_STRING_LOWER
          column name for searchStringLower
static String COLUMN_UUID
          column name for uuid
static String COLUMN_VETTED_EMAIL_ADDRESSES
          column name for vettedEmailAddresses
static String FIELD_CONTEXT_ID
          constant for field name for: contextId
static String FIELD_CREATE_TIME
          constant for field name for: createTime
static String FIELD_CREATOR_MEMBER_ID
          constant for field name for: creatorMemberId
static String FIELD_DESCRIPTION
          constant for field name for: description
static String FIELD_DISABLED_TIME
          constant for field name for: disabledTime
static String FIELD_EMAIL
          constant for field name for: email
static String FIELD_ENABLED
          constant for field name for: enabled
static String FIELD_IDENTIFIER
          constant for field name for: identifier
static String FIELD_INSTITUTION
          constant for field name for: institution
static String FIELD_MODIFIER_MEMBER_ID
          constant for field name for: modifierMemberId
static String FIELD_MODIFY_TIME
          constant for field name for: modifyTime
static String FIELD_NAME
          constant for field name for: name
static String FIELD_SEARCH_STRING_LOWER
          constant for field name for: searchStringLower
static String FIELD_UUID
          constant for field name for: uuid
static String FIELD_VETTED_EMAIL_ADDRESSES
          constant for field name for: vettedEmailAddresses
static String TABLE_GROUPER_EXT_SUBJ
          table name for external subjects
 
Fields inherited from class edu.internet2.middleware.grouper.GrouperAPI
COLUMN_HIBERNATE_VERSION_NUMBER, FIELD_DB_VERSION, FIELD_HIBERNATE_VERSION_NUMBER, INITIAL_VERSION_NUMBER
 
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
 
Constructor Summary
ExternalSubject()
           
 
Method Summary
 void addVettedEmailAddress(String vettedEmailAddress)
          add a vetted email address and store this object if necessary
 boolean assignAttribute(String attributeName, String attributeValue)
          assign an attribute to this subject, change value if already exists, add if not
 ExternalSubject clone()
          deep clone the fields in this object
 void delete()
          delete this object from the DB.
 String getContextId()
          contextId links to audit tables
 Date getCreateTime()
          Get creation time for this subject.
 long getCreateTimeDb()
           
 String getCreatorMemberId()
           
 String getDescription()
          description, which is generated from other attributes
 Date getDisabledTime()
          when this was disabled, or when it will be disabled, millis from 1970
 Long getDisabledTimeDb()
          when this was disabled, or when it will be disabled
 String getEmail()
          email address
 String getEnabledDb()
          if this is enabled
 String getIdentifier()
          the thing that the subject uses to login
 String getInstitution()
          institution where the user is from
 String getModifierMemberId()
           
 Date getModifyTime()
          Get modify time for this subject.
 long getModifyTimeDb()
           
 String getName()
          name of subject
 String getSearchStringLower()
          search string to find a subject, in all lower case
 String getUuid()
          uuid for row
 String getVettedEmailAddresses()
          comma separated vetted email addresses
static int internal_daemonCalcFields()
          fix enabled and disabled memberships, and return the count of how many were fixed
static int internal_fixDisabled()
          fix enabled and disabled memberships, and return the count of how many were fixed
 boolean isEnabled()
          if this is enabled
static void notifyWatcherAboutRegistration(String identifier, String emailAddressToNotify, String emailAddressOfInvitee)
          notify watcher about a registration.
 void onPreSave(HibernateSession hibernateSession)
          before a save (insert) occurs
 void onPreUpdate(HibernateSession hibernateSession)
          before an update occurs
 boolean removeAttribute(String attributeName)
          remove an attribute
 ExternalSubjectAttribute retrieveAttribute(String attributeName, boolean exceptionIfNotFound)
          get an attributes for this subject
 Set<ExternalSubjectAttribute> retrieveAttributes()
          get all attributes for this subject
 String retrieveFieldValue(String fieldOrAttributeName)
          get the value by field name or attribute
 void setContextId(String contextId1)
          contextId links to audit tables
 void setCreateTimeDb(long createTime1)
          create time
 void setCreatorMemberId(String creatorMemberId1)
          member id of creator
 void setDescription(String description1)
          description, which is generated from other attributes
 void setDisabledTime(Date theDisabledTime1)
          when this was disabled, or when it will be disabled, millis from 1970
 void setDisabledTimeDb(Long disabledTime1)
          when this was disabled, or when it will be disabled
 void setEmail(String email1)
          email address
 void setEnabled(boolean enabled1)
          if this is enabled
 void setEnabledDb(String enabled1)
          if this is enabled, T or F
 void setIdentifier(String identifier1)
          the thing that the subject uses to login
 void setInstitution(String institution1)
          institution where the user is from
 void setModifierMemberId(String modifierMemberId1)
          member id of modifier
 void setModifyTimeDb(long modifyTime1)
          last time modified
 void setName(String name1)
          name of subject
 void setSearchStringLower(String searchStringLower1)
          search string to find a subject, in all lower case
 void setUuid(String uuid1)
          uuid for row
 void setVettedEmailAddresses(String vettedEmailAddresses1)
          comma separated vetted email addresses
static String sourceId()
          source id for external subjects
static String sourceName()
          source name for external subjects
 void store()
          store this object to the DB.
 void store(Set<ExternalSubjectAttribute> externalSubjectAttributes, String externalSubjectInviteName, boolean validateAttributes, boolean autoaddGroups, boolean fromRecalcDaemon)
          store this object to the DB.
static boolean subjectCanEditExternalUser(edu.internet2.middleware.subject.Subject subject)
          see if someone is allowed to edit, cache for 1 minute, note, this method has no security
 String toString()
           
 void validateIdentifier()
          validate that the identifier is ok, based on grouper.properties
 
Methods inherited from class edu.internet2.middleware.grouper.GrouperAPI
dbVersion, dbVersionClear, dbVersionDifferentFields, dbVersionIsDifferent, dbVersionReset, fieldValue, getHibernateVersionNumber, onDelete, onLoad, onPostDelete, onPostSave, onPostUpdate, onPreDelete, onSave, onUpdate, setHibernateVersionNumber
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TABLE_GROUPER_EXT_SUBJ

public static final String TABLE_GROUPER_EXT_SUBJ
table name for external subjects

See Also:
Constant Field Values

COLUMN_CONTEXT_ID

public static final String COLUMN_CONTEXT_ID
column name for context id

See Also:
Constant Field Values

COLUMN_DESCRIPTION

public static final String COLUMN_DESCRIPTION
column name for description

See Also:
Constant Field Values

COLUMN_DISABLED_TIME

public static final String COLUMN_DISABLED_TIME
column name for disabled time

See Also:
Constant Field Values

COLUMN_EMAIL

public static final String COLUMN_EMAIL
column name for email

See Also:
Constant Field Values

COLUMN_ENABLED

public static final String COLUMN_ENABLED
column name for enabled

See Also:
Constant Field Values

COLUMN_IDENTIFIER

public static final String COLUMN_IDENTIFIER
column name for identifier

See Also:
Constant Field Values

COLUMN_INSTITUTION

public static final String COLUMN_INSTITUTION
column name for institution

See Also:
Constant Field Values

COLUMN_NAME

public static final String COLUMN_NAME
column name for name

See Also:
Constant Field Values

COLUMN_SEARCH_STRING_LOWER

public static final String COLUMN_SEARCH_STRING_LOWER
column name for searchStringLower

See Also:
Constant Field Values

COLUMN_VETTED_EMAIL_ADDRESSES

public static final String COLUMN_VETTED_EMAIL_ADDRESSES
column name for vettedEmailAddresses

See Also:
Constant Field Values

COLUMN_UUID

public static final String COLUMN_UUID
column name for uuid

See Also:
Constant Field Values

COLUMN_CREATE_TIME

public static final String COLUMN_CREATE_TIME
column name for create time

See Also:
Constant Field Values

COLUMN_CREATOR_MEMBER_ID

public static final String COLUMN_CREATOR_MEMBER_ID
column name for creator member id

See Also:
Constant Field Values

COLUMN_MODIFY_TIME

public static final String COLUMN_MODIFY_TIME
column name for modify time

See Also:
Constant Field Values

COLUMN_MODIFIER_MEMBER_ID

public static final String COLUMN_MODIFIER_MEMBER_ID
column name for modifier member id

See Also:
Constant Field Values

FIELD_CONTEXT_ID

public static final String FIELD_CONTEXT_ID
constant for field name for: contextId

See Also:
Constant Field Values

FIELD_CREATE_TIME

public static final String FIELD_CREATE_TIME
constant for field name for: createTime

See Also:
Constant Field Values

FIELD_CREATOR_MEMBER_ID

public static final String FIELD_CREATOR_MEMBER_ID
constant for field name for: creatorMemberId

See Also:
Constant Field Values

FIELD_DESCRIPTION

public static final String FIELD_DESCRIPTION
constant for field name for: description

See Also:
Constant Field Values

FIELD_DISABLED_TIME

public static final String FIELD_DISABLED_TIME
constant for field name for: disabledTime

See Also:
Constant Field Values

FIELD_EMAIL

public static final String FIELD_EMAIL
constant for field name for: email

See Also:
Constant Field Values

FIELD_ENABLED

public static final String FIELD_ENABLED
constant for field name for: enabled

See Also:
Constant Field Values

FIELD_IDENTIFIER

public static final String FIELD_IDENTIFIER
constant for field name for: identifier

See Also:
Constant Field Values

FIELD_INSTITUTION

public static final String FIELD_INSTITUTION
constant for field name for: institution

See Also:
Constant Field Values

FIELD_MODIFIER_MEMBER_ID

public static final String FIELD_MODIFIER_MEMBER_ID
constant for field name for: modifierMemberId

See Also:
Constant Field Values

FIELD_MODIFY_TIME

public static final String FIELD_MODIFY_TIME
constant for field name for: modifyTime

See Also:
Constant Field Values

FIELD_NAME

public static final String FIELD_NAME
constant for field name for: name

See Also:
Constant Field Values

FIELD_SEARCH_STRING_LOWER

public static final String FIELD_SEARCH_STRING_LOWER
constant for field name for: searchStringLower

See Also:
Constant Field Values

FIELD_VETTED_EMAIL_ADDRESSES

public static final String FIELD_VETTED_EMAIL_ADDRESSES
constant for field name for: vettedEmailAddresses

See Also:
Constant Field Values

FIELD_UUID

public static final String FIELD_UUID
constant for field name for: uuid

See Also:
Constant Field Values
Constructor Detail

ExternalSubject

public ExternalSubject()
Method Detail

getVettedEmailAddresses

public String getVettedEmailAddresses()
comma separated vetted email addresses

Returns:
comma separated vetted email addresses

setVettedEmailAddresses

public void setVettedEmailAddresses(String vettedEmailAddresses1)
comma separated vetted email addresses

Parameters:
vettedEmailAddresses1 -

notifyWatcherAboutRegistration

public static void notifyWatcherAboutRegistration(String identifier,
                                                  String emailAddressToNotify,
                                                  String emailAddressOfInvitee)
notify watcher about a registration. If there is a problem, just log the exception

Parameters:
identifier -
emailAddressToNotify -
emailAddressOfInvitee -

addVettedEmailAddress

public void addVettedEmailAddress(String vettedEmailAddress)
add a vetted email address and store this object if necessary

Parameters:
vettedEmailAddress -

getDisabledTimeDb

public Long getDisabledTimeDb()
when this was disabled, or when it will be disabled

Returns:
the millis from 1970

setDisabledTimeDb

public void setDisabledTimeDb(Long disabledTime1)
when this was disabled, or when it will be disabled

Parameters:
disabledTime1 -

getDisabledTime

public Date getDisabledTime()
when this was disabled, or when it will be disabled, millis from 1970

Returns:
disabled time

setDisabledTime

public void setDisabledTime(Date theDisabledTime1)
when this was disabled, or when it will be disabled, millis from 1970

Parameters:
theDisabledTime1 -

isEnabled

public boolean isEnabled()
if this is enabled

Returns:
true if enabled

getEnabledDb

public String getEnabledDb()
if this is enabled

Returns:
T or F

setEnabled

public void setEnabled(boolean enabled1)
if this is enabled

Parameters:
enabled1 -

setEnabledDb

public void setEnabledDb(String enabled1)
if this is enabled, T or F

Parameters:
enabled1 -

getContextId

public String getContextId()
contextId links to audit tables

Returns:
context id

getSearchStringLower

public String getSearchStringLower()
search string to find a subject, in all lower case

Returns:
search string lower

setSearchStringLower

public void setSearchStringLower(String searchStringLower1)
search string to find a subject, in all lower case

Parameters:
searchStringLower1 -

getUuid

public String getUuid()
uuid for row

Returns:
uuid

setUuid

public void setUuid(String uuid1)
uuid for row

Parameters:
uuid1 -

getIdentifier

public String getIdentifier()
the thing that the subject uses to login

Returns:
identifier

setIdentifier

public void setIdentifier(String identifier1)
the thing that the subject uses to login

Parameters:
identifier1 -

getName

public String getName()
name of subject

Returns:
name

setName

public void setName(String name1)
name of subject

Parameters:
name1 -

getDescription

public String getDescription()
description, which is generated from other attributes

Returns:
description

setDescription

public void setDescription(String description1)
description, which is generated from other attributes

Parameters:
description1 -

getEmail

public String getEmail()
email address

Returns:
email

setEmail

public void setEmail(String email1)
email address

Parameters:
email1 -

getInstitution

public String getInstitution()
institution where the user is from

Returns:
institution

setInstitution

public void setInstitution(String institution1)
institution where the user is from

Parameters:
institution1 -

clone

public ExternalSubject clone()
deep clone the fields in this object

Specified by:
clone in interface GrouperCloneable
Specified by:
clone in class GrouperAPI
Returns:
the clone of the object
See Also:
Object.clone()

setContextId

public void setContextId(String contextId1)
contextId links to audit tables

Specified by:
setContextId in interface GrouperHasContext
Parameters:
contextId1 -

getCreateTime

public Date getCreateTime()
Get creation time for this subject.

Returns:
Date that this subject was created.

getCreateTimeDb

public long getCreateTimeDb()
Returns:
create time

getCreatorMemberId

public String getCreatorMemberId()
Returns:
creator

getModifierMemberId

public String getModifierMemberId()
Returns:
the modifier member id

setCreateTimeDb

public void setCreateTimeDb(long createTime1)
create time

Parameters:
createTime1 -

setCreatorMemberId

public void setCreatorMemberId(String creatorMemberId1)
member id of creator

Parameters:
creatorMemberId1 -

setModifierMemberId

public void setModifierMemberId(String modifierMemberId1)
member id of modifier

Parameters:
modifierMemberId1 -

setModifyTimeDb

public void setModifyTimeDb(long modifyTime1)
last time modified

Parameters:
modifyTime1 -

getModifyTime

public Date getModifyTime()
Get modify time for this subject.

Returns:
Date that this subject was created.

getModifyTimeDb

public long getModifyTimeDb()
Returns:
modify time

subjectCanEditExternalUser

public static boolean subjectCanEditExternalUser(edu.internet2.middleware.subject.Subject subject)
see if someone is allowed to edit, cache for 1 minute, note, this method has no security

Parameters:
subject -
Returns:
true if allowed to edit

onPreSave

public void onPreSave(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before a save (insert) occurs

Specified by:
onPreSave in interface HibGrouperLifecycle
Overrides:
onPreSave in class GrouperAPI
See Also:
GrouperAPI.onPreSave(HibernateSession)

onPreUpdate

public void onPreUpdate(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before an update occurs

Specified by:
onPreUpdate in interface HibGrouperLifecycle
Overrides:
onPreUpdate in class GrouperAPI
See Also:
GrouperAPI.onPreUpdate(HibernateSession)

store

public void store()
store this object to the DB.


retrieveFieldValue

public String retrieveFieldValue(String fieldOrAttributeName)
get the value by field name or attribute

Parameters:
fieldOrAttributeName -
Returns:
the value

store

public void store(Set<ExternalSubjectAttribute> externalSubjectAttributes,
                  String externalSubjectInviteName,
                  boolean validateAttributes,
                  boolean autoaddGroups,
                  boolean fromRecalcDaemon)
store this object to the DB.

Parameters:
externalSubjectAttributes - null to not worry, not null to affect the external subject attributes too
externalSubjectInviteName - is a variable you could put in the URL to pass to the hook so you can add the users to custom groups or whatnot
validateAttributes - if required attributes should be validated
autoaddGroups - if groups should be auto-added (e.g. not from daemon)
fromRecalcDaemon - if the recalc daemon is doing the storing

validateIdentifier

public void validateIdentifier()
validate that the identifier is ok, based on grouper.properties


sourceName

public static String sourceName()
source name for external subjects

Returns:
name

sourceId

public static String sourceId()
source id for external subjects

Returns:
id

delete

public void delete()
delete this object from the DB.


internal_fixDisabled

public static int internal_fixDisabled()
fix enabled and disabled memberships, and return the count of how many were fixed

Returns:
the number of records affected

internal_daemonCalcFields

public static int internal_daemonCalcFields()
fix enabled and disabled memberships, and return the count of how many were fixed

Returns:
the number of records affected

assignAttribute

public boolean assignAttribute(String attributeName,
                               String attributeValue)
assign an attribute to this subject, change value if already exists, add if not

Parameters:
attributeName -
attributeValue -
Returns:
true if changed anything, false if not

retrieveAttributes

public Set<ExternalSubjectAttribute> retrieveAttributes()
get all attributes for this subject

Returns:
the attributes

retrieveAttribute

public ExternalSubjectAttribute retrieveAttribute(String attributeName,
                                                  boolean exceptionIfNotFound)
get an attributes for this subject

Parameters:
attributeName -
exceptionIfNotFound -
Returns:
the attributes

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

removeAttribute

public boolean removeAttribute(String attributeName)
remove an attribute

Parameters:
attributeName -
Returns:
true if did anything