From 0aa6321161912c098cc14446ac38811aeba3462c Mon Sep 17 00:00:00 2001 From: Egor Puzanov Date: Fri, 8 Jan 2021 14:40:38 +0100 Subject: [PATCH] move some interfaces and abstract classes from modules/ginas to core --- .../controllers/CoreSubstanceFactory.java | 127 ++++++++++++++++++ .../exporters/AbstractSpreadsheetFormat.java | 30 +++++ .../exporters/BasicColumnValueRecipe.java | 2 +- .../ix/core}/exporters/Column.java | 2 +- .../ix/core}/exporters/ColumnValueRecipe.java | 2 +- .../ix/core}/exporters/Exporter.java | 2 +- .../exporters/GroupColumnValueRecipe.java | 2 +- .../exporters/SingleColumnValueRecipe.java | 2 +- .../ix/core}/exporters/Spreadsheet.java | 2 +- .../ix/core}/exporters/SpreadsheetCell.java | 2 +- .../exporters/SubstanceExporterFactory.java | 3 +- .../LoadValidatorInitializer.java | 7 +- .../ScheduledTaskInitializer.java | 2 +- .../AbstractNoDependencyIDGenerator.java | 2 +- .../ix/core}/utils/IdGeneratorForType.java | 2 +- .../ix/core}/utils/NamedIdGenerator.java | 2 +- .../utils/RandomAlphaNumericIDGenerator.java | 2 +- .../utils/SequentialNumericIDGenerator.java | 4 +- .../ix/core/validator}/ValidatorFactory.java | 5 +- .../ix/core/validator}/ValidatorPlugin.java | 5 +- .../app/ix/ginas/controllers/GinasApp.java | 3 + .../GinasSubstanceExporterFactoryPlugin.java | 2 +- .../controllers/v1/SubstanceFactory.java | 113 +--------------- .../ix/ginas/exporters/CsvSpreadSheet.java | 4 + .../exporters/CsvSpreadsheetBuilder.java | 2 + .../ix/ginas/exporters/DefaultColumns.java | 2 + ...ltSubstanceSpreadsheetExporterFactory.java | 3 + .../ix/ginas/exporters/ExcelSpreadsheet.java | 3 + .../app/ix/ginas/exporters/ExportProcess.java | 1 + .../exporters/InMemoryCsvSpreadSheet.java | 1 + .../app/ix/ginas/exporters/JsonExporter.java | 1 + .../ginas/exporters/JsonExporterFactory.java | 3 + .../exporters/SPLValidatorXMLExporter.java | 1 + .../SPLValidatorXMLExporterFactory.java | 3 + .../SRSLegacyDictionaryExporter.java | 1 + .../SRSLegacyDictionaryExporterFactory.java | 3 + .../app/ix/ginas/exporters/SdfExporter.java | 1 + .../ginas/exporters/SdfExporterFactory.java | 3 + .../ix/ginas/exporters/SpreadsheetFormat.java | 1 + .../exporters/StreamingCsvSpreadsheet.java | 3 + .../exporters/SubstanceCategoryGenerator.java | 1 + .../SubstanceSpreadsheetExporter.java | 1 + .../ApprovalIdGeneratorInitializer.java | 2 +- .../initializers/ChronicStackDumper.java | 1 + .../ix/ginas/initializers/DataRecorder.java | 1 + .../initializers/ReindexTaskInitializer.java | 1 + .../ResaveBackupsTaskInitializer.java | 1 + .../SQLReportScheduledTaskInitializer.java | 1 + .../ScheduledExportTaskInitializer.java | 1 + .../StructureRecalcTaskInitializer.java | 1 + .../UnusedRefReportTaskInitializer.java | 1 + .../ginas/utils/CodeSequentialGenerator.java | 1 + .../ix/ginas/utils/CodeSystemGenerator.java | 1 + .../ginas/app/ix/ginas/utils/GinasUtils.java | 1 + .../app/ix/ginas/utils/UniiLikeGenerator.java | 2 + .../validation/DefaultSubstanceValidator.java | 2 +- .../validators/AbstractValidatorPlugin.java | 4 +- .../validators/IgnoreValidator.java | 2 +- .../NewSubstanceNonBatchLoadValidator.java | 2 +- .../validators/PublicDomainRefValidator.java | 2 +- ...pdateSubstanceNonBatchLoaderValidator.java | 2 +- modules/ginas/conf/ginas.conf | 5 +- modules/ginas/conf/gsrs-core.conf | 2 +- 63 files changed, 247 insertions(+), 152 deletions(-) create mode 100644 app/ix/core/controllers/CoreSubstanceFactory.java create mode 100644 app/ix/core/exporters/AbstractSpreadsheetFormat.java rename {modules/ginas/app/ix/ginas => app/ix/core}/exporters/BasicColumnValueRecipe.java (98%) rename {modules/ginas/app/ix/ginas => app/ix/core}/exporters/Column.java (76%) rename {modules/ginas/app/ix/ginas => app/ix/core}/exporters/ColumnValueRecipe.java (92%) rename {modules/ginas/app/ix/ginas => app/ix/core}/exporters/Exporter.java (95%) rename {modules/ginas/app/ix/ginas => app/ix/core}/exporters/GroupColumnValueRecipe.java (98%) rename {modules/ginas/app/ix/ginas => app/ix/core}/exporters/SingleColumnValueRecipe.java (96%) rename {modules/ginas/app/ix/ginas => app/ix/core}/exporters/Spreadsheet.java (97%) rename {modules/ginas/app/ix/ginas => app/ix/core}/exporters/SpreadsheetCell.java (91%) rename {modules/ginas/app/ix/ginas => app/ix/core}/exporters/SubstanceExporterFactory.java (96%) rename {modules/ginas/app/ix/ginas => app/ix/core}/initializers/LoadValidatorInitializer.java (96%) rename {modules/ginas/app/ix/ginas => app/ix/core}/initializers/ScheduledTaskInitializer.java (98%) rename {modules/ginas/app/ix/ginas => app/ix/core}/utils/AbstractNoDependencyIDGenerator.java (97%) rename {modules/ginas/app/ix/ginas => app/ix/core}/utils/IdGeneratorForType.java (97%) rename {modules/ginas/app/ix/ginas => app/ix/core}/utils/NamedIdGenerator.java (88%) rename {modules/ginas/app/ix/ginas => app/ix/core}/utils/RandomAlphaNumericIDGenerator.java (99%) rename {modules/ginas/app/ix/ginas => app/ix/core}/utils/SequentialNumericIDGenerator.java (97%) rename {modules/ginas/app/ix/ginas/utils/validation => app/ix/core/validator}/ValidatorFactory.java (92%) rename {modules/ginas/app/ix/ginas/utils/validation => app/ix/core/validator}/ValidatorPlugin.java (63%) diff --git a/app/ix/core/controllers/CoreSubstanceFactory.java b/app/ix/core/controllers/CoreSubstanceFactory.java new file mode 100644 index 000000000..e17bae9bf --- /dev/null +++ b/app/ix/core/controllers/CoreSubstanceFactory.java @@ -0,0 +1,127 @@ +package ix.core.controllers; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import ix.core.util.CachedSupplier; +import ix.ginas.models.v1.Substance; +import ix.ginas.models.v1.SubstanceReference; +import ix.utils.UUIDUtil; +import ix.utils.Util; + +import play.Logger; +import play.db.ebean.Model; + +public class CoreSubstanceFactory extends EntityFactory { + private static final String CODE_TYPE_PRIMARY = "PRIMARY"; + static public CachedSupplier> finder = Util.finderFor(UUID.class, Substance.class); + + /** + * Get a Substance by it's UUID + * @param uuid + * @return + */ + public static Substance getSubstance(String uuid) { + if (uuid == null ||!UUIDUtil.isUUID(uuid)) { + return null; + } + return getSubstance(UUID.fromString(uuid)); + } + public static Substance getSubstance(UUID uuid) { + return getEntity(uuid, finder.get()); + } + + public static Substance getFullSubstance(SubstanceReference subRef) { + try { + if (subRef == null) + return null; + return getSubstanceByApprovalIDOrUUID(subRef.approvalID, subRef.refuuid); + }catch(Exception e){ + e.printStackTrace(); + throw e; + } + } + + public static List getSubstanceWithAlternativeDefinition(Substance altSub) { + List sublist = new ArrayList(); + sublist = finder.get().where() + .and(com.avaje.ebean.Expr.eq("relationships.relatedSubstance.refuuid", + altSub.getOrGenerateUUID().toString()), + com.avaje.ebean.Expr.eq("relationships.type", Substance.ALTERNATE_SUBSTANCE_REL)).findList(); + + List realList = new ArrayList(); + for (Substance sub : sublist) { + for (SubstanceReference sref : sub.getAlternativeDefinitionReferences()) { + if (sref.refuuid.equals(altSub.getUuid().toString())) { + realList.add(sub); + break; + } + } + } + return realList; + } + + /** + * Returns the substance corresponding to the supplied uuid or approvalID. + * + * If either is null, it will not be used in resolving. This method returns + * first based on the UUID, and falls back to the approvalID if nothing is + * found. + * + * @param approvalID + * @param uuid + * @return + */ + private static Substance getSubstanceByApprovalIDOrUUID(String approvalID, String uuid) { + try { + if (approvalID == null && uuid == null) + return null; + Substance s = null; + + if(uuid != null){ + try{ + s=getSubstance(uuid); + }catch(Exception e){ + e.printStackTrace(); + } + } + + if (s == null && approvalID != null) { + s = getSubstanceByApprovalID(approvalID); + } + return s; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + // return finder.where().eq("approvalID", approvalID).findUnique(); + } + public static Substance getSubstanceByApprovalID(String approvalID) { + List list = finder.get().where().ieq("approvalID", approvalID).findList(); + if (list != null && list.size() > 0) { + return list.get(0); + } + return null; + } + + public static List getSubstances(int top, int skip, String filter) { + List substances = filter(new FetchOptions(top, skip, filter), finder.get()); + return substances; + } + + // TODO: Doesn't support top/skip + public static List getSubstancesWithExactName(int top, int skip, String name) { + return finder.get().where().eq("names.name", name).findList(); + } + + // TODO: Doesn't support top/skip + public static List getSubstancesWithExactCode(int top, int skip, String code, String codeSystem) { + return finder.get().where(Util.andAll( + com.avaje.ebean.Expr.eq("codes.code", code), + com.avaje.ebean.Expr.eq("codes.codeSystem", codeSystem), + com.avaje.ebean.Expr.eq("codes.type", CODE_TYPE_PRIMARY) + )) + .findList(); + } +} \ No newline at end of file diff --git a/app/ix/core/exporters/AbstractSpreadsheetFormat.java b/app/ix/core/exporters/AbstractSpreadsheetFormat.java new file mode 100644 index 000000000..db06155dd --- /dev/null +++ b/app/ix/core/exporters/AbstractSpreadsheetFormat.java @@ -0,0 +1,30 @@ +package ix.core.exporters; + +import java.io.OutputStream; +import java.util.Objects; +import java.util.function.Function; + +public abstract class AbstractSpreadsheetFormat extends OutputFormat { + + public AbstractSpreadsheetFormat(String extension, String displayname) { + super(extension, displayname); + } + + abstract Spreadsheet createSpeadsheet(OutputStream out); + + public AbstractSpreadsheetFormat withInfo(Function extension, Function displayName){ + Objects.requireNonNull(extension); + Objects.requireNonNull(displayName); + + return newSubclass(this, extension.apply(new StringBuilder(this.getExtension())), displayName.apply(new StringBuilder(this.getDisplayName()))); + } + + private AbstractSpreadsheetFormat newSubclass(AbstractSpreadsheetFormat parentClass, String ext, String display){ + return new AbstractSpreadsheetFormat(ext, display) { + @Override + Spreadsheet createSpeadsheet(OutputStream out) { + return parentClass.createSpeadsheet(out); + } + }; + } +} diff --git a/modules/ginas/app/ix/ginas/exporters/BasicColumnValueRecipe.java b/app/ix/core/exporters/BasicColumnValueRecipe.java similarity index 98% rename from modules/ginas/app/ix/ginas/exporters/BasicColumnValueRecipe.java rename to app/ix/core/exporters/BasicColumnValueRecipe.java index 8ee965e7f..99c920281 100644 --- a/modules/ginas/app/ix/ginas/exporters/BasicColumnValueRecipe.java +++ b/app/ix/core/exporters/BasicColumnValueRecipe.java @@ -1,4 +1,4 @@ -package ix.ginas.exporters; +package ix.core.exporters; import java.util.Objects; diff --git a/modules/ginas/app/ix/ginas/exporters/Column.java b/app/ix/core/exporters/Column.java similarity index 76% rename from modules/ginas/app/ix/ginas/exporters/Column.java rename to app/ix/core/exporters/Column.java index aa7bb8dc1..c55f3ae48 100644 --- a/modules/ginas/app/ix/ginas/exporters/Column.java +++ b/app/ix/core/exporters/Column.java @@ -1,4 +1,4 @@ -package ix.ginas.exporters; +package ix.core.exporters; /** * Created by katzelda on 8/19/16. diff --git a/modules/ginas/app/ix/ginas/exporters/ColumnValueRecipe.java b/app/ix/core/exporters/ColumnValueRecipe.java similarity index 92% rename from modules/ginas/app/ix/ginas/exporters/ColumnValueRecipe.java rename to app/ix/core/exporters/ColumnValueRecipe.java index 88f363cfc..b71722986 100644 --- a/modules/ginas/app/ix/ginas/exporters/ColumnValueRecipe.java +++ b/app/ix/core/exporters/ColumnValueRecipe.java @@ -1,4 +1,4 @@ -package ix.ginas.exporters; +package ix.core.exporters; /** * Created by katzelda on 8/19/16. diff --git a/modules/ginas/app/ix/ginas/exporters/Exporter.java b/app/ix/core/exporters/Exporter.java similarity index 95% rename from modules/ginas/app/ix/ginas/exporters/Exporter.java rename to app/ix/core/exporters/Exporter.java index 0e1277d09..a9fd620f5 100644 --- a/modules/ginas/app/ix/ginas/exporters/Exporter.java +++ b/app/ix/core/exporters/Exporter.java @@ -1,4 +1,4 @@ -package ix.ginas.exporters; +package ix.core.exporters; import java.io.Closeable; import java.io.IOException; diff --git a/modules/ginas/app/ix/ginas/exporters/GroupColumnValueRecipe.java b/app/ix/core/exporters/GroupColumnValueRecipe.java similarity index 98% rename from modules/ginas/app/ix/ginas/exporters/GroupColumnValueRecipe.java rename to app/ix/core/exporters/GroupColumnValueRecipe.java index fe72eabda..609b1e55f 100644 --- a/modules/ginas/app/ix/ginas/exporters/GroupColumnValueRecipe.java +++ b/app/ix/core/exporters/GroupColumnValueRecipe.java @@ -1,4 +1,4 @@ -package ix.ginas.exporters; +package ix.core.exporters; import java.util.*; diff --git a/modules/ginas/app/ix/ginas/exporters/SingleColumnValueRecipe.java b/app/ix/core/exporters/SingleColumnValueRecipe.java similarity index 96% rename from modules/ginas/app/ix/ginas/exporters/SingleColumnValueRecipe.java rename to app/ix/core/exporters/SingleColumnValueRecipe.java index 276ad50eb..79453fa6c 100644 --- a/modules/ginas/app/ix/ginas/exporters/SingleColumnValueRecipe.java +++ b/app/ix/core/exporters/SingleColumnValueRecipe.java @@ -1,4 +1,4 @@ -package ix.ginas.exporters; +package ix.core.exporters; import java.util.function.BiFunction; diff --git a/modules/ginas/app/ix/ginas/exporters/Spreadsheet.java b/app/ix/core/exporters/Spreadsheet.java similarity index 97% rename from modules/ginas/app/ix/ginas/exporters/Spreadsheet.java rename to app/ix/core/exporters/Spreadsheet.java index d06af65b1..8e04836a6 100644 --- a/modules/ginas/app/ix/ginas/exporters/Spreadsheet.java +++ b/app/ix/core/exporters/Spreadsheet.java @@ -1,4 +1,4 @@ -package ix.ginas.exporters; +package ix.core.exporters; import java.io.Closeable; diff --git a/modules/ginas/app/ix/ginas/exporters/SpreadsheetCell.java b/app/ix/core/exporters/SpreadsheetCell.java similarity index 91% rename from modules/ginas/app/ix/ginas/exporters/SpreadsheetCell.java rename to app/ix/core/exporters/SpreadsheetCell.java index 8fa297c43..2d3c9686d 100644 --- a/modules/ginas/app/ix/ginas/exporters/SpreadsheetCell.java +++ b/app/ix/core/exporters/SpreadsheetCell.java @@ -1,4 +1,4 @@ -package ix.ginas.exporters; +package ix.core.exporters; import java.util.Date; diff --git a/modules/ginas/app/ix/ginas/exporters/SubstanceExporterFactory.java b/app/ix/core/exporters/SubstanceExporterFactory.java similarity index 96% rename from modules/ginas/app/ix/ginas/exporters/SubstanceExporterFactory.java rename to app/ix/core/exporters/SubstanceExporterFactory.java index 224be8acf..08b341f47 100644 --- a/modules/ginas/app/ix/ginas/exporters/SubstanceExporterFactory.java +++ b/app/ix/core/exporters/SubstanceExporterFactory.java @@ -1,6 +1,5 @@ -package ix.ginas.exporters; +package ix.core.exporters; -import ix.core.exporters.OutputFormat; import ix.ginas.models.v1.Substance; import java.io.IOException; diff --git a/modules/ginas/app/ix/ginas/initializers/LoadValidatorInitializer.java b/app/ix/core/initializers/LoadValidatorInitializer.java similarity index 96% rename from modules/ginas/app/ix/ginas/initializers/LoadValidatorInitializer.java rename to app/ix/core/initializers/LoadValidatorInitializer.java index 496117452..6773753ec 100644 --- a/modules/ginas/app/ix/ginas/initializers/LoadValidatorInitializer.java +++ b/app/ix/core/initializers/LoadValidatorInitializer.java @@ -1,13 +1,12 @@ -package ix.ginas.initializers; +package ix.core.initializers; import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.TypeFactory; -import ix.core.initializers.Initializer; import ix.core.util.IOUtil; +import ix.core.validator.ValidatorFactory; +import ix.core.validator.ValidatorPlugin; import ix.ginas.models.v1.Substance; -import ix.ginas.utils.validation.ValidatorFactory; -import ix.ginas.utils.validation.ValidatorPlugin; import play.Application; import java.util.Collections; diff --git a/modules/ginas/app/ix/ginas/initializers/ScheduledTaskInitializer.java b/app/ix/core/initializers/ScheduledTaskInitializer.java similarity index 98% rename from modules/ginas/app/ix/ginas/initializers/ScheduledTaskInitializer.java rename to app/ix/core/initializers/ScheduledTaskInitializer.java index e1a696a4b..55821b156 100644 --- a/modules/ginas/app/ix/ginas/initializers/ScheduledTaskInitializer.java +++ b/app/ix/core/initializers/ScheduledTaskInitializer.java @@ -1,4 +1,4 @@ -package ix.ginas.initializers; +package ix.core.initializers; import java.io.BufferedOutputStream; import java.io.File; diff --git a/modules/ginas/app/ix/ginas/utils/AbstractNoDependencyIDGenerator.java b/app/ix/core/utils/AbstractNoDependencyIDGenerator.java similarity index 97% rename from modules/ginas/app/ix/ginas/utils/AbstractNoDependencyIDGenerator.java rename to app/ix/core/utils/AbstractNoDependencyIDGenerator.java index 1b916d909..0f52fdee8 100644 --- a/modules/ginas/app/ix/ginas/utils/AbstractNoDependencyIDGenerator.java +++ b/app/ix/core/utils/AbstractNoDependencyIDGenerator.java @@ -1,4 +1,4 @@ -package ix.ginas.utils; +package ix.core.utils; /** * An ID Generator that can generate a new ID without relying on any diff --git a/modules/ginas/app/ix/ginas/utils/IdGeneratorForType.java b/app/ix/core/utils/IdGeneratorForType.java similarity index 97% rename from modules/ginas/app/ix/ginas/utils/IdGeneratorForType.java rename to app/ix/core/utils/IdGeneratorForType.java index 06f1708c8..cfbfe5c1f 100644 --- a/modules/ginas/app/ix/ginas/utils/IdGeneratorForType.java +++ b/app/ix/core/utils/IdGeneratorForType.java @@ -1,4 +1,4 @@ -package ix.ginas.utils; +package ix.core.utils; /** * An ID Generator which may use properties of a given type diff --git a/modules/ginas/app/ix/ginas/utils/NamedIdGenerator.java b/app/ix/core/utils/NamedIdGenerator.java similarity index 88% rename from modules/ginas/app/ix/ginas/utils/NamedIdGenerator.java rename to app/ix/core/utils/NamedIdGenerator.java index 8f2db2158..cda7fed5f 100644 --- a/modules/ginas/app/ix/ginas/utils/NamedIdGenerator.java +++ b/app/ix/core/utils/NamedIdGenerator.java @@ -1,4 +1,4 @@ -package ix.ginas.utils; +package ix.core.utils; public interface NamedIdGenerator extends IdGeneratorForType { /** diff --git a/modules/ginas/app/ix/ginas/utils/RandomAlphaNumericIDGenerator.java b/app/ix/core/utils/RandomAlphaNumericIDGenerator.java similarity index 99% rename from modules/ginas/app/ix/ginas/utils/RandomAlphaNumericIDGenerator.java rename to app/ix/core/utils/RandomAlphaNumericIDGenerator.java index a497392cc..efb79c61e 100644 --- a/modules/ginas/app/ix/ginas/utils/RandomAlphaNumericIDGenerator.java +++ b/app/ix/core/utils/RandomAlphaNumericIDGenerator.java @@ -1,4 +1,4 @@ -package ix.ginas.utils; +package ix.core.utils; import java.util.HashSet; import java.util.Objects; diff --git a/modules/ginas/app/ix/ginas/utils/SequentialNumericIDGenerator.java b/app/ix/core/utils/SequentialNumericIDGenerator.java similarity index 97% rename from modules/ginas/app/ix/ginas/utils/SequentialNumericIDGenerator.java rename to app/ix/core/utils/SequentialNumericIDGenerator.java index bb6e36db9..55f95f36c 100644 --- a/modules/ginas/app/ix/ginas/utils/SequentialNumericIDGenerator.java +++ b/app/ix/core/utils/SequentialNumericIDGenerator.java @@ -1,6 +1,4 @@ -package ix.ginas.utils; - - +package ix.core.utils; public abstract class SequentialNumericIDGenerator extends AbstractNoDependencyIDGenerator implements NamedIdGenerator { diff --git a/modules/ginas/app/ix/ginas/utils/validation/ValidatorFactory.java b/app/ix/core/validator/ValidatorFactory.java similarity index 92% rename from modules/ginas/app/ix/ginas/utils/validation/ValidatorFactory.java rename to app/ix/core/validator/ValidatorFactory.java index a64f42883..357b7bf29 100644 --- a/modules/ginas/app/ix/ginas/utils/validation/ValidatorFactory.java +++ b/app/ix/core/validator/ValidatorFactory.java @@ -1,8 +1,7 @@ -package ix.ginas.utils.validation; +package ix.core.validator; -import ix.core.validator.Validator; import ix.core.util.CachedSupplier; -import ix.ginas.initializers.LoadValidatorInitializer; +import ix.core.initializers.LoadValidatorInitializer; import java.util.LinkedHashMap; import java.util.List; diff --git a/modules/ginas/app/ix/ginas/utils/validation/ValidatorPlugin.java b/app/ix/core/validator/ValidatorPlugin.java similarity index 63% rename from modules/ginas/app/ix/ginas/utils/validation/ValidatorPlugin.java rename to app/ix/core/validator/ValidatorPlugin.java index 1bfccf9d2..add5f8ce9 100644 --- a/modules/ginas/app/ix/ginas/utils/validation/ValidatorPlugin.java +++ b/app/ix/core/validator/ValidatorPlugin.java @@ -1,7 +1,6 @@ -package ix.ginas.utils.validation; +package ix.core.validator; -import ix.core.validator.Validator; -import ix.ginas.initializers.LoadValidatorInitializer; +import ix.core.initializers.LoadValidatorInitializer; /** * Created by katzelda on 5/7/18. diff --git a/modules/ginas/app/ix/ginas/controllers/GinasApp.java b/modules/ginas/app/ix/ginas/controllers/GinasApp.java index 82b705177..3d4b54890 100644 --- a/modules/ginas/app/ix/ginas/controllers/GinasApp.java +++ b/modules/ginas/app/ix/ginas/controllers/GinasApp.java @@ -25,7 +25,10 @@ import gov.nih.ncats.molwitch.Chemical; import gov.nih.ncats.molwitch.io.ChemFormat; import ix.core.controllers.v1.GsrsApiUtil; +import ix.core.exporters.Exporter; import ix.core.exporters.OutputFormat; +import ix.core.exporters.SubstanceExporterFactory; +import ix.core.exporters.SubstanceExporterFactory.Parameters; import ix.core.validator.GinasProcessingMessage; import ix.core.UserFetcher; import ix.core.adapters.EntityPersistAdapter; diff --git a/modules/ginas/app/ix/ginas/controllers/plugins/GinasSubstanceExporterFactoryPlugin.java b/modules/ginas/app/ix/ginas/controllers/plugins/GinasSubstanceExporterFactoryPlugin.java index 330bf6e51..0731a8363 100644 --- a/modules/ginas/app/ix/ginas/controllers/plugins/GinasSubstanceExporterFactoryPlugin.java +++ b/modules/ginas/app/ix/ginas/controllers/plugins/GinasSubstanceExporterFactoryPlugin.java @@ -19,7 +19,7 @@ import ix.core.util.IOUtil; import ix.core.exporters.OutputFormat; -import ix.ginas.exporters.SubstanceExporterFactory; +import ix.core.exporters.SubstanceExporterFactory; import org.apache.poi.util.DefaultTempFileCreationStrategy; import org.apache.poi.util.TempFile; import org.apache.poi.util.TempFileCreationStrategy; diff --git a/modules/ginas/app/ix/ginas/controllers/v1/SubstanceFactory.java b/modules/ginas/app/ix/ginas/controllers/v1/SubstanceFactory.java index 63326f5a8..af99e12c6 100644 --- a/modules/ginas/app/ix/ginas/controllers/v1/SubstanceFactory.java +++ b/modules/ginas/app/ix/ginas/controllers/v1/SubstanceFactory.java @@ -23,6 +23,7 @@ import ix.core.adapters.EntityPersistAdapter; import ix.core.adapters.EntityPersistAdapter.ChangeOperation; import ix.core.chem.StructureProcessor; +import ix.core.controllers.CoreSubstanceFactory; import ix.core.controllers.EntityFactory; import ix.core.controllers.search.SearchFactory; import ix.core.controllers.search.SearchRequest; @@ -79,10 +80,8 @@ ,searchRequestBuilderClass = ix.ginas.controllers.v1.SubstanceFactory.SubstanceSearchRequestBuilder.class ) -public class SubstanceFactory extends EntityFactory { - private static final String CODE_TYPE_PRIMARY = "PRIMARY"; +public class SubstanceFactory extends CoreSubstanceFactory { public static final double SEQUENCE_IDENTITY_CUTOFF = 0.95; - static public CachedSupplier> finder = Util.finderFor(UUID.class, Substance.class); // Do we still need this? // Yes used in GinasApp @@ -103,17 +102,6 @@ public SearchRequest build() { } } - /** - * Get a Substance by it's UUID - * @param uuid - * @return - */ - public static Substance getSubstance(String uuid) { - if (uuid == null ||!UUIDUtil.isUUID(uuid)) { - return null; - } - return getSubstance(UUID.fromString(uuid)); - } /** * Get the highest version number of this Substance by it's UUID * @param uuid @@ -355,13 +343,6 @@ public static Optional> getSubstanceAndSubunitFromSubu return Optional.ofNullable(tuple); } - - - - public static Substance getSubstance(UUID uuid) { - return getEntity(uuid, finder.get()); - } - public static Result get(UUID id, String select) { return get(id, select, finder.get()); } @@ -373,14 +354,7 @@ public static Result hierarchy (UUID id) { return Results.ok(EntityWrapper.of(SubstanceHierarchyFinder.makeJsonTreeForAPI(sub)).toFullJsonNode()); } public static Substance getFullSubstance(SubstanceReference subRef) { - try { - if (subRef == null) - return null; - return getSubstanceByApprovalIDOrUUID(subRef.approvalID, subRef.refuuid); - }catch(Exception e){ - e.printStackTrace(); - throw e; - } + return CoreSubstanceFactory.getFullSubstance(subRef); } public static Optional resolveID(String s){ @@ -396,60 +370,6 @@ public static Optional resolveID(String s){ } - public static List getSubstanceWithAlternativeDefinition(Substance altSub) { - List sublist = new ArrayList(); - sublist = finder.get().where() - .and(com.avaje.ebean.Expr.eq("relationships.relatedSubstance.refuuid", - altSub.getOrGenerateUUID().toString()), - com.avaje.ebean.Expr.eq("relationships.type", Substance.ALTERNATE_SUBSTANCE_REL)).findList(); - - List realList = new ArrayList(); - for (Substance sub : sublist) { - for (SubstanceReference sref : sub.getAlternativeDefinitionReferences()) { - if (sref.refuuid.equals(altSub.getUuid().toString())) { - realList.add(sub); - break; - } - } - } - return realList; - } - - /** - * Returns the substance corresponding to the supplied uuid or approvalID. - * - * If either is null, it will not be used in resolving. This method returns - * first based on the UUID, and falls back to the approvalID if nothing is - * found. - * - * @param approvalID - * @param uuid - * @return - */ - private static Substance getSubstanceByApprovalIDOrUUID(String approvalID, String uuid) { - try { - if (approvalID == null && uuid == null) - return null; - Substance s = null; - - if(uuid != null){ - try{ - s=getSubstance(uuid); - }catch(Exception e){ - e.printStackTrace(); - } - } - - if (s == null && approvalID != null) { - s = getSubstanceByApprovalID(approvalID); - } - return s; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - // return finder.where().eq("approvalID", approvalID).findUnique(); - } public static Result getSubstanceByApprovalIDForApi(String approvalID) { Substance s = getSubstanceByApprovalID(approvalID); if(s==null){ @@ -458,13 +378,6 @@ public static Result getSubstanceByApprovalIDForApi(String approvalID) { ObjectMapper mapper = getEntityMapper(); return ok((JsonNode)mapper.valueToTree(s)); } - public static Substance getSubstanceByApprovalID(String approvalID) { - List list = finder.get().where().ieq("approvalID", approvalID).findList(); - if (list != null && list.size() > 0) { - return list.get(0); - } - return null; - } public static String getMostRecentCode(String codeSystem, String like) { List subs = finder.get().where() @@ -488,26 +401,6 @@ public static String getMostRecentCode(String codeSystem, String like) { return retCodes.get(0); } - public static List getSubstances(int top, int skip, String filter) { - List substances = filter(new FetchOptions(top, skip, filter), finder.get()); - return substances; - } - - // TODO: Doesn't support top/skip - public static List getSubstancesWithExactName(int top, int skip, String name) { - return finder.get().where().eq("names.name", name).findList(); - } - - // TODO: Doesn't support top/skip - public static List getSubstancesWithExactCode(int top, int skip, String code, String codeSystem) { - return finder.get().where(Util.andAll( - com.avaje.ebean.Expr.eq("codes.code", code), - com.avaje.ebean.Expr.eq("codes.codeSystem", codeSystem), - com.avaje.ebean.Expr.eq("codes.type", CODE_TYPE_PRIMARY) - )) - .findList(); - } - public static Integer getCount() { try { return getCount(finder.get()); diff --git a/modules/ginas/app/ix/ginas/exporters/CsvSpreadSheet.java b/modules/ginas/app/ix/ginas/exporters/CsvSpreadSheet.java index e7d5de087..90ac32e01 100644 --- a/modules/ginas/app/ix/ginas/exporters/CsvSpreadSheet.java +++ b/modules/ginas/app/ix/ginas/exporters/CsvSpreadSheet.java @@ -8,6 +8,10 @@ import java.util.Arrays; import java.util.Date; +import ix.core.exporters.Spreadsheet; +import ix.core.exporters.Spreadsheet.SpreadsheetRow; +import ix.core.exporters.SpreadsheetCell; + /** * Created by katzelda on 8/23/16. */ diff --git a/modules/ginas/app/ix/ginas/exporters/CsvSpreadsheetBuilder.java b/modules/ginas/app/ix/ginas/exporters/CsvSpreadsheetBuilder.java index 9d1a0baf2..a8e11553d 100644 --- a/modules/ginas/app/ix/ginas/exporters/CsvSpreadsheetBuilder.java +++ b/modules/ginas/app/ix/ginas/exporters/CsvSpreadsheetBuilder.java @@ -5,6 +5,8 @@ import java.text.SimpleDateFormat; import java.util.Objects; +import ix.core.exporters.Spreadsheet; + /** * Created by katzelda on 8/22/16. */ diff --git a/modules/ginas/app/ix/ginas/exporters/DefaultColumns.java b/modules/ginas/app/ix/ginas/exporters/DefaultColumns.java index a9e0f598a..0d47ba368 100644 --- a/modules/ginas/app/ix/ginas/exporters/DefaultColumns.java +++ b/modules/ginas/app/ix/ginas/exporters/DefaultColumns.java @@ -1,5 +1,7 @@ package ix.ginas.exporters; +import ix.core.exporters.Column; + /** * Created by katzelda on 8/19/16. */ diff --git a/modules/ginas/app/ix/ginas/exporters/DefaultSubstanceSpreadsheetExporterFactory.java b/modules/ginas/app/ix/ginas/exporters/DefaultSubstanceSpreadsheetExporterFactory.java index 8e04d17ab..7fd8cfc4b 100644 --- a/modules/ginas/app/ix/ginas/exporters/DefaultSubstanceSpreadsheetExporterFactory.java +++ b/modules/ginas/app/ix/ginas/exporters/DefaultSubstanceSpreadsheetExporterFactory.java @@ -1,6 +1,9 @@ package ix.ginas.exporters; import ix.core.exporters.OutputFormat; +import ix.core.exporters.Spreadsheet; +import ix.core.exporters.SubstanceExporterFactory; +import ix.core.exporters.SubstanceExporterFactory.Parameters; import java.io.IOException; import java.io.OutputStream; diff --git a/modules/ginas/app/ix/ginas/exporters/ExcelSpreadsheet.java b/modules/ginas/app/ix/ginas/exporters/ExcelSpreadsheet.java index e202584ec..5923e13e4 100644 --- a/modules/ginas/app/ix/ginas/exporters/ExcelSpreadsheet.java +++ b/modules/ginas/app/ix/ginas/exporters/ExcelSpreadsheet.java @@ -1,5 +1,8 @@ package ix.ginas.exporters; +import ix.core.exporters.Spreadsheet; +import ix.core.exporters.Spreadsheet.SpreadsheetRow; +import ix.core.exporters.SpreadsheetCell; import ix.core.util.IOUtil; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; diff --git a/modules/ginas/app/ix/ginas/exporters/ExportProcess.java b/modules/ginas/app/ix/ginas/exporters/ExportProcess.java index 11ab6e0cc..278cf0a5f 100644 --- a/modules/ginas/app/ix/ginas/exporters/ExportProcess.java +++ b/modules/ginas/app/ix/ginas/exporters/ExportProcess.java @@ -8,6 +8,7 @@ import java.util.stream.Stream; import ix.core.controllers.EntityFactory; +import ix.core.exporters.Exporter; import ix.core.util.CachedSupplier; import ix.core.util.IOUtil; import ix.core.util.TimeUtil; diff --git a/modules/ginas/app/ix/ginas/exporters/InMemoryCsvSpreadSheet.java b/modules/ginas/app/ix/ginas/exporters/InMemoryCsvSpreadSheet.java index d94d9e9ee..017c0fcb1 100644 --- a/modules/ginas/app/ix/ginas/exporters/InMemoryCsvSpreadSheet.java +++ b/modules/ginas/app/ix/ginas/exporters/InMemoryCsvSpreadSheet.java @@ -1,5 +1,6 @@ package ix.ginas.exporters; +import ix.core.exporters.Spreadsheet.SpreadsheetRow; import java.io.IOException; import java.util.Arrays; diff --git a/modules/ginas/app/ix/ginas/exporters/JsonExporter.java b/modules/ginas/app/ix/ginas/exporters/JsonExporter.java index 86a925986..1a22f51d8 100644 --- a/modules/ginas/app/ix/ginas/exporters/JsonExporter.java +++ b/modules/ginas/app/ix/ginas/exporters/JsonExporter.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.databind.ObjectWriter; import ix.core.controllers.EntityFactory; +import ix.core.exporters.Exporter; import ix.ginas.models.v1.Substance; /** diff --git a/modules/ginas/app/ix/ginas/exporters/JsonExporterFactory.java b/modules/ginas/app/ix/ginas/exporters/JsonExporterFactory.java index 7df3e34d9..a5b2644d9 100644 --- a/modules/ginas/app/ix/ginas/exporters/JsonExporterFactory.java +++ b/modules/ginas/app/ix/ginas/exporters/JsonExporterFactory.java @@ -1,6 +1,9 @@ package ix.ginas.exporters; +import ix.core.exporters.Exporter; import ix.core.exporters.OutputFormat; +import ix.core.exporters.SubstanceExporterFactory; +import ix.core.exporters.SubstanceExporterFactory.Parameters; import ix.ginas.models.v1.Substance; import java.io.IOException; diff --git a/modules/ginas/app/ix/ginas/exporters/SPLValidatorXMLExporter.java b/modules/ginas/app/ix/ginas/exporters/SPLValidatorXMLExporter.java index 25dac8d9d..a5c4541d4 100644 --- a/modules/ginas/app/ix/ginas/exporters/SPLValidatorXMLExporter.java +++ b/modules/ginas/app/ix/ginas/exporters/SPLValidatorXMLExporter.java @@ -10,6 +10,7 @@ import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; +import ix.core.exporters.Exporter; import ix.ginas.models.v1.Substance; public class SPLValidatorXMLExporter implements Exporter { diff --git a/modules/ginas/app/ix/ginas/exporters/SPLValidatorXMLExporterFactory.java b/modules/ginas/app/ix/ginas/exporters/SPLValidatorXMLExporterFactory.java index abe9637c9..bf0d9755f 100644 --- a/modules/ginas/app/ix/ginas/exporters/SPLValidatorXMLExporterFactory.java +++ b/modules/ginas/app/ix/ginas/exporters/SPLValidatorXMLExporterFactory.java @@ -1,6 +1,9 @@ package ix.ginas.exporters; +import ix.core.exporters.Exporter; import ix.core.exporters.OutputFormat; +import ix.core.exporters.SubstanceExporterFactory; +import ix.core.exporters.SubstanceExporterFactory.Parameters; import ix.ginas.models.v1.Substance; import java.io.IOException; diff --git a/modules/ginas/app/ix/ginas/exporters/SRSLegacyDictionaryExporter.java b/modules/ginas/app/ix/ginas/exporters/SRSLegacyDictionaryExporter.java index 6b81c03db..ee4eb6db8 100644 --- a/modules/ginas/app/ix/ginas/exporters/SRSLegacyDictionaryExporter.java +++ b/modules/ginas/app/ix/ginas/exporters/SRSLegacyDictionaryExporter.java @@ -15,6 +15,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; +import ix.core.exporters.Exporter; import ix.ginas.models.v1.Name; import ix.ginas.models.v1.Substance; import ix.utils.Tuple; diff --git a/modules/ginas/app/ix/ginas/exporters/SRSLegacyDictionaryExporterFactory.java b/modules/ginas/app/ix/ginas/exporters/SRSLegacyDictionaryExporterFactory.java index a7b26df87..129566d8d 100644 --- a/modules/ginas/app/ix/ginas/exporters/SRSLegacyDictionaryExporterFactory.java +++ b/modules/ginas/app/ix/ginas/exporters/SRSLegacyDictionaryExporterFactory.java @@ -1,6 +1,9 @@ package ix.ginas.exporters; +import ix.core.exporters.Exporter; import ix.core.exporters.OutputFormat; +import ix.core.exporters.SubstanceExporterFactory; +import ix.core.exporters.SubstanceExporterFactory.Parameters; import ix.ginas.models.v1.Substance; import java.io.IOException; diff --git a/modules/ginas/app/ix/ginas/exporters/SdfExporter.java b/modules/ginas/app/ix/ginas/exporters/SdfExporter.java index 70847cfec..01aeaaae2 100644 --- a/modules/ginas/app/ix/ginas/exporters/SdfExporter.java +++ b/modules/ginas/app/ix/ginas/exporters/SdfExporter.java @@ -12,6 +12,7 @@ import java.util.Objects; import gov.nih.ncats.molwitch.Chemical; +import ix.core.exporters.Exporter; import ix.ginas.models.v1.Substance; import ix.core.validator.GinasProcessingMessage; diff --git a/modules/ginas/app/ix/ginas/exporters/SdfExporterFactory.java b/modules/ginas/app/ix/ginas/exporters/SdfExporterFactory.java index 964c4dd43..7e3d9220c 100644 --- a/modules/ginas/app/ix/ginas/exporters/SdfExporterFactory.java +++ b/modules/ginas/app/ix/ginas/exporters/SdfExporterFactory.java @@ -1,7 +1,10 @@ package ix.ginas.exporters; import gov.nih.ncats.molwitch.Chemical; +import ix.core.exporters.Exporter; import ix.core.exporters.OutputFormat; +import ix.core.exporters.SubstanceExporterFactory; +import ix.core.exporters.SubstanceExporterFactory.Parameters; import ix.core.validator.GinasProcessingMessage; import ix.ginas.models.v1.Code; import ix.ginas.models.v1.Name; diff --git a/modules/ginas/app/ix/ginas/exporters/SpreadsheetFormat.java b/modules/ginas/app/ix/ginas/exporters/SpreadsheetFormat.java index f9ac31e29..9f97991d6 100644 --- a/modules/ginas/app/ix/ginas/exporters/SpreadsheetFormat.java +++ b/modules/ginas/app/ix/ginas/exporters/SpreadsheetFormat.java @@ -1,6 +1,7 @@ package ix.ginas.exporters; import ix.core.exporters.OutputFormat; +import ix.core.exporters.Spreadsheet; import java.io.OutputStream; import java.util.Objects; diff --git a/modules/ginas/app/ix/ginas/exporters/StreamingCsvSpreadsheet.java b/modules/ginas/app/ix/ginas/exporters/StreamingCsvSpreadsheet.java index aab10a3af..515745988 100644 --- a/modules/ginas/app/ix/ginas/exporters/StreamingCsvSpreadsheet.java +++ b/modules/ginas/app/ix/ginas/exporters/StreamingCsvSpreadsheet.java @@ -4,6 +4,9 @@ import java.io.UncheckedIOException; import java.util.LinkedList; +import ix.core.exporters.Spreadsheet; +import ix.core.exporters.Spreadsheet.SpreadsheetRow; + /** * Created by katzelda on 8/22/16. */ diff --git a/modules/ginas/app/ix/ginas/exporters/SubstanceCategoryGenerator.java b/modules/ginas/app/ix/ginas/exporters/SubstanceCategoryGenerator.java index 4484d5d50..ced5a7824 100644 --- a/modules/ginas/app/ix/ginas/exporters/SubstanceCategoryGenerator.java +++ b/modules/ginas/app/ix/ginas/exporters/SubstanceCategoryGenerator.java @@ -5,6 +5,7 @@ import java.util.Set; import java.util.TreeSet; +import ix.core.exporters.*; import ix.ginas.models.v1.Relationship; import ix.ginas.models.v1.Substance; diff --git a/modules/ginas/app/ix/ginas/exporters/SubstanceSpreadsheetExporter.java b/modules/ginas/app/ix/ginas/exporters/SubstanceSpreadsheetExporter.java index 6bd8d40ce..527bb82a1 100644 --- a/modules/ginas/app/ix/ginas/exporters/SubstanceSpreadsheetExporter.java +++ b/modules/ginas/app/ix/ginas/exporters/SubstanceSpreadsheetExporter.java @@ -7,6 +7,7 @@ import gov.nih.ncats.molwitch.Chemical; import gov.nih.ncats.molwitch.inchi.Inchi; +import ix.core.exporters.*; import ix.core.models.Group; import ix.core.models.Structure; import ix.core.util.CachedSupplier; diff --git a/modules/ginas/app/ix/ginas/initializers/ApprovalIdGeneratorInitializer.java b/modules/ginas/app/ix/ginas/initializers/ApprovalIdGeneratorInitializer.java index e1f75933e..e126589e5 100644 --- a/modules/ginas/app/ix/ginas/initializers/ApprovalIdGeneratorInitializer.java +++ b/modules/ginas/app/ix/ginas/initializers/ApprovalIdGeneratorInitializer.java @@ -4,10 +4,10 @@ import com.fasterxml.jackson.databind.type.TypeFactory; import ix.core.initializers.Initializer; import ix.core.util.IOUtil; +import ix.core.utils.NamedIdGenerator; import ix.ginas.models.v1.Substance; import ix.ginas.utils.DefaultApprovalIDGenerator; import ix.ginas.utils.GinasUtils; -import ix.ginas.utils.NamedIdGenerator; import play.Application; import play.Logger; diff --git a/modules/ginas/app/ix/ginas/initializers/ChronicStackDumper.java b/modules/ginas/app/ix/ginas/initializers/ChronicStackDumper.java index 6cef804e5..7a5f6dd88 100644 --- a/modules/ginas/app/ix/ginas/initializers/ChronicStackDumper.java +++ b/modules/ginas/app/ix/ginas/initializers/ChronicStackDumper.java @@ -1,6 +1,7 @@ package ix.ginas.initializers; import ix.core.initializers.Initializer; +import ix.core.initializers.ScheduledTaskInitializer; import ix.core.plugins.CronExpressionBuilder; import ix.core.plugins.SchedulerPlugin; import ix.core.plugins.SchedulerPlugin.TaskListener; diff --git a/modules/ginas/app/ix/ginas/initializers/DataRecorder.java b/modules/ginas/app/ix/ginas/initializers/DataRecorder.java index b791e215a..c36fa0f0a 100644 --- a/modules/ginas/app/ix/ginas/initializers/DataRecorder.java +++ b/modules/ginas/app/ix/ginas/initializers/DataRecorder.java @@ -1,6 +1,7 @@ package ix.ginas.initializers; import ix.core.initializers.Initializer; +import ix.core.initializers.ScheduledTaskInitializer; import ix.core.plugins.CronExpressionBuilder; import ix.core.plugins.SchedulerPlugin; import ix.core.util.KeepLastList; diff --git a/modules/ginas/app/ix/ginas/initializers/ReindexTaskInitializer.java b/modules/ginas/app/ix/ginas/initializers/ReindexTaskInitializer.java index e012c3bc7..f4e81cdc4 100644 --- a/modules/ginas/app/ix/ginas/initializers/ReindexTaskInitializer.java +++ b/modules/ginas/app/ix/ginas/initializers/ReindexTaskInitializer.java @@ -4,6 +4,7 @@ import ix.core.adapters.EntityPersistAdapter; import ix.core.initializers.Initializer; +import ix.core.initializers.ScheduledTaskInitializer; import ix.core.models.UserProfile; import ix.core.plugins.CronExpressionBuilder; import ix.core.plugins.SchedulerPlugin.ScheduledTask; diff --git a/modules/ginas/app/ix/ginas/initializers/ResaveBackupsTaskInitializer.java b/modules/ginas/app/ix/ginas/initializers/ResaveBackupsTaskInitializer.java index baf6a2c83..dee6bbdfd 100644 --- a/modules/ginas/app/ix/ginas/initializers/ResaveBackupsTaskInitializer.java +++ b/modules/ginas/app/ix/ginas/initializers/ResaveBackupsTaskInitializer.java @@ -11,6 +11,7 @@ import java.util.logging.Logger; import ix.core.initializers.Initializer; +import ix.core.initializers.ScheduledTaskInitializer; import ix.core.models.BaseModel; import ix.core.plugins.SchedulerPlugin.TaskListener; import ix.core.processors.BackupProcessor; diff --git a/modules/ginas/app/ix/ginas/initializers/SQLReportScheduledTaskInitializer.java b/modules/ginas/app/ix/ginas/initializers/SQLReportScheduledTaskInitializer.java index 770f9eeb7..73766cbc2 100644 --- a/modules/ginas/app/ix/ginas/initializers/SQLReportScheduledTaskInitializer.java +++ b/modules/ginas/app/ix/ginas/initializers/SQLReportScheduledTaskInitializer.java @@ -16,6 +16,7 @@ import java.util.concurrent.locks.ReentrantLock; import ix.core.initializers.Initializer; +import ix.core.initializers.ScheduledTaskInitializer; import ix.core.plugins.SchedulerPlugin.TaskListener; import ix.core.util.TimeUtil; import play.Logger; diff --git a/modules/ginas/app/ix/ginas/initializers/ScheduledExportTaskInitializer.java b/modules/ginas/app/ix/ginas/initializers/ScheduledExportTaskInitializer.java index 7415b7373..9507b5dee 100644 --- a/modules/ginas/app/ix/ginas/initializers/ScheduledExportTaskInitializer.java +++ b/modules/ginas/app/ix/ginas/initializers/ScheduledExportTaskInitializer.java @@ -11,6 +11,7 @@ import java.util.function.Supplier; import ix.core.initializers.Initializer; +import ix.core.initializers.ScheduledTaskInitializer; import ix.core.models.Principal; import ix.core.plugins.SchedulerPlugin.TaskListener; import ix.core.util.TimeUtil; diff --git a/modules/ginas/app/ix/ginas/initializers/StructureRecalcTaskInitializer.java b/modules/ginas/app/ix/ginas/initializers/StructureRecalcTaskInitializer.java index bd56b4530..4ec50737e 100644 --- a/modules/ginas/app/ix/ginas/initializers/StructureRecalcTaskInitializer.java +++ b/modules/ginas/app/ix/ginas/initializers/StructureRecalcTaskInitializer.java @@ -6,6 +6,7 @@ package ix.ginas.initializers; import ix.core.chem.StructureProcessorTask; +import ix.core.initializers.ScheduledTaskInitializer; import ix.core.models.Structure; import ix.core.plugins.SchedulerPlugin.TaskListener; import ix.core.utils.executor.ProcessExecutionService; diff --git a/modules/ginas/app/ix/ginas/initializers/UnusedRefReportTaskInitializer.java b/modules/ginas/app/ix/ginas/initializers/UnusedRefReportTaskInitializer.java index afac3da77..003fdb996 100644 --- a/modules/ginas/app/ix/ginas/initializers/UnusedRefReportTaskInitializer.java +++ b/modules/ginas/app/ix/ginas/initializers/UnusedRefReportTaskInitializer.java @@ -16,6 +16,7 @@ import java.util.stream.Collectors; import ix.core.initializers.Initializer; +import ix.core.initializers.ScheduledTaskInitializer; import ix.core.models.BaseModel; import ix.core.models.Keyword; import ix.core.plugins.SchedulerPlugin; diff --git a/modules/ginas/app/ix/ginas/utils/CodeSequentialGenerator.java b/modules/ginas/app/ix/ginas/utils/CodeSequentialGenerator.java index 54eb13110..235ab0a03 100644 --- a/modules/ginas/app/ix/ginas/utils/CodeSequentialGenerator.java +++ b/modules/ginas/app/ix/ginas/utils/CodeSequentialGenerator.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import gov.nih.ncats.common.util.CachedSupplier; +import ix.core.utils.SequentialNumericIDGenerator; import ix.ginas.controllers.v1.CodeFactory; import ix.ginas.models.v1.Code; import ix.ginas.models.v1.Reference; diff --git a/modules/ginas/app/ix/ginas/utils/CodeSystemGenerator.java b/modules/ginas/app/ix/ginas/utils/CodeSystemGenerator.java index c88d1e96d..4f8c73100 100644 --- a/modules/ginas/app/ix/ginas/utils/CodeSystemGenerator.java +++ b/modules/ginas/app/ix/ginas/utils/CodeSystemGenerator.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import ix.core.utils.NamedIdGenerator; import ix.core.util.ConfigHelper; import ix.ginas.models.v1.Substance; diff --git a/modules/ginas/app/ix/ginas/utils/GinasUtils.java b/modules/ginas/app/ix/ginas/utils/GinasUtils.java index a33e30d66..e7550bd50 100644 --- a/modules/ginas/app/ix/ginas/utils/GinasUtils.java +++ b/modules/ginas/app/ix/ginas/utils/GinasUtils.java @@ -30,6 +30,7 @@ import ix.core.util.CachedSupplier; import ix.core.util.ConfigHelper; import ix.core.util.IOUtil; +import ix.core.utils.NamedIdGenerator; import ix.ginas.models.v1.Substance; import ix.ginas.utils.validation.DefaultSubstanceValidator; import play.Logger; diff --git a/modules/ginas/app/ix/ginas/utils/UniiLikeGenerator.java b/modules/ginas/app/ix/ginas/utils/UniiLikeGenerator.java index a80fa64c9..7863eef96 100644 --- a/modules/ginas/app/ix/ginas/utils/UniiLikeGenerator.java +++ b/modules/ginas/app/ix/ginas/utils/UniiLikeGenerator.java @@ -1,5 +1,7 @@ package ix.ginas.utils; +import ix.core.utils.NamedIdGenerator; +import ix.core.utils.RandomAlphaNumericIDGenerator; import ix.ginas.controllers.v1.SubstanceFactory; import ix.ginas.models.v1.Substance; diff --git a/modules/ginas/app/ix/ginas/utils/validation/DefaultSubstanceValidator.java b/modules/ginas/app/ix/ginas/utils/validation/DefaultSubstanceValidator.java index cf21b7e66..08e5b1f39 100644 --- a/modules/ginas/app/ix/ginas/utils/validation/DefaultSubstanceValidator.java +++ b/modules/ginas/app/ix/ginas/utils/validation/DefaultSubstanceValidator.java @@ -8,7 +8,7 @@ import ix.core.models.Role; import ix.core.models.UserProfile; import ix.core.validator.*; -import ix.ginas.initializers.LoadValidatorInitializer; +import ix.core.initializers.LoadValidatorInitializer; import ix.ginas.models.v1.Substance; import ix.ginas.utils.GinasProcessingStrategy; import ix.ginas.utils.GinasUtils; diff --git a/modules/ginas/app/ix/ginas/utils/validation/validators/AbstractValidatorPlugin.java b/modules/ginas/app/ix/ginas/utils/validation/validators/AbstractValidatorPlugin.java index ce3ebdec7..5dbc5fbd6 100644 --- a/modules/ginas/app/ix/ginas/utils/validation/validators/AbstractValidatorPlugin.java +++ b/modules/ginas/app/ix/ginas/utils/validation/validators/AbstractValidatorPlugin.java @@ -1,9 +1,9 @@ package ix.ginas.utils.validation.validators; +import ix.core.validator.ValidatorPlugin; import ix.core.UserFetcher; import ix.core.models.UserProfile; -import ix.ginas.initializers.LoadValidatorInitializer; -import ix.ginas.utils.validation.ValidatorPlugin; +import ix.core.initializers.LoadValidatorInitializer; /** * Created by katzelda on 5/7/18. diff --git a/modules/ginas/app/ix/ginas/utils/validation/validators/IgnoreValidator.java b/modules/ginas/app/ix/ginas/utils/validation/validators/IgnoreValidator.java index 5c070df8e..b41dc342b 100644 --- a/modules/ginas/app/ix/ginas/utils/validation/validators/IgnoreValidator.java +++ b/modules/ginas/app/ix/ginas/utils/validation/validators/IgnoreValidator.java @@ -1,7 +1,7 @@ package ix.ginas.utils.validation.validators; import ix.core.validator.ValidatorCallback; -import ix.ginas.initializers.LoadValidatorInitializer; +import ix.core.initializers.LoadValidatorInitializer; import ix.ginas.models.v1.Substance; /** diff --git a/modules/ginas/app/ix/ginas/utils/validation/validators/NewSubstanceNonBatchLoadValidator.java b/modules/ginas/app/ix/ginas/utils/validation/validators/NewSubstanceNonBatchLoadValidator.java index a442facdf..ab320a1ca 100644 --- a/modules/ginas/app/ix/ginas/utils/validation/validators/NewSubstanceNonBatchLoadValidator.java +++ b/modules/ginas/app/ix/ginas/utils/validation/validators/NewSubstanceNonBatchLoadValidator.java @@ -4,7 +4,7 @@ import ix.core.models.Role; import ix.core.models.UserProfile; import ix.core.validator.ValidatorCallback; -import ix.ginas.initializers.LoadValidatorInitializer; +import ix.core.initializers.LoadValidatorInitializer; import ix.ginas.models.v1.Substance; /** diff --git a/modules/ginas/app/ix/ginas/utils/validation/validators/PublicDomainRefValidator.java b/modules/ginas/app/ix/ginas/utils/validation/validators/PublicDomainRefValidator.java index 7b6e52142..62b35f4f3 100644 --- a/modules/ginas/app/ix/ginas/utils/validation/validators/PublicDomainRefValidator.java +++ b/modules/ginas/app/ix/ginas/utils/validation/validators/PublicDomainRefValidator.java @@ -2,7 +2,7 @@ import ix.core.validator.GinasProcessingMessage; import ix.core.validator.ValidatorCallback; -import ix.ginas.initializers.LoadValidatorInitializer; +import ix.core.initializers.LoadValidatorInitializer; import ix.ginas.models.v1.Reference; import ix.ginas.models.v1.Substance; diff --git a/modules/ginas/app/ix/ginas/utils/validation/validators/UpdateSubstanceNonBatchLoaderValidator.java b/modules/ginas/app/ix/ginas/utils/validation/validators/UpdateSubstanceNonBatchLoaderValidator.java index 9c4bd3941..a93e44e54 100644 --- a/modules/ginas/app/ix/ginas/utils/validation/validators/UpdateSubstanceNonBatchLoaderValidator.java +++ b/modules/ginas/app/ix/ginas/utils/validation/validators/UpdateSubstanceNonBatchLoaderValidator.java @@ -4,7 +4,7 @@ import ix.core.models.Role; import ix.core.models.UserProfile; import ix.core.validator.ValidatorCallback; -import ix.ginas.initializers.LoadValidatorInitializer; +import ix.core.initializers.LoadValidatorInitializer; import ix.ginas.models.v1.Substance; import ix.ginas.utils.GinasUtils; diff --git a/modules/ginas/conf/ginas.conf b/modules/ginas/conf/ginas.conf index bb00e54f2..7f371139e 100644 --- a/modules/ginas/conf/ginas.conf +++ b/modules/ginas/conf/ginas.conf @@ -275,9 +275,6 @@ ix.core.initializers=[ { "class": "ix.ginas.initializers.LoadDefaultUsersInitializer" }, - { - "class" : "ix.ginas.initializers.LoadValidatorInitializer" - }, { "class" : "ix.ginas.initializers.MolwitchInitializer" }, @@ -321,7 +318,7 @@ ix.core.initializers=[ }, { #THIS IS IMPORTANT, DO NOT REMOVE THIS - "class": "ix.ginas.initializers.LoadValidatorInitializer" + "class": "ix.core.initializers.LoadValidatorInitializer" }, { #THIS IS IMPORTANT, DO NOT REMOVE THIS diff --git a/modules/ginas/conf/gsrs-core.conf b/modules/ginas/conf/gsrs-core.conf index 68dcca75e..2b19987f4 100644 --- a/modules/ginas/conf/gsrs-core.conf +++ b/modules/ginas/conf/gsrs-core.conf @@ -442,7 +442,7 @@ ix.core.initializers=[ }, { #This is important - "class" : "ix.ginas.initializers.LoadValidatorInitializer" + "class" : "ix.core.initializers.LoadValidatorInitializer" }, { "class": "ix.ginas.initializers.ApprovalIdGeneratorInitializer"