Search in sources :

Example 6 with IXmlBuilder

use of org.whole.lang.xml.builders.IXmlBuilder in project whole by wholeplatform.

the class HibernateMapping method apply.

public void apply(IBuilderOperation op) {
    IXmlBuilder b0 = (IXmlBuilder) op.wGetBuilder(XmlLanguageKit.URI);
    b0.Document_();
    b0.Prolog_();
    b0.XMLDecl_();
    b0.Version("1.0");
    b0.Encoding("UTF-8");
    b0._XMLDecl();
    b0.DocTypeDecl_();
    b0.Name("hibernate-mapping");
    b0.PublicId_();
    b0.PubidLiteral("-//Hibernate/Hibernate Mapping DTD 3.0//EN");
    b0.SystemLiteral("http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd");
    b0._PublicId();
    b0._DocTypeDecl();
    b0.Misc_(1);
    b0.Comment_();
    b0.CommentText("@generator whole");
    b0._Comment();
    b0._Misc();
    b0._Prolog();
    b0.Element_();
    b0.Name("hibernate-mapping");
    b0.Attributes_(1);
    b0.Attribute_();
    b0.Name("package");
    b0.wDefault();
    b0._Attribute();
    b0._Attributes();
    b0.Content_(1);
    b0.Element_();
    b0.Name("class");
    b0.Attributes_(2);
    b0.Attribute_();
    b0.Name("name");
    b0.wDefault();
    b0._Attribute();
    b0.Attribute_();
    b0.Name("table");
    b0.wDefault();
    b0._Attribute();
    b0._Attributes();
    b0.Content_(2);
    b0.Element_();
    b0.Name("id");
    b0.Attributes_(1);
    b0.Attribute_();
    b0.Name("name");
    b0.Value("id");
    b0._Attribute();
    b0._Attributes();
    b0.Content_(1);
    b0.Element_();
    b0.Name("generator");
    b0.Attributes_(1);
    b0.Attribute_();
    b0.Name("class");
    b0.Value("native");
    b0._Attribute();
    b0._Attributes();
    b0.wDefault();
    b0._Element();
    b0._Content();
    b0._Element();
    b0.Element_();
    b0.Name("property");
    b0.Attributes_(1);
    b0.Attribute_();
    b0.Name("name");
    b0.wDefault();
    b0._Attribute();
    b0._Attributes();
    b0.Content_(1);
    b0.Element_();
    b0.Name("column");
    b0.Attributes_(1);
    b0.Attribute_();
    b0.Name("name");
    b0.wDefault();
    b0._Attribute();
    b0._Attributes();
    b0.wDefault();
    b0._Element();
    b0._Content();
    b0._Element();
    b0._Content();
    b0._Element();
    b0._Content();
    b0._Element();
    b0._Document();
}
Also used : IXmlBuilder(org.whole.lang.xml.builders.IXmlBuilder)

Example 7 with IXmlBuilder

use of org.whole.lang.xml.builders.IXmlBuilder in project whole by wholeplatform.

the class XmlLanguageDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addLanguageKit(new XmlLanguageKit());
    platform.addOperationFactory(XmlLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new XmlGenericBuilderAdapter((IXmlBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(XmlLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new XmlSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(XmlLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new XmlPrettyPrinterVisitor((PrettyPrinterOperation) operation);
        }
    });
    platform.addOperationFactory(XmlLanguageKit.URI, NormalizerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new XmlNormalizerVisitor();
        }
    });
    platform.addPersistenceKit("org.whole.lang.xml.XmlBuilderEditor", XmlBuilderPersistenceKit.instance());
    platform.addPersistenceKit("org.whole.lang.xml.XmlSourceEditor", XmlSourcePersistenceKit.instance());
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) PrettyPrinterOperation(org.whole.lang.operations.PrettyPrinterOperation) XmlNormalizerVisitor(org.whole.lang.xml.visitors.XmlNormalizerVisitor) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) XmlGenericBuilderAdapter(org.whole.lang.xml.builders.XmlGenericBuilderAdapter) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) XmlPrettyPrinterVisitor(org.whole.lang.xml.visitors.XmlPrettyPrinterVisitor) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) XmlSpecificBuilderAdapter(org.whole.lang.xml.builders.XmlSpecificBuilderAdapter) IXmlBuilder(org.whole.lang.xml.builders.IXmlBuilder)

Example 8 with IXmlBuilder

use of org.whole.lang.xml.builders.IXmlBuilder in project whole by wholeplatform.

the class XsiModelTemplate method apply.

public void apply(IBuilderOperation operation) {
    IXmlBuilder builder = (IXmlBuilder) operation.wGetBuilder(XmlLanguageKit.URI);
    ICommonsBuilder cb = (ICommonsBuilder) operation.wGetBuilder(CommonsLanguageKit.URI);
    if (EntityUtils.hasParent(model) && MappingStrategyUtils.hasElementNCName(model)) {
        builder.Document_();
        builder.Prolog_();
        builder.XMLDecl_();
        builder.Version("1.0");
        builder.Encoding(encoding);
        cb.Resolver();
        builder._XMLDecl();
        cb.Resolver();
        cb.Resolver();
        builder._Prolog();
        apply(builder);
        builder._Document();
    } else
        apply(builder);
}
Also used : IXmlBuilder(org.whole.lang.xml.builders.IXmlBuilder) ICommonsBuilder(org.whole.lang.commons.builders.ICommonsBuilder)

Aggregations

IXmlBuilder (org.whole.lang.xml.builders.IXmlBuilder)8 ModelBuilderOperation (org.whole.lang.builders.ModelBuilderOperation)5 ICommonsBuilder (org.whole.lang.commons.builders.ICommonsBuilder)5 XmlGenericBuilderAdapter (org.whole.lang.xml.builders.XmlGenericBuilderAdapter)2 Test (org.junit.Test)1 Category (org.junit.experimental.categories.Category)1 IBindingManager (org.whole.lang.bindings.IBindingManager)1 IBuilder (org.whole.lang.builders.IBuilder)1 IBuilderFactory (org.whole.lang.builders.IBuilderFactory)1 IBuilderOperation (org.whole.lang.builders.IBuilderOperation)1 StreamPersistenceProvider (org.whole.lang.codebase.StreamPersistenceProvider)1 IEntityContext (org.whole.lang.contexts.IEntityContext)1 IOperation (org.whole.lang.operations.IOperation)1 PrettyPrinterOperation (org.whole.lang.operations.PrettyPrinterOperation)1 ModelTemplate (org.whole.lang.templates.ModelTemplate)1 IVisitor (org.whole.lang.visitors.IVisitor)1 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)1 XmlSpecificBuilderAdapter (org.whole.lang.xml.builders.XmlSpecificBuilderAdapter)1 XmlNormalizerBuilderOperation (org.whole.lang.xml.codebase.XmlNormalizerBuilderOperation)1 Document (org.whole.lang.xml.model.Document)1