Search in sources :

Example 1 with XQueryInteraction

use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.

the class NestedForeignKeyProject method getTeamDescriptor.

private EISDescriptor getTeamDescriptor() {
    EISDescriptor descriptor = new EISDescriptor();
    descriptor.setJavaClass(Team.class);
    descriptor.setDataTypeName("team");
    descriptor.setPrimaryKeyFieldName("@id");
    EISDirectMapping idMapping = new EISDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");
    descriptor.addMapping(idMapping);
    EISCompositeCollectionMapping employeesMapping = new EISCompositeCollectionMapping();
    employeesMapping.setAttributeName("employees");
    employeesMapping.useCollectionClass(java.util.Vector.class);
    employeesMapping.setReferenceClass(Employee.class);
    employeesMapping.setXPath("employee");
    descriptor.addMapping(employeesMapping);
    // Insert
    XQueryInteraction insertCall = new XQueryInteraction();
    insertCall.setFunctionName("insert");
    insertCall.setProperty("fileName", "team.xml");
    insertCall.setXQueryString("team");
    descriptor.getQueryManager().setInsertCall(insertCall);
    // Read object
    XQueryInteraction readObjectCall = new XQueryInteraction();
    readObjectCall.setFunctionName("read");
    readObjectCall.setProperty("fileName", "team.xml");
    readObjectCall.setXQueryString("team[@id='#@id']");
    readObjectCall.setOutputResultPath("result");
    descriptor.getQueryManager().setReadObjectCall(readObjectCall);
    // Read all
    XQueryInteraction readAllCall = new XQueryInteraction();
    readAllCall.setFunctionName("read-all");
    readAllCall.setProperty("fileName", "team.xml");
    readAllCall.setXQueryString("team");
    readAllCall.setOutputResultPath("result");
    descriptor.getQueryManager().setReadAllCall(readAllCall);
    // Delete
    XQueryInteraction deleteCall = new XQueryInteraction();
    deleteCall.setFunctionName("delete");
    deleteCall.setProperty("fileName", "team.xml");
    deleteCall.setXQueryString("team[@id='#@id']");
    descriptor.getQueryManager().setDeleteCall(deleteCall);
    // Update
    XQueryInteraction updateCall = new XQueryInteraction();
    updateCall.setFunctionName("update");
    updateCall.setProperty("fileName", "team.xml");
    updateCall.setXQueryString("team[@id='#@id']");
    descriptor.getQueryManager().setUpdateCall(updateCall);
    return descriptor;
}
Also used : EISCompositeCollectionMapping(org.eclipse.persistence.eis.mappings.EISCompositeCollectionMapping) XQueryInteraction(org.eclipse.persistence.eis.interactions.XQueryInteraction) EISDescriptor(org.eclipse.persistence.eis.EISDescriptor) EISDirectMapping(org.eclipse.persistence.eis.mappings.EISDirectMapping)

Example 2 with XQueryInteraction

use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.

the class NestedForeignKeyProject method getProjectDescriptor.

private ClassDescriptor getProjectDescriptor() {
    EISDescriptor descriptor = new EISDescriptor();
    descriptor.setJavaClass(Project.class);
    descriptor.setDataTypeName("project");
    descriptor.setPrimaryKeyFieldName("@id");
    EISDirectMapping nameMapping = new EISDirectMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setXPath("name/text()");
    descriptor.addMapping(nameMapping);
    EISDirectMapping idMapping = new EISDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");
    descriptor.addMapping(idMapping);
    // Insert
    XQueryInteraction insertCall = new XQueryInteraction();
    insertCall.setXQueryString("project");
    insertCall.setFunctionName("insert");
    insertCall.setProperty("fileName", "project.xml");
    descriptor.getQueryManager().setInsertCall(insertCall);
    // Read object
    XQueryInteraction readObjectCall = new XQueryInteraction();
    readObjectCall.setFunctionName("read");
    readObjectCall.setProperty("fileName", "project.xml");
    readObjectCall.setXQueryString("project[@id='#@id']");
    readObjectCall.setOutputResultPath("result");
    descriptor.getQueryManager().setReadObjectCall(readObjectCall);
    // Read all
    XQueryInteraction readAllCall = new XQueryInteraction();
    readAllCall.setFunctionName("read-all");
    readAllCall.setProperty("fileName", "project.xml");
    readAllCall.setXQueryString("project");
    readAllCall.setOutputResultPath("result");
    descriptor.getQueryManager().setReadAllCall(readAllCall);
    // Delete
    XQueryInteraction deleteCall = new XQueryInteraction();
    deleteCall.setFunctionName("delete");
    readAllCall.setProperty("fileName", "project.xml");
    readObjectCall.setXQueryString("project[@id='#@id']");
    descriptor.getQueryManager().setDeleteCall(deleteCall);
    // Update
    XQueryInteraction updateCall = new XQueryInteraction();
    updateCall.setFunctionName("update");
    readAllCall.setProperty("fileName", "project.xml");
    readObjectCall.setXQueryString("project[@id='#@id']");
    descriptor.getQueryManager().setUpdateCall(updateCall);
    return descriptor;
}
Also used : XQueryInteraction(org.eclipse.persistence.eis.interactions.XQueryInteraction) EISDescriptor(org.eclipse.persistence.eis.EISDescriptor) EISDirectMapping(org.eclipse.persistence.eis.mappings.EISDirectMapping)

Example 3 with XQueryInteraction

use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.

the class NestedOwnedToExternalRootProject method getProjectDescriptor.

