agave-profiles/profiles-core/src/main/java/org/iplantc/service/profile/manager/InternalUserManager.java
/**
	 * Creates a new InternalUser and assigns it to the current API user.
	 * @param jsonInternalUser
	 * @param apiUsername
	 * @return
	 * @throws ProfileException
	 */
Creates a new InternalUser and assigns it to the current API user.
@param jsonInternalUser
@param apiUsername
@return
@throws ProfileException
Creates a new InternalUser and assigns it to the current API user . @param jsonInternalUser @param apiUsername @return @throws ProfileException
public InternalUser addInternalUser(JSONObject jsonInternalUser, String apiUsername) 
	throws ProfileException, InternalUsernameConflictException {
		try 
		{
			InternalUser internalUser = InternalUser.fromJSON(jsonInternalUser);
			internalUser.setCreatedBy(apiUsername);
			if (dao.isUsernameAvailable(apiUsername, internalUser.getUsername())) 
			{
				dao.persist(internalUser);
				NotificationManager.process(internalUser.getUuid(), "CREATED", apiUsername);
			} 
			else 
			{
				throw new InternalUsernameConflictException("Username '" + internalUser.getUsername() + "' " +
						"is not available. Please select another username.");
			}
			return internalUser;
		} 
		catch(InternalUsernameConflictException | ProfileException e) {
			throw e;
		} catch(ProfileArgumentException e) {
			throw new ProfileException(e.getMessage(), e);
		}
		catch(Exception e) {
			throw new ProfileException("Failed to create new internal user.", e);
		}
	}
public InternalUser addInternalUser ( JSONObject jsonInternalUser , String apiUsername ) throws ProfileException , InternalUsernameConflictException { try { InternalUser internalUser = InternalUser . fromJSON ( jsonInternalUser ) ; internalUser . setCreatedBy ( apiUsername ) ; if ( dao . isUsernameAvailable ( apiUsername , internalUser . getUsername ( ) ) ) { dao . persist ( internalUser ) ; NotificationManager . process ( internalUser . getUuid ( ) , "CREATED" , apiUsername ) ; } else { throw new InternalUsernameConflictException ( "Username '" + internalUser . getUsername ( ) + "' " + "is not available. Please select another username." ) ; } return internalUser ; } catch ( InternalUsernameConflictException | ProfileException e ) { throw e ; } catch ( ProfileArgumentException e ) { throw new ProfileException ( e . getMessage ( ) , e ) ; } catch ( Exception e ) { throw new ProfileException ( "Failed to create new internal user." , e ) ; } }
Creates a new InternalUser and assigns it to the current API user.
Creates a new InternalUser and assigns it to the current API user .