-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 46 additions & 3 deletions
49
Model/src/main/java/org/apidb/apicommon/model/report/ai/SingleGeneAiExpressionReporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,55 @@ | ||
package org.apidb.apicommon.model.report.ai; | ||
|
||
import org.gusdb.wdk.model.report.AbstractReporter; | ||
import org.gusdb.wdk.model.report.Reporter; | ||
import org.gusdb.wdk.model.report.ReporterConfigException; | ||
import org.apidb.apicommon.model.report.ai.expression.Summarizer; | ||
import org.gusdb.wdk.model.WdkModelException; | ||
|
||
public class SingleGeneAiExpressionReporter extends AbstractReporter { | ||
import org.json.JSONObject; | ||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
|
||
// configure: is any config needed? | ||
public class SingleGeneAiExpressionReporter extends AbstractReporter { | ||
|
||
private enum CacheMode { | ||
TEST("test"), | ||
POPULATE("populate"); | ||
private final String mode; | ||
CacheMode(String mode) { | ||
this.mode = mode; | ||
} | ||
public String getMode() { | ||
return mode; | ||
} | ||
public static CacheMode fromString(String mode) throws IllegalArgumentException { | ||
for (CacheMode cm : CacheMode.values()) { | ||
if (cm.mode.equalsIgnoreCase(mode)) { | ||
return cm; | ||
} | ||
} | ||
throw new IllegalArgumentException("Invalid CacheMode: " + mode); | ||
} | ||
} | ||
|
||
private CacheMode _cacheMode = CacheMode.TEST; | ||
|
||
@Override | ||
public Reporter configure(JSONObject config) throws ReporterConfigException, WdkModelException { | ||
try { | ||
_cacheMode = CacheMode.fromString(config.getString("cacheMode")); | ||
} catch (IllegalArgumentException e) { | ||
throw new ReporterConfigException("Invalid cacheMode value: " + config.getString("cacheMode"), e); | ||
} | ||
return this; | ||
} | ||
|
||
@Override | ||
protected void write(OutputStream out) throws IOException, WdkModelException { | ||
|
||
} | ||
|
||
|
||
// write: does the business - see SingleGeneReporter for example | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters