/*
 * Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0,
 * or the Eclipse Distribution License v. 1.0 which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
 */

// Contributors:
//     Oracle - initial API and implementation from Oracle TopLink
package org.eclipse.persistence.testing.models.sequencing;

import java.util.*;

/**
 * TOPLink generated Project class.
 * <b>WARNING</b>: This code was generated by an automated tool.
 * Any changes will be lost when the code is re-generated
 */
public class TestProjectForSequenceChecking extends org.eclipse.persistence.sessions.Project {
    protected org.eclipse.persistence.sessions.DatabaseSession session;

    /**
     * <b>WARNING</b>: This code was generated by an automated tool.
     * Any changes will be lost when the code is re-generated
     */
    public TestProjectForSequenceChecking() {
        applyPROJECT();
        applyLOGIN();
        buildTestClass1Descriptor();
        buildTestClass2Descriptor();
    }

    /**
     * TOPLink generated method.
     * <b>WARNING</b>: This code was generated by an automated tool.
     * Any changes will be lost when the code is re-generated
     */
    protected void applyLOGIN() {
    }

    /**
     * TOPLink generated method.
     * <b>WARNING</b>: This code was generated by an automated tool.
     * Any changes will be lost when the code is re-generated
     */
    protected void applyPROJECT() {
        setName("TestIdentity");
    }

    /**
     * TOPLink generated method.
     * <b>WARNING</b>: This code was generated by an automated tool.
     * Any changes will be lost when the code is re-generated
     */
    protected void buildTestClass1Descriptor() {
        org.eclipse.persistence.descriptors.RelationalDescriptor descriptor = new org.eclipse.persistence.descriptors.RelationalDescriptor();

        // SECTION: DESCRIPTOR
        descriptor.setJavaClass(org.eclipse.persistence.testing.models.sequencing.SeqTestClass1.class);
        Vector vector = new Vector();
        vector.addElement("SEQTESTTABLE1");
        descriptor.setTableNames(vector);
        descriptor.addPrimaryKeyFieldName("SEQTESTTABLE1.PKEY");

        // SECTION: PROPERTIES
        descriptor.useSoftCacheWeakIdentityMap();
        descriptor.setIdentityMapSize(100);
        descriptor.setSequenceNumberName("SEQTESTCLASS1_SEQ");
        descriptor.setSequenceNumberFieldName("PKEY");
        descriptor.setExistenceChecking("Assume existence");

        // SECTION: COPY POLICY
        descriptor.createCopyPolicy("constructor");

        // SECTION: INSTANTIATION POLICY
        descriptor.createInstantiationPolicy("constructor");

        // SECTION: DIRECTTOFIELDMAPPING
        org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
        directtofieldmapping.setAttributeName("pkey");
        directtofieldmapping.setIsReadOnly(false);
        directtofieldmapping.setGetMethodName("getPkey");
        directtofieldmapping.setSetMethodName("setPkey");
        directtofieldmapping.setFieldName("SEQTESTTABLE1.PKEY");
        descriptor.addMapping(directtofieldmapping);

        // SECTION: DIRECTTOFIELDMAPPING
        org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
        directtofieldmapping1.setAttributeName("test1");
        directtofieldmapping1.setIsReadOnly(false);
        directtofieldmapping1.setGetMethodName("getTest1");
        directtofieldmapping1.setSetMethodName("setTest1");
        directtofieldmapping1.setFieldName("SEQTESTTABLE1.FIRST_");
        descriptor.addMapping(directtofieldmapping1);

        // SECTION: DIRECTTOFIELDMAPPING
        org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
        directtofieldmapping2.setAttributeName("test2");
        directtofieldmapping2.setIsReadOnly(false);
        directtofieldmapping2.setGetMethodName("getTest2");
        directtofieldmapping2.setSetMethodName("setTest2");
        directtofieldmapping2.setFieldName("SEQTESTTABLE1.SECOND_");
        descriptor.addMapping(directtofieldmapping2);
        addDescriptor(descriptor);
    }

    /**
     * TOPLink generated method.
     * <b>WARNING</b>: This code was generated by an automated tool.
     * Any changes will be lost when the code is re-generated
     */
    protected void buildTestClass2Descriptor() {
        org.eclipse.persistence.descriptors.RelationalDescriptor descriptor = new org.eclipse.persistence.descriptors.RelationalDescriptor();

        // SECTION: DESCRIPTOR
        descriptor.setJavaClass(org.eclipse.persistence.testing.models.sequencing.SeqTestClass2.class);
        Vector vector = new Vector();
        vector.addElement("SEQTESTTABLE2");
        descriptor.setTableNames(vector);
        descriptor.addPrimaryKeyFieldName("SEQTESTTABLE2.PKEY");

        // SECTION: PROPERTIES
        descriptor.useSoftCacheWeakIdentityMap();
        descriptor.setIdentityMapSize(100);
        descriptor.setSequenceNumberName("SEQTESTCLASS2_SEQ");
        descriptor.setSequenceNumberFieldName("PKEY");
        descriptor.setExistenceChecking("Assume existence");

        // SECTION: COPY POLICY
        descriptor.createCopyPolicy("constructor");

        // SECTION: INSTANTIATION POLICY
        descriptor.createInstantiationPolicy("constructor");

        // SECTION: DIRECTTOFIELDMAPPING
        org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
        directtofieldmapping.setAttributeName("pkey");
        directtofieldmapping.setIsReadOnly(false);
        directtofieldmapping.setGetMethodName("getPkey");
        directtofieldmapping.setSetMethodName("setPkey");
        directtofieldmapping.setFieldName("SEQTESTTABLE2.PKEY");
        descriptor.addMapping(directtofieldmapping);

        // SECTION: DIRECTTOFIELDMAPPING
        org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
        directtofieldmapping1.setAttributeName("test1");
        directtofieldmapping1.setIsReadOnly(false);
        directtofieldmapping1.setGetMethodName("getTest1");
        directtofieldmapping1.setSetMethodName("setTest1");
        directtofieldmapping1.setFieldName("SEQTESTTABLE2.FIRST_");
        descriptor.addMapping(directtofieldmapping1);

        // SECTION: DIRECTTOFIELDMAPPING
        org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
        directtofieldmapping2.setAttributeName("test2");
        directtofieldmapping2.setIsReadOnly(false);
        directtofieldmapping2.setGetMethodName("getTest2");
        directtofieldmapping2.setSetMethodName("setTest2");
        directtofieldmapping2.setFieldName("SEQTESTTABLE2.SECOND_");
        descriptor.addMapping(directtofieldmapping2);
        addDescriptor(descriptor);

    }
}