private ClassDescriptor getProjectDescriptor() {
    EISDescriptor descriptor = new EISDescriptor();
    descriptor.setJavaClass(Project.class);
    descriptor.setDataTypeName("project");
    descriptor.setPrimaryKeyFieldName("@id");
    EISDirectMapping nameMapping = new EISDirectMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setXPath("name/text()");
    descriptor.addMapping(nameMapping);
    EISDirectMapping idMapping = new EISDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");
    descriptor.addMapping(idMapping);
    // Insert
    XQueryInteraction insertCall = new XQueryInteraction();
    insertCall.setXQueryString("project");
    insertCall.setFunctionName("insert");
    insertCall.setProperty("fileName", "project.xml");
    descriptor.getQueryManager().setInsertCall(insertCall);
    // Read object
    XQueryInteraction readObjectCall = new XQueryInteraction();
    readObjectCall.setFunctionName("read");
    readObjectCall.setProperty("fileName", "project.xml");
    readObjectCall.setXQueryString("project[@id='#@id']");
    readObjectCall.setOutputResultPath("result");
    descriptor.getQueryManager().setReadObjectCall(readObjectCall);
    // Read all
    XQueryInteraction readAllCall = new XQueryInteraction();
    readAllCall.setFunctionName("read-all");
    readAllCall.setProperty("fileName", "project.xml");
    readAllCall.setXQueryString("project");
    readAllCall.setOutputResultPath("result");
    descriptor.getQueryManager().setReadAllCall(readAllCall);
    // Delete
    XQueryInteraction deleteCall = new XQueryInteraction();
    deleteCall.setFunctionName("delete");
    readAllCall.setProperty("fileName", "project.xml");
    readObjectCall.setXQueryString("project[@id='#@id']");
    descriptor.getQueryManager().setDeleteCall(deleteCall);
    // Update
    XQueryInteraction updateCall = new XQueryInteraction();
    updateCall.setFunctionName("update");
    readAllCall.setProperty("fileName", "project.xml");
    readObjectCall.setXQueryString("project[@id='#@id']");
    descriptor.getQueryManager().setUpdateCall(updateCall);
    return descriptor;
}
Also used : XQueryInteraction(org.eclipse.persistence.eis.interactions.XQueryInteraction) EISDescriptor(org.eclipse.persistence.eis.EISDescriptor) EISDirectMapping(org.eclipse.persistence.eis.mappings.EISDirectMapping)

Example 4 with XQueryInteraction

use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.

the class NestedOwnedToExternalRootTestCases method createTables.

@Override
protected void createTables() {
    // Drop tables
    XQueryInteraction interaction = new XQueryInteraction();
    XMLFileInteractionSpec spec = new XMLFileInteractionSpec();
    interaction = new XQueryInteraction();
    interaction.setFunctionName("drop-PROJECT");
    spec = new XMLFileInteractionSpec();
    spec.setFileName("project.xml");
    spec.setInteractionType(XMLFileInteractionSpec.DELETE);
    interaction.setInteractionSpec(spec);
    session.executeNonSelectingCall(interaction);
    interaction = new XQueryInteraction();
    interaction.setFunctionName("drop-COMPANY");
    spec = new XMLFileInteractionSpec();
    spec.setFileName("company.xml");
    spec.setInteractionType(XMLFileInteractionSpec.DELETE);
    interaction.setInteractionSpec(spec);
    session.executeNonSelectingCall(interaction);
}
Also used : XMLFileInteractionSpec(org.eclipse.persistence.internal.eis.adapters.xmlfile.XMLFileInteractionSpec) XQueryInteraction(org.eclipse.persistence.eis.interactions.XQueryInteraction)

Example 5 with XQueryInteraction

use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.

the class RootToRootTestCases method createTables.

@Override
protected void createTables() {
    // Drop tables
    XQueryInteraction interaction = new XQueryInteraction();
    XMLFileInteractionSpec spec = new XMLFileInteractionSpec();
    interaction = new XQueryInteraction();
    interaction.setFunctionName("drop-PROJECT");
    spec = new XMLFileInteractionSpec();
    spec.setFileName("project.xml");
    spec.setInteractionType(XMLFileInteractionSpec.DELETE);
    interaction.setInteractionSpec(spec);
    session.executeNonSelectingCall(interaction);
    interaction = new XQueryInteraction();
    interaction.setFunctionName("drop-EMPLOYEE");
    spec = new XMLFileInteractionSpec();
    spec.setFileName("employee.xml");
    spec.setInteractionType(XMLFileInteractionSpec.DELETE);
    interaction.setInteractionSpec(spec);
    session.executeNonSelectingCall(interaction);
}
Also used : XMLFileInteractionSpec(org.eclipse.persistence.internal.eis.adapters.xmlfile.XMLFileInteractionSpec) XQueryInteraction(org.eclipse.persistence.eis.interactions.XQueryInteraction)

Aggregations

XQueryInteraction (org.eclipse.persistence.eis.interactions.XQueryInteraction)129 EISDescriptor (org.eclipse.persistence.eis.EISDescriptor)91 EISDirectMapping (org.eclipse.persistence.eis.mappings.EISDirectMapping)91 XMLFileInteractionSpec (org.eclipse.persistence.internal.eis.adapters.xmlfile.XMLFileInteractionSpec)36 EISOneToManyMapping (org.eclipse.persistence.eis.mappings.EISOneToManyMapping)27 EISCompositeCollectionMapping (org.eclipse.persistence.eis.mappings.EISCompositeCollectionMapping)17 EISOneToOneMapping (org.eclipse.persistence.eis.mappings.EISOneToOneMapping)12 ReadAllQuery (org.eclipse.persistence.queries.ReadAllQuery)9 InsertObjectQuery (org.eclipse.persistence.queries.InsertObjectQuery)2 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)1 DataModifyQuery (org.eclipse.persistence.queries.DataModifyQuery)1 ValueReadQuery (org.eclipse.persistence.queries.ValueReadQuery)1