Java Code Examples for com.gs.fw.common.mithra.attribute.Attribute#equals()
The following examples show how to use
com.gs.fw.common.mithra.attribute.Attribute#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DbExtractor.java From reladomo with Apache License 2.0 | 6 votes |
private static Attribute[] getPrimaryKeyAttributesWithNoSource(RelatedFinder finder) { Attribute sourceAttribute = finder.getSourceAttribute(); Attribute[] primaryKeyAttributes = finder.getPrimaryKeyAttributes(); if (sourceAttribute == null) { return primaryKeyAttributes; } int sourceLength = sourceAttribute == null ? 0 : 1; Attribute[] attributes = new Attribute[primaryKeyAttributes.length - sourceLength]; int index = 0; for (Attribute pkAttr : primaryKeyAttributes) { if (!pkAttr.equals(sourceAttribute)) { attributes[index++] = pkAttr; } } return attributes; }
Example 2
Source File: DeepFetchNode.java From reladomo with Apache License 2.0 | 6 votes |
@Override public int compare(Attribute o1, Attribute o2) { if (o1.equals(o2)) { return 0; } int leftRank = o1.isAsOfAttribute() ? 100 : 0; int rightRank = o2.isAsOfAttribute() ? 100 : 0; if (leftRank == rightRank) { return o1.getAttributeName().compareTo(o2.getAttributeName()); } else { return leftRank - rightRank; } }
Example 3
Source File: AbstractDatedCache.java From reladomo with Apache License 2.0 | 5 votes |
private boolean isImmutableAttribute(Attribute attribute) { for (int i = 0; i < this.immutableAttributes.length; i++) { if (attribute.equals(this.immutableAttributes[i])) { return true; } } return false; }
Example 4
Source File: AbstractDatedCache.java From reladomo with Apache License 2.0 | 5 votes |
public IndexReference getIndexRef(Attribute attribute) { if (this.asOfAttributes.length == 1 && attribute.equals(this.asOfAttributes[0])) { return this.asOfProxyReference; } return this.noIndexReference; }
Example 5
Source File: AbstractNonDatedCache.java From reladomo with Apache License 2.0 | 5 votes |
private boolean isImmutableAttribute(Attribute attribute) { for (int i = 0; i < this.immutableAttributes.length; i++) { if (attribute.equals(this.immutableAttributes[i])) { return true; } } return false; }
Example 6
Source File: DbExtractor.java From reladomo with Apache License 2.0 | 5 votes |
private static Attribute[] getSourcelessPrimaryKeyWithFromAttributes(RelatedFinder finder) { AsOfAttribute[] asOfAttributes = finder.getAsOfAttributes(); Attribute sourceAttribute = finder.getSourceAttribute(); Attribute[] primaryKeyAttributes = finder.getPrimaryKeyAttributes(); if (asOfAttributes == null && sourceAttribute == null) { return primaryKeyAttributes; } int asOfLength = asOfAttributes == null ? 0 : asOfAttributes.length; int sourceLength = sourceAttribute == null ? 0 : 1; Attribute[] attributes = new Attribute[primaryKeyAttributes.length + asOfLength - sourceLength]; int index = 0; for (Attribute pkAttr : primaryKeyAttributes) { if (!pkAttr.equals(sourceAttribute)) { attributes[index++] = pkAttr; } } if (asOfAttributes != null) { for (AsOfAttribute asOfAttr : asOfAttributes) { attributes[index++] = asOfAttr.getFromAttribute(); } } return attributes; }
Example 7
Source File: MultiInOperation.java From reladomo with Apache License 2.0 | 5 votes |
protected int getAttributeIndex(Attribute attribute) { for (int i = 0; i < attributes.length; i++) { if (attribute.equals(attributes[i])) { return i; } } return -1; }
Example 8
Source File: MultiEqualityMapper.java From reladomo with Apache License 2.0 | 5 votes |
private boolean containedInArray(Attribute[] indexAttributes, Attribute right) { for(Attribute a: indexAttributes) { if (a.equals(right)) { return true; } } return false; }
Example 9
Source File: EqualityMapper.java From reladomo with Apache License 2.0 | 5 votes |
@Override public void clearLeftOverFromObjectCache(Collection<Object> parentObjects, EqualityOperation extraEqOp, Operation extraOperation) { MithraFastList attrList = new MithraFastList(2); attrList.add(this.getRight()); if (extraEqOp != null) { extraEqOp.addEqAttributes(attrList); } Cache cache = ((Attribute)attrList.get(0)).getOwnerPortal().getCache(); IndexReference bestIndexReference = cache.getBestIndexReference(attrList); if (bestIndexReference != null && bestIndexReference.isValid() && cache.isUnique(bestIndexReference.indexReference)) { Attribute[] indexAttributes = cache.getIndexAttributes(bestIndexReference.indexReference); List<Extractor> extractors = new MithraFastList<Extractor>(indexAttributes.length); Operation localExtraOperation = extraOperation; if (indexAttributes.length != attrList.size()) { localExtraOperation = localExtraOperation == null ? extraEqOp : extraEqOp.and(localExtraOperation); } for (Attribute a : indexAttributes) { if (a.equals(this.getRight())) { extractors.add(this.getLeft()); } else { extractors.add(extraEqOp.getParameterExtractorFor(a)); } } cache.markNonExistent(bestIndexReference.indexReference, parentObjects, extractors, null, localExtraOperation); } }
Example 10
Source File: TupleTempContext.java From reladomo with Apache License 2.0 | 5 votes |
public Map<Attribute, Attribute> getPrototypeToTupleAttributeMap() { Map<Attribute, Attribute> result = new UnifiedMap<Attribute, Attribute>(this.persistentTupleAttributes.length); Attribute prototypeSourceAttribute = prototypeAttributes[0].getSourceAttribute(); int pos = 0; for(Attribute protoAttr: prototypeAttributes) { if (!protoAttr.equals(prototypeSourceAttribute)) { result.put(protoAttr, (Attribute)persistentTupleAttributes[pos++]); } } return result; }
Example 11
Source File: EqualityMapper.java From reladomo with Apache License 2.0 | 4 votes |
public Attribute getDeepestEqualAttribute(Attribute attribute) { if (attribute.equals(this.left)) return this.right; return null; }