當前位置: 首頁>>代碼示例>>Java>>正文


Java SubjectTypeEnum類代碼示例

本文整理匯總了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;
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:17,代碼來源:GridGrouper.java

示例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;
}
 
開發者ID:NCIP,項目名稱:cagrid2,代碼行數:17,代碼來源:GridGrouper.java

示例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});
        }
    }
}
 
開發者ID:Unicon,項目名稱:googleapps-grouper-provisioner,代碼行數:37,代碼來源:GoogleAppsChangeLogConsumer.java

示例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});
        }
    }

}
 
開發者ID:Unicon,項目名稱:googleapps-grouper-provisioner,代碼行數:31,代碼來源:GoogleAppsChangeLogConsumer.java

示例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});
        }
    }

}
 
開發者ID:Unicon,項目名稱:googleapps-grouper-provisioner,代碼行數:36,代碼來源:GoogleAppsChangeLogConsumer.java

示例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});
        }
    }

}
 
開發者ID:Unicon,項目名稱:googleapps-grouper-provisioner,代碼行數:41,代碼來源:GoogleAppsChangeLogConsumer.java

示例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;
}
 
開發者ID:Unicon,項目名稱:googleapps-grouper-provisioner,代碼行數:10,代碼來源:GoogleAppsChangeLogConsumerTest.java

示例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;
}
 
開發者ID:Unicon,項目名稱:googleapps-grouper-provisioner,代碼行數:10,代碼來源:GoogleAppsChangeLogConsumerTest.java

示例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});
    }
}
 
開發者ID:Unicon,項目名稱:googleapps-grouper-provisioner,代碼行數:53,代碼來源:GoogleAppsChangeLogConsumer.java

示例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;
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:6,代碼來源:NonGridSubject.java

示例11: GridUserSubject

import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //導入依賴的package包/類
public GridUserSubject(String id, Source source) {
	super(id, SubjectTypeEnum.PERSON, source);
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:4,代碼來源:GridUserSubject.java

示例12: GridHostSubject

import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //導入依賴的package包/類
public GridHostSubject(String id, Source source) {
	super(id, SubjectTypeEnum.APPLICATION, source);
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:4,代碼來源:GridHostSubject.java

示例13: NonGridSourceAdapter

import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //導入依賴的package包/類
public NonGridSourceAdapter() {
	super();
	this.addSubjectType(SubjectTypeEnum.PERSON.getName());
	this.addSubjectType(SubjectTypeEnum.APPLICATION.getName());
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:6,代碼來源:NonGridSourceAdapter.java

示例14: AnonymousGridUserSubject

import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //導入依賴的package包/類
public AnonymousGridUserSubject(Source source) {
	super(ANONYMOUS_GRID_USER_ID, SubjectTypeEnum.PERSON, source);
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:4,代碼來源:AnonymousGridUserSubject.java

示例15: GridSourceAdapter

import edu.internet2.middleware.subject.provider.SubjectTypeEnum; //導入依賴的package包/類
public GridSourceAdapter() {
	super();
	this.addSubjectType(SubjectTypeEnum.PERSON.getName());
	this.addSubjectType(SubjectTypeEnum.APPLICATION.getName());
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:6,代碼來源:GridSourceAdapter.java


注:本文中的edu.internet2.middleware.subject.provider.SubjectTypeEnum類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。