本文整理汇总了Java中edu.internet2.middleware.subject.provider.SubjectTypeEnum类的典型用法代码示例。如果您正苦于以下问题:Java SubjectTypeEnum类的具体用法?Java SubjectTypeEnum怎么用?Java SubjectTypeEnum使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SubjectTypeEnum类属于edu.internet2.middleware.subject.provider包,在下文中一共展示了SubjectTypeEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: memberToMemberDescriptor
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
private MemberDescriptor memberToMemberDescriptor(Member m) throws Exception {
MemberDescriptor member = new MemberDescriptor();
member.setUUID(m.getUuid());
member.setSubjectId(m.getSubjectId());
member.setSubjectName(m.getSubject().getName());
if (m.getSubject().getSource().getClass().getName().equals(GridSourceAdapter.class.getName())) {
member.setMemberType(MemberType.Grid);
} else if ((m.getSubjectType().equals(SubjectTypeEnum.GROUP))
&& (m.getSubject().getSource().getClass().getName().equals(GrouperSourceAdapter.class.getName()))) {
member.setMemberType(MemberType.GrouperGroup);
} else {
member.setMemberType(MemberType.Other);
}
return member;
}
示例2: memberToMemberDescriptor
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
private MemberDescriptor memberToMemberDescriptor(Member m) throws Exception {
MemberDescriptor member = new MemberDescriptor();
member.setUUID(m.getUuid());
member.setSubjectId(m.getSubjectId());
member.setSubjectName(m.getSubject().getName());
if (m.getSubject().getSource().getClass().getName().equals(GridSourceAdapter.class.getName())) {
member.setMemberType(MemberType.GRID);
} else if ((m.getSubjectType().equals(SubjectTypeEnum.GROUP))
&& (m.getSubject().getSource().getClass().getName().equals(GrouperSourceAdapter.class.getName()))) {
member.setMemberType(MemberType.GROUPER_GROUP);
} else {
member.setMemberType(MemberType.OTHER);
}
return member;
}
示例3: processMembershipDelete
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
/**
* Delete a membership entry.
*
* @param consumer the change log consumer
* @param changeLogEntry the change log entry
*/
protected void processMembershipDelete(GoogleAppsChangeLogConsumer consumer, ChangeLogEntry changeLogEntry) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Processing membership delete.", consumerName,
toString(changeLogEntry));
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_DELETE.groupName);
final edu.internet2.middleware.grouper.Group grouperGroup = connector.fetchGrouperGroup(groupName);
if (!connector.shouldSyncGroup(grouperGroup)) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Skipping membership delete, nothing to do cause the group is not flagged or is gone.", consumerName,
toString(changeLogEntry));
return;
}
final String subjectId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_DELETE.subjectId);
final String sourceId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_DELETE.sourceId);
final Subject lookupSubject = connector.fetchGrouperSubject(sourceId, subjectId);
final SubjectType subjectType = lookupSubject.getType();
//For nested groups, ChangeLogEvents fire when the group is removed, and also for each indirect user added,
//so we only need to handle PERSON events.
if (subjectType == SubjectTypeEnum.PERSON) {
try {
connector.removeGooMembership(groupName, lookupSubject);
} catch (IOException e) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Error processing membership delete: {}", new Object[]{consumerName,
toString(changeLogEntry), e});
}
}
}
示例4: processPrivilegeAdd
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
protected void processPrivilegeAdd(GoogleAppsChangeLogConsumer consumer, ChangeLogEntry changeLogEntry) {
final String ROLE = "MEMBER"; //Other types are ADMIN and OWNER. Neither makes sense for managed groups.
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Processing privilege add.", consumerName,
toString(changeLogEntry));
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.PRIVILEGE_ADD.ownerName);
final String privilegeName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.PRIVILEGE_ADD.privilegeName);
final String memberId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.PRIVILEGE_ADD.memberId);
final edu.internet2.middleware.grouper.Group grouperGroup = connector.fetchGrouperGroup(groupName);
final Member member = MemberFinder.findByUuid(GrouperSession.staticGrouperSession(), memberId, false);
if (!connector.shouldSyncGroup(grouperGroup)) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Skipping privilege add, nothing to do cause the group is not flagged or is gone.", consumerName,
toString(changeLogEntry));
return;
}
if (member.getSubjectType() == SubjectTypeEnum.PERSON) {
try {
connector.createGooMember(grouperGroup, member.getSubject(), connector.determineRole(member, grouperGroup));
} catch (IOException e) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Error processing privilege add: {}", new Object[]{consumerName,
toString(changeLogEntry), e});
}
}
}
示例5: processPrivilegeUpdate
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
/**
* Update a privilege entry.
*
* @param consumer the change log consumer
* @param changeLogEntry the change log entry
*/
protected void processPrivilegeUpdate(GoogleAppsChangeLogConsumer consumer, ChangeLogEntry changeLogEntry) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Processing privilege update.", consumerName,
toString(changeLogEntry));
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.PRIVILEGE_UPDATE.ownerName);
final String privilegeName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.PRIVILEGE_UPDATE.privilegeName);
final String memberId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.PRIVILEGE_UPDATE.id);
final edu.internet2.middleware.grouper.Group grouperGroup = connector.fetchGrouperGroup(groupName);
final Member member = MemberFinder.findByUuid(GrouperSession.staticGrouperSession(), memberId, false);
if (!connector.shouldSyncGroup(grouperGroup)) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Skipping privilege update, nothing to do cause the group is not flagged or is gone.", consumerName,
toString(changeLogEntry));
return;
}
if (member.getSubjectType() == SubjectTypeEnum.PERSON) {
try {
connector.updateGooMember(grouperGroup, member.getSubject(), connector.determineRole(member, grouperGroup));
} catch (IOException e) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Error processing privilege update: {}", new Object[]{consumerName,
toString(changeLogEntry), e});
}
}
}
示例6: processPrivilegeDelete
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
/**
* Delete a privilege entry.
*
* @param consumer the change log consumer
* @param changeLogEntry the change log entry
*/
protected void processPrivilegeDelete(GoogleAppsChangeLogConsumer consumer, ChangeLogEntry changeLogEntry) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Processing privilege delete.", consumerName,
toString(changeLogEntry));
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.PRIVILEGE_DELETE.ownerName);
final String privilegeName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.PRIVILEGE_DELETE.privilegeName);
final String memberId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.PRIVILEGE_DELETE.memberId);
final edu.internet2.middleware.grouper.Group grouperGroup = connector.fetchGrouperGroup(groupName);
final Member member = MemberFinder.findByUuid(GrouperSession.staticGrouperSession(), memberId, false);
if (!connector.shouldSyncGroup(grouperGroup)) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Skipping privilege delete, nothing to do cause the group is not flagged or is gone", consumerName,
toString(changeLogEntry));
return;
}
if (member.getSubjectType() == SubjectTypeEnum.PERSON) {
try {
if (grouperGroup.hasMember(member.getSubject())) {
connector.updateGooMember(grouperGroup, member.getSubject(), connector.determineRole(member, grouperGroup));
} else {
connector.removeGooMembership(grouperGroup.getName(), member.getSubject());
}
} catch (IOException e) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Error processing privilege delete: {}",
new Object[]{consumerName, toString(changeLogEntry), e});
}
}
}
示例7: getTestUserSubject
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
private Subject getTestUserSubject() {
Subject subject = mock(Subject.class);
when(subject.getAttributeValue("givenName")).thenReturn("testgn2");
when(subject.getAttributeValue("sn")).thenReturn("testfn2");
when(subject.getAttributeValue("displayName")).thenReturn("testgn2, testfn2");
when(subject.getAttributeValue("mail")).thenReturn(addressFormatter.qualifySubjectAddress(subjectId));
when(subject.getType()).thenReturn(SubjectTypeEnum.PERSON);
return subject;
}
示例8: getTestGroupSubject
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
private Subject getTestGroupSubject() {
Subject subject = mock(Subject.class);
when(subject.getAttributeValue("givenName")).thenReturn("testgn2");
when(subject.getAttributeValue("sn")).thenReturn("testfn2");
when(subject.getAttributeValue("displayName")).thenReturn("testgn2, testfn2");
when(subject.getAttributeValue("mail")).thenReturn(addressFormatter.qualifySubjectAddress(subjectId));
when(subject.getType()).thenReturn(SubjectTypeEnum.GROUP);
return subject;
}
示例9: processMembershipAdd
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
/**
* Add a membership.
*
* @param consumer the change log consumer
* @param changeLogEntry the change log entry
*/
protected void processMembershipAdd(GoogleAppsChangeLogConsumer consumer, ChangeLogEntry changeLogEntry) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Processing membership add.", consumerName,
toString(changeLogEntry));
final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_ADD.groupName);
final String memberId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_ADD.memberId);
final edu.internet2.middleware.grouper.Group grouperGroup = connector.fetchGrouperGroup(groupName);
final Member member = MemberFinder.findByUuid(GrouperSession.staticGrouperSession(), memberId, false);
if (!connector.shouldSyncGroup(grouperGroup)) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Skipping membership add, nothing to do cause the group is not flagged or is gone.", consumerName,
toString(changeLogEntry));
return;
}
final String subjectId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_ADD.subjectId);
final String sourceId = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.MEMBERSHIP_ADD.sourceId);
final Subject lookupSubject = connector.fetchGrouperSubject(sourceId, subjectId);
final SubjectType subjectType = lookupSubject.getType();
try {
Group group = connector.fetchGooGroup(connector.getAddressFormatter().qualifyGroupAddress(groupName));
if (group == null) {
connector.createGooGroupIfNecessary(grouperGroup);
group = connector.fetchGooGroup(connector.getAddressFormatter().qualifyGroupAddress(groupName));
}
//For nested groups, ChangeLogEvents fire when the group is added, and also for each indirect user added,
//so we only need to handle PERSON events.
if (subjectType == SubjectTypeEnum.PERSON) {
User user = connector.fetchGooUser(connector.getAddressFormatter().qualifySubjectAddress(subjectId));
if (user == null) {
user = connector.createGooUser(lookupSubject);
}
if (user != null) {
connector.createGooMember(group, user, connector.determineRole(member, grouperGroup));
}
}
} catch (IOException e) {
LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Error processing membership add failed: {}", new Object[] {consumerName,
toString(changeLogEntry), e});
}
}
示例10: NonGridSubject
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
protected NonGridSubject(String id, Source source) {
this.id = id;
this.type = SubjectTypeEnum.PERSON;
this.source = source;
}
示例11: GridUserSubject
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
public GridUserSubject(String id, Source source) {
super(id, SubjectTypeEnum.PERSON, source);
}
示例12: GridHostSubject
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
public GridHostSubject(String id, Source source) {
super(id, SubjectTypeEnum.APPLICATION, source);
}
示例13: NonGridSourceAdapter
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
public NonGridSourceAdapter() {
super();
this.addSubjectType(SubjectTypeEnum.PERSON.getName());
this.addSubjectType(SubjectTypeEnum.APPLICATION.getName());
}
示例14: AnonymousGridUserSubject
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
public AnonymousGridUserSubject(Source source) {
super(ANONYMOUS_GRID_USER_ID, SubjectTypeEnum.PERSON, source);
}
示例15: GridSourceAdapter
import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //导入依赖的package包/类
public GridSourceAdapter() {
super();
this.addSubjectType(SubjectTypeEnum.PERSON.getName());
this.addSubjectType(SubjectTypeEnum.APPLICATION.getName());
}