當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。