Search in sources :

Example 16 with UserProfile

use of org.ovirt.engine.core.common.businessentities.UserProfile in project ovirt-engine by oVirt.

the class AddUserProfileCommand method executeCommand.

@Override
protected void executeCommand() {
    UserProfile existingProfile = getUserProfile();
    if (existingProfile != null) {
        /*
             * if validate() allowed us to get this far, then we must expect
             * isSSHPublicKeyUpdate(existingProfile) == true
             */
        executeCommandUpdateSSHPublicKey(existingProfile);
    } else {
        UserProfile profile = getParameters().getUserProfile();
        profile.setId(Guid.newGuid());
        profile.setUserId(getUserId());
        /* must be overridden */
        if (!StringUtils.isEmpty(profile.getSshPublicKey())) {
            profile.setSshPublicKeyId(Guid.newGuid());
        }
        userProfileDao.save(profile);
        setSucceeded(true);
    }
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile)

Aggregations

UserProfile (org.ovirt.engine.core.common.businessentities.UserProfile)16 Test (org.junit.Test)6 UserProfileParameters (org.ovirt.engine.core.common.action.UserProfileParameters)3 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Before (org.junit.Before)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 Guid (org.ovirt.engine.core.compat.Guid)1 Frontend (org.ovirt.engine.ui.frontend.Frontend)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)1 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)1 UIConstants (org.ovirt.engine.ui.uicompat.UIConstants)1