![JAR search and dependency download from the Maven repository](/logo.png)
com.gs.fw.common.mithra.finder.RelationshipMultiExtractor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reladomo Show documentation
Show all versions of reladomo Show documentation
Reladomo is an object-relational mapping framework.
/*
Copyright 2016 Goldman Sachs.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package com.gs.fw.common.mithra.finder;
import com.gs.collections.impl.list.mutable.FastList;
import com.gs.fw.common.mithra.MithraObjectPortal;
import com.gs.fw.common.mithra.attribute.Attribute;
import com.gs.fw.common.mithra.cache.Cache;
import com.gs.fw.common.mithra.cache.IndexReference;
import com.gs.fw.common.mithra.extractor.Extractor;
import java.io.Serializable;
import java.util.List;
public class RelationshipMultiExtractor
{
private List leftAttributes;
private List extractors;
private Extractor[] extractorArray;
private volatile IndexReference bestIndexRef;
private volatile UpdateCountHolder[] updateCountHolders;
private volatile int[] originalValues;
public RelationshipMultiExtractor(List leftAttributes, List extractors)
{
this.leftAttributes = leftAttributes;
this.extractors = extractors;
this.extractorArray = extractors.toArray(new Extractor[extractors.size()]);
}
public List getLeftAttributes()
{
return leftAttributes;
}
public IndexReference getBestIndexRef(Cache cache)
{
IndexReference localRef = this.bestIndexRef;
if (localRef == null)
{
localRef = cache.getBestIndexReference(this.getLeftAttributes());
this.bestIndexRef = localRef;
}
else if (!localRef.isForCache(cache))
{
this.updateCountHolders = createUpdateCountHolders();
localRef = cache.getBestIndexReference(this.getLeftAttributes());
this.bestIndexRef = localRef;
}
return localRef;
}
public Extractor[] getExtractorArray()
{
return extractorArray;
}
public List getExtractors()
{
return extractors;
}
public int[] getUpdateCountValues()
{
int[] currentValues = this.originalValues;
if (expired(currentValues))
{
currentValues = createCurrentUpdateCounts();
this.originalValues = currentValues;
}
return currentValues;
}
private boolean expired(int[] old)
{
if (old == null)
{
return true;
}
UpdateCountHolder[] countHolders = this.updateCountHolders;
if (countHolders == null)
{
return true;
}
for(int i=0;i leftAttributes;
public RelationshipMultiExtractorBuilder(Attribute... leftAttributes)
{
this.leftAttributes = FastList.newListWith(leftAttributes);
}
public RelationshipMultiExtractor withExtractors(Extractor... extractors)
{
return new RelationshipMultiExtractor(leftAttributes, FastList.newListWith(extractors));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy