diff --git a/nbdemetra-benchmarking/pom.xml b/nbdemetra-benchmarking/pom.xml index d393b7b..540e1b1 100644 --- a/nbdemetra-benchmarking/pom.xml +++ b/nbdemetra-benchmarking/pom.xml @@ -5,7 +5,7 @@ eu.europa.ec.joinup.sat nbdemetra-benchmarking nbm - 2.2.0 + 2.2.1 NbDemetra - Benchmarking This module provides some experimental methods for temporal disaggregation and multi-variate benchmarking: @@ -22,7 +22,7 @@ 2.6 3.14 - 2.2.0 + 2.2.1 @@ -114,6 +114,12 @@ nbdemetra-spreadsheet runtime + + + org.projectlombok + lombok + provided + diff --git a/nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java b/nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java deleted file mode 100644 index 1bd7d09..0000000 --- a/nbdemetra-benchmarking/src/main/java/ec/benchmarking/CholetteDocument2.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013 National Bank of Belgium - * - * Licensed under the EUPL, Version 1.1 or – as soon they will be approved - * by the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * - * http://ec.europa.eu/idabc/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package ec.benchmarking; - -import ec.tss.Ts; -import ec.tss.disaggregation.documents.BenchmarkingResults; -import ec.tss.disaggregation.documents.UniCholetteSpecification; -import ec.tss.disaggregation.processors.CholetteProcessor; -import ec.tss.documents.MultiTsDocument; -import ec.tstoolkit.algorithm.ProcessingContext; - -/** - * - * @author Jean Palate - */ -public class CholetteDocument2 extends MultiTsDocument2 { - - public CholetteDocument2() { - super(CholetteProcessor.instance); - setSpecification(new UniCholetteSpecification()); - } - - public CholetteDocument2(ProcessingContext context) { - super(CholetteProcessor.instance, context); - setSpecification(new UniCholetteSpecification()); - } - - @Override - public void setInput(Ts[] s) { - if (s != null && s.length != 2) { - throw new IllegalArgumentException("Cholette requires 2 time series"); - } - super.setInput(s); - } -} \ No newline at end of file diff --git a/nbdemetra-benchmarking/src/main/java/ec/benchmarking/DentonDocument2.java b/nbdemetra-benchmarking/src/main/java/ec/benchmarking/DentonDocument2.java deleted file mode 100644 index f35cf9c..0000000 --- a/nbdemetra-benchmarking/src/main/java/ec/benchmarking/DentonDocument2.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* Copyright 2013 National Bank of Belgium -* -* Licensed under the EUPL, Version 1.1 or – as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use this work except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* http://ec.europa.eu/idabc/eupl -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -*/ - -package ec.benchmarking; - -import ec.tss.Ts; -import ec.tss.disaggregation.documents.BenchmarkingResults; -import ec.tss.disaggregation.documents.DentonSpecification; -import ec.tss.disaggregation.processors.DentonProcessor; -import ec.tss.documents.ActiveDocument; -import ec.tss.documents.MultiTsDocument; -import ec.tstoolkit.algorithm.ProcessingContext; -import java.util.Arrays; - -/** - * - * @author Jean Palate - */ -public class DentonDocument2 extends MultiTsDocument2 { - - public DentonDocument2() { - super(DentonProcessor.instance); - setSpecification(new DentonSpecification()); - } - - public DentonDocument2(ProcessingContext context) { - super(DentonProcessor.instance, context); - setSpecification(new DentonSpecification()); - } - - @Override - public void setInput(Ts[] s) { - if (s != null && s.length != 2) { - throw new IllegalArgumentException("Denton requires 2 time series"); - } - Ts[] frozen=new Ts[2]; - for (int i=0; i - * @param - */ -public abstract class MultiTsDocument2 extends ActiveDocument { - - public static final String SERIES = "series"; - protected IProcessingFactory factory_; - - public MultiTsDocument2(IProcessingFactory factory) { - super(factory.getInformation().name); - this.factory_ = factory; - } - - public MultiTsDocument2(IProcessingFactory factory, ProcessingContext context) { - super(factory.getInformation().name, context); - this.factory_ = factory; - } - - @Deprecated - public Ts[] getTs() { - return getInput(); - } - - @Deprecated - void setTs(Ts[] ts) { - setInput(ts); - } - - @Override - public void setInput(Ts[] s) { - if (isLocked() || Arrays.equals(getMonikers(getInput()), getMonikers(s))) { - return; - } - Ts[] frozen=new Ts[s.length]; - for (int i=0; i processing = factory_.generateProcessing(spec, getContext()); - return processing.process(dinput); - } - - @Override - public MultiTsDocument2 clone() { - MultiTsDocument2 cl = (MultiTsDocument2) super.clone(); - cl.setInput(clone(getInput()), true); - return cl; - } - - public IProcessingFactory getProcessor() { - return factory_; - } - - public TsMoniker[] getMonikers() { - return getMonikers(getInput()); - } - - private static TsMoniker[] getMonikers(Ts[] ts) { - if (ts == null) { - return null; - } - TsMoniker[] monikers = new TsMoniker[ts.length]; - for (int i = 0; i < ts.length; ++i) { - monikers[i] = ts[i] != null ? ts[i].getMoniker() : null; - } - return monikers; - } - - public boolean isTsFrozen() { - Ts[] ts = getInput(); - if (ts == null) { - return false; - } - for (int i = 0; i < ts.length; ++i) { - if (ts[i].isFrozen()) { - return true; - } - } - return false; - } - - public void freezeTs() { - Ts[] ts = getInput(); - if (ts == null) { - return; - } - boolean changed = false; - for (int i = 0; i < ts.length; ++i) { - if (!ts[i].isFrozen()) { - ts[i] = ts[i].freeze(); - changed = true; - } - } - if (changed) { - super.setInput(ts, true); - } - } - - public void unfreezeTs() { - Ts[] ts = getInput(); - if (ts == null) { - return; - } - boolean changed = false; - for (int i = 0; i < ts.length; ++i) { - if (ts[i].isFrozen()) { - ts[i] = ts[i].unfreeze(); - changed = true; - } - } - if (changed) { - super.setInput(ts, false); - getMetaData().put(MetaData.DATE, new Date().toString()); - } - } - - @Override - public void setSpecification(S spec) { - super.setSpecification(spec); - } - - @Override - public InformationSet write(boolean verbose) { - Ts[] ts = getInput(); - InformationSet info = super.write(verbose); - info.add(ALGORITHM, factory_.getInformation()); - if (ts != null) { - TsInformation tsinfo; - for (int i = 0; i < ts.length; ++i) { - if (ts[i].getMoniker().isAnonymous()) { - tsinfo = new TsInformation(ts[i], TsInformationType.All); - } else { - tsinfo = new TsInformation(ts[i].freeze(), TsInformationType.All); - } - info.subSet(INPUT).add(SERIES + i, tsinfo); - } - } - S spec = getSpecification(); - if (spec != null) { - info.set(SPEC, spec.write(verbose)); - } - return info; - } - - @Override - public boolean read(InformationSet info) { - if (!super.read(info)) { - return false; - } - AlgorithmDescriptor algorithm = info.get(ALGORITHM, AlgorithmDescriptor.class); - if (algorithm == null || !factory_.getInformation().isCompatible(algorithm)) { - return false; - } - InformationSet input = info.getSubSet(INPUT); - if (input != null) { - List> sel = input.select(SERIES + '*', TsInformation.class); - Collections.sort(sel, new Information.IndexedNameSorter(SERIES)); - Ts[] s = new Ts[sel.size()]; - for (int i = 0; i < s.length; ++i) { - TsInformation tsinfo = sel.get(i).value; - s[i] = TsFactory.instance.createTs(tsinfo.name, tsinfo.moniker, tsinfo.metaData, tsinfo.data); - } - setInput(s, true); - } - InformationSet ispec = info.getSubSet(SPEC); - if (ispec != null) { - S spec = getSpecification(); - if (spec == null) { - return false; - } else { - return spec.read(ispec); - } - } - return true; - } - - @Override - public String getDescription() { - return factory_.getInformation().name; //To change body of generated methods, choose Tools | Templates. - } - - public static Ts[] clone(Ts[] s) { - if (s == null || s.length == 0) { - return s; - } else { - Ts[] ns = s.clone(); - for (int i = 0; i < ns.length; ++i) { - ns[i] = TsDocument.clone(s[i]); - } - return ns; - } - } -} diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocFileRepository.java index 42e5a92..f38c620 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CalendarizationDocFileRepository.java @@ -21,6 +21,7 @@ import ec.nbdemetra.ws.WorkspaceItem; import ec.tss.disaggregation.documents.CalendarizationDocument; import ec.tstoolkit.MetaData; +import internal.workspace.file.CalendarizationDocHandler; import java.util.Date; import org.openide.util.lookup.ServiceProvider; @@ -31,23 +32,36 @@ @ServiceProvider(service = IWorkspaceItemRepository.class) public final class CalendarizationDocFileRepository extends DefaultFileItemRepository { - public static final String REPOSITORY = "CalendarizationDoc"; - + @Deprecated + public static final String REPOSITORY = CalendarizationDocHandler.REPOSITORY; + @Override public String getRepository() { return REPOSITORY; } @Override - public Class getSupportedType() { - return CalendarizationDocument.class; + public boolean load(WorkspaceItem item) { + return loadFile(item, (CalendarizationDocument o) -> { + item.setElement(o); + item.resetDirty(); + }); } - + @Override - public boolean save(WorkspaceItem doc) { - CalendarizationDocument element = doc.getElement(); + public boolean save(WorkspaceItem item) { + CalendarizationDocument element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); - return super.save(doc); + return storeFile(item, element, item::resetDirty); } + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + + @Override + public Class getSupportedType() { + return CalendarizationDocument.class; + } } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java index 4d0dca9..973c4d1 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocFileRepository.java @@ -16,11 +16,12 @@ */ package ec.nbdemetra.benchmarking; -import ec.benchmarking.CholetteDocument2; import ec.nbdemetra.ws.DefaultFileItemRepository; import ec.nbdemetra.ws.IWorkspaceItemRepository; import ec.nbdemetra.ws.WorkspaceItem; +import ec.tss.disaggregation.documents.CholetteDocument; import ec.tstoolkit.MetaData; +import internal.workspace.file.CholetteDocHandler; import java.util.Date; import org.openide.util.lookup.ServiceProvider; @@ -29,24 +30,38 @@ * @author palatej */ @ServiceProvider(service = IWorkspaceItemRepository.class) -public final class CholetteDocFileRepository extends DefaultFileItemRepository { +public final class CholetteDocFileRepository extends DefaultFileItemRepository { - public static final String REPOSITORY = "CholetteDoc"; + @Deprecated + public static final String REPOSITORY = CholetteDocHandler.REPOSITORY; @Override - public Class getSupportedType() { - return CholetteDocument2.class; + public String getRepository() { + return REPOSITORY; } @Override - public String getRepository() { - return REPOSITORY; + public boolean load(WorkspaceItem item) { + return loadFile(item, (CholetteDocument o) -> { + item.setElement(o); + item.resetDirty(); + }); } @Override - public boolean save(WorkspaceItem doc) { - CholetteDocument2 element = doc.getElement(); + public boolean save(WorkspaceItem item) { + CholetteDocument element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); - return super.save(doc); + return storeFile(item, element, item::resetDirty); + } + + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + + @Override + public Class getSupportedType() { + return CholetteDocument.class; } } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java index ec02e98..1f5164c 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteDocumentManager.java @@ -23,7 +23,7 @@ import ec.nbdemetra.ws.IWorkspaceItemManager; import ec.nbdemetra.ws.WorkspaceFactory; import ec.nbdemetra.ws.WorkspaceItem; -import ec.benchmarking.CholetteDocument2; +import ec.tss.disaggregation.documents.CholetteDocument; import ec.tss.disaggregation.documents.UniCholetteSpecification; import ec.tstoolkit.descriptors.IObjectDescriptor; import ec.tstoolkit.utilities.Id; @@ -43,17 +43,17 @@ @ServiceProvider( service = IWorkspaceItemManager.class, position = 1500) -public class CholetteDocumentManager extends AbstractWorkspaceItemManager { +public class CholetteDocumentManager extends AbstractWorkspaceItemManager { static { - DocumentUIServices.getDefault().register(CholetteDocument2.class, new DocumentUIServices.AbstractUIFactory() { + DocumentUIServices.getDefault().register(CholetteDocument.class, new DocumentUIServices.AbstractUIFactory() { @Override - public IObjectDescriptor getSpecificationDescriptor(CholetteDocument2 document) { + public IObjectDescriptor getSpecificationDescriptor(CholetteDocument document) { return new CholetteSpecUI(document.getSpecification().clone()); } @Override - public IProcDocumentView getDocumentView(CholetteDocument2 document) { + public IProcDocumentView getDocumentView(CholetteDocument document) { return CholetteViewFactory.getDefault().create(document); } @@ -76,8 +76,8 @@ public Id getId() { } @Override - protected CholetteDocument2 createNewObject() { - return new CholetteDocument2(); + protected CholetteDocument createNewObject() { + return new CholetteDocument(); } @Override @@ -100,7 +100,7 @@ public Action getPreferredItemAction(final Id child) { return new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { - WorkspaceItem doc = (WorkspaceItem) WorkspaceFactory.getInstance().getActiveWorkspace().searchDocument(child); + WorkspaceItem doc = (WorkspaceItem) WorkspaceFactory.getInstance().getActiveWorkspace().searchDocument(child); if (doc != null) { openDocument(doc); } @@ -110,7 +110,7 @@ public void actionPerformed(ActionEvent e) { @Override public Class getItemClass() { - return CholetteDocument2.class; + return CholetteDocument.class; } @Override @@ -118,7 +118,7 @@ public Icon getManagerIcon() { return ImageUtilities.loadImageIcon("ec/nbdemetra/benchmarking/resource-monitor_16x16.png", false); } - public void openDocument(WorkspaceItem item) { + public void openDocument(WorkspaceItem item) { if (item.isOpen()) { item.getView().requestActive(); } else { diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteTopComponent.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteTopComponent.java index 806712b..ab679a7 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteTopComponent.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/CholetteTopComponent.java @@ -16,11 +16,11 @@ */ package ec.nbdemetra.benchmarking; -import ec.benchmarking.CholetteDocument2; -import ec.nbdemetra.benchmarking.ui.Ts2ProcessingViewer2; +import ec.tss.disaggregation.documents.CholetteDocument; import ec.nbdemetra.ws.WorkspaceFactory; import ec.nbdemetra.ws.WorkspaceItem; import ec.nbdemetra.ws.ui.WorkspaceTopComponent; +import ec.ui.view.tsprocessing.Ts2ProcessingViewer; import org.netbeans.api.settings.ConvertAsProperties; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; @@ -47,16 +47,16 @@ "CTL_CholetteTopComponent=Cholette Window", "HINT_CholetteTopComponent=This is a Cholette window" }) -public final class CholetteTopComponent extends WorkspaceTopComponent { +public final class CholetteTopComponent extends WorkspaceTopComponent { - protected Ts2ProcessingViewer2 panel; + protected Ts2ProcessingViewer panel; public CholetteTopComponent() { super(null); //initDocument(); } - public CholetteTopComponent(WorkspaceItem doc) { + public CholetteTopComponent(WorkspaceItem doc) { super(doc); initDocument(); } @@ -66,7 +66,7 @@ public void initDocument() { setToolTipText(Bundle.CTL_CholetteTopComponent()); initComponents(); // node=new InternalNode(); - panel = Ts2ProcessingViewer2.create(this.getDocument().getElement(), "Series", "Constraint"); + panel = Ts2ProcessingViewer.create(this.getDocument().getElement(), "Series", "Constraint"); add(panel); } @@ -160,7 +160,7 @@ protected String getContextPath() { // // @Override // public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { -// CholetteDocument2 document = getDocument().getElement(); +// CholetteDocument document = getDocument().getElement(); // UniCholetteSpecification nspec = document.getSpecification().clone(); // nspec.setRho((Double)t); // document.setSpecification(nspec); @@ -188,7 +188,7 @@ protected String getContextPath() { // // @Override // public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { -// CholetteDocument2 document = getDocument().getElement(); +// CholetteDocument document = getDocument().getElement(); // UniCholetteSpecification nspec = document.getSpecification().clone(); // nspec.setLambda((Double)t); // setSpecification(nspec); @@ -220,7 +220,7 @@ protected String getContextPath() { //// //// @Override //// public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { -//// CholetteDocument2 document = getDocument().getElement(); +//// CholetteDocument document = getDocument().getElement(); //// UniCholetteSpecification nspec = document.getSpecification().clone(); //// // to do //// document.setSpecification(nspec); @@ -248,7 +248,7 @@ protected String getContextPath() { // // @Override // public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { -// CholetteDocument2 document = getDocument().getElement(); +// CholetteDocument document = getDocument().getElement(); // UniCholetteSpecification nspec = document.getSpecification().clone(); // nspec.setAggregationFrequency((TsFrequency)t); // document.setSpecification(nspec); diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java index 739032f..616f54e 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocFileRepository.java @@ -19,8 +19,9 @@ import ec.nbdemetra.ws.DefaultFileItemRepository; import ec.nbdemetra.ws.IWorkspaceItemRepository; import ec.nbdemetra.ws.WorkspaceItem; -import ec.benchmarking.DentonDocument2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.tstoolkit.MetaData; +import internal.workspace.file.DentonDocHandler; import java.util.Date; import org.openide.util.lookup.ServiceProvider; @@ -29,24 +30,38 @@ * @author palatej */ @ServiceProvider(service = IWorkspaceItemRepository.class) -public final class DentonDocFileRepository extends DefaultFileItemRepository { +public final class DentonDocFileRepository extends DefaultFileItemRepository { - public static final String REPOSITORY = "DentonDoc"; + @Deprecated + public static final String REPOSITORY = DentonDocHandler.REPOSITORY; @Override - public Class getSupportedType() { - return DentonDocument2.class; + public String getRepository() { + return REPOSITORY; } @Override - public String getRepository() { - return REPOSITORY; + public boolean load(WorkspaceItem item) { + return loadFile(item, (DentonDocument o) -> { + item.setElement(o); + item.resetDirty(); + }); } @Override - public boolean save(WorkspaceItem doc) { - DentonDocument2 element = doc.getElement(); + public boolean save(WorkspaceItem item) { + DentonDocument element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); - return super.save(doc); + return storeFile(item, element, item::resetDirty); + } + + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + + @Override + public Class getSupportedType() { + return DentonDocument.class; } } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java index a9bad40..0dd8a64 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonDocumentManager.java @@ -16,7 +16,7 @@ */ package ec.nbdemetra.benchmarking; -import ec.benchmarking.DentonDocument2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.nbdemetra.benchmarking.descriptors.DentonSpecUI; import ec.nbdemetra.benchmarking.ui.DentonViewFactory; import ec.nbdemetra.disaggregation.descriptors.BasicSpecUI; @@ -41,19 +41,19 @@ @ServiceProvider( service = IWorkspaceItemManager.class, position = 1000) -public class DentonDocumentManager extends AbstractWorkspaceItemManager { +public class DentonDocumentManager extends AbstractWorkspaceItemManager { static { CustomPropertyEditorRegistry.INSTANCE.registerEnumEditor(BasicSpecUI.AggregationType.class); - DocumentUIServices.getDefault().register(DentonDocument2.class, new DocumentUIServices.AbstractUIFactory() { + DocumentUIServices.getDefault().register(DentonDocument.class, new DocumentUIServices.AbstractUIFactory() { @Override - public IObjectDescriptor getSpecificationDescriptor(DentonDocument2 document) { + public IObjectDescriptor getSpecificationDescriptor(DentonDocument document) { return new DentonSpecUI(document.getSpecification().clone()); } @Override - public IProcDocumentView getDocumentView(DentonDocument2 document) { + public IProcDocumentView getDocumentView(DentonDocument document) { return DentonViewFactory.getDefault().create(document); } @@ -75,8 +75,8 @@ public Id getId() { } @Override - protected DentonDocument2 createNewObject() { - return new DentonDocument2(); + protected DentonDocument createNewObject() { + return new DentonDocument(); } @Override @@ -99,7 +99,7 @@ public Action getPreferredItemAction(final Id child) { return new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { - WorkspaceItem doc = (WorkspaceItem) WorkspaceFactory.getInstance().getActiveWorkspace().searchDocument(child); + WorkspaceItem doc = (WorkspaceItem) WorkspaceFactory.getInstance().getActiveWorkspace().searchDocument(child); if (doc != null) { openDocument(doc); } @@ -107,7 +107,7 @@ public void actionPerformed(ActionEvent e) { }; } - public void openDocument(WorkspaceItem item) { + public void openDocument(WorkspaceItem item) { if (item.isOpen()) { item.getView().requestActive(); } else { @@ -119,7 +119,7 @@ public void openDocument(WorkspaceItem item) { @Override public Class getItemClass() { - return DentonDocument2.class; + return DentonDocument.class; } @Override diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java index 754fa31..f2472e6 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/DentonTopComponent.java @@ -16,8 +16,7 @@ */ package ec.nbdemetra.benchmarking; -import ec.benchmarking.DentonDocument2; -import ec.nbdemetra.benchmarking.ui.Ts2ProcessingViewer2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.nbdemetra.ws.WorkspaceFactory; import ec.nbdemetra.ws.WorkspaceItem; import ec.nbdemetra.ws.ui.WorkspaceTopComponent; @@ -49,16 +48,16 @@ "CTL_DentonTopComponent=Denton Window", "HINT_DentonTopComponent=This is a Denton window" }) -public final class DentonTopComponent extends WorkspaceTopComponent { +public final class DentonTopComponent extends WorkspaceTopComponent { - protected Ts2ProcessingViewer2 panel; + protected Ts2ProcessingViewer panel; public DentonTopComponent() { super(null); //initDocument(); } - public DentonTopComponent(WorkspaceItem doc) { + public DentonTopComponent(WorkspaceItem doc) { super(doc); initDocument(); } @@ -67,7 +66,7 @@ public void initDocument() { setName(getDocument().getDisplayName()); setToolTipText(Bundle.CTL_CholetteTopComponent()); initComponents(); - panel = Ts2ProcessingViewer2.create(this.getDocument().getElement(), "Series", "Constraint"); + panel = Ts2ProcessingViewer.create(this.getDocument().getElement(), "Series", "Constraint"); add(panel); } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java index f59e9fb..1c25073 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocFileRepository.java @@ -18,25 +18,48 @@ import ec.nbdemetra.ws.DefaultFileItemRepository; import ec.nbdemetra.ws.IWorkspaceItemRepository; +import ec.nbdemetra.ws.WorkspaceItem; import ec.tss.disaggregation.documents.MultiCholetteDocument; +import internal.workspace.file.MultiCholetteDocHandler; import org.openide.util.lookup.ServiceProvider; /** * * @author Jean Palate - */@ServiceProvider(service = IWorkspaceItemRepository.class) -public class MultiCholetteDocFileRepository extends DefaultFileItemRepository{ + */ +@ServiceProvider(service = IWorkspaceItemRepository.class) +public class MultiCholetteDocFileRepository extends DefaultFileItemRepository { + + @Deprecated + public static final String REPOSITORY = MultiCholetteDocHandler.REPOSITORY; - public static final String REPOSITORY = "MultiCholetteDoc"; - - @Override + @Override public String getRepository() { return REPOSITORY; } + @Override + public boolean load(WorkspaceItem item) { + return loadFile(item, (MultiCholetteDocument o) -> { + item.setElement(o); + item.resetDirty(); + }); + } + + @Override + public boolean save(WorkspaceItem item) { + MultiCholetteDocument element = item.getElement(); +// element.getMetaData().put(MetaData.DATE, new Date().toString()); + return storeFile(item, element, item::resetDirty); + } + + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + @Override public Class getSupportedType() { return MultiCholetteDocument.class; } } - diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocumentManager.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocumentManager.java index 1a0deb8..223153c 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocumentManager.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/MultiCholetteDocumentManager.java @@ -23,6 +23,7 @@ import ec.tss.disaggregation.documents.MultiCholetteDocument; import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.LinearId; +import internal.workspace.file.MultiCholetteDocHandler; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; @@ -36,7 +37,7 @@ */ @ServiceProvider( service = IWorkspaceItemManager.class, -position = 3000) + position = 3000) public class MultiCholetteDocumentManager extends AbstractWorkspaceItemManager { // static { @@ -57,8 +58,7 @@ public class MultiCholetteDocumentManager extends AbstractWorkspaceItemManager ndoc = mgr.create(ws); + WorkspaceItem ndoc = mgr.create(ws); mgr.openDocument(ndoc); } } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/DentonNewDocument.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/DentonNewDocument.java index 5c999c1..aace589 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/DentonNewDocument.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/actions/DentonNewDocument.java @@ -16,7 +16,7 @@ */ package ec.nbdemetra.benchmarking.actions; -import ec.benchmarking.DentonDocument2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.nbdemetra.benchmarking.DentonDocumentManager; import ec.nbdemetra.ws.Workspace; import ec.nbdemetra.ws.WorkspaceFactory; @@ -47,7 +47,7 @@ public void actionPerformed(ActionEvent e) { DentonDocumentManager mgr = WorkspaceFactory.getInstance().getManager(DentonDocumentManager.class); if (mgr != null) { Workspace ws = WorkspaceFactory.getInstance().getActiveWorkspace(); - WorkspaceItem ndoc = mgr.create(ws); + WorkspaceItem ndoc = mgr.create(ws); mgr.openDocument(ndoc); } } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/CholetteViewFactory.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/CholetteViewFactory.java index 0c83652..40ec565 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/CholetteViewFactory.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/CholetteViewFactory.java @@ -17,7 +17,7 @@ package ec.nbdemetra.benchmarking.ui; import ec.tss.disaggregation.documents.BenchmarkingResults; -import ec.benchmarking.CholetteDocument2; +import ec.tss.disaggregation.documents.CholetteDocument; import ec.tstoolkit.utilities.DefaultInformationExtractor; import ec.tstoolkit.utilities.Id; import ec.tstoolkit.utilities.InformationExtractor; @@ -35,19 +35,19 @@ * * @author Jean Palate */ -public class CholetteViewFactory extends ProcDocumentViewFactory { +public class CholetteViewFactory extends ProcDocumentViewFactory { public static final String INPUT = "Input", RESULTS = "Results"; public static final Id RESULTS_MAIN = new LinearId(RESULTS); - private static final IProcDocumentViewFactory INSTANCE = new CholetteViewFactory(); + private static final IProcDocumentViewFactory INSTANCE = new CholetteViewFactory(); - public static IProcDocumentViewFactory getDefault() { + public static IProcDocumentViewFactory getDefault() { return INSTANCE; } private CholetteViewFactory() { - registerFromLookup(CholetteDocument2.class); + registerFromLookup(CholetteDocument.class); } @Override @@ -55,20 +55,20 @@ public Id getPreferredView() { return RESULTS_MAIN; //To change body of generated methods, choose Tools | Templates. } - private static class CholetteExtractor extends DefaultInformationExtractor { + private static class CholetteExtractor extends DefaultInformationExtractor { static final CholetteExtractor INSTANCE = new CholetteExtractor(); @Override - public BenchmarkingResults retrieve(CholetteDocument2 source) { + public BenchmarkingResults retrieve(CholetteDocument source) { return source.getResults(); } }; - private static class ItemFactory extends ComposedProcDocumentItemFactory { + private static class ItemFactory extends ComposedProcDocumentItemFactory { - public ItemFactory(Id itemId, InformationExtractor informationExtractor, ItemUI, I> itemUI) { - super(CholetteDocument2.class, itemId, informationExtractor, itemUI); + public ItemFactory(Id itemId, InformationExtractor informationExtractor, ItemUI, I> itemUI) { + super(CholetteDocument.class, itemId, informationExtractor, itemUI); } } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/DentonViewFactory.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/DentonViewFactory.java index 03078c1..59942e5 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/DentonViewFactory.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/DentonViewFactory.java @@ -16,7 +16,7 @@ */ package ec.nbdemetra.benchmarking.ui; -import ec.benchmarking.DentonDocument2; +import ec.tss.disaggregation.documents.DentonDocument; import ec.tss.disaggregation.documents.BenchmarkingResults; import ec.tstoolkit.utilities.DefaultInformationExtractor; import ec.tstoolkit.utilities.Id; @@ -35,19 +35,19 @@ * * @author Jean Palate */ -public class DentonViewFactory extends ProcDocumentViewFactory { +public class DentonViewFactory extends ProcDocumentViewFactory { public static final String INPUT = "Input", RESULTS = "Results"; public static final Id RESULTS_MAIN = new LinearId(RESULTS); - private static final IProcDocumentViewFactory INSTANCE = new DentonViewFactory(); + private static final IProcDocumentViewFactory INSTANCE = new DentonViewFactory(); - public static IProcDocumentViewFactory getDefault() { + public static IProcDocumentViewFactory getDefault() { return INSTANCE; } private DentonViewFactory() { - registerFromLookup(DentonDocument2.class); + registerFromLookup(DentonDocument.class); } @Override @@ -55,20 +55,20 @@ public Id getPreferredView() { return RESULTS_MAIN; //To change body of generated methods, choose Tools | Templates. } - private static class DentonExtractor extends DefaultInformationExtractor { + private static class DentonExtractor extends DefaultInformationExtractor { static final DentonExtractor INSTANCE = new DentonExtractor(); @Override - public BenchmarkingResults retrieve(DentonDocument2 source) { + public BenchmarkingResults retrieve(DentonDocument source) { return source.getResults(); } }; - private static class ItemFactory extends ComposedProcDocumentItemFactory { + private static class ItemFactory extends ComposedProcDocumentItemFactory { - public ItemFactory(Id itemId, InformationExtractor informationExtractor, ItemUI, I> itemUI) { - super(DentonDocument2.class, itemId, informationExtractor, itemUI); + public ItemFactory(Id itemId, InformationExtractor informationExtractor, ItemUI, I> itemUI) { + super(DentonDocument.class, itemId, informationExtractor, itemUI); } } diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/Ts2ProcessingViewer2.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/Ts2ProcessingViewer2.java deleted file mode 100644 index e3090d2..0000000 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/benchmarking/ui/Ts2ProcessingViewer2.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package ec.nbdemetra.benchmarking.ui; - -import ec.benchmarking.MultiTsDocument2; -import ec.nbdemetra.ui.MonikerUI; -import ec.tss.Ts; -import ec.tss.TsMoniker; -import ec.tss.datatransfer.TssTransferSupport; -import ec.tss.documents.MultiTsDocument; -import ec.tstoolkit.algorithm.IProcSpecification; -import ec.ui.view.tsprocessing.DefaultProcessingViewer; -import java.awt.Font; -import javax.swing.Box; -import javax.swing.JLabel; -import javax.swing.JToolBar; -import javax.swing.TransferHandler; - -/** - * - * @author Jean Palate - */ -public class Ts2ProcessingViewer2 extends DefaultProcessingViewer { - - // FACTORY METHODS > - public static Ts2ProcessingViewer2 create(MultiTsDocument2 doc, String y, String z) { - Ts2ProcessingViewer2 viewer = new Ts2ProcessingViewer2(Type.APPLY, y, z); - if (doc != null) { - viewer.setDocument(doc); - } - return viewer; - } - // < FACTORY METHODS - // CONSTANTS - private static final Font DROP_DATA_FONT = new JLabel().getFont().deriveFont(Font.ITALIC); - // visual components - private final JLabel dropDataLabely, dropDataLabelz; - private final JLabel tsLabely, tsLabelz; - private final JLabel specLabel; - - public Ts2ProcessingViewer2(Type type, String y, String z) { - super(type); - this.dropDataLabely = new JLabel("Drop " + y + " here"); - this.dropDataLabelz = new JLabel("Drop " + z + " here"); - dropDataLabely.setFont(DROP_DATA_FONT); - dropDataLabelz.setFont(DROP_DATA_FONT); - this.tsLabely = new JLabel(y); - tsLabely.setVisible(false); - this.tsLabelz = new JLabel(z); - tsLabelz.setVisible(false); - this.specLabel = new JLabel("Spec: "); - specLabel.setVisible(false); - - toolBar.add(Box.createHorizontalStrut(3), 0); - toolBar.add(dropDataLabely, 1); - toolBar.add(tsLabely, 2); - toolBar.add(new JToolBar.Separator(), 3); - toolBar.add(dropDataLabelz, 4); - toolBar.add(tsLabelz, 5); - toolBar.add(new JToolBar.Separator(), 6); - toolBar.add(specLabel, 7); - - TsHandler hy = new TsHandler(0); - TsHandler hz = new TsHandler(1); - tsLabely.setTransferHandler(hy); - dropDataLabely.setTransferHandler(hy); - tsLabelz.setTransferHandler(hz); - dropDataLabelz.setTransferHandler(hz); - } - - @Override - public void refreshHeader() { - MultiTsDocument2 doc = getDocument(); - if (doc == null) { - return; - } - Ts[] input = (Ts[]) doc.getInput(); - if (input == null || input[0] == null) { - dropDataLabely.setVisible(true); - tsLabely.setVisible(false); - } else { - dropDataLabely.setVisible(false); - TsMoniker monikery = input[0].getMoniker(); - tsLabely.setIcon(MonikerUI.getDefault().getIcon(monikery)); - tsLabely.setToolTipText(tsLabely.getText() + (monikery.getSource() != null ? (" (" + monikery.getSource() + ")") : "")); - tsLabely.setVisible(true); - } - if (input == null || input[1] == null) { - dropDataLabelz.setVisible(true); - tsLabelz.setVisible(false); - } else { - dropDataLabelz.setVisible(false); - TsMoniker monikerz = input[1].getMoniker(); - tsLabelz.setIcon(MonikerUI.getDefault().getIcon(monikerz)); - tsLabelz.setToolTipText(tsLabelz.getText() + (monikerz.getSource() != null ? (" (" + monikerz.getSource() + ")") : "")); - tsLabelz.setVisible(true); - } - if (input != null) { - IProcSpecification spec = doc.getSpecification(); - specLabel.setText("Spec: " + (spec != null ? spec.toString() : "")); - specLabel.setVisible(true); - } else { - specLabel.setVisible(false); - } - this.toolBar.doLayout(); - - } - - class TsHandler extends TransferHandler { - - private final int pos; - - TsHandler(int pos) { - this.pos = pos; - } - - @Override - public boolean canImport(TransferSupport support) { - return TssTransferSupport.getDefault().canImport(support.getDataFlavors()); - } - - @Override - public boolean importData(TransferHandler.TransferSupport support) { - Ts ts = TssTransferSupport.getDefault().toTs(support.getTransferable()); - if (ts != null) { - Ts[] input = (Ts[]) getDocument().getInput(); - if (input == null) { - input = new Ts[2]; - }else - input=input.clone(); - input[pos] = ts; - getDocument().setInput(input); - refreshAll(); - return true; - } - return false; - } - } -} diff --git a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelDocFileRepository.java b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelDocFileRepository.java index 2877faa..e6d45e8 100644 --- a/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelDocFileRepository.java +++ b/nbdemetra-benchmarking/src/main/java/ec/nbdemetra/disaggregation/TsDisaggregationModelDocFileRepository.java @@ -21,6 +21,7 @@ import ec.nbdemetra.ws.WorkspaceItem; import ec.tss.disaggregation.documents.TsDisaggregationModelDocument; import ec.tstoolkit.MetaData; +import internal.workspace.file.TsDisaggregationDocHandler; import java.util.Date; import org.openide.util.lookup.ServiceProvider; @@ -31,22 +32,36 @@ @ServiceProvider(service = IWorkspaceItemRepository.class) public final class TsDisaggregationModelDocFileRepository extends DefaultFileItemRepository { - public static final String REPOSITORY = "TsDisaggregationDoc"; + @Deprecated + public static final String REPOSITORY = TsDisaggregationDocHandler.REPOSITORY; @Override - public Class getSupportedType() { - return TsDisaggregationModelDocument.class; + public String getRepository() { + return REPOSITORY; } @Override - public String getRepository() { - return REPOSITORY; + public boolean load(WorkspaceItem item) { + return loadFile(item, (TsDisaggregationModelDocument o) -> { + item.setElement(o); + item.resetDirty(); + }); } @Override - public boolean save(WorkspaceItem doc) { - TsDisaggregationModelDocument element = doc.getElement(); + public boolean save(WorkspaceItem item) { + TsDisaggregationModelDocument element = item.getElement(); element.getMetaData().put(MetaData.DATE, new Date().toString()); - return super.save(doc); + return storeFile(item, element, item::resetDirty); + } + + @Override + public boolean delete(WorkspaceItem doc) { + return deleteFile(doc); + } + + @Override + public Class getSupportedType() { + return TsDisaggregationModelDocument.class; } } diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CalendarizationDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CalendarizationDocHandler.java new file mode 100644 index 0000000..1c86a6c --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CalendarizationDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 National Bank of Belgium + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved + * by the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * + * http://ec.europa.eu/idabc/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package internal.workspace.file; + +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.CalendarizationDocument; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class CalendarizationDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Benchmarking", "Calendarization"); + public static final String REPOSITORY = "CalendarizationDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(CalendarizationDocument::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +} diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java new file mode 100644 index 0000000..b801f85 --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/CholetteDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 National Bank of Belgium + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved + * by the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * + * http://ec.europa.eu/idabc/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package internal.workspace.file; + +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.CholetteDocument; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class CholetteDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Benchmarking", "Univariate", "Cholette"); + public static final String REPOSITORY = "CholetteDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(CholetteDocument::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +} diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java new file mode 100644 index 0000000..68c12c9 --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/DentonDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 National Bank of Belgium + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved + * by the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * + * http://ec.europa.eu/idabc/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package internal.workspace.file; + +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.DentonDocument; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class DentonDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Benchmarking", "Univariate", "Denton"); + public static final String REPOSITORY = "DentonDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(DentonDocument::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +} diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/MultiCholetteDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/MultiCholetteDocHandler.java new file mode 100644 index 0000000..2003819 --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/MultiCholetteDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 National Bank of Belgium + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved + * by the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * + * http://ec.europa.eu/idabc/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package internal.workspace.file; + +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.MultiCholetteDocument; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class MultiCholetteDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Benchmarking", "Multivariate", "Cholette"); + public static final String REPOSITORY = "MultiCholetteDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(MultiCholetteDocument::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +} diff --git a/nbdemetra-benchmarking/src/main/java/internal/workspace/file/TsDisaggregationDocHandler.java b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/TsDisaggregationDocHandler.java new file mode 100644 index 0000000..8c60672 --- /dev/null +++ b/nbdemetra-benchmarking/src/main/java/internal/workspace/file/TsDisaggregationDocHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 National Bank of Belgium + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved + * by the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * + * http://ec.europa.eu/idabc/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package internal.workspace.file; + +import ec.demetra.workspace.WorkspaceFamily; +import ec.demetra.workspace.file.FileFormat; +import ec.demetra.workspace.file.spi.FamilyHandler; +import ec.demetra.workspace.file.util.InformationSetSupport; +import ec.tss.disaggregation.documents.TsDisaggregationModelDocument; +import ec.tstoolkit.utilities.LinearId; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Philippe Charles + */ +@ServiceProvider(service = FamilyHandler.class) +public final class TsDisaggregationDocHandler implements FamilyHandler { + + public static final LinearId FAMILY = new LinearId("Temporal disaggregation", "Regression model"); + public static final String REPOSITORY = "TsDisaggregationDoc"; + + @lombok.experimental.Delegate + private final FamilyHandler delegate = InformationSetSupport + .of(TsDisaggregationModelDocument::new, REPOSITORY) + .asHandler(WorkspaceFamily.of(FAMILY), FileFormat.GENERIC); +}