All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebeaninternal.server.deploy.DeployUpdateMapFactory Maven / Gradle / Ivy

There is a newer version: 2.8.1
Show newest version
package com.avaje.ebeaninternal.server.deploy;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.avaje.ebeaninternal.server.deploy.id.ImportedId;

/**
 * Build a map of logical to physical names for use in Orm Updates.
 *
 */
public class DeployUpdateMapFactory {

	private static final Logger logger = Logger.getLogger(DeployUpdateMapFactory.class.getName());
	
	/**
	 * Build a map of logical to physical names for use in Orm Updates for a given descriptor.
	 * 

* This includes the dbWrite scalar properties and imported foreign key properties. *

*/ public static Map build(BeanDescriptor descriptor) { Map deployMap = new HashMap(); String shortName = descriptor.getName(); String beanName = shortName.toLowerCase(); deployMap.put(beanName, descriptor.getBaseTable()); BeanProperty[] baseScalar = descriptor.propertiesBaseScalar(); for (BeanProperty baseProp : baseScalar) { // excluding formula, secondary table properties if (baseProp.isDbInsertable() || baseProp.isDbUpdatable()){ deployMap.put(baseProp.getName().toLowerCase(), baseProp.getDbColumn()); } } BeanPropertyAssocOne[] oneImported = descriptor.propertiesOneImported(); for (BeanPropertyAssocOne assocOne : oneImported) { ImportedId importedId = assocOne.getImportedId(); if (importedId == null){ String m = descriptor.getFullName()+" importedId is null for associated: "+assocOne.getFullBeanName(); logger.log(Level.SEVERE, m); } else if (importedId.isScalar()){ deployMap.put(importedId.getLogicalName(), importedId.getDbColumn()); } } return deployMap; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy