/** * {@inheritDoc} */ public Properties getProperties() { return persistenceUnitDescriptor.getProperties(); // its already a clone }
/** * Given a persistence unit descriptor * return the value of a property if the * user has specified it. * If the user has not defined this property * return the default value. * @param parBundle the persistence unit descriptor that is being worked on. * @param propertyName the property name being checked. * @param defaultValue the default value to be used. * @return the property value. */ private String getPersistencePropVal(PersistenceUnitDescriptor parBundle, String propertyName, String defaultValue) { return parBundle.getProperties().getProperty(propertyName, defaultValue); }
/** * Utility method that is used to actually set the property into the persistence unit descriptor. * @param descriptor the persistence unit descriptor that is being worked on. * @param propertyName the name of the property. * @param propertyValue the value of the property. */ private static void addPropertyToOverride(PersistenceUnitDescriptor descriptor, Map<String, Object> overrides, String propertyName, String propertyValue) { String oldPropertyValue = descriptor.getProperties().getProperty(propertyName); if(null == oldPropertyValue) { //Do not override any value explicitly specified by the user overrides.put(propertyName, propertyValue); } }
/** * @return true if the given <code>pud</code> contains a JPA standard property for schema generation */ private static boolean containsStandardSchemaGenerationProperty(PersistenceUnitDescriptor pud) { boolean containsStandardSchemaGenerationProperty = false; for (Object puPropertyName : pud.getProperties().keySet()) { if(puPropertyName instanceof String && String.class.cast(puPropertyName).startsWith(STANDARD_SCHEMA_GENERATION_PREFIX) ) { containsStandardSchemaGenerationProperty = true; break; } } return containsStandardSchemaGenerationProperty; }
private ValidationMode getValidationMode(PersistenceUnitDescriptor pud) { ValidationMode validationMode = pud.getValidationMode(); //Initialize with value element <validation-mode> in persitence.xml //Check is overridden in properties String validationModeFromProperty = (String) pud.getProperties().get(VALIDATION_MODE_PROPERTY); if(validationModeFromProperty != null) { //User would get IllegalArgumentException if he has specified invalid mode validationMode = ValidationMode.valueOf(validationModeFromProperty); } return validationMode; }
Properties properties = pud.getProperties(); for (Map.Entry entry : properties.entrySet()) { String key = (String) entry.getKey();