Search in sources :

Example 1 with Address

use of org.apache.directory.fortress.core.model.Address in project directory-fortress-core by apache.

the class Options method updateAddress.

private void updateAddress(User user) {
    Address uAddr = user.getAddress();
    Vector fractionValues = parser.getOptionValues(address);
    if (fractionValues != null) {
        for (Object val : fractionValues) {
            String szAddress = (String) val;
            uAddr.setAddress(szAddress);
        }
    }
    uAddr.setCity(getCity());
    uAddr.setState(getState());
    uAddr.setPostalCode(getPostalCode());
    uAddr.setPostOfficeBox(getPostOfficeBox());
}
Also used : Address(org.apache.directory.fortress.core.model.Address) Vector(java.util.Vector)

Example 2 with Address

use of org.apache.directory.fortress.core.model.Address in project directory-fortress-core by apache.

the class UserTestData method getAddress.

private static Address getAddress(String[] szInput, int col) {
    Address address = null;
    try {
        if (StringUtils.isNotEmpty(szInput[col])) {
            address = new Address();
            StringTokenizer charSetTkn = new StringTokenizer(szInput[col], TestUtils.DELIMITER_TEST_DATA);
            if (charSetTkn.countTokens() > 0) {
                int count = 0;
                while (charSetTkn.hasMoreTokens()) {
                    String value = charSetTkn.nextToken();
                    /* ADDRESS_COL */
                    switch(count++) {
                        // Twentynine Palms */
                        case 0:
                            address.setCity(value);
                            break;
                        // CA */
                        case 1:
                            address.setState(value);
                            break;
                        // 92252 */
                        case 2:
                            address.setPostalCode(value);
                            break;
                        // 2345 */
                        case 3:
                            address.setBuilding(value);
                            break;
                        // 123 */
                        case 4:
                            address.setDepartmentNumber(value);
                            break;
                        // 2525 */
                        case 5:
                            address.setRoomNumber(value);
                            break;
                        /* ADDRESS_COL */
                        default:
                            address.setAddress(value);
                            break;
                    }
                }
            }
        }
    } catch (java.lang.ArrayIndexOutOfBoundsException ae) {
    // ignore
    }
    return address;
}
Also used : StringTokenizer(java.util.StringTokenizer) Address(org.apache.directory.fortress.core.model.Address) Constraint(org.apache.directory.fortress.core.model.Constraint)

Example 3 with Address

use of org.apache.directory.fortress.core.model.Address in project directory-fortress-core by apache.

the class UserTestData method assertAddress.

public static void assertAddress(String[] usr, Address address) {
    Address expectedAddress = getAddress(usr);
    assertTrue(UserTestData.class.getName() + ".assertEquals failed compare user address", expectedAddress.equals(address));
}
Also used : Address(org.apache.directory.fortress.core.model.Address)

Example 4 with Address

use of org.apache.directory.fortress.core.model.Address in project directory-fortress-core by apache.

the class UserDAO method unloadAddress.

/**
 * Given an ldap entry containing organzationalPerson address information, convert to {@link Address}
 *
 * @param entry contains ldap entry to retrieve admin roles from.
 * @return entity of type {@link Address}.
 * @throws LdapInvalidAttributeValueException
 * @throws org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException in the event of ldap
 * client error.
 */
private Address unloadAddress(Entry entry) throws LdapInvalidAttributeValueException {
    Address addr = new ObjectFactory().createAddress();
    List<String> pAddrs = getAttributes(entry, SchemaConstants.POSTAL_ADDRESS_AT);
    if (pAddrs != null) {
        for (String pAddr : pAddrs) {
            addr.setAddress(pAddr);
        }
    }
    addr.setCity(getAttribute(entry, SchemaConstants.L_AT));
    addr.setState(getAttribute(entry, SchemaConstants.ST_AT));
    addr.setPostalCode(getAttribute(entry, SchemaConstants.POSTALCODE_AT));
    addr.setPostOfficeBox(getAttribute(entry, SchemaConstants.POSTOFFICEBOX_AT));
    addr.setBuilding(getAttribute(entry, SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT));
    addr.setDepartmentNumber(getAttribute(entry, DEPARTMENT_NUMBER));
    addr.setRoomNumber(getAttribute(entry, ROOM_NUMBER));
    return addr;
}
Also used : Address(org.apache.directory.fortress.core.model.Address) ObjectFactory(org.apache.directory.fortress.core.model.ObjectFactory)

Aggregations

Address (org.apache.directory.fortress.core.model.Address)4 StringTokenizer (java.util.StringTokenizer)1 Vector (java.util.Vector)1 Constraint (org.apache.directory.fortress.core.model.Constraint)1 ObjectFactory (org.apache.directory.fortress.core.model.ObjectFactory)1