XMLContext.Default xmlDefaults = xmlContext.getDefault( null ); defaults.put( "schema", xmlDefaults.getSchema() ); defaults.put( "catalog", xmlDefaults.getCatalog() ); defaults.put( "delimited-identifier", xmlDefaults.getDelimitedIdentifier() );
private void getCollectionTable(List<Annotation> annotationList, Element element, XMLContext.Default defaults) { Element subelement = element != null ? element.element( "collection-table" ) : null; if ( subelement != null ) { AnnotationDescriptor annotation = new AnnotationDescriptor( CollectionTable.class ); copyStringAttribute( annotation, subelement, "name", false ); copyStringAttribute( annotation, subelement, "catalog", false ); if ( StringHelper.isNotEmpty( defaults.getCatalog() ) && StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) { annotation.setValue( "catalog", defaults.getCatalog() ); } copyStringAttribute( annotation, subelement, "schema", false ); if ( StringHelper.isNotEmpty( defaults.getSchema() ) && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) { annotation.setValue( "schema", defaults.getSchema() ); } JoinColumn[] joinColumns = getJoinColumns( subelement, false ); if ( joinColumns.length > 0 ) { annotation.setValue( "joinColumns", joinColumns ); } buildUniqueConstraints( annotation, subelement ); buildIndex( annotation, subelement ); annotationList.add( AnnotationFactory.create( annotation ) ); } }
public void override(Default globalDefault) { if ( globalDefault != null ) { if ( globalDefault.getAccess() != null ) access = globalDefault.getAccess(); if ( globalDefault.getPackageName() != null ) packageName = globalDefault.getPackageName(); if ( globalDefault.getSchema() != null ) schema = globalDefault.getSchema(); if ( globalDefault.getCatalog() != null ) catalog = globalDefault.getCatalog(); if ( globalDefault.getDelimitedIdentifier() != null ) delimitedIdentifier = globalDefault.getDelimitedIdentifier(); if ( globalDefault.getMetadataComplete() != null ) { metadataComplete = globalDefault.getMetadataComplete(); } //TODO fix that in stone if cascade-persist is set already? if ( globalDefault.getCascadePersist() != null ) cascadePersist = globalDefault.getCascadePersist(); } }
public void override(Default globalDefault) { if ( globalDefault != null ) { if ( globalDefault.getAccess() != null ) access = globalDefault.getAccess(); if ( globalDefault.getPackageName() != null ) packageName = globalDefault.getPackageName(); if ( globalDefault.getSchema() != null ) schema = globalDefault.getSchema(); if ( globalDefault.getCatalog() != null ) catalog = globalDefault.getCatalog(); if ( globalDefault.getDelimitedIdentifier() != null ) delimitedIdentifier = globalDefault.getDelimitedIdentifier(); if ( globalDefault.getMetadataComplete() != null ) { metadataComplete = globalDefault.getMetadataComplete(); } //TODO fix that in stone if cascade-persist is set already? if ( globalDefault.getCascadePersist() != null ) cascadePersist = globalDefault.getCascadePersist(); } }
|| StringHelper.isNotEmpty( defaults.getSchema() ) ) { AnnotationDescriptor annotation = new AnnotationDescriptor( Table.class ); if ( defaults.canUseJavaAnnotations() ) { && StringHelper.isNotEmpty( defaults.getSchema() ) ) { annotation.setValue( "schema", defaults.getSchema() ); if ( StringHelper.isNotEmpty( defaults.getSchema() ) && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) { annotation.setValue( "schema", defaults.getSchema() );
if ( defaultToJoinTable && ( StringHelper.isNotEmpty( defaults.getCatalog() ) || StringHelper.isNotEmpty( defaults.getSchema() ) ) ) { AnnotationDescriptor ad = new AnnotationDescriptor( annotationType ); if ( defaults.canUseJavaAnnotations() ) { && StringHelper.isNotEmpty( defaults.getSchema() ) ) { ad.setValue( "schema", defaults.getSchema() );
if ( StringHelper.isNotEmpty( defaults.getSchema() ) || StringHelper.isNotEmpty( defaults.getCatalog() ) ) { AnnotationDescriptor annotation = new AnnotationDescriptor( TableGenerator.class ); && StringHelper.isNotEmpty( defaults.getSchema() ) ) { annotation.setValue( "catalog", defaults.getSchema() );
private void overridesDefaultInSecondaryTable( SecondaryTable secTableAnn, XMLContext.Default defaults, List<SecondaryTable> secondaryTables ) { if ( secTableAnn != null ) { //handle default values if ( StringHelper.isNotEmpty( defaults.getCatalog() ) || StringHelper.isNotEmpty( defaults.getSchema() ) ) { AnnotationDescriptor annotation = new AnnotationDescriptor( SecondaryTable.class ); annotation.setValue( "name", secTableAnn.name() ); annotation.setValue( "schema", secTableAnn.schema() ); annotation.setValue( "catalog", secTableAnn.catalog() ); annotation.setValue( "uniqueConstraints", secTableAnn.uniqueConstraints() ); annotation.setValue( "pkJoinColumns", secTableAnn.pkJoinColumns() ); if ( StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) && StringHelper.isNotEmpty( defaults.getSchema() ) ) { annotation.setValue( "schema", defaults.getSchema() ); } if ( StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) && StringHelper.isNotEmpty( defaults.getCatalog() ) ) { annotation.setValue( "catalog", defaults.getCatalog() ); } secondaryTables.add( (SecondaryTable) AnnotationFactory.create( annotation ) ); } else { secondaryTables.add( secTableAnn ); } } }
private void getJoinTable(List<Annotation> annotationList, Element tree, XMLContext.Default defaults) { Element subelement = tree == null ? null : tree.element( "join-table" ); final Class<JoinTable> annotationType = JoinTable.class; if ( subelement != null ) { //ignore java annotation, an element is defined AnnotationDescriptor annotation = new AnnotationDescriptor( annotationType ); copyStringAttribute( annotation, subelement, "name", false ); copyStringAttribute( annotation, subelement, "catalog", false ); if ( StringHelper.isNotEmpty( defaults.getCatalog() ) && StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) { annotation.setValue( "catalog", defaults.getCatalog() ); } copyStringAttribute( annotation, subelement, "schema", false ); if ( StringHelper.isNotEmpty( defaults.getSchema() ) && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) { annotation.setValue( "schema", defaults.getSchema() ); } buildUniqueConstraints( annotation, subelement ); annotation.setValue( "joinColumns", getJoinColumns( subelement, false ) ); annotation.setValue( "inverseJoinColumns", getJoinColumns( subelement, true ) ); annotationList.add( AnnotationFactory.create( annotation ) ); } }
public static TableGenerator buildTableGeneratorAnnotation(Element element, XMLContext.Default defaults) { AnnotationDescriptor ad = new AnnotationDescriptor( TableGenerator.class ); copyStringAttribute( ad, element, "name", false ); copyStringAttribute( ad, element, "table", false ); copyStringAttribute( ad, element, "catalog", false ); copyStringAttribute( ad, element, "schema", false ); copyStringAttribute( ad, element, "pk-column-name", false ); copyStringAttribute( ad, element, "value-column-name", false ); copyStringAttribute( ad, element, "pk-column-value", false ); copyIntegerAttribute( ad, element, "initial-value" ); copyIntegerAttribute( ad, element, "allocation-size" ); buildUniqueConstraints( ad, element ); if ( StringHelper.isEmpty( (String) ad.valueOf( "schema" ) ) && StringHelper.isNotEmpty( defaults.getSchema() ) ) { ad.setValue( "schema", defaults.getSchema() ); } if ( StringHelper.isEmpty( (String) ad.valueOf( "catalog" ) ) && StringHelper.isNotEmpty( defaults.getCatalog() ) ) { ad.setValue( "catalog", defaults.getCatalog() ); } return AnnotationFactory.create( ad ); }
public void override(Default globalDefault) { if ( globalDefault != null ) { if ( globalDefault.getAccess() != null ) access = globalDefault.getAccess(); if ( globalDefault.getPackageName() != null ) packageName = globalDefault.getPackageName(); if ( globalDefault.getSchema() != null ) schema = globalDefault.getSchema(); if ( globalDefault.getCatalog() != null ) catalog = globalDefault.getCatalog(); if ( globalDefault.getDelimitedIdentifier() != null ) delimitedIdentifier = globalDefault.getDelimitedIdentifier(); if ( globalDefault.getMetadataComplete() != null ) { metadataComplete = globalDefault.getMetadataComplete(); } //TODO fix that in stone if cascade-persist is set already? if ( globalDefault.getCascadePersist() != null ) cascadePersist = globalDefault.getCascadePersist(); } }
|| StringHelper.isNotEmpty( defaults.getSchema() ) ) { AnnotationDescriptor annotation = new AnnotationDescriptor( Table.class ); if ( defaults.canUseJavaAnnotations() ) { && StringHelper.isNotEmpty( defaults.getSchema() ) ) { annotation.setValue( "schema", defaults.getSchema() ); if ( StringHelper.isNotEmpty( defaults.getSchema() ) && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) { annotation.setValue( "schema", defaults.getSchema() );
if ( defaultToJoinTable && ( StringHelper.isNotEmpty( defaults.getCatalog() ) || StringHelper.isNotEmpty( defaults.getSchema() ) ) ) { AnnotationDescriptor ad = new AnnotationDescriptor( annotationType ); if ( defaults.canUseJavaAnnotations() ) { && StringHelper.isNotEmpty( defaults.getSchema() ) ) { ad.setValue( "schema", defaults.getSchema() );
if ( StringHelper.isNotEmpty( defaults.getSchema() ) || StringHelper.isNotEmpty( defaults.getCatalog() ) ) { AnnotationDescriptor annotation = new AnnotationDescriptor( TableGenerator.class ); && StringHelper.isNotEmpty( defaults.getSchema() ) ) { annotation.setValue( "catalog", defaults.getSchema() );
private void overridesDefaultInSecondaryTable( SecondaryTable secTableAnn, XMLContext.Default defaults, List<SecondaryTable> secondaryTables ) { if ( secTableAnn != null ) { //handle default values if ( StringHelper.isNotEmpty( defaults.getCatalog() ) || StringHelper.isNotEmpty( defaults.getSchema() ) ) { AnnotationDescriptor annotation = new AnnotationDescriptor( SecondaryTable.class ); annotation.setValue( "name", secTableAnn.name() ); annotation.setValue( "schema", secTableAnn.schema() ); annotation.setValue( "catalog", secTableAnn.catalog() ); annotation.setValue( "uniqueConstraints", secTableAnn.uniqueConstraints() ); annotation.setValue( "pkJoinColumns", secTableAnn.pkJoinColumns() ); if ( StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) && StringHelper.isNotEmpty( defaults.getSchema() ) ) { annotation.setValue( "schema", defaults.getSchema() ); } if ( StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) && StringHelper.isNotEmpty( defaults.getCatalog() ) ) { annotation.setValue( "catalog", defaults.getCatalog() ); } secondaryTables.add( AnnotationFactory.create( annotation ) ); } else { secondaryTables.add( secTableAnn ); } } } private static void buildIndex(AnnotationDescriptor annotation, Element element){
private JoinTable buildJoinTable(Element tree, XMLContext.Default defaults) { Element subelement = tree == null ? null : tree.element( "join-table" ); final Class<JoinTable> annotationType = JoinTable.class; if ( subelement == null ) { return null; } //ignore java annotation, an element is defined AnnotationDescriptor annotation = new AnnotationDescriptor( annotationType ); copyStringAttribute( annotation, subelement, "name", false ); copyStringAttribute( annotation, subelement, "catalog", false ); if ( StringHelper.isNotEmpty( defaults.getCatalog() ) && StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) { annotation.setValue( "catalog", defaults.getCatalog() ); } copyStringAttribute( annotation, subelement, "schema", false ); if ( StringHelper.isNotEmpty( defaults.getSchema() ) && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) { annotation.setValue( "schema", defaults.getSchema() ); } buildUniqueConstraints( annotation, subelement ); buildIndex( annotation, subelement ); annotation.setValue( "joinColumns", getJoinColumns( subelement, false ) ); annotation.setValue( "inverseJoinColumns", getJoinColumns( subelement, true ) ); return AnnotationFactory.create( annotation ); }
public void override(Default globalDefault) { if ( globalDefault != null ) { if ( globalDefault.getAccess() != null ) { access = globalDefault.getAccess(); } if ( globalDefault.getPackageName() != null ) { packageName = globalDefault.getPackageName(); } if ( globalDefault.getSchema() != null ) { schema = globalDefault.getSchema(); } if ( globalDefault.getCatalog() != null ) { catalog = globalDefault.getCatalog(); } if ( globalDefault.getDelimitedIdentifier() != null ) { delimitedIdentifier = globalDefault.getDelimitedIdentifier(); } if ( globalDefault.getMetadataComplete() != null ) { metadataComplete = globalDefault.getMetadataComplete(); } //TODO fix that in stone if cascade-persist is set already? if ( globalDefault.getCascadePersist() != null ) cascadePersist = globalDefault.getCascadePersist(); } }
public static TableGenerator buildTableGeneratorAnnotation(Element element, XMLContext.Default defaults) { AnnotationDescriptor ad = new AnnotationDescriptor( TableGenerator.class ); copyStringAttribute( ad, element, "name", false ); copyStringAttribute( ad, element, "table", false ); copyStringAttribute( ad, element, "catalog", false ); copyStringAttribute( ad, element, "schema", false ); copyStringAttribute( ad, element, "pk-column-name", false ); copyStringAttribute( ad, element, "value-column-name", false ); copyStringAttribute( ad, element, "pk-column-value", false ); copyIntegerAttribute( ad, element, "initial-value" ); copyIntegerAttribute( ad, element, "allocation-size" ); buildUniqueConstraints( ad, element ); if ( StringHelper.isEmpty( (String) ad.valueOf( "schema" ) ) && StringHelper.isNotEmpty( defaults.getSchema() ) ) { ad.setValue( "schema", defaults.getSchema() ); } if ( StringHelper.isEmpty( (String) ad.valueOf( "catalog" ) ) && StringHelper.isNotEmpty( defaults.getCatalog() ) ) { ad.setValue( "catalog", defaults.getCatalog() ); } return AnnotationFactory.create( ad ); }