Package org.eclipse.persistence.internal.helper

Examples of org.eclipse.persistence.internal.helper.DatabaseField


            if (result instanceof List) {
                List results = (List)result;
                output.setDOM(output.createNewDocument("results"));
                if (results != null) {
                    for (int index = 0; index < results.size(); index++) {
                        output.add(new DatabaseField("result"), results.get(index));
                    }
                }
            } else {
                output.setDOM(output.createNewDocument("results"));
                output.add(new DatabaseField("result"), result);
            }
            return output;
        } else {
            return fileRecord;
        }
View Full Code Here


                    // assume OUT_CURSOR
                    spa = new StoredProcedureOutCursorArgument();
                }
                spa.argumentName = argumentName;
                if (argument instanceof DatabaseField) {
                    DatabaseField argField = (DatabaseField)argument;
                    spa.setDatabaseField(argField);
                }
                else {
                    if (argument instanceof Object[]) {
                       Object first = ((Object[])argument)[0];
                       DatabaseField secondField = (DatabaseField)((Object[])argument)[1];;
                       if (first instanceof DatabaseField) {
                           DatabaseField firstField = (DatabaseField)first;
                           spa.setDatabaseField(firstField);
                       }
                       else {
                           spa.argumentValue = first;
                           spa.setDatabaseField(secondField);
View Full Code Here

            // vector of parameters/arguments to be added the call
            Vector procedureArguments = (Vector)attributeValue;
            for (int i = 0; i < procedureArguments.size(); i++) {
                StoredProcedureArgument spa = (StoredProcedureArgument)procedureArguments.get(i);
                Integer direction = spa.getDirection();
                DatabaseField dbField = spa.getDatabaseField();
                spc.getProcedureArgumentNames().add(spa.argumentName);
                if (direction.equals(IN)) {
                    if (spa.argumentValue != null) {
                        spc.appendIn(spa.argumentValue);
                    }
                    else {
                        spc.appendIn(dbField);
                    }
                }
                else if (direction.equals(OUT)) {
                    spc.appendOut(dbField);
                }
                else if (direction.equals(OUT_CURSOR)) {
                    spc.appendOutCursor(dbField);
                }
                else  if (direction.equals(INOUT)) {
                    StoredProcedureInOutArgument spaInOut = (StoredProcedureInOutArgument)spa;
                    DatabaseField outField = new DatabaseField(spaInOut.outputArgumentName);
                    outField.type = dbField.type;
                    if (spaInOut.argumentValue != null) {
                        spc.appendInOut(spaInOut.argumentValue, outField);
                    }
                    else {
View Full Code Here

          }
          Integer getDirection() {
              return IN;
          }
          DatabaseField getDatabaseField() {
              DatabaseField dbfield = new DatabaseField(argumentFieldName == null ? "" : argumentFieldName);
              dbfield.type = argumentType;
              dbfield.sqlType = argumentSQLType;
              if ((argumentSqlTypeName != null) &&
                  (!argumentSqlTypeName.equals(""))) {
                  dbfield = new ObjectRelationalDatabaseField(dbfield);
View Full Code Here

              if (dbField.isObjectRelationalDatabaseField()) {
                  ObjectRelationalDatabaseField ordField =
                      (ObjectRelationalDatabaseField)dbField;
                  argumentSqlTypeName = ordField.getSqlTypeName();
                  argumentSQLType = ordField.getSqlType();
                  DatabaseField tempField = ordField.getNestedTypeField();
                  if (tempField != null) {
                      nestedType = new StoredProcedureArgument(tempField);
                  }
              }
          }
View Full Code Here

                    ClassDescriptor descriptor = (ClassDescriptor) object;
                    Vector associations = descriptor.getMultipleTableForeignKeyAssociations();
                    for (int index = 0; index < associations.size(); index++) {
                        Association association = (Association) associations.get(index);
                        String targetPrimaryKeyFieldName = (String) association.getKey();
                        association.setKey(new DatabaseField((String) association.getValue()));
                        association.setValue(new DatabaseField(targetPrimaryKeyFieldName));
                    }
                    return associations;
                }
                public void setAttributeValueInObject(Object object, Object value) {
                    ClassDescriptor descriptor = (ClassDescriptor) object;
View Full Code Here

                Vector associations = mapping.getAggregateToSourceFieldNameAssociations();
                Vector translations = new Vector(associations.size());
                for (int index = 0; index < associations.size(); index++) {
                    Association association = (Association)associations.get(index);
                    FieldTranslation translation = new FieldTranslation();
                    translation.setKey(new DatabaseField((String)association.getKey()));
                    translation.setValue(new DatabaseField((String)association.getValue()));
                    translations.add(translation);
                }
                return translations;
            }
View Full Code Here

            public Object getAttributeValueFromObject(Object object) {
                ClassDescriptor mapping = (ClassDescriptor)object;
                Vector associations = mapping.getMultipleTablePrimaryKeyAssociations();
                for (int index = 0; index < associations.size(); index++) {
                    Association association = (Association)associations.get(index);
                    association.setKey(new DatabaseField((String)association.getKey()));
                    association.setValue(new DatabaseField((String)association.getValue()));
                }
                return associations;
            }

            public void setAttributeValueInObject(Object object, Object value) {
                ClassDescriptor mapping = (ClassDescriptor)object;
                Vector associations = (Vector)value;
                for (int index = 0; index < associations.size(); index++) {
                    Association association = (Association)associations.get(index);
                    association.setKey(((DatabaseField)association.getKey()).getQualifiedName());
                    association.setValue(((DatabaseField)association.getValue()).getQualifiedName());
                }
                mapping.setForeignKeyFieldNamesForMultipleTable(associations);
            }
        });
        multipleTablesPrimaryKey.setAttributeName("multipleTablesPrimaryKeys");
        multipleTablesPrimaryKey.setReferenceClass(Association.class);
        multipleTablesPrimaryKey.setXPath(getPrimaryNamespaceXPath() + "multiple-table-primary-keys/" + getSecondaryNamespaceXPath() + "field-reference");
        descriptor.addMapping(multipleTablesPrimaryKey);

        XMLCompositeCollectionMapping multipleTables = new XMLCompositeCollectionMapping();
        multipleTables.setReferenceClass(Association.class);
        multipleTables.setXPath(getPrimaryNamespaceXPath() + "multiple-table-foreign-keys/" + getSecondaryNamespaceXPath() + "field-reference");
        multipleTables.setAttributeAccessor(new AttributeAccessor() {
            public Object getAttributeValueFromObject(Object object) {
                ClassDescriptor mapping = (ClassDescriptor)object;
                Vector associations = mapping.getMultipleTableForeignKeyAssociations();
                for (int index = 0; index < associations.size(); index++) {
                    Association association = (Association)associations.get(index);
                    association.setKey(new DatabaseField((String)association.getKey()));
                    association.setValue(new DatabaseField((String)association.getValue()));
                }
                return associations;
            }

            public void setAttributeValueInObject(Object object, Object value) {
View Full Code Here

                Vector associations = mapping.getSourceToTargetQueryKeyFieldAssociations();
                Vector queryKeyReferences = new Vector(associations.size());
                for (int index = 0; index < associations.size(); index++) {
                    Association association = (Association)associations.get(index);
                    QueryKeyReference reference = new QueryKeyReference();
                    reference.setKey(new DatabaseField((String)association.getKey()));
                    reference.setValue(association.getValue());
                    queryKeyReferences.add(reference);
                }
                return queryKeyReferences;
            }
View Full Code Here

                        name = ((AbstractCompositeCollectionMapping)queryKeyExpression.getMapping()).getField().getName() + "." + name;                       
                    } else if (queryKeyExpression.getMapping().isAbstractCompositeDirectCollectionMapping()) {
                        name = ((AbstractCompositeDirectCollectionMapping)queryKeyExpression.getMapping()).getField().getName() + "." + name;                       
                    }
                }
                DatabaseField field = new DatabaseField();
                field.setName(name);
                value = field;
            }
        } else if (expression.isFieldExpression()) {
            value = ((FieldExpression)expression).getField();
        } else if (expression.isConstantExpression()) {
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.internal.helper.DatabaseField

Copyright © 2018 www.massapicom. 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.