/*
 * All Rights Reserved.
 */
package com.unboundid.ldap.sdk.controls;

import java.util.HashSet;
import java.util.Set;
import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.LDAPSDKTestCase;

/**
 * This class provides a set of test cases for the
 * {@code ContentSyncRequestMode} class.
 */
public final class ContentSyncRequestModeTestCase extends LDAPSDKTestCase {

    /**
     * Provides test coverage for the REFRESH_ONLY mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshOnly() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_ONLY;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 1);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);

    /**
     * Provides test coverage for the REFRESH_AND_PERSIST mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshAndPersist() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_AND_PERSIST;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 3);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides general test coverage for the enum.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testGeneral() throws Exception {
        for (final ContentSyncRequestMode m : ContentSyncRequestMode.values()) {
            assertNotNull(m);
            assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
            assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
            assertNotNull(m.name());
            assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
            assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
        }
        try {
            ContentSyncRequestMode.valueOf("invalid");
            fail("Expected an exception for an invalid valueOf string");
        } catch (final Exception e) {
            // This was expected.
        }
        assertNull(ContentSyncRequestMode.valueOf(-1));
    }

    /**
     * Tests the {@code forName} method with automated tests based on the actual
     * name of the enum values.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testForNameAutomated() throws Exception {
        for (final ContentSyncRequestMode value : ContentSyncRequestMode.values()) {
            for (final String name : getNames(value.name())) {
                assertNotNull(ContentSyncRequestMode.forName(name));
                assertEquals(ContentSyncRequestMode.forName(name), value);
            }
        }
        assertNull(ContentSyncRequestMode.forName("some undefined name"));
    }

    /**
     * Retrieves a set of names for testing the {@code forName} method based on
     * the provided set of names.
     *
     * @param  baseNames  The base set of names to use to generate the full set of
     *                    names.  It must not be {@code null} or empty.
     *
     * @return  The full set of names to use for testing.
     */
    private static Set<String> getNames(final String... baseNames) {
        final HashSet<String> nameSet = new HashSet<>(10);
        for (final String name : baseNames) {
            nameSet.add(name);
            nameSet.add(name.toLowerCase());
            nameSet.add(name.toUpperCase());
            final String nameWithDashesInsteadOfUnderscores = name.replace('_', '-');
            nameSet.add(nameWithDashesInsteadOfUnderscores);
            nameSet.add(nameWithDashesInsteadOfUnderscores.toLowerCase());
            nameSet.add(nameWithDashesInsteadOfUnderscores.toUpperCase());
            final String nameWithUnderscoresInsteadOfDashes = name.replace('-', '_');
            nameSet.add(nameWithUnderscoresInsteadOfDashes);
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toLowerCase());
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toUpperCase());
            final StringBuilder nameWithoutUnderscoresOrDashes = new StringBuilder();
            for (final char c : name.toCharArray()) {
                if ((c != '-') && (c != '_')) {
                    nameWithoutUnderscoresOrDashes.append(c);
                }
            }
            nameSet.add(nameWithoutUnderscoresOrDashes.toString());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toLowerCase());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toUpperCase());
        }
        return nameSet;
    }
}


ode m = ContentSyncRequestMode.REFRESH_ONLY;

/*
 * All Rights Reserved.
 */
package com.unboundid.ldap.sdk.controls;

import java.util.HashSet;
import java.util.Set;
import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.LDAPSDKTestCase;

/**
 * This class provides a set of test cases for the
 * {@code ContentSyncRequestMode} class.
 */
public final class ContentSyncRequestModeTestCase extends LDAPSDKTestCase {

    /**
     * Provides test coverage for the REFRESH_ONLY mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshOnly() throws Exception {
        final ContentSyncRequestM

        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 1);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides test coverage for the REFRESH_AND_PERSIST mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshAndPersist() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_AND_PERSIST;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 3);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides general test coverage for the enum.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testGeneral() throws Exception {
        for (final ContentSyncRequestMode m : ContentSyncRequestMode.values()) {
            assertNotNull(m);
            assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
            assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
            assertNotNull(m.name());
            assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
            assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
        }
        try {
            ContentSyncRequestMode.valueOf("invalid");
            fail("Expected an exception for an invalid valueOf string");
        } catch (final Exception e) {
            // This was expected.
        }
        assertNull(ContentSyncRequestMode.valueOf(-1));
    }

    /**
     * Tests the {@code forName} method with automated tests based on the actual
     * name of the enum values.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testForNameAutomated() throws Exception {
        for (final ContentSyncRequestMode value : ContentSyncRequestMode.values()) {
            for (final String name : getNames(value.name())) {
                assertNotNull(ContentSyncRequestMode.forName(name));
                assertEquals(ContentSyncRequestMode.forName(name), value);
            }
        }
        assertNull(ContentSyncRequestMode.forName("some undefined name"));
    }

    /**
     * Retrieves a set of names for testing the {@code forName} method based on
     * the provided set of names.
     *
     * @param  baseNames  The base set of names to use to generate the full set of
     *                    names.  It must not be {@code null} or empty.
     *
     * @return  The full set of names to use for testing.
     */
    private static Set<String> getNames(final String... baseNames) {
        final HashSet<String> nameSet = new HashSet<>(10);
        for (final String name : baseNames) {
            nameSet.add(name);
            nameSet.add(name.toLowerCase());
            nameSet.add(name.toUpperCase());
            final String nameWithDashesInsteadOfUnderscores = name.replace('_', '-');
            nameSet.add(nameWithDashesInsteadOfUnderscores);
            nameSet.add(nameWithDashesInsteadOfUnderscores.toLowerCase());
            nameSet.add(nameWithDashesInsteadOfUnderscores.toUpperCase());
            final String nameWithUnderscoresInsteadOfDashes = name.replace('-', '_');
            nameSet.add(nameWithUnderscoresInsteadOfDashes);
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toLowerCase());
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toUpperCase());
            final StringBuilder nameWithoutUnderscoresOrDashes = new StringBuilder();
            for (final char c : name.toCharArray()) {
                if ((c != '-') && (c != '_')) {
                    nameWithoutUnderscoresOrDashes.append(c);
                }
            }
            nameSet.add(nameWithoutUnderscoresOrDashes.toString());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toLowerCase());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toUpperCase());
        }
        return nameSet;
    }
}


@Test()
    public void testForNameAutomated() throws Exception {
        for (final ContentSyncRequestMode value : ContentSyncRequestMode.values()) {
            for (final String name : getNames(value.name())) {
                assertNotNull(ContentSyncRequestMode.forName(name));
                assertEquals(ContentSyncRequestMode.forName(name), value);
            }
        }
        assertNull(ContentSyncRequestMode.forName("some undefined name"));
    }

/*
 * All Rights Reserved.
 */
package com.unboundid.ldap.sdk.controls;

import java.util.HashSet;
import java.util.Set;
import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.LDAPSDKTestCase;

/**
 * This class provides a set of test cases for the
 * {@code ContentSyncRequestMode} class.
 */
public final class ContentSyncRequestModeTestCase extends LDAPSDKTestCase {

    /**
     * Provides test coverage for the REFRESH_ONLY mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshOnly() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_ONLY;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 1);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides test coverage for the REFRESH_AND_PERSIST mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshAndPersist() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_AND_PERSIST;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 3);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides general test coverage for the enum.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testGeneral() throws Exception {
        for (final ContentSyncRequestMode m : ContentSyncRequestMode.values()) {
            assertNotNull(m);
            assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
            assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
            assertNotNull(m.name());
            assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
            assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
        }
        try {
            ContentSyncRequestMode.valueOf("invalid");
            fail("Expected an exception for an invalid valueOf string");
        } catch (final Exception e) {
            // This was expected.
        }
        assertNull(ContentSyncRequestMode.valueOf(-1));
    }

    /**
     * Tests the {@code forName} method with automated tests based on the actual
     * name of the enum values.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */

    /**
     * Retrieves a set of names for testing the {@code forName} method based on
     * the provided set of names.
     *
     * @param  baseNames  The base set of names to use to generate the full set of
     *                    names.  It must not be {@code null} or empty.
     *
     * @return  The full set of names to use for testing.
     */
    private static Set<String> getNames(final String... baseNames) {
        final HashSet<String> nameSet = new HashSet<>(10);
        for (final String name : baseNames) {
            nameSet.add(name);
            nameSet.add(name.toLowerCase());
            nameSet.add(name.toUpperCase());
            final String nameWithDashesInsteadOfUnderscores = name.replace('_', '-');
            nameSet.add(nameWithDashesInsteadOfUnderscores);
            nameSet.add(nameWithDashesInsteadOfUnderscores.toLowerCase());
            nameSet.add(nameWithDashesInsteadOfUnderscores.toUpperCase());
            final String nameWithUnderscoresInsteadOfDashes = name.replace('-', '_');
            nameSet.add(nameWithUnderscoresInsteadOfDashes);
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toLowerCase());
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toUpperCase());
            final StringBuilder nameWithoutUnderscoresOrDashes = new StringBuilder();
            for (final char c : name.toCharArray()) {
                if ((c != '-') && (c != '_')) {
                    nameWithoutUnderscoresOrDashes.append(c);
                }
            }
            nameSet.add(nameWithoutUnderscoresOrDashes.toString());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toLowerCase());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toUpperCase());
        }
        return nameSet;
    }
}


if ((c != '-') && (c != '_')) {
                    nameWithoutUnderscoresOrDashes.append(c);
                }

/*
 * All Rights Reserved.
 */
package com.unboundid.ldap.sdk.controls;

import java.util.HashSet;
import java.util.Set;
import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.LDAPSDKTestCase;

/**
 * This class provides a set of test cases for the
 * {@code ContentSyncRequestMode} class.
 */
public final class ContentSyncRequestModeTestCase extends LDAPSDKTestCase {

    /**
     * Provides test coverage for the REFRESH_ONLY mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshOnly() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_ONLY;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 1);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides test coverage for the REFRESH_AND_PERSIST mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshAndPersist() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_AND_PERSIST;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 3);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides general test coverage for the enum.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testGeneral() throws Exception {
        for (final ContentSyncRequestMode m : ContentSyncRequestMode.values()) {
            assertNotNull(m);
            assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
            assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
            assertNotNull(m.name());
            assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
            assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
        }
        try {
            ContentSyncRequestMode.valueOf("invalid");
            fail("Expected an exception for an invalid valueOf string");
        } catch (final Exception e) {
            // This was expected.
        }
        assertNull(ContentSyncRequestMode.valueOf(-1));
    }

    /**
     * Tests the {@code forName} method with automated tests based on the actual
     * name of the enum values.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testForNameAutomated() throws Exception {
        for (final ContentSyncRequestMode value : ContentSyncRequestMode.values()) {
            for (final String name : getNames(value.name())) {
                assertNotNull(ContentSyncRequestMode.forName(name));
                assertEquals(ContentSyncRequestMode.forName(name), value);
            }
        }
        assertNull(ContentSyncRequestMode.forName("some undefined name"));
    }

    /**
     * Retrieves a set of names for testing the {@code forName} method based on
     * the provided set of names.
     *
     * @param  baseNames  The base set of names to use to generate the full set of
     *                    names.  It must not be {@code null} or empty.
     *
     * @return  The full set of names to use for testing.
     */
    private static Set<String> getNames(final String... baseNames) {
        final HashSet<String> nameSet = new HashSet<>(10);
        for (final String name : baseNames) {
            nameSet.add(name);
            nameSet.add(name.toLowerCase());
            nameSet.add(name.toUpperCase());
            final String nameWithDashesInsteadOfUnderscores = name.replace('_', '-');
            nameSet.add(nameWithDashesInsteadOfUnderscores);
            nameSet.add(nameWithDashesInsteadOfUnderscores.toLowerCase());
            nameSet.add(nameWithDashesInsteadOfUnderscores.toUpperCase());
            final String nameWithUnderscoresInsteadOfDashes = name.replace('-', '_');
            nameSet.add(nameWithUnderscoresInsteadOfDashes);
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toLowerCase());
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toUpperCase());
            final StringBuilder nameWithoutUnderscoresOrDashes = new StringBuilder();
            for (final char c : name.toCharArray()) {

            }
            nameSet.add(nameWithoutUnderscoresOrDashes.toString());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toLowerCase());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toUpperCase());
        }
        return nameSet;
    }
}


try {
            ContentSyncRequestMode.valueOf("invalid");
            fail("Expected an exception for an invalid valueOf string");
        } catch (final Exception e) {
            // This was expected.
        }

/*
 * All Rights Reserved.
 */
package com.unboundid.ldap.sdk.controls;

import java.util.HashSet;
import java.util.Set;
import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.LDAPSDKTestCase;

/**
 * This class provides a set of test cases for the
 * {@code ContentSyncRequestMode} class.
 */
public final class ContentSyncRequestModeTestCase extends LDAPSDKTestCase {

    /**
     * Provides test coverage for the REFRESH_ONLY mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshOnly() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_ONLY;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 1);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides test coverage for the REFRESH_AND_PERSIST mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshAndPersist() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_AND_PERSIST;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 3);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides general test coverage for the enum.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testGeneral() throws Exception {
        for (final ContentSyncRequestMode m : ContentSyncRequestMode.values()) {
            assertNotNull(m);
            assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
            assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
            assertNotNull(m.name());
            assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
            assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
        }

        assertNull(ContentSyncRequestMode.valueOf(-1));
    }

    /**
     * Tests the {@code forName} method with automated tests based on the actual
     * name of the enum values.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testForNameAutomated() throws Exception {
        for (final ContentSyncRequestMode value : ContentSyncRequestMode.values()) {
            for (final String name : getNames(value.name())) {
                assertNotNull(ContentSyncRequestMode.forName(name));
                assertEquals(ContentSyncRequestMode.forName(name), value);
            }
        }
        assertNull(ContentSyncRequestMode.forName("some undefined name"));
    }

    /**
     * Retrieves a set of names for testing the {@code forName} method based on
     * the provided set of names.
     *
     * @param  baseNames  The base set of names to use to generate the full set of
     *                    names.  It must not be {@code null} or empty.
     *
     * @return  The full set of names to use for testing.
     */
    private static Set<String> getNames(final String... baseNames) {
        final HashSet<String> nameSet = new HashSet<>(10);
        for (final String name : baseNames) {
            nameSet.add(name);
            nameSet.add(name.toLowerCase());
            nameSet.add(name.toUpperCase());
            final String nameWithDashesInsteadOfUnderscores = name.replace('_', '-');
            nameSet.add(nameWithDashesInsteadOfUnderscores);
            nameSet.add(nameWithDashesInsteadOfUnderscores.toLowerCase());
            nameSet.add(nameWithDashesInsteadOfUnderscores.toUpperCase());
            final String nameWithUnderscoresInsteadOfDashes = name.replace('-', '_');
            nameSet.add(nameWithUnderscoresInsteadOfDashes);
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toLowerCase());
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toUpperCase());
            final StringBuilder nameWithoutUnderscoresOrDashes = new StringBuilder();
            for (final char c : name.toCharArray()) {
                if ((c != '-') && (c != '_')) {
                    nameWithoutUnderscoresOrDashes.append(c);
                }
            }
            nameSet.add(nameWithoutUnderscoresOrDashes.toString());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toLowerCase());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toUpperCase());
        }
        return nameSet;
    }
}


@Override
            public String getMethodsInterceptor()

package org.apache.skywalking.apm.plugin.shardingsphere.v41.define;

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;

/**
 * {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts. {@link org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}.
 */
public class JDBCRootInvokeInstrumentation extends AbstractShardingSphere41Instrumentation {

    private static final String ENHANCE_CLASS = "org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor";

    private static final String JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v41.JDBCRootInvokeInterceptor";

    @Override
    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
        return new InstanceMethodsInterceptPoint[] { new InstanceMethodsInterceptPoint() {

            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("executeCallback");
            }

{
                return JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS;
            }

            @Override
            public boolean isOverrideArgs() {
                return false;
            }
        } };
    }

    @Override
    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
        return new ConstructorInterceptPoint[0];
    }

    @Override
    protected ClassMatch enhanceClass() {
        return NameMatch.byName(ENHANCE_CLASS);
    }
}


{
        return NameMatch.byName(ENHANCE_CLASS);
    }

package org.apache.skywalking.apm.plugin.shardingsphere.v41.define;

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;

/**
 * {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts. {@link org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}.
 */
public class JDBCRootInvokeInstrumentation extends AbstractShardingSphere41Instrumentation {

    private static final String ENHANCE_CLASS = "org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor";

    private static final String JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v41.JDBCRootInvokeInterceptor";

    @Override
    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
        return new InstanceMethodsInterceptPoint[] { new InstanceMethodsInterceptPoint() {

            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("executeCallback");
            }

            @Override
            public String getMethodsInterceptor() {
                return JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS;
            }

            @Override
            public boolean isOverrideArgs() {
                return false;
            }
        } };
    }

    @Override
    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
        return new ConstructorInterceptPoint[0];
    }

    @Override
    protected ClassMatch enhanceClass()


package org.apache.skywalking.apm.plugin.shardingsphere.v41.define;

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;

/**
 * {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts. {@link org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}.
 */
public class JDBCRootInvokeInstrumentation extends AbstractShardingSphere41Instrumentation {

    private static final String ENHANCE_CLASS = "org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor";

    private static final String JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v41.JDBCRootInvokeInterceptor";

    @Override
    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {

        return new InstanceMethodsInterceptPoint[] { new InstanceMethodsInterceptPoint() {

            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("executeCallback");
            }

            @Override
            public String getMethodsInterceptor() {
                return JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS;
            }

            @Override
            public boolean isOverrideArgs() {
                return false;
            }
        } };
    }

    @Override
    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
        return new ConstructorInterceptPoint[0];
    }

    @Override
    protected ClassMatch enhanceClass() {
        return NameMatch.byName(ENHANCE_CLASS);
    }
}


return new InstanceMethodsInterceptPoint[] { new InstanceMethodsInterceptPoint() {

            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("executeCallback");
            }

            @Override
            public String getMethodsInterceptor() {
                return JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS;
            }

            @Override
            public boolean isOverrideArgs() {
                return false;
            }
        } };

    }

    @Override
    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
        return new ConstructorInterceptPoint[0];
    }

    @Override
    protected ClassMatch enhanceClass() {
        return NameMatch.byName(ENHANCE_CLASS);
    }
}


package org.apache.skywalking.apm.plugin.shardingsphere.v41.define;

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;

/**
 * {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts. {@link org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}.
 */
public class JDBCRootInvokeInstrumentation extends AbstractShardingSphere41Instrumentation {

    private static final String ENHANCE_CLASS = "org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor";

    private static final String JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v41.JDBCRootInvokeInterceptor";

    @Override
    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
        return new InstanceMethodsInterceptPoint[] { new InstanceMethodsInterceptPoint() {

            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("executeCallback");
            }

            @Override
            public String getMethodsInterceptor() {
                return JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS;
            }

            @Override
            public boolean isOverrideArgs() {
                return false;
            }
        } };

    @Override
    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
        return new ConstructorInterceptPoint[0];
    }

    @Override
    protected ClassMatch enhanceClass() {
        return NameMatch.byName(ENHANCE_CLASS);
    }
}


package org.apache.skywalking.apm.plugin.shardingsphere.v41.define;

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;

/**
 * {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts. {@link org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}.
 */
public class JDBCRootInvokeInstrumentation extends AbstractShardingSphere41Instrumentation {

    private static final String ENHANCE_CLASS = "org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor";

    private static final String JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v41.JDBCRootInvokeInterceptor";

    @Override
    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
        return new InstanceMethodsInterceptPoint[] { new InstanceMethodsInterceptPoint() {

            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("executeCallback");
            }

            @Override
            public String getMethodsInterceptor() {
                return JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS;
            }

            @Override
            public boolean isOverrideArgs() {
                return false;
            }
        } };
    }

    @Override
    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
        return new ConstructorInterceptPoint[0];
    }

    @Override
    protected ClassMatch enhanceClass() {
        return


@Override
    protected boolean enable(Node[] nodes)

package com.sun.hotspot.igv.coordinator.actions;

import com.sun.hotspot.igv.data.GraphDocument;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.serialization.Printer;
import com.sun.hotspot.igv.settings.Settings;
import java.io.*;
import javax.swing.Action;
import javax.swing.JFileChooser;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
import org.openide.util.actions.NodeAction;

/**
 * @author Thomas Wuerthinger
 */
public final class SaveAsAction extends NodeAction {

    public SaveAsAction() {
        putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file...");
    }

    @Override
    protected void performAction(Node[] activatedNodes) {
        GraphDocument doc = new GraphDocument();
        for (Node n : activatedNodes) {
            Group group = n.getLookup().lookup(Group.class);
            doc.addElement(group);
        }
        save(doc);
    }

    public static void save(GraphDocument doc) {
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(ImportAction.getFileFilter());
        fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT)));
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            if (!file.getName().contains(".")) {
                file = new File(file.getAbsolutePath() + ".xml");
            }
            File dir = file;
            if (!dir.isDirectory()) {
                dir = dir.getParentFile();
            }
            Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());
            try {
                try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) {
                    Printer p = new Printer();
                    p.export(writer, doc);
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    protected int mode() {
        return CookieAction.MODE_SOME;
    }

    @Override
    public String getName() {
        return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
    }

    @Override
    protected String iconResource() {
        return "com/sun/hotspot/igv/coordinator/images/save.png";
    }

    @Override
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }

    @Override
    protected boolean asynchronous() {
        return false;
    }

{
        int cnt = 0;
        for (Node n : nodes) {
            cnt += n.getLookup().lookupAll(Group.class).size();
        }
        return cnt > 0;
    }
}


{
        return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
    }

package com.sun.hotspot.igv.coordinator.actions;

import com.sun.hotspot.igv.data.GraphDocument;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.serialization.Printer;
import com.sun.hotspot.igv.settings.Settings;
import java.io.*;
import javax.swing.Action;
import javax.swing.JFileChooser;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
import org.openide.util.actions.NodeAction;

/**
 * @author Thomas Wuerthinger
 */
public final class SaveAsAction extends NodeAction {

    public SaveAsAction() {
        putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file...");
    }

    @Override
    protected void performAction(Node[] activatedNodes) {
        GraphDocument doc = new GraphDocument();
        for (Node n : activatedNodes) {
            Group group = n.getLookup().lookup(Group.class);
            doc.addElement(group);
        }
        save(doc);
    }

    public static void save(GraphDocument doc) {
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(ImportAction.getFileFilter());
        fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT)));
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            if (!file.getName().contains(".")) {
                file = new File(file.getAbsolutePath() + ".xml");
            }
            File dir = file;
            if (!dir.isDirectory()) {
                dir = dir.getParentFile();
            }
            Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());
            try {
                try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) {
                    Printer p = new Printer();
                    p.export(writer, doc);
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    protected int mode() {
        return CookieAction.MODE_SOME;
    }

    @Override
    public String getName()

    @Override
    protected String iconResource() {
        return "com/sun/hotspot/igv/coordinator/images/save.png";
    }

    @Override
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }

    @Override
    protected boolean asynchronous() {
        return false;
    }

    @Override
    protected boolean enable(Node[] nodes) {
        int cnt = 0;
        for (Node n : nodes) {
            cnt += n.getLookup().lookupAll(Group.class).size();
        }
        return cnt > 0;
    }
}


GraphDocument doc = new GraphDocument();

package com.sun.hotspot.igv.coordinator.actions;

import com.sun.hotspot.igv.data.GraphDocument;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.serialization.Printer;
import com.sun.hotspot.igv.settings.Settings;
import java.io.*;
import javax.swing.Action;
import javax.swing.JFileChooser;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
import org.openide.util.actions.NodeAction;

/**
 * @author Thomas Wuerthinger
 */
public final class SaveAsAction extends NodeAction {

    public SaveAsAction() {
        putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file...");
    }

    @Override
    protected void performAction(Node[] activatedNodes) {

        for (Node n : activatedNodes) {
            Group group = n.getLookup().lookup(Group.class);
            doc.addElement(group);
        }
        save(doc);
    }

    public static void save(GraphDocument doc) {
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(ImportAction.getFileFilter());
        fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT)));
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            if (!file.getName().contains(".")) {
                file = new File(file.getAbsolutePath() + ".xml");
            }
            File dir = file;
            if (!dir.isDirectory()) {
                dir = dir.getParentFile();
            }
            Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());
            try {
                try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) {
                    Printer p = new Printer();
                    p.export(writer, doc);
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    protected int mode() {
        return CookieAction.MODE_SOME;
    }

    @Override
    public String getName() {
        return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
    }

    @Override
    protected String iconResource() {
        return "com/sun/hotspot/igv/coordinator/images/save.png";
    }

    @Override
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }

    @Override
    protected boolean asynchronous() {
        return false;
    }

    @Override
    protected boolean enable(Node[] nodes) {
        int cnt = 0;
        for (Node n : nodes) {
            cnt += n.getLookup().lookupAll(Group.class).size();
        }
        return cnt > 0;
    }
}


for (Node n : activatedNodes) {
            Group group = n.getLookup().lookup(Group.class);
            doc.addElement(group);
        }

package com.sun.hotspot.igv.coordinator.actions;

import com.sun.hotspot.igv.data.GraphDocument;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.serialization.Printer;
import com.sun.hotspot.igv.settings.Settings;
import java.io.*;
import javax.swing.Action;
import javax.swing.JFileChooser;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
import org.openide.util.actions.NodeAction;

/**
 * @author Thomas Wuerthinger
 */
public final class SaveAsAction extends NodeAction {

    public SaveAsAction() {
        putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file...");
    }

    @Override
    protected void performAction(Node[] activatedNodes) {
        GraphDocument doc = new GraphDocument();

        save(doc);
    }

    public static void save(GraphDocument doc) {
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(ImportAction.getFileFilter());
        fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT)));
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            if (!file.getName().contains(".")) {
                file = new File(file.getAbsolutePath() + ".xml");
            }
            File dir = file;
            if (!dir.isDirectory()) {
                dir = dir.getParentFile();
            }
            Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());
            try {
                try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) {
                    Printer p = new Printer();
                    p.export(writer, doc);
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    protected int mode() {
        return CookieAction.MODE_SOME;
    }

    @Override
    public String getName() {
        return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
    }

    @Override
    protected String iconResource() {
        return "com/sun/hotspot/igv/coordinator/images/save.png";
    }

    @Override
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }

    @Override
    protected boolean asynchronous() {
        return false;
    }

    @Override
    protected boolean enable(Node[] nodes) {
        int cnt = 0;
        for (Node n : nodes) {
            cnt += n.getLookup().lookupAll(Group.class).size();
        }
        return cnt > 0;
    }
}


package com.sun.hotspot.igv.coordinator.actions;

import com.sun.hotspot.igv.data.GraphDocument;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.serialization.Printer;
import com.sun.hotspot.igv.settings.Settings;
import java.io.*;
import javax.swing.Action;
import javax.swing.JFileChooser;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
import org.openide.util.actions.NodeAction;

/**
 * @author Thomas Wuerthinger
 */
public final class SaveAsAction extends NodeAction {

    public SaveAsAction() {
        putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file...");
    }

    @Override
    protected void performAction(Node[] activatedNodes) {
        GraphDocument doc = new GraphDocument();
        for (Node n : activatedNodes) {
            Group group = n.getLookup().lookup(Group.class);
            doc.addElement(group);
        }

    public static void save(GraphDocument doc) {
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(ImportAction.getFileFilter());
        fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT)));
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            if (!file.getName().contains(".")) {
                file = new File(file.getAbsolutePath() + ".xml");
            }
            File dir = file;
            if (!dir.isDirectory()) {
                dir = dir.getParentFile();
            }
            Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());
            try {
                try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) {
                    Printer p = new Printer();
                    p.export(writer, doc);
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    protected int mode() {
        return CookieAction.MODE_SOME;
    }

    @Override
    public String getName() {
        return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
    }

    @Override
    protected String iconResource() {
        return "com/sun/hotspot/igv/coordinator/images/save.png";
    }

    @Override
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }

    @Override
    protected boolean asynchronous() {
        return false;
    }

    @Override
    protected boolean enable(Node[] nodes) {
        int cnt = 0;
        for (Node n : nodes) {
            cnt += n.getLookup().lookupAll(Group.class).size();
        }
        return cnt > 0;
    }
}


package com.sun.hotspot.igv.coordinator.actions;

import com.sun.hotspot.igv.data.GraphDocument;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.serialization.Printer;
import com.sun.hotspot.igv.settings.Settings;
import java.io.*;
import javax.swing.Action;
import javax.swing.JFileChooser;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
import org.openide.util.actions.NodeAction;

/**
 * @author Thomas Wuerthinger
 */
public final class SaveAsAction extends NodeAction {

    public SaveAsAction() {
        putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file...");
    }

    @Override
    protected void performAction(Node[] activatedNodes) {
        GraphDocument doc = new GraphDocument();
        for (Node n : activatedNodes) {
            Group group = n.getLookup().lookup(Group.class);
            doc.addElement(group);
        }
        save(doc);
    }

    public static void save(GraphDocument doc) {
        JFileChooser fc = new JF

        fc.setFileFilter(ImportAction.getFileFilter());
        fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT)));
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            if (!file.getName().contains(".")) {
                file = new File(file.getAbsolutePath() + ".xml");
            }
            File dir = file;
            if (!dir.isDirectory()) {
                dir = dir.getParentFile();
            }
            Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());
            try {
                try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) {
                    Printer p = new Printer();
                    p.export(writer, doc);
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    protected int mode() {
        return CookieAction.MODE_SOME;
    }

    @Override
    public String getName() {
        return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
    }

    @Override
    protected String iconResource() {
        return "com/sun/hotspot/igv/coordinator/images/save.png";
    }

    @Override
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }

    @Override
    protected boolean asynchronous() {
        return false;
    }

    @Override
    protected boolean enable(Node[] nodes) {
        int cnt = 0;
        for (Node n : nodes) {
            cnt += n.getLookup().lookupAll(Group.class).size();
        }
        return cnt > 0;
    }
}


if (!dir.isDirectory()) {
                dir = dir.getParentFile();
            }

package com.sun.hotspot.igv.coordinator.actions;

import com.sun.hotspot.igv.data.GraphDocument;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.serialization.Printer;
import com.sun.hotspot.igv.settings.Settings;
import java.io.*;
import javax.swing.Action;
import javax.swing.JFileChooser;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
import org.openide.util.actions.NodeAction;

/**
 * @author Thomas Wuerthinger
 */
public final class SaveAsAction extends NodeAction {

    public SaveAsAction() {
        putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file...");
    }

    @Override
    protected void performAction(Node[] activatedNodes) {
        GraphDocument doc = new GraphDocument();
        for (Node n : activatedNodes) {
            Group group = n.getLookup().lookup(Group.class);
            doc.addElement(group);
        }
        save(doc);
    }

    public static void save(GraphDocument doc) {
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(ImportAction.getFileFilter());
        fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT)));
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            if (!file.getName().contains(".")) {
                file = new File(file.getAbsolutePath() + ".xml");
            }
            File dir = file;

            Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());
            try {
                try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) {
                    Printer p = new Printer();
                    p.export(writer, doc);
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    protected int mode() {
        return CookieAction.MODE_SOME;
    }

    @Override
    public String getName() {
        return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
    }

    @Override
    protected String iconResource() {
        return "com/sun/hotspot/igv/coordinator/images/save.png";
    }

    @Override
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }

    @Override
    protected boolean asynchronous() {
        return false;
    }

    @Override
    protected boolean enable(Node[] nodes) {
        int cnt = 0;
        for (Node n : nodes) {
            cnt += n.getLookup().lookupAll(Group.class).size();
        }
        return cnt > 0;
    }
}


try {
                try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) {
                    Printer p = new Printer();
                    p.export(writer, doc);
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }

package com.sun.hotspot.igv.coordinator.actions;

import com.sun.hotspot.igv.data.GraphDocument;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.serialization.Printer;
import com.sun.hotspot.igv.settings.Settings;
import java.io.*;
import javax.swing.Action;
import javax.swing.JFileChooser;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
import org.openide.util.actions.NodeAction;

/**
 * @author Thomas Wuerthinger
 */
public final class SaveAsAction extends NodeAction {

    public SaveAsAction() {
        putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file...");
    }

    @Override
    protected void performAction(Node[] activatedNodes) {
        GraphDocument doc = new GraphDocument();
        for (Node n : activatedNodes) {
            Group group = n.getLookup().lookup(Group.class);
            doc.addElement(group);
        }
        save(doc);
    }

    public static void save(GraphDocument doc) {
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(ImportAction.getFileFilter());
        fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT)));
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            if (!file.getName().contains(".")) {
                file = new File(file.getAbsolutePath() + ".xml");
            }
            File dir = file;
            if (!dir.isDirectory()) {
                dir = dir.getParentFile();
            }
            Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());

        }
    }

    protected int mode() {
        return CookieAction.MODE_SOME;
    }

    @Override
    public String getName() {
        return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
    }

    @Override
    protected String iconResource() {
        return "com/sun/hotspot/igv/coordinator/images/save.png";
    }

    @Override
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }

    @Override
    protected boolean asynchronous() {
        return false;
    }

    @Override
    protected boolean enable(Node[] nodes) {
        int cnt = 0;
        for (Node n : nodes) {
            cnt += n.getLookup().lookupAll(Group.class).size();
        }
        return cnt > 0;
    }
}


/*
 * Encog(tm) Core v3.4 - Java Version
 * http://example.com
 * http://example.com

 *
 *
 * For more information on Heaton Research copyrights, licenses
 * and trademarks visit:
 * http://example.com
 */
package org.encog.ml.genetic;

import org.encog.ml.MLEncodable;
import org.encog.ml.genetic.genome.DoubleArrayGenome;

/**
 * Implements a genome that allows a feedforward neural network to be trained
 * using a genetic algorithm. The chromosome for a feed forward neural network
 * is the weight and bias matrix.
 */
public class MLMethodGenome extends DoubleArrayGenome {

    private static final long serialVersionUID = 1L;

    private MLEncodable phenotype;

    /**
     * Construct a neural genome.
     *
     * @param thePhenotype
     *            The phenotype to use.
     */
    public MLMethodGenome(final MLEncodable thePhenotype) {
        super(thePhenotype.encodedArrayLength());
        this.phenotype = thePhenotype;
        this.phenotype.encodeToArray(getData());
    }

    /**
     * Decode the phenotype.
     */
    public void decode() {
        this.phenotype.decodeFromArray(getData());
    }

    /**
     * @return the phenotype
     */

{
        return this.phenotype;
    }

    /**
     * @param phenotype
     *            the phenotype to set
     */
    public void setPhenotype(final MLEncodable phenotype) {
        this.phenotype = phenotype;
    }
}


{
        this.phenotype = phenotype;
    }

/*
 * Encog(tm) Core v3.4 - Java Version
 * http://example.com
 * http://example.com

 *
 *
 * For more information on Heaton Research copyrights, licenses
 * and trademarks visit:
 * http://example.com
 */
package org.encog.ml.genetic;

import org.encog.ml.MLEncodable;
import org.encog.ml.genetic.genome.DoubleArrayGenome;

/**
 * Implements a genome that allows a feedforward neural network to be trained
 * using a genetic algorithm. The chromosome for a feed forward neural network
 * is the weight and bias matrix.
 */
public class MLMethodGenome extends DoubleArrayGenome {

    private static final long serialVersionUID = 1L;

    private MLEncodable phenotype;

    /**
     * Construct a neural genome.
     *
     * @param thePhenotype
     *            The phenotype to use.
     */
    public MLMethodGenome(final MLEncodable thePhenotype) {
        super(thePhenotype.encodedArrayLength());
        this.phenotype = thePhenotype;
        this.phenotype.encodeToArray(getData());
    }

    /**
     * Decode the phenotype.
     */
    public void decode() {
        this.phenotype.decodeFromArray(getData());
    }

    /**
     * @return the phenotype
     */
    public MLEncodable getPhenotype() {
        return this.phenotype;
    }

    /**
     * @param phenotype
     *            the phenotype to set
     */
    public void setPhenotype(final MLEncodable phenotype)


/*
 * Encog(tm) Core v3.4 - Java Version
 * http://example.com
 * http://example.com

 *
 *
 * For more information on Heaton Research copyrights, licenses
 * and trademarks visit:
 * http://example.com
 */
package org.encog.ml.genetic;

import org.encog.ml.MLEncodable;
import org.encog.ml.genetic.genome.DoubleArrayGenome;

/**
 * Implements a genome that allows a feedforward neural network to be trained
 * using a genetic algorithm. The chromosome for a feed forward neural network
 * is the weight and bias matrix.
 */
public class MLMethodGenome extends DoubleArrayGenome {

    private static final long serialVersionUID = 1L;

    private MLEncodable phenotype;

    /**
     * Construct a neural genome.
     *
     * @param thePhenotype
     *            The phenotype to use.
     */
    public MLMethodGenome(final MLEncodable thePhenotype) {
        super(thePhenotype.encodedArrayLength());
        this.phenotype = thePhenotype;
        this.phenotype.encodeToArray(getData());
    }

    /**
     * Decode the phenotype.
     */
    public void decode() {
        this.phenotype.decodeFromArray(getData());
    }

    /**
     * @return the phenotype
     */
    public MLEncodable getPhenotype() {
        return this.phenotype;
    }

    /**
     * @param phenotype
     *            the phenotype to set
     */
    public void setPhenotype(final MLEncodable phenotype) {
        this.phenotype = phenot


public MLEncodable getPhenotype() {
        return this.phenotype;
    }

    /**
     * @param phenotype
     *            the phenotype to set
     */
    public void setPhenotype(final MLEncodable phenotype) {
        this.phenotype = phenotype;
    }
}


@Test
    public void testThatDependencyIsInjected()

package com.example.mytemplate;

import org.junit.Before;
import org.junit.Test;
import javax.inject.Inject;
import dagger.Module;
import dagger.ObjectGraph;
import dagger.Provides;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;

public class ModuleTest {

    @Module(injects = ModuleTest.class)
    static final class MyModule {

        @Provides
        SampleModel provideSampleModel() {
            return new SampleModel();
        }
    }

    @Inject
    SampleModel mSampleModel;

    @Before
    public void setUp() throws Exception {
        ObjectGraph.create(new MyModule()).inject(this);
    }

{
        assertThat(mSampleModel, is(notNullValue()));
    }
}


{
        ObjectGraph.create(new MyModule()).inject(this);
    }

package com.example.mytemplate;

import org.junit.Before;
import org.junit.Test;
import javax.inject.Inject;
import dagger.Module;
import dagger.ObjectGraph;
import dagger.Provides;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;

public class ModuleTest {

    @Module(injects = ModuleTest.class)
    static final class MyModule {

        @Provides
        SampleModel provideSampleModel() {
            return new SampleModel();
        }
    }

    @Inject
    SampleModel mSampleModel;

    @Before
    public void setUp() throws Exception

    @Test
    public void testThatDependencyIsInjected() {
        assertThat(mSampleModel, is(notNullValue()));
    }
}


package com.example.mytemplate;

import org.junit.Before;
import org.junit.Test;
import javax.inject.Inject;
import dagger.Module;
import dagger.ObjectGraph;
import dagger.Provides;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;

public class ModuleTest {

    @Module(injects = ModuleTest.class)
    static final class MyModule {

        @Provides
        SampleModel provideSampleModel() {
            return

        }
    }

    @Inject
    SampleModel mSampleModel;

    @Before
    public void setUp() throws Exception {
        ObjectGraph.create(new MyModule()).inject(this);
    }

    @Test
    public void testThatDependencyIsInjected() {
        assertThat(mSampleModel, is(notNullValue()));
    }
}


package com.haydikodlayalim.hystrix;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;

@EnableHystrixDashboard
@SpringBootApplication
public class HystrixDashboardApplication {

{
        SpringApplication.run(HystrixDashboardApplication.class, args);
    }
}


{
        SpringApplication.run(HystrixDashboardApplication.class, args);
    }

package com.haydikodlayalim.hystrix;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;

@EnableHystrixDashboard
@SpringBootApplication
public class HystrixDashboardApplication {

    public static void main(String[] args)


package com.haydikodlayalim.hystrix;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;

@EnableHystrixDashboard
@SpringBootApplication
public class HystrixDashboardApplication {

    public static void main(String[] args) {
        Spring


public int delete(ReaderForm readerForm)

package com.dao;

import com.core.ConnDB;
import java.util.*;
import java.sql.*;
import com.actionForm.ReaderForm;

public class ReaderDAO {

    private ConnDB conn = new ConnDB();

    // 查询数据
    public Collection query(String strif) {
        ReaderForm readerForm = null;
        Collection readerColl = new ArrayList();
        String sql = "";
        if (strif != "all" && strif != null && strif != "") {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where " + strif + "";
        } else {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id";
        }
        ResultSet rs = conn.executeQuery(sql);
        String birthday = "";
        try {
            while (rs.next()) {
                readerForm = new ReaderForm();
                readerForm.setId(Integer.valueOf(rs.getString(1)));
                readerForm.setName(rs.getString(2));
                readerForm.setSex(rs.getString(3));
                readerForm.setBarcode(rs.getString(4));
                readerForm.setVocation(rs.getString(5));
                birthday = rs.getString(6);
                readerForm.setBirthday(birthday == null ? "" : birthday);
                readerForm.setPaperType(rs.getString(7));
                readerForm.setPaperNO(rs.getString(8));
                readerForm.setTel(rs.getString(9));
                readerForm.setEmail(rs.getString(10));
                readerForm.setCreateDate(rs.getString(11));
                readerForm.setOperator(rs.getString(12));
                readerForm.setRemark(rs.getString(13));
                readerForm.setTypeid(rs.getInt(14));
                readerForm.setTypename(rs.getString(15));
                readerForm.setNumber(rs.getInt(16));
                readerColl.add(readerForm);
            }
        } catch (SQLException ex) {
        }
        conn.close();
        return readerColl;
    }

    // 用于修改的查询
    public ReaderForm queryM(ReaderForm readerForm) {
        ReaderForm readerForm1 = null;
        String sql = "";
        if (readerForm.getId() != null) {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where r.id=" + readerForm.getId() + "";
        } else if (readerForm.getBarcode() != null) {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where r.barcode=" + readerForm.getBarcode() + "";
        }
        System.out.println("修改读者信息时的SQL：" + sql);
        ResultSet rs = conn.executeQuery(sql);
        String birthday = "";
        try {
            while (rs.next()) {
                readerForm1 = new ReaderForm();
                readerForm1.setId(Integer.valueOf(rs.getString(1)));
                readerForm1.setName(rs.getString(2));
                readerForm1.setSex(rs.getString(3));
                readerForm1.setBarcode(rs.getString(4));
                readerForm1.setVocation(rs.getString(5));
                birthday = rs.getString(6);
                readerForm1.setBirthday(birthday == null ? "" : birthday);
                readerForm1.setPaperType(rs.getString(7));
                readerForm1.setPaperNO(rs.getString(8));
                readerForm1.setTel(rs.getString(9));
                readerForm1.setEmail(rs.getString(10));
                readerForm1.setCreateDate(rs.getString(11));
                readerForm1.setOperator(rs.getString(12));
                readerForm1.setRemark(rs.getString(13));
                readerForm1.setTypeid(rs.getInt(14));
                readerForm1.setTypename(rs.getString(15));
                readerForm1.setNumber(rs.getInt(16));
                System.out.println(rs.getString(2));
            }
        } catch (SQLException ex) {
        }
        conn.close();
        return readerForm1;
    }

    // 添加数据
    public int insert(ReaderForm readerForm) {
        String sql1 = "SELECT * FROM tb_reader WHERE barcode='" + readerForm.getBarcode() + "'";
        ResultSet rs = conn.executeQuery(sql1);
        String sql = "";
        int falg = 0;
        try {
            if (rs.next()) {
                falg = 2;
            } else {
                if (readerForm.getBirthday() == "") {
                    sql = "Insert into tb_reader (name,sex,barcode,vocation,paperType,paperNO,tel,email,createDate,operator,remark,typeid) values('" + readerForm.getName() + "','" + readerForm.getSex() + "','" + readerForm.getBarcode() + "','" + readerForm.getVocation() + "','" + readerForm.getPaperType() + "','" + readerForm.getPaperNO() + "','" + readerForm.getTel() + "','" + readerForm.getEmail() + "','" + readerForm.getCreateDate() + "','" + readerForm.getOperator() + "','" + readerForm.getRemark() + "'," + readerForm.getTypeid() + ")";
                } else {
                    sql = "Insert into tb_reader (name,sex,barcode,vocation,birthday,paperType,paperNO,tel,email,createDate,operator,remark,typeid) values('" + readerForm.getName() + "','" + readerForm.getSex() + "','" + readerForm.getBarcode() + "','" + readerForm.getVocation() + "','" + readerForm.getBirthday() + "','" + readerForm.getPaperType() + "','" + readerForm.getPaperNO() + "','" + readerForm.getTel() + "','" + readerForm.getEmail() + "','" + readerForm.getCreateDate() + "','" + readerForm.getOperator() + "','" + readerForm.getRemark() + "'," + readerForm.getTypeid() + ")";
                }
                falg = conn.executeUpdate(sql);
                System.out.println("添加读者信息的SQL：" + sql);
                conn.close();
            }
        } catch (SQLException ex) {
            falg = 0;
        }
        System.out.println("falg:" + falg);
        return falg;
    }

    // 修改数据
    public int update(ReaderForm readerForm) {
        String sql = "";
        if (readerForm.getBirthday() == "") {
            sql = "Update tb_reader set sex='" + readerForm.getSex() + "',barcode='" + readerForm.getBarcode() + "',vocation='" + readerForm.getVocation() + "',birthday=null,paperType='" + readerForm.getPaperType() + "',paperNO='" + readerForm.getPaperNO() + "',tel='" + readerForm.getTel() + "',email='" + readerForm.getEmail() + "',remark='" + readerForm.getRemark() + "',typeid=" + readerForm.getTypeid() + " where id=" + readerForm.getId() + "";
        } else {
            sql = "Update tb_reader set sex='" + readerForm.getSex() + "',barcode='" + readerForm.getBarcode() + "',vocation='" + readerForm.getVocation() + "',birthday='" + readerForm.getBirthday() + "',paperType='" + readerForm.getPaperType() + "',paperNO='" + readerForm.getPaperNO() + "',tel='" + readerForm.getTel() + "',email='" + readerForm.getEmail() + "',remark='" + readerForm.getRemark() + "',typeid=" + readerForm.getTypeid() + " where id=" + readerForm.getId() + "";
        }
        int falg = conn.executeUpdate(sql);
        System.out.println("修改数据时的SQL：" + sql);
        conn.close();
        return falg;
    }

    // 删除数据

{
        String sql = "Delete from tb_reader where id=" + readerForm.getId() + "";
        int falg = conn.executeUpdate(sql);
        System.out.println("删除时的SQL：" + sql);
        return falg;
    }
}


{
        String sql = "Delete from tb_reader where id=" + readerForm.getId() + "";
        int falg = conn.executeUpdate(sql);
        System.out.println("删除时的SQL：" + sql);
        return falg;
    }

package com.dao;

import com.core.ConnDB;
import java.util.*;
import java.sql.*;
import com.actionForm.ReaderForm;

public class ReaderDAO {

    private ConnDB conn = new ConnDB();

    // 查询数据
    public Collection query(String strif) {
        ReaderForm readerForm = null;
        Collection readerColl = new ArrayList();
        String sql = "";
        if (strif != "all" && strif != null && strif != "") {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where " + strif + "";
        } else {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id";
        }
        ResultSet rs = conn.executeQuery(sql);
        String birthday = "";
        try {
            while (rs.next()) {
                readerForm = new ReaderForm();
                readerForm.setId(Integer.valueOf(rs.getString(1)));
                readerForm.setName(rs.getString(2));
                readerForm.setSex(rs.getString(3));
                readerForm.setBarcode(rs.getString(4));
                readerForm.setVocation(rs.getString(5));
                birthday = rs.getString(6);
                readerForm.setBirthday(birthday == null ? "" : birthday);
                readerForm.setPaperType(rs.getString(7));
                readerForm.setPaperNO(rs.getString(8));
                readerForm.setTel(rs.getString(9));
                readerForm.setEmail(rs.getString(10));
                readerForm.setCreateDate(rs.getString(11));
                readerForm.setOperator(rs.getString(12));
                readerForm.setRemark(rs.getString(13));
                readerForm.setTypeid(rs.getInt(14));
                readerForm.setTypename(rs.getString(15));
                readerForm.setNumber(rs.getInt(16));
                readerColl.add(readerForm);
            }
        } catch (SQLException ex) {
        }
        conn.close();
        return readerColl;
    }

    // 用于修改的查询
    public ReaderForm queryM(ReaderForm readerForm) {
        ReaderForm readerForm1 = null;
        String sql = "";
        if (readerForm.getId() != null) {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where r.id=" + readerForm.getId() + "";
        } else if (readerForm.getBarcode() != null) {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where r.barcode=" + readerForm.getBarcode() + "";
        }
        System.out.println("修改读者信息时的SQL：" + sql);
        ResultSet rs = conn.executeQuery(sql);
        String birthday = "";
        try {
            while (rs.next()) {
                readerForm1 = new ReaderForm();
                readerForm1.setId(Integer.valueOf(rs.getString(1)));
                readerForm1.setName(rs.getString(2));
                readerForm1.setSex(rs.getString(3));
                readerForm1.setBarcode(rs.getString(4));
                readerForm1.setVocation(rs.getString(5));
                birthday = rs.getString(6);
                readerForm1.setBirthday(birthday == null ? "" : birthday);
                readerForm1.setPaperType(rs.getString(7));
                readerForm1.setPaperNO(rs.getString(8));
                readerForm1.setTel(rs.getString(9));
                readerForm1.setEmail(rs.getString(10));
                readerForm1.setCreateDate(rs.getString(11));
                readerForm1.setOperator(rs.getString(12));
                readerForm1.setRemark(rs.getString(13));
                readerForm1.setTypeid(rs.getInt(14));
                readerForm1.setTypename(rs.getString(15));
                readerForm1.setNumber(rs.getInt(16));
                System.out.println(rs.getString(2));
            }
        } catch (SQLException ex) {
        }
        conn.close();
        return readerForm1;
    }

    // 添加数据
    public int insert(ReaderForm readerForm) {
        String sql1 = "SELECT * FROM tb_reader WHERE barcode='" + readerForm.getBarcode() + "'";
        ResultSet rs = conn.executeQuery(sql1);
        String sql = "";
        int falg = 0;
        try {
            if (rs.next()) {
                falg = 2;
            } else {
                if (readerForm.getBirthday() == "") {
                    sql = "Insert into tb_reader (name,sex,barcode,vocation,paperType,paperNO,tel,email,createDate,operator,remark,typeid) values('" + readerForm.getName() + "','" + readerForm.getSex() + "','" + readerForm.getBarcode() + "','" + readerForm.getVocation() + "','" + readerForm.getPaperType() + "','" + readerForm.getPaperNO() + "','" + readerForm.getTel() + "','" + readerForm.getEmail() + "','" + readerForm.getCreateDate() + "','" + readerForm.getOperator() + "','" + readerForm.getRemark() + "'," + readerForm.getTypeid() + ")";
                } else {
                    sql = "Insert into tb_reader (name,sex,barcode,vocation,birthday,paperType,paperNO,tel,email,createDate,operator,remark,typeid) values('" + readerForm.getName() + "','" + readerForm.getSex() + "','" + readerForm.getBarcode() + "','" + readerForm.getVocation() + "','" + readerForm.getBirthday() + "','" + readerForm.getPaperType() + "','" + readerForm.getPaperNO() + "','" + readerForm.getTel() + "','" + readerForm.getEmail() + "','" + readerForm.getCreateDate() + "','" + readerForm.getOperator() + "','" + readerForm.getRemark() + "'," + readerForm.getTypeid() + ")";
                }
                falg = conn.executeUpdate(sql);
                System.out.println("添加读者信息的SQL：" + sql);
                conn.close();
            }
        } catch (SQLException ex) {
            falg = 0;
        }
        System.out.println("falg:" + falg);
        return falg;
    }

    // 修改数据
    public int update(ReaderForm readerForm) {
        String sql = "";
        if (readerForm.getBirthday() == "") {
            sql = "Update tb_reader set sex='" + readerForm.getSex() + "',barcode='" + readerForm.getBarcode() + "',vocation='" + readerForm.getVocation() + "',birthday=null,paperType='" + readerForm.getPaperType() + "',paperNO='" + readerForm.getPaperNO() + "',tel='" + readerForm.getTel() + "',email='" + readerForm.getEmail() + "',remark='" + readerForm.getRemark() + "',typeid=" + readerForm.getTypeid() + " where id=" + readerForm.getId() + "";
        } else {
            sql = "Update tb_reader set sex='" + readerForm.getSex() + "',barcode='" + readerForm.getBarcode() + "',vocation='" + readerForm.getVocation() + "',birthday='" + readerForm.getBirthday() + "',paperType='" + readerForm.getPaperType() + "',paperNO='" + readerForm.getPaperNO() + "',tel='" + readerForm.getTel() + "',email='" + readerForm.getEmail() + "',remark='" + readerForm.getRemark() + "',typeid=" + readerForm.getTypeid() + " where id=" + readerForm.getId() + "";
        }
        int falg = conn.executeUpdate(sql);
        System.out.println("修改数据时的SQL：" + sql);
        conn.close();
        return falg;
    }

    // 删除数据
    public int delete(ReaderForm readerForm)


        String sql = "";
        if (readerForm.getBirthday() == "") {
            sql = "Update tb_reader set sex='" + readerForm.getSex() + "',barcode='" + readerForm.getBarcode() + "',vocation='" + readerForm.getVocation() + "',birthday=null,paperType='" + readerForm.getPaperType() + "',paperNO='" + readerForm.getPaperNO() + "',tel='" + readerForm.getTel() + "',email='" + readerForm.getEmail() + "',remark='" + readerForm.getRemark() + "',typeid=" + readerForm.getTypeid() + " where id=" + readerForm.getId() + "";
        } else {
            sql = "Update tb_reader set sex='" + readerForm.getSex() + "',barcode='" + readerForm.getBarcode() + "',vocation='" + readerForm.getVocation() + "',birthday='" + readerForm.getBirthday() + "',paperType='" + readerForm.getPaperType() + "',paperNO='" + readerForm.getPaperNO() + "',tel='" + readerForm.getTel() + "',email='" + readerForm.getEmail() + "',remark='" + readerForm.getRemark() + "',typeid=" + readerForm.getTypeid() + " where id=" + readerForm.getId() + "";
        }

package com.dao;

import com.core.ConnDB;
import java.util.*;
import java.sql.*;
import com.actionForm.ReaderForm;

public class ReaderDAO {

    private ConnDB conn = new ConnDB();

    // 查询数据
    public Collection query(String strif) {
        ReaderForm readerForm = null;
        Collection readerColl = new ArrayList();
        String sql = "";
        if (strif != "all" && strif != null && strif != "") {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where " + strif + "";
        } else {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id";
        }
        ResultSet rs = conn.executeQuery(sql);
        String birthday = "";
        try {
            while (rs.next()) {
                readerForm = new ReaderForm();
                readerForm.setId(Integer.valueOf(rs.getString(1)));
                readerForm.setName(rs.getString(2));
                readerForm.setSex(rs.getString(3));
                readerForm.setBarcode(rs.getString(4));
                readerForm.setVocation(rs.getString(5));
                birthday = rs.getString(6);
                readerForm.setBirthday(birthday == null ? "" : birthday);
                readerForm.setPaperType(rs.getString(7));
                readerForm.setPaperNO(rs.getString(8));
                readerForm.setTel(rs.getString(9));
                readerForm.setEmail(rs.getString(10));
                readerForm.setCreateDate(rs.getString(11));
                readerForm.setOperator(rs.getString(12));
                readerForm.setRemark(rs.getString(13));
                readerForm.setTypeid(rs.getInt(14));
                readerForm.setTypename(rs.getString(15));
                readerForm.setNumber(rs.getInt(16));
                readerColl.add(readerForm);
            }
        } catch (SQLException ex) {
        }
        conn.close();
        return readerColl;
    }

    // 用于修改的查询
    public ReaderForm queryM(ReaderForm readerForm) {
        ReaderForm readerForm1 = null;
        String sql = "";
        if (readerForm.getId() != null) {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where r.id=" + readerForm.getId() + "";
        } else if (readerForm.getBarcode() != null) {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where r.barcode=" + readerForm.getBarcode() + "";
        }
        System.out.println("修改读者信息时的SQL：" + sql);
        ResultSet rs = conn.executeQuery(sql);
        String birthday = "";
        try {
            while (rs.next()) {
                readerForm1 = new ReaderForm();
                readerForm1.setId(Integer.valueOf(rs.getString(1)));
                readerForm1.setName(rs.getString(2));
                readerForm1.setSex(rs.getString(3));
                readerForm1.setBarcode(rs.getString(4));
                readerForm1.setVocation(rs.getString(5));
                birthday = rs.getString(6);
                readerForm1.setBirthday(birthday == null ? "" : birthday);
                readerForm1.setPaperType(rs.getString(7));
                readerForm1.setPaperNO(rs.getString(8));
                readerForm1.setTel(rs.getString(9));
                readerForm1.setEmail(rs.getString(10));
                readerForm1.setCreateDate(rs.getString(11));
                readerForm1.setOperator(rs.getString(12));
                readerForm1.setRemark(rs.getString(13));
                readerForm1.setTypeid(rs.getInt(14));
                readerForm1.setTypename(rs.getString(15));
                readerForm1.setNumber(rs.getInt(16));
                System.out.println(rs.getString(2));
            }
        } catch (SQLException ex) {
        }
        conn.close();
        return readerForm1;
    }

    // 添加数据
    public int insert(ReaderForm readerForm) {
        String sql1 = "SELECT * FROM tb_reader WHERE barcode='" + readerForm.getBarcode() + "'";
        ResultSet rs = conn.executeQuery(sql1);
        String sql = "";
        int falg = 0;
        try {
            if (rs.next()) {
                falg = 2;
            } else {
                if (readerForm.getBirthday() == "") {
                    sql = "Insert into tb_reader (name,sex,barcode,vocation,paperType,paperNO,tel,email,createDate,operator,remark,typeid) values('" + readerForm.getName() + "','" + readerForm.getSex() + "','" + readerForm.getBarcode() + "','" + readerForm.getVocation() + "','" + readerForm.getPaperType() + "','" + readerForm.getPaperNO() + "','" + readerForm.getTel() + "','" + readerForm.getEmail() + "','" + readerForm.getCreateDate() + "','" + readerForm.getOperator() + "','" + readerForm.getRemark() + "'," + readerForm.getTypeid() + ")";
                } else {
                    sql = "Insert into tb_reader (name,sex,barcode,vocation,birthday,paperType,paperNO,tel,email,createDate,operator,remark,typeid) values('" + readerForm.getName() + "','" + readerForm.getSex() + "','" + readerForm.getBarcode() + "','" + readerForm.getVocation() + "','" + readerForm.getBirthday() + "','" + readerForm.getPaperType() + "','" + readerForm.getPaperNO() + "','" + readerForm.getTel() + "','" + readerForm.getEmail() + "','" + readerForm.getCreateDate() + "','" + readerForm.getOperator() + "','" + readerForm.getRemark() + "'," + readerForm.getTypeid() + ")";
                }
                falg = conn.executeUpdate(sql);
                System.out.println("添加读者信息的SQL：" + sql);
                conn.close();
            }
        } catch (SQLException ex) {
            falg = 0;
        }
        System.out.println("falg:" + falg);
        return falg;
    }

    // 修改数据
    public int update(ReaderForm readerForm) {

        int falg = conn.executeUpdate(sql);
        System.out.println("修改数据时的SQL：" + sql);
        conn.close();
        return falg;
    }

    // 删除数据
    public int delete(ReaderForm readerForm) {
        String sql = "Delete from tb_reader where id=" + readerForm.getId() + "";
        int falg = conn.executeUpdate(sql);
        System.out.println("删除时的SQL：" + sql);
        return falg;
    }
}


int falg = conn.executeUpdate(sql);
        System.out.println("修改数据时的SQL：" + sql);

package com.dao;

import com.core.ConnDB;
import java.util.*;
import java.sql.*;
import com.actionForm.ReaderForm;

public class ReaderDAO {

    private ConnDB conn = new ConnDB();

    // 查询数据
    public Collection query(String strif) {
        ReaderForm readerForm = null;
        Collection readerColl = new ArrayList();
        String sql = "";
        if (strif != "all" && strif != null && strif != "") {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where " + strif + "";
        } else {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id";
        }
        ResultSet rs = conn.executeQuery(sql);
        String birthday = "";
        try {
            while (rs.next()) {
                readerForm = new ReaderForm();
                readerForm.setId(Integer.valueOf(rs.getString(1)));
                readerForm.setName(rs.getString(2));
                readerForm.setSex(rs.getString(3));
                readerForm.setBarcode(rs.getString(4));
                readerForm.setVocation(rs.getString(5));
                birthday = rs.getString(6);
                readerForm.setBirthday(birthday == null ? "" : birthday);
                readerForm.setPaperType(rs.getString(7));
                readerForm.setPaperNO(rs.getString(8));
                readerForm.setTel(rs.getString(9));
                readerForm.setEmail(rs.getString(10));
                readerForm.setCreateDate(rs.getString(11));
                readerForm.setOperator(rs.getString(12));
                readerForm.setRemark(rs.getString(13));
                readerForm.setTypeid(rs.getInt(14));
                readerForm.setTypename(rs.getString(15));
                readerForm.setNumber(rs.getInt(16));
                readerColl.add(readerForm);
            }
        } catch (SQLException ex) {
        }
        conn.close();
        return readerColl;
    }

    // 用于修改的查询
    public ReaderForm queryM(ReaderForm readerForm) {
        ReaderForm readerForm1 = null;
        String sql = "";
        if (readerForm.getId() != null) {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where r.id=" + readerForm.getId() + "";
        } else if (readerForm.getBarcode() != null) {
            sql = "select r.*,t.name as typename,t.number from tb_reader r left join tb_readerType t on r.typeid=t.id where r.barcode=" + readerForm.getBarcode() + "";
        }
        System.out.println("修改读者信息时的SQL：" + sql);
        ResultSet rs = conn.executeQuery(sql);
        String birthday = "";
        try {
            while (rs.next()) {
                readerForm1 = new ReaderForm();
                readerForm1.setId(Integer.valueOf(rs.getString(1)));
                readerForm1.setName(rs.getString(2));
                readerForm1.setSex(rs.getString(3));
                readerForm1.setBarcode(rs.getString(4));
                readerForm1.setVocation(rs.getString(5));
                birthday = rs.getString(6);
                readerForm1.setBirthday(birthday == null ? "" : birthday);
                readerForm1.setPaperType(rs.getString(7));
                readerForm1.setPaperNO(rs.getString(8));
                readerForm1.setTel(rs.getString(9));
                readerForm1.setEmail(rs.getString(10));
                readerForm1.setCreateDate(rs.getString(11));
                readerForm1.setOperator(rs.getString(12));
                readerForm1.setRemark(rs.getString(13));
                readerForm1.setTypeid(rs.getInt(14));
                readerForm1.setTypename(rs.getString(15));
                readerForm1.setNumber(rs.getInt(16));
                System.out.println(rs.getString(2));
            }
        } catch (SQLException ex) {
        }
        conn.close();
        return readerForm1;
    }

    // 添加数据
    public int insert(ReaderForm readerForm) {
        String sql1 = "SELECT * FROM tb_reader WHERE barcode='" + readerForm.getBarcode() + "'";
        ResultSet rs = conn.executeQuery(sql1);
        String sql = "";
        int falg = 0;
        try {
            if (rs.next()) {
                falg = 2;
            } else {
                if (readerForm.getBirthday() == "") {
                    sql = "Insert into tb_reader (name,sex,barcode,vocation,paperType,paperNO,tel,email,createDate,operator,remark,typeid) values('" + readerForm.getName() + "','" + readerForm.getSex() + "','" + readerForm.getBarcode() + "','" + readerForm.getVocation() + "','" + readerForm.getPaperType() + "','" + readerForm.getPaperNO() + "','" + readerForm.getTel() + "','" + readerForm.getEmail() + "','" + readerForm.getCreateDate() + "','" + readerForm.getOperator() + "','" + readerForm.getRemark() + "'," + readerForm.getTypeid() + ")";
                } else {
                    sql = "Insert into tb_reader (name,sex,barcode,vocation,birthday,paperType,paperNO,tel,email,createDate,operator,remark,typeid) values('" + readerForm.getName() + "','" + readerForm.getSex() + "','" + readerForm.getBarcode() + "','" + readerForm.getVocation() + "','" + readerForm.getBirthday() + "','" + readerForm.getPaperType() + "','" + readerForm.getPaperNO() + "','" + readerForm.getTel() + "','" + readerForm.getEmail() + "','" + readerForm.getCreateDate() + "','" + readerForm.getOperator() + "','" + readerForm.getRemark() + "'," + readerForm.getTypeid() + ")";
                }
                falg = conn.executeUpdate(sql);
                System.out.println("添加读者信息的SQL：" + sql);
                conn.close();
            }
        } catch (SQLException ex) {
            falg = 0;
        }
        System.out.println("falg:" + falg);
        return falg;
    }

    // 修改数据
    public int update(ReaderForm readerForm) {
        String sql = "";
        if (readerForm.getBirthday() == "") {
            sql = "Update tb_reader set sex='" + readerForm.getSex() + "',barcode='" + readerForm.getBarcode() + "',vocation='" + readerForm.getVocation() + "',birthday=null,paperType='" + readerForm.getPaperType() + "',paperNO='" + readerForm.getPaperNO() + "',tel='" + readerForm.getTel() + "',email='" + readerForm.getEmail() + "',remark='" + readerForm.getRemark() + "',typeid=" + readerForm.getTypeid() + " where id=" + readerForm.getId() + "";
        } else {
            sql = "Update tb_reader set sex='" + readerForm.getSex() + "',barcode='" + readerForm.getBarcode() + "',vocation='" + readerForm.getVocation() + "',birthday='" + readerForm.getBirthday() + "',paperType='" + readerForm.getPaperType() + "',paperNO='" + readerForm.getPaperNO() + "',tel='" + readerForm.getTel() + "',email='" + readerForm.getEmail() + "',remark='" + readerForm.getRemark() + "',typeid=" + readerForm.getTypeid() + " where id=" + readerForm.getId() + "";
        }

        conn.close();
        return falg;
    }

    // 删除数据
    public int delete(ReaderForm readerForm) {
        String sql = "Delete from tb_reader where id=" + readerForm.getId() + "";
        int falg = conn.executeUpdate(sql);
        System.out.println("删除时的SQL：" + sql);
        return falg;
    }
}