Java Code Examples for com.gs.fw.common.mithra.attribute.Attribute#isAttributeNull()

The following examples show how to use com.gs.fw.common.mithra.attribute.Attribute#isAttributeNull() . 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: ColumnarOutStream.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public BitsInBytes encodeColumnarNull(List data, SingleColumnAttribute attr) throws IOException
{
    BitsInBytes result = null;
    Attribute a = (Attribute) attr;
    for(int i=0;i<data.size();i++)
    {
        if (a.isAttributeNull(data.get(i)))
        {
            if (result == null)
            {
                result = new BitsInBytes(data.size());
            }
            result.set(i);
        }
    }
    if (result == null)
    {
        out.write(0);
    }
    else
    {
        out.write(1);
        result.writeToOutputStream(out);
    }
    return result;
}
 
Example 2
Source File: MultiEqualityMapper.java    From reladomo with Apache License 2.0 6 votes vote down vote up
private Operation getAndOperation(Object target)
{
    Operation first = getMultiEqualityOperationForSize(target, this.mappedIndex);
    Operation second = NoOperation.instance();
    for(int i=this.mappedIndex;i< this.equalityMappers.size();i++)
    {
        EqualityMapper mapper = ((EqualityMapper)this.equalityMappers.get(i));
        Attribute right = mapper.getRight();
        if (right.isAttributeNull(target))
        {
            return new None(mapper.getLeft());
        }
        second = second.and(mapper.getLeft().nonPrimitiveEq(right.valueOf(target)));
    }
    return first.and(second);
}
 
Example 3
Source File: MultiUpdateOperation.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private StringBuffer createFirstPartSingleKeySql(String fullyQualifiedTableName)
{
    StringBuffer buf = new StringBuffer(30 + this.updates.size()*20 + singleValuedPrimaryKeys.size() * 20);
    buf.append("update ");
    buf.append(fullyQualifiedTableName);
    buf.append(" set ");
    for(int i=0;i<updates.size();i++)
    {
        AttributeUpdateWrapper upd = updates.get(i);
        if (i > 0) buf.append(", ");
        buf.append(upd.getSetAttributeSql());
    }
    buf.append(" where ");
    if (this.versionAttribute != null)
    {
        buf.append((this.versionAttribute).getColumnName());
        buf.append(" = ? ");
        buf.append(" and ");
    }
    for(int i=0;i<this.singleValuedPrimaryKeys.size();)
    {
        Attribute attr = (Attribute) singleValuedPrimaryKeys.get(i);
        buf.append(attr.getColumnName());
        if (attr.isAttributeNull(this.dataObjects[0]))
        {
            buf.append(" IS NULL ");
            this.singleValuedPrimaryKeys.remove(i);
        }
        else
        {
            buf.append(" = ? ");
            i++;
        }
        buf.append(" and ");
    }
    return buf;
}
 
Example 4
Source File: MultiEqualityMapper.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private Operation getMultiEqualityOperationForSize(Object target, int size)
{
    AtomicOperation[] newOperations = new AtomicOperation[size];
    for(int i=0;i< size;i++)
    {
        EqualityMapper mapper = ((EqualityMapper)this.equalityMappers.get(i));
        Attribute right = mapper.getRight();
        if (right.isAttributeNull(target))
        {
            return new None(mapper.getLeft());
        }
        newOperations[i] = (AtomicOperation) mapper.getLeft().nonPrimitiveEq(right.valueOf(target));
    }
    return new MultiEqualityOperation(newOperations);
}
 
Example 5
Source File: DeepFetchNode.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private boolean isNullConstant(UnifiedSet<Attribute> constantSet, List resolvedBySourceList)
{
    if (constantSet.isEmpty()) return false;
    Object one = resolvedBySourceList.get(0);
    for(Attribute a: constantSet)
    {
        if (a.isAttributeNull(one))
        {
            return true;
        }
    }
    return false;
}
 
Example 6
Source File: DeepFetchNode.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private List filterParentWithNullsOrFilters(Attribute[] arrayAttributes, List parentList)
{
    List result = null;
    for(int i=0;i<parentList.size();i++)
    {
        Object o = parentList.get(i);
        boolean mustFilter = false;
        for (Attribute a : arrayAttributes)
        {
            mustFilter = a.isAttributeNull(o);
            if (mustFilter)
            {
                if (result == null)
                {
                    result = FastList.newList(parentList.size());
                    result.addAll(parentList.subList(0, i));
                }
                break;
            }
        }
        if (!mustFilter && result != null)
        {
            result.add(o);
        }
    }
    return result == null ? parentList : result;
}