use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class DelReviewMgrRestImpl method read.
/**
* {@inheritDoc}
*/
@Override
public OrgUnit read(OrgUnit entity) throws SecurityException {
VUtil.assertNotNull(entity, GlobalErrIds.ORG_NULL, CLS_NM + ".readOrgUnit");
OrgUnit retOrg;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(entity);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ORG_READ);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retOrg = (OrgUnit) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retOrg;
}
use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class DelReviewMgrRestImpl method search.
/**
* {@inheritDoc}
*/
@Override
public List<OrgUnit> search(OrgUnit.Type type, String searchVal) throws SecurityException {
VUtil.assertNotNull(type, GlobalErrIds.ORG_TYPE_NULL, CLS_NM + ".search");
List<OrgUnit> retOrgs;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
OrgUnit inOrg = new OrgUnit(searchVal, type);
request.setEntity(inOrg);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ORG_SEARCH);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retOrgs = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retOrgs;
}
use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class DelegatedAdminMgrConsole method addAscendant.
/**
*/
private void addAscendant(OrgUnit.Type type) {
try {
OrgUnit cou = new OrgUnit();
OrgUnit pou = new OrgUnit();
cou.setType(type);
pou.setType(type);
ReaderUtil.clearScreen();
System.out.println("Enter child orgunit name:");
cou.setName(ReaderUtil.readLn());
System.out.println("Enter parent orgunit name to add to repo:");
pou.setName(ReaderUtil.readLn());
System.out.println("Enter parent orgunit description:");
pou.setDescription(ReaderUtil.readLn());
dAmgr.addAscendant(cou, pou);
System.out.println("child orgunit [" + cou.getName() + "]");
System.out.println("parent orgunit [" + pou.getName() + "]");
System.out.println("parent orgunit and inheritance relationship has been added");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("addAscendant caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class DelegatedAdminMgrConsole method addDescendant.
/**
*/
private void addDescendant(OrgUnit.Type type) {
try {
OrgUnit cou = new OrgUnit();
OrgUnit pou = new OrgUnit();
cou.setType(type);
pou.setType(type);
ReaderUtil.clearScreen();
System.out.println("Enter child orgunit name to add to repo:");
cou.setName(ReaderUtil.readLn());
System.out.println("Enter child orgunit description:");
cou.setDescription(ReaderUtil.readLn());
System.out.println("Enter parent orgunit name:");
pou.setName(ReaderUtil.readLn());
dAmgr.addDescendant(pou, cou);
System.out.println("child orgunit [" + cou.getName() + "]");
System.out.println("parent orgunit [" + pou.getName() + "]");
System.out.println("child orgunit and inheritance relationship has been added");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("addDescendant caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class DelegatedAdminMgrConsole method update.
private void update(OrgUnit.Type type) {
OrgUnit ou = new OrgUnit();
try {
ReaderUtil.clearScreen();
System.out.println("Enter orgunit name:");
ou.setName(ReaderUtil.readLn());
System.out.println("Enter description field");
ou.setDescription(ReaderUtil.readLn());
ou.setType(type);
OrgUnit ou2 = dAmgr.update(ou);
System.out.println("name [" + ou2.getName() + "]");
System.out.println("internalId [" + ou2.getId() + "]");
System.out.println("name description [" + ou2.getDescription() + "]");
System.out.println("has been updated");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("update caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
Aggregations