use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.
the class PermDAO method unloadPALdapEntry.
private PermissionAttribute unloadPALdapEntry(Entry le, long sequence) throws LdapInvalidAttributeValueException {
PermissionAttribute entity = new ObjectFactory().createPermissionAttribute();
entity.setSequenceId(sequence);
entity.setAttributeName(getAttribute(le, SchemaConstants.CN_AT));
entity.setDn(le.getDn().getName());
entity.setInternalId(getAttribute(le, GlobalIds.FT_IID));
entity.setDescription(getAttribute(le, SchemaConstants.DESCRIPTION_AT));
entity.setDataType(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DATA_TYPE));
entity.setDefaultOperator(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_OPERATOR));
entity.setDefaultStrategy(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_STRATEGY));
entity.setDefaultValue(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_VALUE));
List<String> validValues = getAttributes(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES);
if (validValues != null) {
for (String value : validValues) {
entity.getValidValues().add(value);
}
}
return entity;
}
use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.
the class PermDAO method unloadPobjLdapEntry.
/**
* @param le
* @param sequence
* @return
* @throws LdapInvalidAttributeValueException
* @throws LdapException
*/
private PermObj unloadPobjLdapEntry(Entry le, long sequence, boolean isAdmin) throws LdapInvalidAttributeValueException {
PermObj entity = new ObjectFactory().createPermObj();
entity.setSequenceId(sequence);
entity.setObjName(getAttribute(le, GlobalIds.POBJ_NAME));
entity.setOu(getAttribute(le, SchemaConstants.OU_AT));
entity.setDn(le.getDn().getName());
entity.setInternalId(getAttribute(le, GlobalIds.FT_IID));
entity.setType(getAttribute(le, GlobalIds.TYPE));
entity.setDescription(getAttribute(le, SchemaConstants.DESCRIPTION_AT));
entity.addProperties(PropUtil.getProperties(getAttributes(le, GlobalIds.PROPS)));
entity.setAdmin(isAdmin);
return entity;
}
use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.
the class PolicyDAO method unloadLdapEntry.
/**
* @param le
* @param sequence
* @return
* @throws LdapInvalidAttributeValueException
* @throws LdapException
*/
private PwPolicy unloadLdapEntry(Entry le, long sequence) throws LdapInvalidAttributeValueException {
PwPolicy entity = new ObjectFactory().createPswdPolicy();
entity.setSequenceId(sequence);
entity.setName(getAttribute(le, PW_PWD_ID));
String val;
val = getAttribute(le, PW_MIN_AGE);
if (StringUtils.isNotEmpty(val)) {
entity.setMinAge(Integer.valueOf(val));
}
val = getAttribute(le, PW_MAX_AGE);
if (StringUtils.isNotEmpty(val)) {
entity.setMaxAge(Long.valueOf(val));
}
val = getAttribute(le, PW_IN_HISTORY);
if (StringUtils.isNotEmpty(val)) {
entity.setInHistory(Short.valueOf(val));
}
val = getAttribute(le, PW_CHECK_QUALITY);
if (StringUtils.isNotEmpty(val)) {
entity.setCheckQuality(Short.valueOf(val));
}
val = getAttribute(le, PW_MIN_LENGTH);
if (StringUtils.isNotEmpty(val)) {
entity.setMinLength(Short.valueOf(val));
}
val = getAttribute(le, PW_EXPIRE_WARNING);
if (StringUtils.isNotEmpty(val)) {
entity.setExpireWarning(Long.valueOf(val));
}
val = getAttribute(le, PW_GRACE_LOGIN_LIMIT);
if (StringUtils.isNotEmpty(val)) {
entity.setGraceLoginLimit(Short.valueOf(val));
}
val = getAttribute(le, PW_LOCKOUT);
if (StringUtils.isNotEmpty(val)) {
entity.setLockout(Boolean.valueOf(val));
}
val = getAttribute(le, PW_LOCKOUT_DURATION);
if (StringUtils.isNotEmpty(val)) {
entity.setLockoutDuration(Integer.valueOf(val));
}
val = getAttribute(le, PW_MAX_FAILURE);
if (StringUtils.isNotEmpty(val)) {
entity.setMaxFailure(Short.valueOf(val));
}
val = getAttribute(le, PW_FAILURE_COUNT_INTERVAL);
if (StringUtils.isNotEmpty(val)) {
entity.setFailureCountInterval(Short.valueOf(val));
}
val = getAttribute(le, PW_MUST_CHANGE);
if (StringUtils.isNotEmpty(val)) {
// noinspection BooleanConstructorCall
entity.setMustChange(Boolean.valueOf(val));
}
val = getAttribute(le, PW_ALLOW_USER_CHANGE);
if (StringUtils.isNotEmpty(val)) {
entity.setAllowUserChange(Boolean.valueOf(val));
}
val = getAttribute(le, PW_SAFE_MODIFY);
if (StringUtils.isNotEmpty(val)) {
entity.setSafeModify(Boolean.valueOf(val));
}
return entity;
}
use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.
the class OrgUnitDAO method unloadDescendants.
/**
* @param le
* @param sequence
* @param contextId
* @return
* @throws LdapInvalidAttributeValueException
* @throws LdapException
*/
private Graphable unloadDescendants(Entry le, long sequence, String contextId) throws LdapInvalidAttributeValueException {
OrgUnit entity = new ObjectFactory().createOrgUnit();
entity.setSequenceId(sequence);
entity.setName(getAttribute(le, SchemaConstants.OU_AT));
entity.setParents(getAttributeSet(le, GlobalIds.PARENT_NODES));
return entity;
}
use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.
the class OrgUnitDAO method getEntityFromLdapEntry.
/**
* @param le
* @param sequence
* @param contextId
* @return
* @throws LdapInvalidAttributeValueException
* @throws LdapException
*/
private OrgUnit getEntityFromLdapEntry(Entry le, long sequence, String contextId) throws LdapInvalidAttributeValueException {
OrgUnit entity = new ObjectFactory().createOrgUnit();
entity.setSequenceId(sequence);
entity.setId(getAttribute(le, GlobalIds.FT_IID));
entity.setName(getAttribute(le, SchemaConstants.OU_AT));
entity.setDescription(getAttribute(le, SchemaConstants.DESCRIPTION_AT));
String dn = le.getDn().getName();
if (dn.contains(getRootDn(contextId, GlobalIds.PSU_ROOT))) {
entity.setType(OrgUnit.Type.PERM);
// entity.setParents(PsoUtil.getParents(entity.getName().toUpperCase(), contextId));
entity.setChildren(PsoUtil.getInstance().getChildren(entity.getName().toUpperCase(), contextId));
} else if (dn.contains(getRootDn(contextId, GlobalIds.OSU_ROOT))) {
entity.setType(OrgUnit.Type.USER);
// entity.setParents(UsoUtil.getParents(entity.getName().toUpperCase(), contextId));
entity.setChildren(UsoUtil.getInstance().getChildren(entity.getName().toUpperCase(), contextId));
}
entity.setParents(getAttributeSet(le, GlobalIds.PARENT_NODES));
return entity;
}
Aggregations