
sdmx.net.DoubleRegistry Maven / Gradle / Ivy
The newest version!
/*
This file is part of sdmx-sax.
Copyright 2015 James Stanley Gardner
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
package sdmx.net;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import sdmx.Registry;
import sdmx.common.TextOperatorType;
import sdmx.commonreferences.CodeReference;
import sdmx.commonreferences.CodelistReference;
import sdmx.commonreferences.ConceptReference;
import sdmx.commonreferences.ConceptSchemeReference;
import sdmx.commonreferences.DataStructureReference;
import sdmx.commonreferences.DataflowReference;
import sdmx.commonreferences.IDType;
import sdmx.commonreferences.ItemReference;
import sdmx.commonreferences.ItemSchemeReference;
import sdmx.commonreferences.ItemSchemeReferenceBase;
import sdmx.commonreferences.NestedID;
import sdmx.commonreferences.NestedNCNameID;
import sdmx.commonreferences.StructureReference;
import sdmx.commonreferences.VersionQuery;
import sdmx.commonreferences.Version;
import sdmx.exception.QueryableException;
import sdmx.message.BaseHeaderType;
import sdmx.message.DataMessage;
import sdmx.message.DataQueryMessage;
import sdmx.message.DataStructureQueryMessage;
import sdmx.message.HeaderTimeType;
import sdmx.message.PartyType;
import sdmx.message.SenderType;
import sdmx.message.StructureType;
import sdmx.query.base.QueryIDType;
import sdmx.query.base.QueryNestedIDType;
import sdmx.query.datastructure.DataStructureWhereType;
import sdmx.structure.base.ItemSchemeType;
import sdmx.structure.base.ItemType;
import sdmx.structure.base.MaintainableType;
import sdmx.structure.codelist.CodeType;
import sdmx.structure.codelist.CodelistType;
import sdmx.structure.concept.ConceptSchemeType;
import sdmx.structure.concept.ConceptType;
import sdmx.structure.dataflow.DataflowType;
import sdmx.structure.datastructure.DataStructureType;
import sdmx.xml.DateTime;
public class DoubleRegistry implements Registry {
Registry left = LocalRegistry.getDefaultWorkspace();
Registry right = LocalRegistry.getDefaultWorkspace();
public DoubleRegistry(Registry left, Registry right) {
this.left = left;
this.right=right;
Logger.getLogger("sdmx").fine("DoubleRegistry:left="+left.getClass());
Logger.getLogger("sdmx").fine("DoubleRegistry:right="+right.getClass());
}
public void load(StructureType struct) {
left.load(struct);
}
public void unload(StructureType struct) {
left.unload(struct);
}
@Override
public List listDataflows() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void clear() {
left.clear();
right.clear();
}
@Override
public DataStructureType find(DataStructureReference ref) {
Logger.getLogger("sdmx").log(Level.FINE,"DoubleRegistry:find(DataStructureReference-"+ref.toString());
DataStructureType dst = left.find(ref);
if( dst==null ) {
return right.find(ref);
}
return dst;
}
@Override
public DataflowType find(DataflowReference ref) {
Logger.getLogger("sdmx").log(Level.FINE,"DoubleRegistry:find(DataflowReference-"+ref.toString());
DataflowType dst = left.find(ref);
if( dst==null ) {
return right.find(ref);
}
return dst;
}
@Override
public CodeType find(CodeReference ref) {
Logger.getLogger("sdmx").log(Level.FINE,"DoubleRegistry:find(CodeReference-"+ref.toString());
CodeType dst = left.find(ref);
if( dst==null ) {
return right.find(ref);
}
return dst;
}
@Override
public CodelistType find(CodelistReference ref) {
Logger.getLogger("sdmx").log(Level.FINE,"DoubleRegistry:find(CodelistReference-"+ref.toString());
CodelistType dst = left.find(ref);
if( dst==null ) {
return right.find(ref);
}
return dst;
}
@Override
public ConceptType find(ConceptReference ref) {
Logger.getLogger("sdmx").log(Level.FINE,"DoubleRegistry:find(ConceptReference-"+ref.toString());
ConceptType dst = left.find(ref);
if( dst==null ) {
return right.find(ref);
}
return dst;
}
@Override
public ConceptSchemeType find(ConceptSchemeReference ref) {
Logger.getLogger("sdmx").log(Level.FINE,"DoubleRegistry:find(ConceptSchemeReference-"+ref.toString());
ConceptSchemeType dst = left.find(ref);
if( dst==null ) {
return right.find(ref);
}
return dst;
}
@Override
public ItemType find(ItemReference ref) {
ConceptType concept = find(ConceptReference.create(ref.getAgencyId(), ref.getMaintainableParentId(), ref.getVersion(), ref.getId()));
if( concept!=null) return concept;
CodeType code = find(CodeReference.create(ref.getAgencyId(),ref.getMaintainableParentId(), ref.getVersion(), ref.getId()));
return code;
}
@Override
public ItemSchemeType find(ItemSchemeReferenceBase ref) {
ConceptSchemeType concept = find(ConceptSchemeReference.create(ref.getAgencyId(), ref.getMaintainableParentId(), ref.getVersion()));
if( concept!=null) return concept;
CodelistType code = find(CodelistReference.create(ref.getAgencyId(),ref.getMaintainableParentId(), ref.getVersion()));
return code;
}
@Override
public void save(OutputStream out) throws IOException {
left.save(out);
}
public void merge(){}
@Override
public List search(DataStructureReference ref) {
return Collections.EMPTY_LIST;
}
@Override
public List search(DataflowReference ref) {
return Collections.EMPTY_LIST;
}
@Override
public List search(CodeReference ref) {
return Collections.EMPTY_LIST;
}
@Override
public List search(CodelistReference ref) {
return Collections.EMPTY_LIST;
}
@Override
public List search(ItemReference ref) {
return Collections.EMPTY_LIST;
}
@Override
public List search(ItemSchemeReferenceBase ref) {
return Collections.EMPTY_LIST;
}
@Override
public List search(ConceptReference ref) {
return Collections.EMPTY_LIST;
}
@Override
public List search(ConceptSchemeReference ref) {
return Collections.EMPTY_LIST;
}
public List getCache(){
List result = new ArrayList();
result.addAll(left.getCache());
result.addAll(right.getCache());
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy