All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.spotinst.sdkjava.model.bl.admin.account.AccountConverter Maven / Gradle / Ivy

There is a newer version: 1.0.121
Show newest version
package com.spotinst.sdkjava.model.bl.admin.account;

import com.spotinst.sdkjava.model.api.admin.account.*;


public class AccountConverter {
    //region BL -> DAL
    public static ApiAccountAdmin toDal(BlAccountAdmin src) {
        ApiAccountAdmin retVal = null;

        if (src != null) {
            retVal = new ApiAccountAdmin();

            if (src.isNameSet()) {
                retVal.setName(src.getName());
            }

            if (src.isAccountIdSet()) {
                retVal.setAccountId(src.getAccountId());
            }

            if (src.isOrganizationIdSet()) {
                retVal.setOrganizationId(src.getOrganizationId());
            }

            if (src.isCloudProviderSet()) {
                retVal.setCloudProvider(src.getCloudProvider());
            }

            if (src.isProviderExternalIdSet()) {
                retVal.setProviderExternalId(src.getProviderExternalId());
            }
        }

        return retVal;
    }


    //endregion

    //region DAL -> BL
    public static BlAccountAdmin toBl(ApiAccountAdmin src) {
        BlAccountAdmin retVal = null;

        if (src != null) {
            BlAccountAdmin.Builder accountBuilder = BlAccountAdmin.Builder.get();

            if (src.isAccountIdSet()) {
                accountBuilder.setAccountId(src.getAccountId());
            }

            if (src.isNameSet()) {
                accountBuilder.setName(src.getName());
            }

            if (src.isOrganizationIdSet()) {
                accountBuilder.setOrganizationId(src.getOrganizationId());
            }

            if (src.isCloudProviderSet()) {
                accountBuilder.setCloudProvider(src.getCloudProvider());
            }

            if (src.isProviderExternalIdSet()) {
                accountBuilder.setProviderExternalId(src.getProviderExternalId());
            }

            retVal = accountBuilder.build();

        }

        return retVal;
    }
    //endregion
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy