Example usage for org.hibernate.mapping MetaAttribute getValue

List of usage examples for org.hibernate.mapping MetaAttribute getValue

Introduction

In this page you can find the example usage for org.hibernate.mapping MetaAttribute getValue.

Prototype

public String getValue() 

Source Link

Usage

From source file:com.siemens.scr.avt.ad.query.common.DicomMappingDictionaryLoadingStrategy.java

License:Open Source License

private void loadDicomHeaderMetadata(DicomMappingDictionary dict, String table, String column, Property prop) {
    MetaAttribute isHeader = prop.getMetaAttribute(DICOM_HEADER);
    if (isHeader != null)
        if (isHeader != null && Boolean.parseBoolean(isHeader.getValue())) {
            DefaultDicomHeaderEntry.setHeaderTable(table);
            DefaultDicomHeaderEntry.setHeaderColumn(column);
        }/*from www.  java  2s .  c  o  m*/
}

From source file:com.siemens.scr.avt.ad.query.common.DicomMappingDictionaryLoadingStrategy.java

License:Open Source License

private void loadTag(DicomMappingDictionary dict, Property prop, String key) {
    MetaAttribute tag = prop.getMetaAttribute(TAG);

    if (tag != null) {
        dict.addTag2Key(parseHex(tag.getValue()), key);
    }/*from  w  w  w. ja v  a2  s.co m*/
}

From source file:org.eclipse.emf.teneo.hibernate.HbUtil.java

License:Open Source License

public static EClass getEClassFromMeta(Component component) {
    final MetaAttribute ePackageMetaAttribute = component.getMetaAttribute(HbMapperConstants.EPACKAGE_PARAM);
    if (ePackageMetaAttribute == null) {
        return null;
    }/*  www.j  a v  a2s.  com*/
    final EPackage epackage = PackageRegistryProvider.getInstance().getPackageRegistry()
            .getEPackage(ePackageMetaAttribute.getValue());
    if (epackage == null) {
        throw new IllegalArgumentException(
                "Could not find ePackage using nsuri " + ePackageMetaAttribute.getValue());
    }
    final MetaAttribute eClassMetaAttribute = component.getMetaAttribute(HbMapperConstants.ECLASS_NAME_META);
    if (eClassMetaAttribute == null) {
        return null;
    }
    return (EClass) epackage.getEClassifier(eClassMetaAttribute.getValue());
}

From source file:org.eclipse.emf.teneo.hibernate.HbUtil.java

License:Open Source License

/** Returns the meta class uri, if not found then null is returned */
public static String getEClassNameFromFeatureMapMeta(PersistentClass pc) {
    MetaAttribute ma = pc.getMetaAttribute(HbMapperConstants.FEATUREMAP_META);
    if (ma == null) {
        return null;
    }/*from w ww  .  j av  a2 s .  c  o  m*/
    return ma.getValue();
}

From source file:org.eclipse.emf.teneo.hibernate.mapping.elist.FeatureMapEntryComponentTuplizer.java

License:Open Source License

protected PropertyAccessor getPropertyAccessor(Property mappedProperty, Component component) {
    final HbDataStore hds = HbHelper.INSTANCE.getDataStore(component.getOwner());
    if (mappedProperty.getMetaAttribute(HbMapperConstants.VERSION_META) != null) {
        return hds.getHbContext().createVersionAccessor();
    } else if (mappedProperty.getName().compareToIgnoreCase(HbMapperConstants.PROPERTY_FEATURE) == 0) {
        return hds.getHbContext().createFeatureMapEntryFeatureURIAccessor();
    } else if (mappedProperty.getName().compareToIgnoreCase(HbMapperConstants.PROPERTY_MIXED_CDATA) == 0) {
        return hds.getHbContext().createFeatureMapEntryAccessor(Constants.CDATA);
    } else if (mappedProperty.getName().compareToIgnoreCase(HbMapperConstants.PROPERTY_MIXED_COMMENT) == 0) {
        return hds.getHbContext().createFeatureMapEntryAccessor(Constants.COMMENT);
    } else if (mappedProperty.getName().compareToIgnoreCase(HbMapperConstants.PROPERTY_MIXED_TEXT) == 0) {
        return hds.getHbContext().createFeatureMapEntryAccessor(Constants.TEXT);
    } else if (mappedProperty.getName().endsWith(HbMapperConstants.PROPERTY_ANY_PRIMITIVE)) {
        return hds.getExtensionManager().getExtension(WildCardAttributePropertyHandler.class);
    } else if (mappedProperty.getName().endsWith(HbMapperConstants.PROPERTY_ANY_REFERENCE)) {
        return hds.getExtensionManager().getExtension(WildCardReferencePropertyHandler.class);
    }//from   w  w  w . j a  v a 2 s.  c  o  m

    final MetaAttribute ma = component.getMetaAttribute(HbMapperConstants.FEATUREMAP_META);
    final String eclassUri = ma.getValue();
    final EClass eClass = hds.getEntityNameStrategy().toEClass(eclassUri);
    final EStructuralFeature efeature = StoreUtil.getEStructuralFeature(eClass, mappedProperty.getName());

    if (efeature == null) {
        throw new HbMapperException("Feature not found for property " + mappedProperty.getName());
    }

    if (log.isDebugEnabled()) {
        log.debug("Creating property accessor for " + mappedProperty.getName() + "/" + eclassUri + "/"
                + efeature.getName());
    }

    return hds.getHbContext().createFeatureMapEntryAccessor(efeature);
}

From source file:org.openeos.tools.hibernate.hbm2java.UnoReverseEngineeringStrategy.java

License:Apache License

@Override
public boolean isOneToOne(ForeignKey foreignKey) {
    Map tableMap = this.tableToMetaAttributes(TableIdentifier.create(foreignKey.getTable()));
    if (tableMap != null) {
        MetaAttribute forceOneToOne = (MetaAttribute) tableMap.get("force-one-to-one");
        if (forceOneToOne != null) {
            String[] fks = forceOneToOne.getValue().split(",");
            for (int i = 0; i < fks.length; i++) {
                if (fks[i].trim().equalsIgnoreCase(foreignKey.getName())) {
                    return true;
                }/*  w w  w  .j av  a  2  s . c  o  m*/
            }
        }
    }
    return super.isOneToOne(foreignKey);

}

From source file:org.openeos.tools.hibernate.hbm2java.UnoReverseEngineeringStrategy.java

License:Apache License

@Override
public boolean useColumnForOptimisticLock(TableIdentifier identifier, String column) {
    Map columnMeta = this.columnToMetaAttributes(identifier, column);
    if (columnMeta != null) {
        MetaAttribute isOptimisticAttribute = (MetaAttribute) columnMeta.get("is-optimistic-lock-column");
        if (isOptimisticAttribute != null) {
            return Boolean.parseBoolean(isOptimisticAttribute.getValue());
        }//from w  w  w . ja va  2  s. co  m
    }
    return super.useColumnForOptimisticLock(identifier, column);
}

From source file:org.web4thejob.orm.MetaUtil.java

License:Open Source License

public static boolean hasMetaAttribute(Property property, String name) {
    final MetaAttribute metaAttribute = property.getMetaAttribute(name);
    if (metaAttribute != null) {
        try {//w  w w  .ja  v a2  s .c o m
            return metaAttribute.getValue() != null;
        } catch (final Exception e) {
            return false;
        }
    }
    return false;
}

From source file:org.web4thejob.orm.MetaUtil.java

License:Open Source License

public static boolean hasMetaAttribute(PersistentClass persistentClass, String name) {
    final MetaAttribute metaAttribute = persistentClass.getMetaAttribute(name);
    if (metaAttribute != null) {
        try {/*from   ww w  .  jav  a2s .  c o  m*/
            return metaAttribute.getValue() != null;
        } catch (final Exception e) {
            return false;
        }
    }
    return false;
}