Search in sources :

Example 1 with Source

use of com.homeaway.datapullclient.input.Source in project datapull by homeaway.

the class DataPullRequestProcessor method createBootstrapScript.

private Boolean createBootstrapScript(Migration[] myObjects, String bootstrapFile, String bootstrapFilePath, String bootstrapActionStringFromUser, String defaultbootstrapString) throws ProcessingException {
    StringBuilder stringBuilder = new StringBuilder();
    List<String> list = new ArrayList<>();
    Boolean haveBootstrapAction = false;
    for (Migration mig : myObjects) {
        if (mig.getSource() != null) {
            if (mig.getSource().getJksfiles() != null) {
                list.addAll(Arrays.asList(mig.getSource().getJksfiles()));
            }
        } else {
            Source[] sources = mig.getSources();
            if (sources != null && sources.length > 0) {
                for (Source source : sources) {
                    if (source.getJksfiles() != null) {
                        list.addAll(Arrays.asList(source.getJksfiles()));
                    }
                }
            }
        }
        if (mig.getDestination() != null) {
            if (mig.getDestination().getJksfiles() != null) {
                list.addAll(Arrays.asList(mig.getDestination().getJksfiles()));
            }
        }
    }
    if (!list.isEmpty() || !bootstrapActionStringFromUser.isEmpty()) {
        stringBuilder = createBootstrapString(list.toArray(), bootstrapActionStringFromUser);
    }
    if (!defaultbootstrapString.isEmpty()) {
        stringBuilder.append(defaultbootstrapString);
    }
    if (stringBuilder.length() > 0) {
        saveConfig(bootstrapFilePath, bootstrapFile, stringBuilder.toString());
        haveBootstrapAction = true;
    }
    return haveBootstrapAction;
}
Also used : Migration(com.homeaway.datapullclient.input.Migration) Source(com.homeaway.datapullclient.input.Source)

Aggregations

Migration (com.homeaway.datapullclient.input.Migration)1 Source (com.homeaway.datapullclient.input.Source)1