<commit_before>package org.sanelib.eboss.api.converters.client;


import com.google.common.base.Strings;
import org.sanelib.eboss.api.converters.DtoToCommandConverter;
import org.sanelib.eboss.api.dto.client.ClientDTO;
import org.sanelib.eboss.common.utils.DateHelper;
import org.sanelib.eboss.core.commands.ProcessCommand;
import org.sanelib.eboss.core.commands.client.AddClient;
import org.sanelib.eboss.core.exceptions.ProcessError;
import org.springframework.stereotype.Component;

@Component
public class AddClientConverter implements DtoToCommandConverter<ClientDTO> {

    @Override
    public ProcessCommand convert(ClientDTO dto, ProcessError processError) throws NoSuchFieldException, IllegalAccessException {

        AddClient command= new AddClient();

        if(Strings.isNullOrEmpty(dto.getClientId())){
            processError.addError("common.field.required", "client_id", "domain.customer.client_id");

        }else{
            command.setClientId(dto.getClientId());
        }

        if(Strings.isNullOrEmpty(dto.getClientSecret())){
            processError.addError("common.field.required", "client_secret", "domain.customer.client_secret");

        }else{
            command.setClientSecret(dto.getClientSecret());
        }

        if(Strings.isNullOrEmpty(dto.getClientName())){
            processError.addError("common.field.required", "client_name", "domain.customer.client_name");

        }else{
            command.setClientName(dto.getClientName());
        }

        command.setDescription(dto.getDescription());

        if(Strings.isNullOrEmpty(dto.getClientUrl())){
            processError.addError("common.field.required", "client_url", "domain.customer.client_url");

        }else{
            command.setClientUrl(dto.getClientUrl());
        }

        if(Strings.isNullOrEmpty(dto.getClientType())){
            processError.addError("common.field.required", "client_type", "domain.customer.client_type");

        }else{
            command.setClientType(dto.getClientType());
        }

        command.setScope(dto.getScope());
        command.setRedirectUri(dto.getRedirectUri());

        if(Strings.isNullOrEmpty(dto.getRegdate())){
            processError.addError("common.field.required", "regdate", "domain.customer.regdate");

        }else{
            command.setRegdate(DateHelper.fromDateString((dto.getRegdate())));
        }

        return command;
    }
}<commit_msg>Updating add client converter for domain client.<commit_after>package org.sanelib.eboss.api.converters.client;


import com.google.common.base.Strings;
import org.sanelib.eboss.api.converters.DtoToCommandConverter;
import org.sanelib.eboss.api.dto.client.ClientDTO;
import org.sanelib.eboss.common.utils.DateHelper;
import org.sanelib.eboss.core.commands.ProcessCommand;
import org.sanelib.eboss.core.commands.client.AddClient;
import org.sanelib.eboss.core.exceptions.ProcessError;
import org.springframework.stereotype.Component;

@Component
public class AddClientConverter implements DtoToCommandConverter<ClientDTO> {

    @Override
    public ProcessCommand convert(ClientDTO dto, ProcessError processError) throws NoSuchFieldException, IllegalAccessException {

        AddClient command= new AddClient();

        if(Strings.isNullOrEmpty(dto.getClientId())){
            processError.addError("common.field.required", "clientId", "domain.client.clientId");

        }else{
            command.setClientId(dto.getClientId());
        }

        if(Strings.isNullOrEmpty(dto.getClientSecret())){
            processError.addError("common.field.required", "clientSecret", "domain.client.clientSecret");

        }else{
            command.setClientSecret(dto.getClientSecret());
        }

        if(Strings.isNullOrEmpty(dto.getClientName())){
            processError.addError("common.field.required", "clientName", "domain.client.clientName");

        }else{
            command.setClientName(dto.getClientName());
        }

        command.setDescription(dto.getDescription());

        if(Strings.isNullOrEmpty(dto.getClientUrl())){
            processError.addError("common.field.required", "clientUrl", "domain.client.clientUrl");

        }else{
            command.setClientUrl(dto.getClientUrl());
        }

        if(Strings.isNullOrEmpty(dto.getClientType())){
            processError.addError("common.field.required", "clientType", "domain.client.clientType");

        }else{
            command.setClientType(dto.getClientType());
        }

        command.setScope(dto.getScope());
        command.setRedirectUri(dto.getRedirectUri());

        if(Strings.isNullOrEmpty(dto.getRegistrationDate())){
            processError.addError("common.field.required", "registrationDate", "domain.client.registrationDate");

        }else{
            command.setRegistrationDate(DateHelper.fromDateString((dto.getRegistrationDate())));
        }

        return command;
    }
}
{'fraction_non_alphanumeric': 0.12545601945683016, 'fraction_numerical': 0.0, 'mean_word_length': 3.4299820466786355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6443412', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1420, 'n_words': 164}