• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Group类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.stormpath.sdk.group.Group的典型用法代码示例。如果您正苦于以下问题:Java Group类的具体用法?Java Group怎么用?Java Group使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Group类属于com.stormpath.sdk.group包,在下文中一共展示了Group类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getClients

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
/**
 * Obtiene la lista de los registros de Client
 *
 * @return Colección de objetos de ClientDetailDTO
 * @generated
 */
@GET
public List<ClientDetailDTO> getClients() {
    String accountHref = req.getRemoteUser();
    if (accountHref != null) {
        Account account = Utils.getClient().getResource(accountHref, Account.class);
        for (Group gr : account.getGroups()) {
            switch (gr.getHref()) {
                case ADMIN_HREF:
                    if (page != null && maxRecords != null) {
                        this.response.setIntHeader("X-Total-Count", clientLogic.countClients());
                        return listEntity2DTO(clientLogic.getClients(page, maxRecords));
                    }
                    return listEntity2DTO(clientLogic.getClients());
                case CLIENT_HREF:
                    Integer id = (int) account.getCustomData().get("client_id");
                    List<ClientDetailDTO> list = new ArrayList();
                    list.add(new ClientDetailDTO(clientLogic.getClient(id.longValue())));
                    return list;
            }
        }
    } 
    return null;
}
 
开发者ID:Uniandes-MISO4203-backup,项目名称:turism-201620-2,代码行数:30,代码来源:ClientResource.java


示例2: getAgencys

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
/**
 * Obtiene la lista de los registros de Agency
 *
 * @return Colección de objetos de AgencyDetailDTO
 * @generated
 */
@GET
public List<AgencyDetailDTO> getAgencys() {
    String accountHref = req.getRemoteUser();
    if (accountHref != null) {
        Account account = Utils.getClient().getResource(accountHref, Account.class);
        for (Group gr : account.getGroups()) {
            switch (gr.getHref()) {
                case ADMIN_HREF:
                    if (page != null && maxRecords != null) {
                    this.response.setIntHeader("X-Total-Count", agencyLogic.countAgencys());
                    return listEntity2DTO(agencyLogic.getAgencys(page, maxRecords));
                }
                return listEntity2DTO(agencyLogic.getAgencys());
                case AGENCY_HREF:
                    Integer id = (int) account.getCustomData().get("agency_id");
                    List<AgencyDetailDTO> list = new ArrayList();
                    list.add(new AgencyDetailDTO(agencyLogic.getAgency(id.longValue())));
                    return list;
            }
        }
    } 
    return null;
}
 
开发者ID:Uniandes-MISO4203-backup,项目名称:turism-201620-2,代码行数:30,代码来源:AgencyResource.java


