Examples of ColumnImpl


Examples of com.force.sdk.jpa.table.ColumnImpl

        if (ammd.getEmbeddedMetaData() != null) {
            // we need to add all the embedded fields
            storeEmbeddedFields(ammd, value);
            return;
        }
        ColumnImpl column = table.getColumnFor(objectProvider.getClassMetaData(), ammd);
        if (column == null || column.getField() == null || !column.getField().isCreateable()) return;
        Object actualValue = value;
        String actualFieldName = column.getFieldName();
        try {
            switch (column.getType()) {
            case datetime:
                if (value instanceof Date) {
                    ColumnMetaData[] cmds = ammd.getColumnMetaData();
                    Calendar cal = Calendar.getInstance();
                    cal.setTime((Date) value);
                    if (cmds != null && cmds.length > 0 && "TIME".equals(cmds[0].getJdbcType())) {
                        actualValue = new Time(cal);
                    } else {
                        actualValue = cal;
                    }
                } else if (value instanceof Time) {
                    actualValue = value;
                }
                break;
            case currency:
                actualValue = value.toString();
                break;
            case reference:
                AbstractClassMetaData acmd =
                    storeManager.getMetaDataManager().getMetaDataForClass(ammd.getType(),
                                                        objectProvider.getExecutionContext().getClassLoaderResolver());
                if (acmd != null) {
                    actualValue = PersistenceUtils.getMemberValue(acmd, acmd.getPKMemberPositions()[0], value);
                    if (actualValue == null) {
                        ObjectManager om = ((ObjectProviderImpl) objectProvider).getStateManager().getObjectManager();
                        if (((ForceObjectManagerImpl) om).isInAllOrNothingMode()) {
                            /**
                             * This is instance of AllOrNothing transaction
                             * Since the parent object has not been saved to the db yet
                             * we do not have an id yet so we link objects by extId
                             */
                            SObject parentRef = new SObject();
                            TableImpl parent = storeManager.getTable(acmd);
                            if (parent.getExternalIdColumn() == null) {
                                throw new NucleusUserException("EntityManager in persistence.xml has 'force.AllOrNothing'"
                                                               + " set to true. In this mode all top parent Entities must"
                                                               + " have an externalId field. Offending entity: "
                                                               + parent.getTableName().getName());
                            }
                            parentRef.setType(parent.getTableName().getForceApiName());
                            SObject parentSObject = ((ForceObjectManagerImpl) om).getParentSObject(value);
                            parentRef.setField(parent.getExternalIdColumn().getFieldName(),
                                                parentSObject.getField(parent.getExternalIdColumn().getFieldName()));
                            actualValue = parentRef;
                            actualFieldName = column.getForceApiRelationshipName();
                        } else {
                            throw new NucleusUserException("Child entity cannot be saved before parent entity.");
                        }
                    }
                } else {
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

            trees[i] = s.currentTree();
        }
        int columnCount = columns.length;
        PropertyValue[] values = new PropertyValue[columnCount];
        for (int i = 0; i < columnCount; i++) {
            ColumnImpl c = columns[i];
            values[i] = c.currentProperty();
        }
        PropertyValue[] orderValues;
        if (orderings == null) {
            orderValues = null;
        } else {
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

        return getColumnIndex(columns, columnName);
    }
   
    static int getColumnIndex(ColumnImpl[] columns, String columnName) {
        for (int i = 0, size = columns.length; i < size; i++) {
            ColumnImpl c = columns[i];
            String cn = c.getColumnName();
            if (cn != null && cn.equals(columnName)) {
                return i;
            }
        }
        return -1;
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

    @Override
    public Iterator<ResultRowImpl> getRows() {
        prepare();
        if (explain) {
            String plan = getPlan();
            columns = new ColumnImpl[] { new ColumnImpl("explain", "plan", "plan")};
            ResultRowImpl r = new ResultRowImpl(this,
                    Tree.EMPTY_ARRAY,
                    new PropertyValue[] { PropertyValues.newString(plan)},
                    null);
            return Arrays.asList(r).iterator();
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

    @Override
    public Iterator<ResultRowImpl> getRows() {
        prepare();
        if (explain) {
            String plan = getPlan();
            columns = new ColumnImpl[] { new ColumnImpl("explain", "plan", "plan")};
            ResultRowImpl r = new ResultRowImpl(this,
                    Tree.EMPTY_ARRAY,
                    new PropertyValue[] { PropertyValues.newString(plan)},
                    null);
            return Arrays.asList(r).iterator();
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("query execute {} ", statement);
            LOG.debug("query plan {}", getPlan());
        }
        RowIterator rowIt = new RowIterator(context.getBaseState());
        Comparator<ResultRowImpl> orderBy = ResultRowImpl.getComparator(orderings);
        Iterator<ResultRowImpl> it =
                FilterIterators.newCombinedFilter(rowIt, distinct, limit, offset, orderBy);
        if (measure) {
            // run the query
            while (it.hasNext()) {
                it.next();
            }
            columns = new ColumnImpl[] {
                    new ColumnImpl("measure", "selector", "selector"),
                    new ColumnImpl("measure", "scanCount", "scanCount")
            };
            ArrayList<ResultRowImpl> list = new ArrayList<ResultRowImpl>();
            ResultRowImpl r = new ResultRowImpl(this,
                    Tree.EMPTY_ARRAY,
                    new PropertyValue[] {
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

                buff.append(s).append(": ").append(p).append(" ");
            }
        }
        ColumnImpl[] cols = query.getColumns();
        for (int i = 0; i < values.length; i++) {
            ColumnImpl c = cols[i];
            String n = c.getColumnName();
            if (n != null) {
                buff.append(n).append(": ").append(values[i]).append(" ");
            }
        }
        return buff.toString();
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

    @Override
    public Iterator<ResultRowImpl> getRows() {
        prepare();
        if (explain) {
            String plan = getPlan();
            columns = new ColumnImpl[] { new ColumnImpl("explain", "plan", "plan")};
            ResultRowImpl r = new ResultRowImpl(this,
                    new String[0],
                    new PropertyValue[] { PropertyValues.newString(plan)},
                    null);
            return Arrays.asList(r).iterator();
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

    @Override
    public Iterator<ResultRowImpl> getRows() {
        prepare();
        if (explain) {
            String plan = getPlan();
            columns = new ColumnImpl[] { new ColumnImpl("explain", "plan", "plan")};
            ResultRowImpl r = new ResultRowImpl(this,
                    new String[0],
                    new PropertyValue[] { PropertyValues.newString(plan)},
                    null);
            return Arrays.asList(r).iterator();
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("query execute {} ", statement);
            LOG.debug("query plan {}", getPlan());
        }
        RowIterator rowIt = new RowIterator(rootState);
        Comparator<ResultRowImpl> orderBy = ResultRowImpl.getComparator(orderings);
        Iterator<ResultRowImpl> it =
                FilterIterators.newCombinedFilter(rowIt, distinct, limit, offset, orderBy);
        if (measure) {
            // run the query
            while (it.hasNext()) {
                it.next();
            }
            columns = new ColumnImpl[] {
                    new ColumnImpl("measure", "selector", "selector"),
                    new ColumnImpl("measure", "scanCount", "scanCount")
            };
            ArrayList<ResultRowImpl> list = new ArrayList<ResultRowImpl>();
            ResultRowImpl r = new ResultRowImpl(this,
                    new String[0],
                    new PropertyValue[] {
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

            paths[i] = s.currentPath();
        }
        int columnCount = columns.length;
        PropertyValue[] values = new PropertyValue[columnCount];
        for (int i = 0; i < columnCount; i++) {
            ColumnImpl c = columns[i];
            values[i] = c.currentProperty();
        }
        PropertyValue[] orderValues;
        if (orderings == null) {
            orderValues = null;
        } else {
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

        return getColumnIndex(columns, columnName);
    }
   
    static int getColumnIndex(ColumnImpl[] columns, String columnName) {
        for (int i = 0, size = columns.length; i < size; i++) {
            ColumnImpl c = columns[i];
            String cn = c.getColumnName();
            if (cn != null && cn.equals(columnName)) {
                return i;
            }
        }
        return -1;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.