in custos-services/custos-core-services/user-profile-core-service/src/main/java/org/apache/custos/user/profile/validator/UserProfileInputValidator.java [95:123]
private boolean validateUserProfile(Object obj, String method) {
if (obj instanceof UserProfileRequest) {
UserProfileRequest profile = (UserProfileRequest) obj;
if (profile.getTenantId() == 0) {
throw new MissingParameterException("tenantId should be valid ", null);
}
if (profile.getProfile() == null) {
throw new MissingParameterException("Profile should be valid ", null);
}
if (profile.getProfile().getUsername() == null || profile.getProfile().getUsername().equals("")) {
throw new MissingParameterException("username should not be null", null);
}
if ((profile.getProfile().getFirstName() == null || profile.getProfile().getFirstName().equals("")) &&
!profile.getProfile().getType().equals(UserTypes.COMMUNITY) ) {
throw new MissingParameterException("firstName should not be null", null);
}
if ((profile.getProfile().getLastName() == null || profile.getProfile().getLastName().equals("")) &&
!profile.getProfile().getType().equals(UserTypes.COMMUNITY)) {
throw new MissingParameterException("lastName should not be null", null);
}
if ((profile.getProfile().getEmail() == null || profile.getProfile().getEmail().equals("")) &&
!profile.getProfile().getType().equals(UserTypes.COMMUNITY)) {
throw new MissingParameterException("emailAddress should not be null", null);
}
}
return true;
}