当前位置: 首页>>代码示例>>Java>>正文


Java Group类代码示例

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


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

示例1: addUserToGroup

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
public void addUserToGroup(int userId, int groupId) throws RedmineException {
	logger.debug("adding user " + userId + " to group " + groupId + "...");
	URI uri = getURIConfigurator().getChildObjectsURI(Group.class, Integer.toString(groupId), User.class);
	HttpPost httpPost = new HttpPost(uri);
	final StringWriter writer = new StringWriter();
	final JSONWriter jsonWriter = new JSONWriter(writer);
	try {
		jsonWriter.object().key("user_id").value(userId).endObject();
	} catch (JSONException e) {
		throw new RedmineInternalError("Unexpected exception", e);
	}
	String body = writer.toString();
	setEntity(httpPost, body);
	String response = send(httpPost);
	logger.debug(response);
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:17,代码来源:Transport.java

示例2: addUserToGroup

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
public void addUserToGroup(int userId, int groupId) throws RedMineException {
	Log.d(DEBUG_TAG, "adding user " + userId + " to group " + groupId + "...");
	URI uri = getURIConfigurator().getChildObjectsURI(Group.class, Integer.toString(groupId), User.class);
	HttpPost httpPost = new HttpPost(uri);
	final JSONStringer jsonWriter = new JSONStringer();
	try {
		jsonWriter.object().key("user_id").value(userId).endObject();
	} catch (JSONException e) {
		throw new RedmineInternalError("Unexpected exception", e);
	}
	String body = jsonWriter.toString();
	setEntity(httpPost, body);
	String response = getCommunicator().sendRequest(httpPost);
	Log.d(DEBUG_TAG, response);
	return;
}
 
开发者ID:noveogroup,项目名称:android-snitch,代码行数:17,代码来源:Transport.java

示例3: getGroups

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
private GrantedAuthority[] getGroups(User user) {
    Set<GrantedAuthority> groups = new HashSet<GrantedAuthority>();
    for (Group group : user.getGroups()) {
        groups.add(new RedmineGroupDetails(group.getName()));
    }
    groups.add(SecurityRealm.AUTHENTICATED_AUTHORITY);
    return groups.toArray(new GrantedAuthority[groups.size()]);
}
 
开发者ID:cyrilix,项目名称:jenkins-redmine-realm,代码行数:9,代码来源:RedmineSecurityRealm.java

示例4: update

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
public void update(Group group) throws RedmineException {
    transport.updateObject(group);
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:4,代码来源:UserManager.java

示例5: write

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
@Override
public void write(JSONWriter writer, Group object) throws JSONException {
	writeGroup(object, writer);
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:5,代码来源:RedmineJSONBuilder.java

示例6: writeGroup

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
public static void writeGroup(Group group, final JSONWriter writer) throws JSONException {
	JsonOutput.addIfNotNull(writer, "id", group.getId());
	JsonOutput.addIfNotNull(writer, "name", group.getName());
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:5,代码来源:RedmineJSONBuilder.java

示例7: parse

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
@Override
public Group parse(JSONObject input) throws JSONException {
	return parseGroup(input);
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:5,代码来源:RedmineJSONParser.java

示例8: parseGroup

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
public static Group parseGroup(JSONObject content) throws JSONException {
	final Group result = GroupFactory.create(JsonInput.getIntOrNull(content, "id"));
	result.setName(JsonInput.getStringOrNull(content, "name"));
	return result;
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:6,代码来源:RedmineJSONParser.java

示例9: write

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
@Override
public void write(JSONStringer writer, Group object) throws JSONException {
	writeGroup(object, writer);
}
 
开发者ID:noveogroup,项目名称:android-snitch,代码行数:5,代码来源:RedmineJSONBuilder.java

示例10: writeGroup

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
public static void writeGroup(Group group, final JSONStringer writer)
		throws JSONException {
	JsonOutput.addIfNotNull(writer, "id", group.getId());
	JsonOutput.addIfNotNull(writer, "name", group.getName());
}
 
开发者ID:noveogroup,项目名称:android-snitch,代码行数:6,代码来源:RedmineJSONBuilder.java

示例11: parseGroup

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
public static Group parseGroup(JSONObject content) throws JSONException {
	final Group result = new Group();
	result.setId(JsonInput.getIntOrNull(content, "id"));
	result.setName(JsonInput.getStringOrNull(content, "name"));
	return result;
}
 
开发者ID:noveogroup,项目名称:android-snitch,代码行数:7,代码来源:RedmineJSONParser.java

示例12: addUserToGroup

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
/**
 * Adds the given user to the given group.
 * <p>
 * Note: "add to group" operation used to be safe (idempotent) for Redmine 2.6.x, but FAILS for Redmine 3.0.0 when
 * executed twice on the same user. I submitted a bug: http://www.redmine.org/issues/19363
 *
 * @param user  - The user being added.
 * @param group - The new group of the user.
 * @throws RedmineException
 * @since Redmine 2.1
 */
public void addUserToGroup(User user, Group group) throws RedmineException {
    transport.addUserToGroup(user.getId(), group.getId());
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:15,代码来源:UserManager.java

示例13: getGroups

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
/**
 * Load list of groups on the server.
 * <p><strong>This operation requires "Redmine Administrator" permission.</strong>
 *
 * @return list of User objects
 * @throws RedmineAuthenticationException invalid or no API access key is used with the server, which
 *                                 requires authorization. Check the constructor arguments.
 * @throws NotFoundException
 * @throws RedmineException
 */
public List<Group> getGroups() throws RedmineException {
    return transport.getObjectsList(Group.class);
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:14,代码来源:UserManager.java

示例14: getGroupById

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
/**
 * Returns the group based on its id.
 * <p>
 * <strong>This operation requires "Redmine Administrators" permission.</strong>
 *
 * @param id id of the group
 * @return the group
 * @throws RedmineException
 */
public Group getGroupById(int id) throws RedmineException {
    return transport.getObject(Group.class, id);
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:13,代码来源:UserManager.java

示例15: getGroupByName

import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
/**
 * Returns the group based on its name.
 * <p>
 * <strong>This operation requires "Redmine Administrators" permission.</strong>
 *
 * @param name
 *            the name of the group
 * @return the group
 * @throws RedmineException
 */
public Group getGroupByName(String name) throws RedmineException {
    return transport.getObject(Group.class, name);
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:14,代码来源:UserManager.java


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