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;
}