示例3: Can_convert_groups_to_granted_authorities

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
@Test
public void Can_convert_groups_to_granted_authorities() {

    final GroupList groups = mock(GroupList.class);

    final Group group1 = mock(Group.class);
    final Group group2 = mock(Group.class);
    final Group group3 = mock(Group.class);
    final String groupName1 = someString();
    final String groupName3 = someString();

    // Given
    given(groups.iterator()).willReturn(asList(group1, group2, group3).iterator());
    given(group1.getStatus()).willReturn(ENABLED);
    given(group1.getName()).willReturn(groupName1);
    given(group2.getStatus()).willReturn(DISABLED);
    given(group2.getName()).willReturn(someString());
    given(group3.getStatus()).willReturn(ENABLED);
    given(group3.getName()).willReturn(groupName3);

    // When
    final Collection<? extends GrantedAuthority> actual = new StormpathGroupGrantedAuthorityConverter().convert(groups);

    // Then
    assertThat(actual, contains(hasField("role", groupName1), hasField("role", groupName3)));
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:27,代码来源:StormpathGroupGrantedAuthorityConverterTest.java


示例4: buildGroups

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
private void buildGroups(final OtfDirectory oDir, final Directory dir) {

		GroupList grps = dir.getGroups();
		for (OtfGroup ogrp : oDir.getGroups().getGroups().values()) {
			boolean found = false;
			for (Group grp : grps) {
				if (grp.getName().equals(ogrp.getName())) {
					buildGroup(ogrp, grp, dir);
					found = true;
				}
			}
			if (!found) {
				buildGroup(ogrp, null, dir);
			}
		}

	}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:18,代码来源:Model2Storm.java


示例5: buildGroup

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
public final OtfGroup buildGroup(final String href) {
	final Group grp = spbd.getResourceByHrefGroup(href);
	OtfGroup ogrp = new OtfGroup();
	ogrp.setIdref(grp.getHref());
	ogrp.setName(grp.getName());
	ogrp.setDescription(grp.getDescription());
	ogrp.setStatus(grp.getStatus().toString());

	for (Account acc : grp.getAccounts()) {
		OtfAccount oacc = buildAccount(acc);
		ogrp.getAccounts().getAccounts().put(oacc.getName(), oacc);
	}

	Map<String, Object> cd = spbd.getResourceByHrefCustomData(grp
			.getCustomData().getHref());
	for (String key : cd.keySet()) {
		if (!OtfCustomData.getReservedWords().contains(key)) {
			String val = cd.get(key).toString();
			OtfCustomField cf = new OtfCustomField(key, val);
			ogrp.getCustData().getCustFields().put(key, cf);
		}
	}
	return ogrp;
}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:25,代码来源:Storm2Model.java


示例6: test_topic_permissions

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
@Test
public void test_topic_permissions() throws Exception {
    List<Group> groups = new LinkedList<Group>();
    List<String> topics = Arrays.asList("testtopicA", "testtopicB", "testtopicC");

    addMockGroupToList(groups, topics.get(0));
    addMockGroupToList(groups, topics.get(1));
    addMockGroupToList(groups, topics.get(2));

    MockIterator mockIterator = new MockIterator(groups);
    when(groupList.iterator()).thenReturn(mockIterator);

    when(account.getGroups()).thenReturn(groupList);
    TestAuthorization testAuthorization = new TestAuthorization(app, account);
    List<MqttTopicPermission> permissions = testAuthorization.getPermissionsForClient(clientData);

    assertEquals(3, permissions.size());

    for (MqttTopicPermission permission : permissions) {
        assertTrue(topics.contains(permission.getTopic()));
    }

}
 
开发者ID:hivemq,项目名称:hivemq-stormpath-plugin,代码行数:24,代码来源:AuthorizationTest.java


示例7: register

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
@Override
public void register(UserDTO user) {
    try {
       Account acct = createUser(user);
    for (Group gr : acct.getGroups()) {
        switch(gr.getHref()){
            case CLIENT_HREF:
            ClientEntity client = new ClientEntity();
            client.setName(user.getUserName());
            client = clientLogic.createClient(client);
            acct.getCustomData().put(CLIENT_CD, client.getId());
            break;
            case AGENCY_HREF:
            AgencyEntity provider = new AgencyEntity();
            provider.setName(user.getUserName());                
            provider = agencyLogic.createAgency(provider);
            acct.getCustomData().put(AGENCY_CD, provider.getId());  
            break;
            default:
             throw new WebApplicationException("Group link doen's match ");
        }
            
        }
    acct.getCustomData().save();
    } catch (ResourceException e) {
        throw new WebApplicationException(e, e.getStatus());
    }
}
 
开发者ID:Uniandes-MISO4203-backup,项目名称:turism-201620-2,代码行数:29,代码来源:UseResource.java


示例8: convert

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
@Override
public Collection<? extends GrantedAuthority> convert(GroupList groups) {
    final Collection<GrantedAuthority> authorities = new ArrayList<>(groups.getSize());
    for (Group group : groups) {
        if (ENABLED.equals(group.getStatus())) {
            authorities.add(new SimpleGrantedAuthority(group.getName()));
        }
    }
    return authorities;
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:11,代码来源:StormpathGroupGrantedAuthorityConverter.java


示例9: getGroups

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
public final List<String> getGroups(final Directory directory) {
	ArrayList<String> groupsList = new ArrayList<String>();
	GroupList groups = directory.getGroups();
	for (Group group : groups) {
		groupsList.add(group.getName());
		LOG.info("group " + group);

	}
	return groupsList;
}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:11,代码来源:BasicTest.java


示例10: buildAccounts

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
private void buildAccounts(final OtfAccountStore oDir,
		final AccountStore accSt) {
	AccountList accs = null;
	SPAccountStoreVisitor spa = new SPAccountStoreVisitor();
	accSt.accept(spa);
	if (spa.getType().equals(SPAccountStoreVisitor.AccountStoreType.DIR)) {
		Directory dir = (Directory) accSt;
		accs = dir.getAccounts();
	}
	if (spa.getType().equals(SPAccountStoreVisitor.AccountStoreType.GROUP)) {
		Group grp = (Group) accSt;
		accs = grp.getAccounts();
	}

	if (accs != null) {
		for (OtfAccount oacc : oDir.getAccounts().getAccounts().values()) {
			boolean found = false;
			for (Account acc : accs) {
				if (acc.getUsername().equals(oacc.getName())) {
					buildAccount(oacc, acc, accSt);
					found = true;
				}
			}
			if (!found) {
				buildAccount(oacc, null, accSt);
			}

		}
	}
}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:31,代码来源:Model2Storm.java


示例11: load

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
public final void load() throws IllegalArgumentException {
	getOtfCb();

	if (cacheSP) {
		getOtfCb().setCacheManager(
				newCacheManager()
						.withDefaultTimeToLive(1, TimeUnit.DAYS)
						// general default
						.withDefaultTimeToIdle(2, TimeUnit.HOURS)
						// general default
						.withCache(
								forResource(Account.class)
										// Account-specific cache settings
										.withTimeToLive(1, TimeUnit.HOURS)
										.withTimeToIdle(30,
												TimeUnit.MINUTES))
						.withCache(forResource(Group.class) // Group-specific
															// cache
															// settings
								.withTimeToLive(2, TimeUnit.HOURS)).build() // build
																			// the
																			// CacheManager
				);
	}

	client = getOtfCb().build();

	tenant = client.getCurrentTenant();
}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:30,代码来源:StormPathBaseDTO.java


示例12: addUpdateMemberLocal

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
@Override
public final String addUpdateMemberLocal(final OtfGroup grpIn,
		final OtfDirectory mDirectoryIn, final boolean isNewIn) {
	Directory mdir = getStorm2Mod().getDirByName(mDirectoryIn.getName());
	if (mdir == null) {
		return DIR_NOT_FOUND;
	}
	if (isNewIn) {
		getMod2Storm().buildGroup(grpIn, null, mdir);
	} else {
		Group remoteG = getStorm2Mod().getGrpByName(grpIn.getName(), mdir);
		getMod2Storm().buildGroup(grpIn, remoteG, mdir);
	}
	return REMOTE_COMMIT_OK;
}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:16,代码来源:StormPathUserSecurityHandler.java


示例13: addUpdateGroupLocal

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
@Override
public final String addUpdateGroupLocal(final OtfGroup grpIn,
		final OtfDirectory mDirectoryIn, final boolean isNewIn) {
	Directory dir = getStorm2Mod().getDirByName(mDirectoryIn.getName());
	if (dir == null) {
		return DIR_NOT_FOUND;
	}
	if (isNewIn) {
		getMod2Storm().buildGroup(grpIn, null, dir);
	} else {
		Group grp = getStorm2Mod().getGrpByName(grpIn.getName(), dir);
		getMod2Storm().buildGroup(grpIn, grp, dir);
	}
	return REMOTE_COMMIT_OK;
}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:16,代码来源:StormPathUserSecurityHandler.java


示例14: getGrpByName

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
public final Group getGrpByName(final String grpName, final Directory dir) {
	GroupList groups = dir.getGroups();
	for (Group group : groups) {
		if (group.getName().equals(grpName)) {
			String dirHref = group.getHref();
			Group group2 = spbd.getResourceByHrefGroup(dirHref);
			return group2;
		}
	}
	return null;
}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:12,代码来源:Storm2Model.java


示例15: buildDirectory

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
public final OtfDirectory buildDirectory(final String hrefId) {

		Directory dir = null;
		OtfDirectory oDir = null;
		try {
			dir = spbd.getResourceByHrefDirectory(hrefId);
		} catch (ResourceException re) {
			LOG.severe("Directory at this href does not exist Dir = "
					+ " href = " + hrefId);
		}
		if (dir != null) {
			oDir = new OtfDirectory();
			oDir.setIdref(dir.getHref());
			oDir.setName(dir.getName());
			oDir.setDescription(dir.getDescription());
			oDir.setStatus(dir.getStatus().toString());
			GroupList groups = dir.getGroups();
			for (Group group : groups) {
				OtfGroup ogroup = buildGroup(group);
				ogroup.setParentDirName(dir.getName());
				oDir.getGroups().getGroups().put(ogroup.getName(), ogroup);
			}
			for (Account acc : dir.getAccounts()) {
				OtfAccount oacc = buildAccount(acc);
				oDir.getAccounts().getAccounts().put(oacc.getName(), oacc);
			}
		}
		return oDir;
	}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:30,代码来源:Storm2Model.java


示例16: getAppsMap

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
public Map<String, List<String>> getAppsMap() {
	Map<String, List<String>> appsMap = new HashMap<String, List<String>>();
	ApplicationList applications = spbd.getTenant().getApplications();
	for (Application application : applications) {
		ArrayList<String> grps = new ArrayList<String>();
		for (Group grp : application.getGroups()) {
			grps.add(grp.getName());
		}
		appsMap.put(application.getName(), grps);
	}

	return appsMap;
}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:14,代码来源:Storm2Model.java


示例17: getDirsMap

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
public Map<String, List<String>> getDirsMap() {
	Map<String, List<String>> dirsMap = new HashMap<String, List<String>>();
	DirectoryList directories = spbd.getTenant().getDirectories();
	for (Directory directory : directories) {
		ArrayList<String> grps = new ArrayList<String>();
		for (Group grp : directory.getGroups()) {
			grps.add(grp.getName());
		}
		dirsMap.put(directory.getName(), grps);
	}

	return dirsMap;
}
 
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:14,代码来源:Storm2Model.java


示例18: getPermissionsForClient

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
@Override
//@Cached(timeToLive = 10, timeUnit = TimeUnit.MINUTES)
public List<MqttTopicPermission> getPermissionsForClient(ClientData clientData) {
    Account account = getAccount(clientData);

    final List<MqttTopicPermission> mqttTopicPermissions = new ArrayList<MqttTopicPermission>();
    if (account != null) {
        for (Group group : account.getGroups()) {
            mqttTopicPermissions.add(new MqttTopicPermission(group.getName()));
        }
    }

    return mqttTopicPermissions;
}
 
开发者ID:hivemq,项目名称:hivemq-stormpath-plugin,代码行数:15,代码来源:Authorization.java


示例19: test_no_topic_permissions_on_empty_groups_for_account

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
@Test
public void test_no_topic_permissions_on_empty_groups_for_account() throws Exception {
    List<Group> emptyGroupList = new LinkedList<Group>();
    MockIterator mockIterator = new MockIterator(emptyGroupList);
    when(groupList.iterator()).thenReturn(mockIterator);

    when(account.getGroups()).thenReturn(groupList);
    TestAuthorization testAuthorization = new TestAuthorization(app, account);
    List<MqttTopicPermission> permissions = testAuthorization.getPermissionsForClient(clientData);

    assertTrue(permissions.isEmpty());
}
 
开发者ID:hivemq,项目名称:hivemq-stormpath-plugin,代码行数:13,代码来源:AuthorizationTest.java


示例20: createGroup

import com.stormpath.sdk.group.Group; //导入依赖的package包/类
@Override
public Group createGroup(Group group) throws ResourceException {
    return application().createGroup(group);
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:5,代码来源:DeferredApplication.java



注:本文中的com.stormpath.sdk.group.Group类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SourceContext类代码示例发布时间:2022-05-15
下一篇:
Java Response类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap