Package org.apache.openjpa.enhance

Examples of org.apache.openjpa.enhance.ApplicationIdTool


        ReverseCodeGenerator gen;
        for (int i = 0; i < mappings.length; i++) {
            if (_log.isInfoEnabled())
                _log.info(_loc.get("class-code", mappings[i]));

            ApplicationIdTool aid = newApplicationIdTool(mappings[i]);
            if (getGenerateAnnotations())
                gen = new AnnotatedCodeGenerator(mappings[i], aid);
            else
                gen = new ReverseCodeGenerator(mappings[i], aid);

            gen.generateCode();

            if (output == null) {
                gen.writeCode();
                written.add(gen.getFile());
                if (aid != null && !aid.isInnerClass())
                    aid.record();
            } else {
                StringWriter writer = new StringWriter();
                gen.writeCode(writer);
                output.put(mappings[i].getDescribedType(), writer.toString());

                if (aid != null && !aid.isInnerClass()) {
                    writer = new StringWriter();
                    aid.setWriter(writer);
                    aid.record();
                    output.put(mappings[i].getObjectIdType(),
                        writer.toString());
                }
            }
        }
View Full Code Here


    /**
     * Generate and write the application identity code.
     */
    private ApplicationIdTool newApplicationIdTool(ClassMapping mapping) {
        ApplicationIdTool tool;
        if (mapping.getIdentityType() == ClassMapping.ID_APPLICATION
            && !mapping.isOpenJPAIdentity()
            && mapping.getPCSuperclass() == null) {
            tool = new ApplicationIdTool(_conf, mapping.getDescribedType(),
                mapping);
            tool.setDirectory(_dir);
            tool.setCodeFormat(_format);
            if (!tool.run())
                return null;
            return tool;
        }
        return null;
    }
View Full Code Here

        ReverseCodeGenerator gen;
        for (int i = 0; i < mappings.length; i++) {
            if (_log.isInfoEnabled())
                _log.info(_loc.get("class-code", mappings[i]));

            ApplicationIdTool aid = newApplicationIdTool(mappings[i]);
            if (getGenerateAnnotations())
                gen = new AnnotatedCodeGenerator(mappings[i], aid);
            else
                gen = new ReverseCodeGenerator(mappings[i], aid);

            gen.generateCode();

            if (output == null) {
                gen.writeCode();
                written.add(gen.getFile());
                if (aid != null && !aid.isInnerClass())
                    aid.record();
            } else {
                StringWriter writer = new StringWriter();
                gen.writeCode(writer);
                output.put(mappings[i].getDescribedType(), writer.toString());

                if (aid != null && !aid.isInnerClass()) {
                    writer = new StringWriter();
                    aid.setWriter(writer);
                    aid.record();
                    output.put(mappings[i].getObjectIdType(),
                        writer.toString());
                }
            }
        }
View Full Code Here

    /**
     * Generate and write the application identity code.
     */
    private ApplicationIdTool newApplicationIdTool(ClassMapping mapping) {
        ApplicationIdTool tool;
        if (mapping.getIdentityType() == ClassMapping.ID_APPLICATION
            && !mapping.isOpenJPAIdentity()
            && mapping.getPCSuperclass() == null) {
            tool = new ApplicationIdTool(_conf, mapping.getDescribedType(),
                mapping);
            tool.setDirectory(_dir);
            tool.setCodeFormat(_format);
            if (!tool.run())
                return null;
            return tool;
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.enhance.ApplicationIdTool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.