use of org.apache.directory.fortress.core.model.OrgUnitRelationship in project directory-fortress-core by apache.
the class DelAdminMgrRestImpl method deleteInheritance.
/**
* {@inheritDoc}
*/
@Override
public void deleteInheritance(OrgUnit parent, OrgUnit child) throws SecurityException {
String methodName = "deleteInheritanceOU";
VUtil.assertNotNull(parent, GlobalErrIds.ORG_PARENT_NULL, CLS_NM + "." + methodName);
VUtil.assertNotNull(parent.getType(), GlobalErrIds.ORG_TYPE_NULL, CLS_NM + "." + methodName);
VUtil.assertNotNull(child, GlobalErrIds.ORG_CHILD_NULL, CLS_NM + "." + methodName);
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
OrgUnitRelationship relationship = new OrgUnitRelationship();
relationship.setParent(parent);
relationship.setChild(child);
request.setEntity(relationship);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ORG_DELINHERIT);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() != 0) {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
}
use of org.apache.directory.fortress.core.model.OrgUnitRelationship in project directory-fortress-core by apache.
the class DelAdminMgrRestImpl method addDescendant.
/**
* {@inheritDoc}
*/
@Override
public void addDescendant(OrgUnit parent, OrgUnit child) throws SecurityException {
String methodName = "addDescendantOU";
VUtil.assertNotNull(parent, GlobalErrIds.ORG_PARENT_NULL, CLS_NM + "." + methodName);
VUtil.assertNotNull(parent.getType(), GlobalErrIds.ORG_TYPE_NULL, CLS_NM + "." + methodName);
VUtil.assertNotNull(child, GlobalErrIds.ORG_CHILD_NULL, CLS_NM + "." + methodName);
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
OrgUnitRelationship relationship = new OrgUnitRelationship();
relationship.setParent(parent);
relationship.setChild(child);
request.setEntity(relationship);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ORG_DESC);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() != 0) {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
}
use of org.apache.directory.fortress.core.model.OrgUnitRelationship in project directory-fortress-core by apache.
the class DelAdminMgrRestImpl method addAscendant.
/**
* {@inheritDoc}
*/
@Override
public void addAscendant(OrgUnit child, OrgUnit parent) throws SecurityException {
String methodName = "addAscendantOU";
VUtil.assertNotNull(parent, GlobalErrIds.ORG_PARENT_NULL, CLS_NM + "." + methodName);
VUtil.assertNotNull(parent.getType(), GlobalErrIds.ORG_TYPE_NULL, CLS_NM + "." + methodName);
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
OrgUnitRelationship relationship = new OrgUnitRelationship();
relationship.setParent(parent);
relationship.setChild(child);
request.setEntity(relationship);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ORG_ASC);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() != 0) {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
}
use of org.apache.directory.fortress.core.model.OrgUnitRelationship in project directory-fortress-core by apache.
the class DelAdminMgrRestImpl method addInheritance.
/**
* {@inheritDoc}
*/
@Override
public void addInheritance(OrgUnit parent, OrgUnit child) throws SecurityException {
String methodName = "addInheritanceOU";
VUtil.assertNotNull(parent, GlobalErrIds.ORG_PARENT_NULL, CLS_NM + "." + methodName);
VUtil.assertNotNull(parent.getType(), GlobalErrIds.ORG_TYPE_NULL, CLS_NM + "." + methodName);
VUtil.assertNotNull(child, GlobalErrIds.ORG_CHILD_NULL, CLS_NM + "." + methodName);
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
OrgUnitRelationship relationship = new OrgUnitRelationship();
relationship.setParent(parent);
relationship.setChild(child);
request.setEntity(relationship);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ORG_ADDINHERIT);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() != 0) {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
}
Aggregations