Skip to content

Commit

Permalink
0005399: Adjusted JobManager.loadJobs() and ran spotlessApply
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-miller-jumpmind committed Aug 11, 2022
1 parent 5a1ad3d commit 397b5c1
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 26 deletions.
Expand Up @@ -58,19 +58,19 @@ public JobManager(ISymmetricEngine engine) {
@Override
public void init() {
this.stopJobs();
List<JobDefinition> jobDefitions = loadJobs(engine);
List<JobDefinition> jobDefinitions = loadCustomJobs();
BuiltInJobs builtInJobs = new BuiltInJobs();
jobDefitions = builtInJobs.syncBuiltInJobs(jobDefitions, engine, taskScheduler); // TODO save built in jobs
jobDefinitions = builtInJobs.syncBuiltInJobs(jobDefinitions, engine, taskScheduler); // TODO save built in jobs
this.jobs = new ArrayList<IJob>();
for (JobDefinition jobDefinition : jobDefitions) {
for (JobDefinition jobDefinition : jobDefinitions) {
IJob job = jobCreator.createJob(jobDefinition, engine, taskScheduler);
if (job != null) {
jobs.add(job);
}
}
}

protected List<JobDefinition> loadJobs(ISymmetricEngine engine) {
public List<JobDefinition> loadCustomJobs() {
return sqlTemplate.query(getSql("loadCustomJobs"), new JobMapper());
}

Expand Down
Expand Up @@ -565,13 +565,13 @@ protected String replaceTemplateVariables(DataEventType dml, Trigger trigger,
}
return ddl;
}

private String convertExternalSelectToDelete(String externalSelect) {
externalSelect = FormatUtils.replace("curTriggerValue", oldTriggerValue, externalSelect);
externalSelect = FormatUtils.replace("curColumnPrefix", oldColumnPrefix, externalSelect);
return externalSelect;
}

private String convertExternalSelectToInsert(String externalSelect) {
externalSelect = FormatUtils.replace("curTriggerValue", newTriggerValue, externalSelect);
externalSelect = FormatUtils.replace("curColumnPrefix", newColumnPrefix, externalSelect);
Expand Down
Expand Up @@ -37,6 +37,8 @@ public interface IJobManager {

public void destroy();

public List<JobDefinition> loadCustomJobs();

public List<IJob> getJobs();

public IJob getJob(String name);
Expand Down
Expand Up @@ -428,7 +428,7 @@ public void batchComplete(DataContext context) {
} catch (Exception e) {
log.warn("Unable to write batch to Kafka " + batchFileName, e);
throw new RuntimeException(e);
// e.printStackTrace();
// e.printStackTrace();
} finally {
context.put(KAFKA_TEXT_CACHE, new HashMap<String, List<String>>());
tableNameCache.clear();
Expand Down
Expand Up @@ -299,13 +299,11 @@ public long getSizeInBytes() {
return size;
}

public Map<String, Object> getAttributes() {
return attributes;
}

public void setAttributes(Map<String, Object> attributes) {
this.attributes = attributes;
}


public Map<String, Object> getAttributes() {
return attributes;
}

public void setAttributes(Map<String, Object> attributes) {
this.attributes = attributes;
}
}
Expand Up @@ -46,7 +46,7 @@ public NewAndOldValue transform(IDatabasePlatform platform,
DataContext context,
TransformColumn column, TransformedData data, Map<String, String> sourceValues,
String newValue, String oldValue) throws IgnoreColumnException, IgnoreRowException {
if (StringUtils.isNotEmpty(newValue)) {
if (StringUtils.isNotEmpty(newValue)) {
String expression = column.getTransformExpression();
if (StringUtils.isNotBlank(expression)) {
String[] tokens = expression.split(",");
Expand Down
Expand Up @@ -283,7 +283,6 @@ public Table buildTargetTable() {
public CsvData buildTargetCsvData(Map<String, Object> attributes) {
CsvData data = new CsvData(this.targetDmlType);
data.setAttributes(attributes);

if (transformation != null) {
data.putAttribute(CsvData.ATTRIBUTE_TABLE_NAME, transformation.getSourceTableName());
}
Expand Down
Expand Up @@ -255,7 +255,7 @@ public void testDeleteFkViolationChildTable() throws Exception {
whichTable = WhichTable.PARENT;
delete(firstId, firstId, "deleteparent", null);
}

@Test
public void testDeleteFkViolationChildTableNoPk() throws Exception {
String firstId = insert(getNextId(), "deleteparentnopk", null);
Expand Down Expand Up @@ -338,8 +338,7 @@ else if (whichTable == WhichTable.GRANDCHILD)
return TEST_TABLE_GRANDCHILD;
else if (whichTable == WhichTable.CHILD_NOPK) {
return TEST_TABLE_CHILD_NOPK;
}
else
} else
return TEST_TABLE;
}

Expand All @@ -351,8 +350,7 @@ else if (whichTable == WhichTable.GRANDCHILD)
return TEST_KEYS_GRANDCHILD;
else if (whichTable == WhichTable.CHILD_NOPK) {
return TEST_KEYS_CHILD_NOPK;
}
else
} else
return TEST_KEYS;
}

Expand All @@ -364,8 +362,7 @@ else if (whichTable == WhichTable.GRANDCHILD)
return TEST_COLUMNS_GRANDCHILD;
else if (whichTable == WhichTable.CHILD_NOPK) {
return TEST_COLUMNS_CHILD_NOPK;
}
else
} else
return TEST_COLUMNS;
}
}
Expand Up @@ -147,7 +147,6 @@ public static void notify(String caption, String message, Consumer<Boolean> shor
if (page != null) {
HorizontalLayout layout = new HorizontalLayout();
Notification notification = new Notification(layout);

if (message.length() <= 250) {
layout.getStyle().set("max-width", "400px");
Label label;
Expand Down

0 comments on commit 397b5c1

Please sign in to comment.