use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo in project jbosstools-hibernate by jbosstools.
the class EntitiesList method isOneProject.
public boolean isOneProject() {
Map<String, EntityInfo> mapEntities = data.getEntities();
Iterator<EntityInfo> it = mapEntities.values().iterator();
boolean res = true;
String javaProjectName = null;
while (it.hasNext()) {
EntityInfo ei = it.next();
if (javaProjectName != null && !javaProjectName.equalsIgnoreCase(ei.getJavaProjectName())) {
res = false;
break;
}
javaProjectName = ei.getJavaProjectName();
}
return res;
}
use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo in project jbosstools-hibernate by jbosstools.
the class ResolveAmbiguous method findRelatedRefFieldInfos.
protected Set<RefFieldInfo> findRelatedRefFieldInfos(String fullyQualifiedName, RefEntityInfo rei) {
String fullyQualifiedName2 = rei.fullyQualifiedName;
EntityInfo entryInfo2 = data.getEntities().get(fullyQualifiedName2);
Set<RefFieldInfo> setRefEntityInfo = entryInfo2.getRefFieldInfoSet(fullyQualifiedName);
return setRefEntityInfo;
}
use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo in project jbosstools-hibernate by jbosstools.
the class AllEntitiesProcessor method reCollectModification.
public void reCollectModification(Map<String, EntityInfo> entities) {
changes.clear();
final ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
HashMap<IPath, EntityInfosCollection> modifications = new HashMap<IPath, EntityInfosCollection>();
Iterator<Map.Entry<String, EntityInfo>> it = entities.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, EntityInfo> entry = it.next();
if (entry.getValue().isInterfaceFlag()) {
continue;
}
final String javaProjectName = entry.getValue().getJavaProjectName();
final String fullyQualifiedName = entry.getValue().getFullyQualifiedName();
IJavaProject javaProject = Utils.findJavaProject(javaProjectName);
ICompilationUnit icu = Utils.findCompilationUnit(javaProject, fullyQualifiedName);
if (icu == null) {
continue;
}
org.eclipse.jdt.core.dom.CompilationUnit cu = Utils.getCompilationUnit(icu, true);
final IPath path = cu.getJavaElement().getPath();
EntityInfosCollection eiCollection = null;
if (modifications.containsKey(path)) {
eiCollection = modifications.get(path);
} else {
eiCollection = new EntityInfosCollection();
eiCollection.setPath(path);
eiCollection.setICompilationUnit(icu);
eiCollection.setCompilationUnit(cu);
modifications.put(path, eiCollection);
try {
bufferManager.connect(path, LocationKind.IFILE, null);
} catch (CoreException e) {
// $NON-NLS-1$
HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e);
}
}
final EntityInfo entityInfo = entry.getValue();
//
entityInfo.updateColumnAnnotationImport(defaultStrLength != columnLength);
entityInfo.updateVersionImport(enableOptLock && entityInfo.isAddVersionFlag());
//
eiCollection.addEntityInfo(entityInfo);
}
Iterator<EntityInfosCollection> itEIC = modifications.values().iterator();
while (itEIC.hasNext()) {
EntityInfosCollection eic = itEIC.next();
eic.updateExistingImportSet();
eic.updateRequiredImportSet();
collectModification(bufferManager, eic, entities);
}
}
use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo in project jbosstools-hibernate by jbosstools.
the class ResolveAmbiguous method findMappedRefEntityInfo.
protected RefEntityInfo findMappedRefEntityInfo(RefEntityInfo rei) {
if (rei.mappedBy == null) {
return null;
}
String fullyQualifiedName2 = rei.fullyQualifiedName;
EntityInfo entryInfo2 = data.getEntities().get(fullyQualifiedName2);
RefEntityInfo refEntityInfo = entryInfo2.getFieldIdRefEntityInfo(rei.mappedBy);
return refEntityInfo;
}
use of org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo in project jbosstools-hibernate by jbosstools.
the class TypeVisitor method setEntities.
public void setEntities(Map<String, EntityInfo> entities) {
rootClasses.clear();
Iterator<Map.Entry<String, EntityInfo>> it = entities.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, EntityInfo> entry = it.next();
EntityInfo entryInfo = entry.getValue();
String className = entryInfo.getName();
ITable table = service.newTable(className.toUpperCase());
IPersistentClass rootClass = service.newRootClass();
rootClass.setEntityName(entryInfo.getFullyQualifiedName());
rootClass.setClassName(entryInfo.getFullyQualifiedName());
rootClass.setProxyInterfaceName(entryInfo.getFullyQualifiedName());
rootClass.setLazy(true);
rootClass.setTable(table);
// abstract or interface
rootClass.setAbstract(entryInfo.isAbstractFlag());
rootClasses.put(entryInfo.getFullyQualifiedName(), rootClass);
}
typeVisitor = new TypeVisitor(service, rootClasses);
}
Aggregations