Search in sources :

Example 1 with OrgUnitRelationship

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());
    }
}
Also used : FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest) OrgUnitRelationship(org.apache.directory.fortress.core.model.OrgUnitRelationship)

Example 2 with OrgUnitRelationship

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());
    }
}
Also used : FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest) OrgUnitRelationship(org.apache.directory.fortress.core.model.OrgUnitRelationship)

Example 3 with OrgUnitRelationship

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());
    }
}
Also used : FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest) OrgUnitRelationship(org.apache.directory.fortress.core.model.OrgUnitRelationship)

Example 4 with OrgUnitRelationship

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());
    }
}
Also used : FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest) OrgUnitRelationship(org.apache.directory.fortress.core.model.OrgUnitRelationship)

Aggregations

SecurityException (org.apache.directory.fortress.core.SecurityException)4 FortRequest (org.apache.directory.fortress.core.model.FortRequest)4 FortResponse (org.apache.directory.fortress.core.model.FortResponse)4 OrgUnitRelationship (org.apache.directory.fortress.core.model.OrgUnitRelationship)4