本文整理汇总了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);
}
示例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;
}
示例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()]);
}
示例4: update
import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
public void update(Group group) throws RedmineException {
transport.updateObject(group);
}
示例5: write
import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
@Override
public void write(JSONWriter writer, Group object) throws JSONException {
writeGroup(object, writer);
}
示例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());
}
示例7: parse
import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
@Override
public Group parse(JSONObject input) throws JSONException {
return parseGroup(input);
}
示例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;
}
示例9: write
import com.taskadapter.redmineapi.bean.Group; //导入依赖的package包/类
@Override
public void write(JSONStringer writer, Group object) throws JSONException {
writeGroup(object, writer);
}
示例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());
}
示例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;
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}