use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupTestData method createGroup.
private static Group createGroup(String name, Type type, String protocol, boolean memberDn, List<String> memberNames) {
Group group = new Group();
group.setName(name);
group.setProtocol(protocol);
group.setMemberDn(memberDn);
group.setType(type);
group.setMembers(memberNames);
return group;
}
use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupMgrRestImpl method deassign.
/**
* {@inheritDoc}
*/
@Override
public Group deassign(Group group, String member) throws SecurityException {
VUtil.assertNotNull(group, GlobalErrIds.GROUP_NULL, CLS_NM + ".deassign");
VUtil.assertNotNull(member, GlobalErrIds.GROUP_MEMBER_NULL, CLS_NM + ".deassign");
Group retGroup;
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(group);
request.setValue(member);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.GROUP_DEASGN);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retGroup = (Group) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retGroup;
}
use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupMgrRestImpl method delete.
/**
* {@inheritDoc}
*/
@Override
public Group delete(Group group) throws SecurityException {
VUtil.assertNotNull(group, GlobalErrIds.GROUP_NULL, CLS_NM + ".delete");
Group retGroup;
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(group);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.GROUP_DELETE);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retGroup = (Group) response.getEntity();
} else {
throw new org.apache.directory.fortress.core.SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retGroup;
}
use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupMgrRestImpl method assign.
/**
* {@inheritDoc}
*/
@Override
public Group assign(Group group, String member) throws SecurityException {
VUtil.assertNotNull(group, GlobalErrIds.GROUP_NULL, CLS_NM + ".assign");
VUtil.assertNotNull(member, GlobalErrIds.GROUP_MEMBER_NULL, CLS_NM + ".assign");
Group retGroup;
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(group);
request.setValue(member);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.GROUP_ASGN);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retGroup = (Group) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retGroup;
}
use of org.apache.directory.fortress.core.model.Group in project directory-fortress-core by apache.
the class GroupMgrRestImpl method update.
/**
* {@inheritDoc}
*/
@Override
public Group update(Group group) throws SecurityException {
VUtil.assertNotNull(group, GlobalErrIds.GROUP_NULL, CLS_NM + ".update");
Group retGroup;
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(group);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.GROUP_UPDATE);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retGroup = (Group) response.getEntity();
} else {
throw new org.apache.directory.fortress.core.SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retGroup;
}
Aggregations