JBoss Tools SVN: r2412 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-12 13:19:04 -0400 (Thu, 12 Jul 2007)
New Revision: 2412
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
Log:
EXIN-218 Properties of component added.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-12 17:17:08 UTC (rev 2411)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamComponent.java 2007-07-12 17:19:04 UTC (rev 2412)
@@ -50,6 +50,11 @@
* @return qualified Class name of component
*/
public String getClassName();
+
+ /**
+ *
+ */
+ public int getPrecedence();
/**
* @return bijected attributes of component
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-12 17:17:08 UTC (rev 2411)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-12 17:19:04 UTC (rev 2412)
@@ -83,6 +83,25 @@
}
/**
+ *
+ */
+ public int getPrecedence() {
+ Set<ISeamXmlComponentDeclaration> xml = getXmlDeclarations();
+ for(ISeamXmlComponentDeclaration d: xml) {
+ String s = d.getPrecedence();
+ if(s == null || s.length() == 0) continue;
+ try {
+ return Integer.valueOf(s);
+ } catch (Exception e) {
+ //ignore here
+ }
+ }
+ ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
+ if(javaDeclaration != null) return javaDeclaration.getPrecedence();
+ return 20;
+ }
+
+ /**
* @see org.jboss.tools.seam.core.ISeamComponent#getMethods()
*/
public Set<ISeamComponentMethod> getMethods() {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-12 17:17:08 UTC (rev 2411)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-12 17:19:04 UTC (rev 2412)
@@ -156,10 +156,10 @@
name.value = m.getName().getIdentifier();
}
- att.setName(name.getValue());
+ att.setName(name);
ValueInfo scope = ValueInfo.getValueInfo(main, "scope");
- if(scope != null) att.setScopeAsString(scope.getValue());
+ if(scope != null) att.setScope(scope);
att.setSourceMember(findMethod(m));
}
@@ -191,10 +191,10 @@
name.value = getFieldName(m);
}
- att.setName(name.getValue());
+ att.setName(name);
ValueInfo scope = ValueInfo.getValueInfo(main, "scope");
- if(scope != null) att.setScopeAsString(scope.getValue());
+ if(scope != null) att.setScope(scope);
att.setSourceMember(findField(m));
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-07-12 17:17:08 UTC (rev 2411)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/TypeScanner.java 2007-07-12 17:19:04 UTC (rev 2412)
@@ -128,8 +128,13 @@
}
a = map.get(INSTALL_ANNOTATION_TYPE);
if(a != null) {
- Object precedence = getValue(a, "precedence");
- if(precedence instanceof Integer) component.setPrecedence((Integer)precedence);
+ String precedence = getValue(a, "precedence");
+ try {
+ int i = Integer.parseInt(precedence);
+ component.setPrecedence(i);
+ } catch (Exception e) {
+ //ignore
+ }
}
a = map.get(STATEFUL_ANNOTATION_TYPE);
if(a != null) {
17 years, 5 months
JBoss Tools SVN: r2411 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-12 13:17:08 -0400 (Thu, 12 Jul 2007)
New Revision: 2411
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
Log:
http://jira.jboss.com/jira/browse/EXIN-327 Ignore duplicate @Name in jars
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-12 16:33:22 UTC (rev 2410)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-12 17:17:08 UTC (rev 2411)
@@ -23,6 +23,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
@@ -180,38 +181,43 @@
usedPrecedences.put(firstJavaDeclarationPrecedence, firstJavaDeclaration);
Set<ISeamComponentDeclaration> declarations = component.getAllDeclarations();
for (ISeamComponentDeclaration declaration : declarations) {
- if(declaration instanceof ISeamJavaComponentDeclaration && declaration.getResource() instanceof IFile) {
- // Save link between component name and java source file.
- validationContext.addLinkedResource(declaration.getName(), declaration.getSourcePath());
- // Validate all elements in declaration but @Name.
- validateJavaDeclaration(project, firstJavaDeclaration, helper, reporter);
- }
- if(declaration instanceof ISeamJavaComponentDeclaration && declaration!=firstJavaDeclaration) {
- // Validate @Name
- // Component class with the same component name. Check precedence.
- ISeamJavaComponentDeclaration javaDeclaration = (ISeamJavaComponentDeclaration)declaration;
- int javaDeclarationPrecedence = javaDeclaration.getPrecedence();
- ISeamJavaComponentDeclaration checkedDeclaration = usedPrecedences.get(javaDeclarationPrecedence);
- if(checkedDeclaration==null) {
- usedPrecedences.put(javaDeclarationPrecedence, javaDeclaration);
- } else {
- IResource javaDeclarationResource = javaDeclaration.getResource();
- // Mark nonunique name.
- if(!markedDeclarations.contains(checkedDeclaration)) {
- // Mark first wrong declaration with that name
- IResource checkedDeclarationResource = checkedDeclaration.getResource();
- ISeamTextSourceReference location = ((SeamComponentDeclaration)checkedDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
+ if(declaration instanceof ISeamJavaComponentDeclaration) {
+ ISeamJavaComponentDeclaration jd = (ISeamJavaComponentDeclaration)declaration;
+ boolean sourceJavaDeclaration = !((IType)jd.getSourceMember()).isBinary();
+ if(sourceJavaDeclaration) {
+ // Save link between component name and java source file.
+ validationContext.addLinkedResource(declaration.getName(), declaration.getSourcePath());
+ // Validate all elements in declaration but @Name.
+ validateJavaDeclaration(project, firstJavaDeclaration, helper, reporter);
+ }
+ if(declaration!=firstJavaDeclaration) {
+ // Validate @Name
+ // Component class with the same component name. Check precedence.
+ ISeamJavaComponentDeclaration javaDeclaration = (ISeamJavaComponentDeclaration)declaration;
+ int javaDeclarationPrecedence = javaDeclaration.getPrecedence();
+ ISeamJavaComponentDeclaration checkedDeclaration = usedPrecedences.get(javaDeclarationPrecedence);
+ boolean sourceCheckedDeclaration = !((IType)checkedDeclaration.getSourceMember()).isBinary();
+ if(checkedDeclaration==null) {
+ usedPrecedences.put(javaDeclarationPrecedence, javaDeclaration);
+ } else if(sourceJavaDeclaration) {
+ IResource javaDeclarationResource = javaDeclaration.getResource();
+ // Mark nonunique name.
+ if(!markedDeclarations.contains(checkedDeclaration) && sourceCheckedDeclaration) {
+ // Mark first wrong declaration with that name
+ IResource checkedDeclarationResource = checkedDeclaration.getResource();
+ ISeamTextSourceReference location = ((SeamComponentDeclaration)checkedDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
+ if(location!=null) {
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, new String[]{component.getName()}, location, checkedDeclarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
+ }
+ markedDeclarations.add(checkedDeclaration);
+ }
+ // Mark next wrong declaration with that name
+ markedDeclarations.add(javaDeclaration);
+ ISeamTextSourceReference location = ((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, new String[]{component.getName()}, location, checkedDeclarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, new String[]{component.getName()}, location, javaDeclarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
}
- markedDeclarations.add(checkedDeclaration);
}
- // Mark next wrong declaration with that name
- markedDeclarations.add(javaDeclaration);
- ISeamTextSourceReference location = ((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
- if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, new String[]{component.getName()}, location, javaDeclarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
- }
}
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-12 16:33:22 UTC (rev 2410)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-12 17:17:08 UTC (rev 2411)
@@ -8,10 +8,10 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-NONUNIQUE_COMPONENT_NAME_MESSAGE=Duplicate component name {0}
+NONUNIQUE_COMPONENT_NAME_MESSAGE=Duplicate component name: {0}
UNKNOWN_INJECTION_NAME=Unknown context variable name: {0}
-STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE=Stateful component {0} must have a method marked @Remove
-STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY=Stateful component {0} must have a method marked @Destroy
-STATEFUL_COMPONENT_WRONG_SCOPE=Stateful component {0} should not have org.jboss.seam.ScopeType.PAGE, nor org.jboss.seam.ScopeType.STATELESS
-STATEFUL_COMPONENT_DUPLICATE_REMOVE=Duplicate @Remove method {0}
-STATEFUL_COMPONENT_DUPLICATE_DESTROY=Duplicate @Destroy method {0}
\ No newline at end of file
+STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE=Stateful component '{0}' must have a method marked @Remove
+STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY=Stateful component '{0}' must have a method marked @Destroy
+STATEFUL_COMPONENT_WRONG_SCOPE=Stateful component '{0}' should not have org.jboss.seam.ScopeType.PAGE, nor org.jboss.seam.ScopeType.STATELESS
+STATEFUL_COMPONENT_DUPLICATE_REMOVE=Duplicate @Remove method '{0}'
+STATEFUL_COMPONENT_DUPLICATE_DESTROY=Duplicate @Destroy method '{0}'
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2410 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: core/internal and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-12 12:33:22 -0400 (Thu, 12 Jul 2007)
New Revision: 2410
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentMethodType.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
Log:
http://jira.jboss.com/jira/browse/EXIN-327 Added @In, @Stateful , @Remove, @Destroy validation
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentMethodType.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentMethodType.java 2007-07-12 15:38:49 UTC (rev 2409)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamComponentMethodType.java 2007-07-12 16:33:22 UTC (rev 2410)
@@ -15,5 +15,6 @@
*/
public enum SeamComponentMethodType {
CREATE,
- DESTROY
+ DESTROY,
+ REMOVE
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-12 15:38:49 UTC (rev 2409)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaValidator.java 2007-07-12 16:33:22 UTC (rev 2410)
@@ -12,7 +12,6 @@
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -23,6 +22,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
@@ -30,10 +30,14 @@
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamComponentMethod;
import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
+import org.jboss.tools.seam.core.ScopeType;
+import org.jboss.tools.seam.core.SeamComponentMethodType;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamProject;
@@ -45,9 +49,14 @@
private static final String MARKED_COMPONENT_MESSAGE_GROUP = "markedComponent";
- public static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID = "NONUNIQUE_COMPONENT_NAME_MESSAGE";
+ private static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID = "NONUNIQUE_COMPONENT_NAME_MESSAGE";
+ private static final String UNKNOWN_INJECTION_NAME_MESSAGE_ID = "UNKNOWN_INJECTION_NAME";
+ private static final String STATEFUL_COMPONENT_DOES_NOT_CONTENT_METHOD_SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DOES_NOT_CONTENT_";
+ private static final String STATEFUL_COMPONENT_DUPLICATE_METHOD__SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DUPLICATE_";
+ private static final String REMOVE_METHOD_POSTFIX_MESSAGE_ID = "REMOVE";
+ private static final String DESTROY_METHOD_POSTFIX_MESSAGE_ID = "DESTROY";
- public static final String UNKNOWN_INJECTION_NAME_MESSAGE_ID = "UNKNOWN_INJECTION_NAME";
+ private static final String STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "STATEFUL_COMPONENT_WRONG_SCOPE";
private SeamValidationContext validationContext;
@@ -64,20 +73,16 @@
if (uris.length > 0) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFile currentFile = null;
- Set<IPath> checkedResources = new HashSet<IPath>();
Set<ISeamComponent> checkedComponents = new HashSet<ISeamComponent>();
+ // Collect all resources which we must validate.
+ Set<IPath> resources = new HashSet<IPath>(); // Resources which we have to validate.
for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) {
currentFile = root.getFile(new Path(uris[i]));
- // Don't validate one resource twice.
- if(checkedResources.contains(currentFile)) {
- continue;
- }
+ // Don't handle one resource twice.
if (currentFile != null && currentFile.exists()) {
// Get all variable names that were linked with this resource.
Set<String> oldVariablesNamesOfChangedFile = validationContext.getVariableNamesByResource(currentFile.getFullPath());
if(oldVariablesNamesOfChangedFile!=null) {
- Set<IPath> resources = new HashSet<IPath>(); // Resources which we have to validate.
-
// Check if variable name was changed in java file
Set<String> newVariableNamesOfChangedFile = getVariablesNameByResource(currentFile.getFullPath(), project);
for (String newVariableName : newVariableNamesOfChangedFile) {
@@ -90,10 +95,7 @@
}
}
}
- // Check if changed file is not linked to any variables anymore.
- if(newVariableNamesOfChangedFile.size() == 0) {
- resources.add(currentFile.getFullPath());
- }
+ resources.add(currentFile.getFullPath());
// Collect all linked resources with old variable names.
for (String name : oldVariablesNamesOfChangedFile) {
@@ -103,26 +105,21 @@
}
}
- // Validate all collected linked resources.
- // Remove all links between resources and variables names because they will be linked again during validation.
- validationContext.clear();
- for (IPath linkedResource : resources) {
- // Don't validate one resource twice.
- if(checkedResources.contains(linkedResource)) {
- continue;
- }
- // Remove markers from collected java file
- reporter.removeMessageSubset(this, linkedResource, MARKED_COMPONENT_MESSAGE_GROUP);
- validateComponent(project, linkedResource, checkedComponents, helper, reporter);
- checkedResources.add(linkedResource);
- }
} else {
- // Validate new (unmarked) Java file.
- validateComponent(project, currentFile.getFullPath(), checkedComponents, helper, reporter);
+ // Validate new (unlinked) Java file.
+ resources.add(currentFile.getFullPath());
}
- // TODO
}
}
+ // Validate all collected linked resources.
+ // Remove all links between resources and variables names because they will be linked again during validation.
+ validationContext.clear();
+ for (IPath linkedResource : resources) {
+ // Remove markers from collected java file
+ reporter.removeMessageSubset(this, linkedResource, MARKED_COMPONENT_MESSAGE_GROUP);
+ validateComponent(project, linkedResource, checkedComponents, helper, reporter);
+ // TODO
+ }
} else {
return validateAll(project, helper, reporter);
}
@@ -187,7 +184,7 @@
// Save link between component name and java source file.
validationContext.addLinkedResource(declaration.getName(), declaration.getSourcePath());
// Validate all elements in declaration but @Name.
- validateInjections(project, firstJavaDeclaration, helper, reporter);
+ validateJavaDeclaration(project, firstJavaDeclaration, helper, reporter);
}
if(declaration instanceof ISeamJavaComponentDeclaration && declaration!=firstJavaDeclaration) {
// Validate @Name
@@ -205,7 +202,7 @@
IResource checkedDeclarationResource = checkedDeclaration.getResource();
ISeamTextSourceReference location = ((SeamComponentDeclaration)checkedDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, location, checkedDeclarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, new String[]{component.getName()}, location, checkedDeclarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
}
markedDeclarations.add(checkedDeclaration);
}
@@ -213,36 +210,81 @@
markedDeclarations.add(javaDeclaration);
ISeamTextSourceReference location = ((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, location, javaDeclarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, new String[]{component.getName()}, location, javaDeclarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
}
}
}
}
+ validateStatefulComponent(project, component, helper, reporter);
}
}
+ private void validateStatefulComponent(ISeamProject project, ISeamComponent component, IValidationContext helper, IReporter reporter) {
+ ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
+ if(javaDeclaration!=null && javaDeclaration.isStateful()) {
+ int length = 0;
+ int offset = 0;
+ try {
+ length = javaDeclaration.getSourceMember().getNameRange().getLength();
+ offset = javaDeclaration.getSourceMember().getNameRange().getOffset();
+ } catch (Exception e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ validateStatefulComponentMethods(project, SeamComponentMethodType.DESTROY, component, length, offset, DESTROY_METHOD_POSTFIX_MESSAGE_ID, helper, reporter);
+ validateStatefulComponentMethods(project, SeamComponentMethodType.REMOVE, component, length, offset, REMOVE_METHOD_POSTFIX_MESSAGE_ID, helper, reporter);
+ ScopeType scope = component.getScope();
+ if(scope == ScopeType.PAGE || scope == ScopeType.STATELESS) {
+ addError(STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID, new String[]{component.getName()}, length, offset, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
+ }
+ }
+ }
+
+ private void validateStatefulComponentMethods(ISeamProject project, SeamComponentMethodType methodType, ISeamComponent component, int lengthOfClassName, int offsetOfClassName, String postfixMessageId, IValidationContext helper, IReporter reporter) {
+ ISeamJavaComponentDeclaration javaDeclaration = component.getJavaDeclaration();
+ Set<ISeamComponentMethod> methods = javaDeclaration.getMethodsByType(methodType);
+ if(methods==null || methods.size()==0) {
+ addError(STATEFUL_COMPONENT_DOES_NOT_CONTENT_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, new String[]{component.getName()}, lengthOfClassName, offsetOfClassName, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
+ } else if(methods.size()>1) {
+ for (ISeamComponentMethod method : methods) {
+ try {
+ IMethod javaMethod = (IMethod)method.getSourceMember();
+ String methodName = javaMethod.getElementName();
+ addError(STATEFUL_COMPONENT_DUPLICATE_METHOD__SUFIX_MESSAGE_ID + postfixMessageId, new String[]{methodName}, method, javaDeclaration.getResource(), MARKED_COMPONENT_MESSAGE_GROUP);
+ } catch (Exception e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ }
+ }
+ }
+
private void validateJavaDeclaration(ISeamProject project, ISeamJavaComponentDeclaration declaration, IValidationContext helper, IReporter reporter) {
- validateInjections(project, declaration, helper, reporter);
+ validateBijections(project, declaration, helper, reporter);
+ // TODO
}
- private void validateInjections(ISeamProject project, ISeamJavaComponentDeclaration declaration, IValidationContext helper, IReporter reporter) {
- Set<IBijectedAttribute> injections = declaration.getBijectedAttributesByType(BijectedAttributeType.IN);
- for (IBijectedAttribute injection : injections) {
- String name = injection.getName();
+ private void validateBijections(ISeamProject project, ISeamJavaComponentDeclaration declaration, IValidationContext helper, IReporter reporter) {
+ Set<IBijectedAttribute> bijections = declaration.getBijectedAttributes();
+ if(bijections==null) {
+ return;
+ }
+ for (IBijectedAttribute bijection : bijections) {
+ String name = bijection.getName();
if(name.startsWith("#{")) {
// TODO Validate EL
} else {
- Set<ISeamContextVariable> variables = project.getVariablesByName(name);
- for (ISeamContextVariable variable : variables) {
- // save link between java source and variable name
- validationContext.addLinkedResource(name, declaration.getSourcePath());
+ // save link between java source and variable name
+ validationContext.addLinkedResource(name, declaration.getSourcePath());
+
+ if(bijection.isOfType(BijectedAttributeType.IN)) {
+ // Validate injection
+ Set<ISeamContextVariable> variables = project.getVariablesByName(name);
+ if(variables==null || variables.size()<1) {
+ // Injection has unknown name. Mark it.
+ // TODO check preferences to mark it as Error or Warning or ignore it.
+ IResource declarationResource = declaration.getResource();
+ addError(UNKNOWN_INJECTION_NAME_MESSAGE_ID, new String[]{name}, bijection, declarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
+ }
}
- if(variables.size()<1) {
- // Injection has unknown name. Mark it.
- // TODO check preferences to mark it as Error or Warning or ignore it.
- IResource declarationResource = declaration.getResource();
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, injection, declarationResource, MARKED_COMPONENT_MESSAGE_GROUP);
- }
}
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-12 15:38:49 UTC (rev 2409)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-12 16:33:22 UTC (rev 2410)
@@ -38,19 +38,16 @@
linkedResources = new HashSet<IPath>();
resourcesByVariableName.put(variableName, linkedResources);
}
- if(!linkedResources.contains(linkedResourcePath)) {
- // save linked resources.
- linkedResources.add(linkedResourcePath);
- }
+ // save linked resources.
+ linkedResources.add(linkedResourcePath);
+
// Save link between resource and variable names. It's needed if variable name changes in resource file.
Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
if(variableNames==null) {
variableNames = new HashSet<String>();
variableNamesByResource.put(linkedResourcePath, variableNames);
}
- if(!variableNames.contains(variableName)) {
- variableNames.add(variableName);
- }
+ variableNames.add(variableName);
}
/**
@@ -60,13 +57,13 @@
*/
public void removeLinkedResource(String oldVariableName, IPath linkedResourcePath) {
Set<IPath> linkedResources = resourcesByVariableName.get(oldVariableName);
- if(linkedResources!=null && linkedResources.contains(linkedResourcePath)) {
+ if(linkedResources!=null) {
// remove linked resource.
linkedResources.remove(linkedResourcePath);
}
// Remove link between resource and variable names.
Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
- if(variableNames!=null && variableNames.contains(oldVariableName)) {
+ if(variableNames!=null) {
variableNames.remove(oldVariableName);
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-12 15:38:49 UTC (rev 2409)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-12 16:33:22 UTC (rev 2410)
@@ -12,7 +12,6 @@
import java.util.Set;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.validation.internal.core.Message;
@@ -55,12 +54,14 @@
}
protected void addError(String messageId, String[] messageArguments, ISeamTextSourceReference location, IResource target, String messageGroup) {
+ addError(messageId, messageArguments, location.getLength(), location.getStartPosition(), target, messageGroup);
+ }
+
+ protected void addError(String messageId, String[] messageArguments, int length, int offset, IResource target, String messageGroup) {
IMessage message = new Message(getBaseName(), IMessage.HIGH_SEVERITY, messageId, messageArguments, target, messageGroup);
- message.setLength(location.getLength());
- message.setOffset(location.getStartPosition());
+ message.setLength(length);
+ message.setOffset(offset);
message.setSeverity(IMessage.HIGH_SEVERITY);
-// message.setAttribute(IMarker.TRANSIENT, Boolean.TRUE);
-// message.setMarkerId("org.jboss.tools.seam.core.seamProblem");
reporter.addMessage(this, message);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-12 15:38:49 UTC (rev 2409)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2007-07-12 16:33:22 UTC (rev 2410)
@@ -8,5 +8,10 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-NONUNIQUE_COMPONENT_NAME_MESSAGE=Component name must be unique if it has the same precedence.
-UNKNOWN_INJECTION_NAME=Unknown context variable name.
\ No newline at end of file
+NONUNIQUE_COMPONENT_NAME_MESSAGE=Duplicate component name {0}
+UNKNOWN_INJECTION_NAME=Unknown context variable name: {0}
+STATEFUL_COMPONENT_DOES_NOT_CONTENT_REMOVE=Stateful component {0} must have a method marked @Remove
+STATEFUL_COMPONENT_DOES_NOT_CONTENT_DESTROY=Stateful component {0} must have a method marked @Destroy
+STATEFUL_COMPONENT_WRONG_SCOPE=Stateful component {0} should not have org.jboss.seam.ScopeType.PAGE, nor org.jboss.seam.ScopeType.STATELESS
+STATEFUL_COMPONENT_DUPLICATE_REMOVE=Duplicate @Remove method {0}
+STATEFUL_COMPONENT_DUPLICATE_DESTROY=Duplicate @Destroy method {0}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2409 - in trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping: dynamicentity and 16 other directories.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-12 11:38:49 -0400 (Thu, 12 Jul 2007)
New Revision: 2409
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Address.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Company.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Customer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/interceptor/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/interceptor/Customer.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/tuplizer/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/tuplizer/Customer.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/Course.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/Course.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/UniversityCourse.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/AB.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/Account.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/Employer.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/Car.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/Car.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/CarPart.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/CarType.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/map/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/map/basic/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/map/basic/ProductLine.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Stock.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Stock.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Valuation.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Valuation.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/Group.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/Group.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/User.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Customer.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Customer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Employee.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Employee.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/allinone.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/allseparateinone.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/entitynames.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/packageentitynames.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/unionsubclass.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/Document.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/Group.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/SessionAttribute.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/UserGroup.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Account.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/BankAccount.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Person.java
Log:
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Address.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Address.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Address.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,18 @@
+package mapping.dynamicentity;
+
+/**
+ * @author <a href="mailto:steve@hibernate.org">Steve Ebersole </a>
+ */
+public interface Address {
+ public Long getId();
+ public void setId(Long id);
+
+ public String getStreet();
+ public void setStreet(String street);
+
+ public String getCity();
+ public void setCity(String city);
+
+ public String getPostalCode();
+ public void setPostalCode(String postalCode);
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Company.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Company.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Company.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,11 @@
+package mapping.dynamicentity;
+
+/**
+ * @author <a href="mailto:steve@hibernate.org">Steve Ebersole </a>
+ */
+public interface Company {
+ public Long getId();
+ public void setId(Long id);
+ public String getName();
+ public void setName(String name);
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Customer.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Customer.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Customer.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,9 @@
+package mapping.dynamicentity;
+
+/**
+ * @author <a href="mailto:steve@hibernate.org">Steve Ebersole </a>
+ */
+public interface Customer extends Person {
+ public Company getCompany();
+ public void setCompany(Company company);
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/Person.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,17 @@
+package mapping.dynamicentity;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:steve@hibernate.org">Steve Ebersole </a>
+ */
+public interface Person {
+ public Long getId();
+ public void setId(Long id);
+ public String getName();
+ public void setName(String name);
+ public Address getAddress();
+ public void setAddress(Address address);
+ public Set getFamily();
+ public void setFamily(Set family);
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/interceptor/Customer.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/interceptor/Customer.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/interceptor/Customer.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.dynamicentity">
+
+ <!--
+ Mapping the Customer and Company interfaces. Our custom Interceptor
+ will be responsible for: a) creating instances representing these
+ interfaces; b) determining the appropriate entity-name (i.e., which
+ entity mapping to use) given an instance of one of these proxies.
+ -->
+ <class name="Person" table="t_person" abstract="false">
+ <!-- <class name="Person" table="t_person" discriminator-value="person"> -->
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <discriminator force="false"/>
+ <property name="name"/>
+
+ <many-to-one name="address" cascade="all" column="addr_id"/>
+
+ <set name="family" lazy="true" cascade="all">
+ <key column="pers_id"/>
+ <one-to-many class="Person"/>
+ </set>
+
+ <subclass name="Customer" discriminator-value="customer" abstract="false">
+ <many-to-one name="company" cascade="none" column="comp_id"/>
+ </subclass>
+ </class>
+
+ <!-- Company interface mapping -->
+ <class name="Company" table="t_company" abstract="false">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ </class>
+
+ <class name="Address" table="t_address" abstract="false">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="street"/>
+ <property name="city"/>
+ <property name="postalCode"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/tuplizer/Customer.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/tuplizer/Customer.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/dynamicentity/tuplizer/Customer.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.dynamicentity">
+
+ <!--
+ Mapping the Customer and Company interfaces. Our custom Interceptor
+ will be responsible for: a) creating instances representing these
+ interfaces; b) determining the appropriate entity-name (i.e., which
+ entity mapping to use) given an instance of one of these proxies.
+ -->
+ <class name="Person" table="t_person" discriminator-value="person" abstract="false">
+ <tuplizer class="org.hibernate.test.dynamicentity.tuplizer.MyEntityTuplizer" entity-mode="pojo"/>
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <discriminator force="false"/>
+ <property name="name"/>
+
+ <many-to-one name="address" cascade="all" column="addr_id"/>
+
+ <set name="family" lazy="true" cascade="all">
+ <key column="pers_id"/>
+ <one-to-many class="Person"/>
+ </set>
+
+ <subclass name="Customer" discriminator-value="customer" abstract="false">
+ <tuplizer class="org.hibernate.test.dynamicentity.tuplizer.MyEntityTuplizer" entity-mode="pojo"/>
+ <many-to-one name="company" cascade="none" column="comp_id"/>
+ </subclass>
+ </class>
+
+ <!-- Company interface mapping -->
+ <class name="Company" table="t_company" abstract="false">
+ <tuplizer class="org.hibernate.test.dynamicentity.tuplizer.MyEntityTuplizer" entity-mode="pojo"/>
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ </class>
+
+ <class name="Address" table="t_address" abstract="false">
+ <tuplizer class="org.hibernate.test.dynamicentity.tuplizer.MyEntityTuplizer" entity-mode="pojo"/>
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="street"/>
+ <property name="city"/>
+ <property name="postalCode"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/Course.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/Course.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/Course.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping
+ package="mapping.ecid"
+ default-access="field">
+
+<!--
+
+ This mapping demonstrates inheritance with embedded composite ids.
+
+-->
+
+ <class name="Course" table="SchoolCourses"
+ discriminator-value="secondary/primary">
+ <composite-id>
+ <key-property name="courseCode"/>
+ <key-property name="org"/>
+ </composite-id>
+ <discriminator column="schoolLevel" length="20"/>
+ <property name="description" not-null="true"/>
+ <subclass name="UniversityCourse" discriminator-value="tertiary">
+ <property name="semester"/>
+ </subclass>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/Course.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/Course.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/Course.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,38 @@
+//$Id: Course.java 6913 2005-05-25 17:37:51Z oneovthafew $
+package mapping.ecid;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class Course implements Serializable {
+
+ private String courseCode;
+ private String org;
+ private String description;
+
+ Course() {}
+ Course(String courseCode, String org, String description) {
+ this.courseCode = courseCode;
+ this.org = org;
+ this.description = description;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getCourseCode() {
+ return courseCode;
+ }
+
+ public String getOrg() {
+ return org;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/UniversityCourse.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/UniversityCourse.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/ecid/UniversityCourse.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,22 @@
+//$Id: UniversityCourse.java 6913 2005-05-25 17:37:51Z oneovthafew $
+package mapping.ecid;
+
+/**
+ * @author Gavin King
+ */
+public class UniversityCourse extends Course {
+
+ private int semester;
+
+ UniversityCourse() {}
+
+ public UniversityCourse(String courseCode, String org, String description, int semester) {
+ super( courseCode, org, description );
+ this.semester = semester;
+ }
+
+ public int getSemester() {
+ return semester;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/AB.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/AB.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/AB.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping >
+
+ <class entity-name="A" table="AX" node="a">
+ <id name="aId" type="int" column="aId" node="@id"/>
+ <property name="x" type="string"/>
+ <set name="bs" node="." embed-xml="true" cascade="all" inverse="true">
+ <key column="aId"/>
+ <one-to-many class="B"/>
+ </set>
+ </class>
+
+
+ <class entity-name="B" table="BX" node="b">
+ <composite-id>
+ <key-property name="bId" column="bId" type="int" node="@bId"/>
+ <key-property name="aId" column="aId" type="int" node="@aId"/>
+ </composite-id>
+ <property name="y" type="string" node="."/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/Account.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/Account.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/Account.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+
+ <class entity-name="Customer" node="customer">
+ <id name="customerId" type="string" node="@id"/>
+ <component name="name">
+ <property name="first" type="string"/>
+ <property name="last" type="string"/>
+ </component>
+ <property name="address" type="string" node="address"/>
+ <map name="stuff">
+ <key column="customerId"/>
+ <map-key type="string" column="bar" node="@bar"/>
+ <element type="string" node="foo" column="foo"/>
+ </map>
+ <bag name="morestuff" node=".">
+ <key column="customerId"/>
+ <element type="integer" node="amount" column="amount"/>
+ </bag>
+ <list name="accounts" cascade="all">
+ <key column="customerId2"/>
+ <list-index column="acctno" base="1"/>
+ <one-to-many entity-name="Account" node="account"/>
+ </list>
+ <many-to-one name="location" node="location/@id" entity-name="Location" embed-xml="false"/>
+ <property name="description" node="." type="string"/>
+ <set name="unembedded" embed-xml="false">
+ <key column="x"/>
+ <element type="string" column="y" not-null="true"/>
+ </set>
+ </class>
+
+ <class entity-name="Account" node="account">
+ <id name="accountId" type="string" node="@id"/>
+ <many-to-one name="customer" column="customerId" entity-name="Customer" cascade="all" embed-xml="true" />
+ <!--not-null="true"-->
+ <property name="balance" type="big_decimal" node="balance" precision="10" scale="0" />
+ </class>
+
+ <class entity-name="Location" node="location">
+ <id name="id" node="@id" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="address" type="string"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/Employer.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/Employer.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/basic/Employer.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+
+ <class entity-name="Employer" node="employer">
+ <id name="id" node="@id" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="name" node="@name" type="string"/>
+ <set name="employees" node="." cascade="all,delete-orphan" fetch="join" lazy="false">
+ <key not-null="true" column="employerId"/>
+ <one-to-many entity-name="Employee" />
+ </set>
+ </class>
+
+ <class entity-name="Employee" node="employee">
+ <id name="id" node="@id" type="long">
+ <generator class="increment"/>
+ </id>
+ <discriminator column="role" type="string" length="10"/>
+ <property name="name" node="@name" type="string"/>
+ <subclass entity-name="Techie" node="techie" />
+ <subclass entity-name="Salesdude" node="sales-dude"/>
+ </class>
+
+ <class entity-name="Department" node="department">
+ <id name="id" node="@id" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="name" node="@name" type="string"/>
+ <many-to-one name="manager" entity-name="Employee" cascade="all" fetch="join" lazy="false" embed-xml="true" node="manager" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/Car.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/Car.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/Car.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.entitymode.dom4j.many2one">
+
+ <class name="Car" lazy="false" node="car">
+ <id name="id" node="@id" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="model" type="string" node="model"/>
+ <many-to-one name="carType" node="carType" class="CarType"/>
+ <set name="carParts" node="." cascade="all">
+ <key column="car" not-null="true"/>
+ <one-to-many class="CarPart" node="carPart" embed-xml="false"/>
+ </set>
+ </class>
+
+ <class name="CarType" lazy="true" node="carType">
+ <id name="id" node="@id" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="typeName" type="string" node="typeName"/>
+ </class>
+
+ <class name="CarPart" node="carPart">
+ <id name="id" node="@id" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="partName" type="string" node="partName"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/Car.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/Car.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/Car.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,58 @@
+package mapping.entitymode.dom4j.many2one;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Paco Hern�ndez
+ */
+public class Car implements java.io.Serializable {
+
+ private long id;
+ private String model;
+ private CarType carType;
+ private Set carParts = new HashSet();
+
+ /**
+ * @return Returns the carType.
+ */
+ public CarType getCarType() {
+ return carType;
+ }
+ /**
+ * @param carType The carType to set.
+ */
+ public void setCarType(CarType carType) {
+ this.carType = carType;
+ }
+ /**
+ * @return Returns the id.
+ */
+ public long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the model.
+ */
+ public String getModel() {
+ return model;
+ }
+ /**
+ * @param model The model to set.
+ */
+ public void setModel(String model) {
+ this.model = model;
+ }
+ public Set getCarParts() {
+ return carParts;
+ }
+ public void setCarParts(Set carParts) {
+ this.carParts = carParts;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/CarPart.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/CarPart.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/CarPart.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,35 @@
+package mapping.entitymode.dom4j.many2one;
+
+/**
+ * @author Paco Hern�ndez
+ */
+public class CarPart implements java.io.Serializable {
+
+ private long id;
+ private String partName;
+
+ /**
+ * @return Returns the id.
+ */
+ public long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the typeName.
+ */
+ public String getPartName() {
+ return partName;
+ }
+ /**
+ * @param typeName The typeName to set.
+ */
+ public void setPartName(String typeName) {
+ this.partName = typeName;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/CarType.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/CarType.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/dom4j/many2one/CarType.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,35 @@
+package mapping.entitymode.dom4j.many2one;
+
+/**
+ * @author Paco Hern�ndez
+ */
+public class CarType implements java.io.Serializable {
+
+ private long id;
+ private String typeName;
+
+ /**
+ * @return Returns the id.
+ */
+ public long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the typeName.
+ */
+ public String getTypeName() {
+ return typeName;
+ }
+ /**
+ * @param typeName The typeName to set.
+ */
+ public void setTypeName(String typeName) {
+ this.typeName = typeName;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/map/basic/ProductLine.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/map/basic/ProductLine.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/map/basic/ProductLine.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+
+<!--
+ This mapping demonstrates "dynamic" entities.
+-->
+
+ <class entity-name="ProductLine">
+ <id name="id" column="productId" length="32" type="string">
+ <generator class="uuid.hex"/>
+ </id>
+
+ <property name="description" not-null="true" length="200" type="string"/>
+
+ <!-- don't use sets for associations, unless you want stack overflows! -->
+ <bag name="models" cascade="all" inverse="true">
+ <key column="productId"/>
+ <one-to-many class="Model"/>
+ </bag>
+
+ </class>
+
+ <class entity-name="Model">
+ <id name="id" column="modelId" length="32" type="string">
+ <generator class="uuid.hex"/>
+ </id>
+
+ <property name="name" not-null="true" length="25" type="string"/>
+ <property name="description" not-null="true" length="200" type="string"/>
+ <many-to-one name="productLine" column="productId" not-null="true" class="ProductLine"/>
+
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Stock.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Stock.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Stock.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping
+ SYSTEM
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.entitymode.multi">
+
+ <class table="STOCK" name="Stock" node="stock">
+
+ <id name="id" column="STOCK_ID" node="@id">
+ <generator class="increment"/>
+ </id>
+
+ <property name="tradeSymbol" type="string" column="SYMBOL"/>
+
+ <many-to-one name="currentValuation" class="Valuation" column="CURR_VAL_ID" cascade="all" />
+
+ <set name="valuations" cascade="all" lazy="true">
+ <key column="STOCK_ID"/>
+ <one-to-many class="Valuation"/>
+ </set>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Stock.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Stock.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Stock.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,49 @@
+// $Id: Stock.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.entitymode.multi;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * POJO implementation of Stock entity.
+ *
+ * @author Steve Ebersole
+ */
+public class Stock {
+ private Long id;
+ private String tradeSymbol;
+ private Valuation currentValuation;
+ private Set valuations = new HashSet();
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getTradeSymbol() {
+ return tradeSymbol;
+ }
+
+ public void setTradeSymbol(String tradeSymbol) {
+ this.tradeSymbol = tradeSymbol;
+ }
+
+ public Valuation getCurrentValuation() {
+ return currentValuation;
+ }
+
+ public void setCurrentValuation(Valuation currentValuation) {
+ this.currentValuation = currentValuation;
+ }
+
+ public Set getValuations() {
+ return valuations;
+ }
+
+ public void setValuations(Set valuations) {
+ this.valuations = valuations;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Valuation.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Valuation.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Valuation.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping
+ SYSTEM
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.entitymode.multi">
+
+ <class table="STOCK_VAL" name="Valuation" node="valuation">
+
+ <id name="id" column="VAL_ID" node="@id">
+ <generator class="increment"/>
+ </id>
+
+ <many-to-one name="stock" embed-xml="false"
+ class="Stock" column="STOCK_ID" cascade="none" />
+
+ <property name="valuationDate" type="date" column="DT"/>
+ <property name="value" type="double" column="VAL"/>
+
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Valuation.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Valuation.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/entitymode/multi/Valuation.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,48 @@
+// $Id: Valuation.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.entitymode.multi;
+
+import java.util.Date;
+
+/**
+ * Implementation of Valuation.
+ *
+ * @author Steve Ebersole
+ */
+public class Valuation {
+ private Long id;
+ private Stock stock;
+ private Date valuationDate;
+ private Double value;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Stock getStock() {
+ return stock;
+ }
+
+ public void setStock(Stock stock) {
+ this.stock = stock;
+ }
+
+ public Date getValuationDate() {
+ return valuationDate;
+ }
+
+ public void setValuationDate(Date valuationDate) {
+ this.valuationDate = valuationDate;
+ }
+
+ public Double getValue() {
+ return value;
+ }
+
+ public void setValue(Double value) {
+ this.value = value;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/Group.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/Group.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/Group.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.exception" >
+ <class name="Group" table="T_GROUP" >
+ <id name="id" unsaved-value="null" column="group_id" >
+ <generator class="native"/>
+ </id>
+ <property name="name" type="string" column="name" />
+ <set name="members" inverse="true" table="T_MEMBERSHIP" cascade="none">
+ <key column="group_id"/>
+ <many-to-many class="User" column="user_id"/>
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/Group.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/Group.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/Group.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,48 @@
+// $Id: Group.java 4746 2004-11-11 20:57:28Z steveebersole $
+package mapping.exception;
+
+import java.util.Set;
+
+/**
+ * Implementation of Group.
+ *
+ * @author Steve Ebersole
+ */
+public class Group {
+ private Long id;
+ private String name;
+ private Set members;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Set getMembers() {
+ return members;
+ }
+
+ public void setMembers(Set members) {
+ this.members = members;
+ }
+
+ public void addMember(User member) {
+ if (member == null) {
+ throw new IllegalArgumentException("Member to add cannot be null");
+ }
+
+ this.members.add(member);
+ member.getMemberships().add(this);
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/User.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/User.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/User.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="mapping.exception" >
+ <class name="User" table="T_USER" >
+ <id name="id" unsaved-value="null" column="user_id" >
+ <generator class="native"/>
+ </id>
+ <property name="username" type="string" column="user_name" />
+ <set name="memberships" inverse="false" table="T_MEMBERSHIP" cascade="none">
+ <key column="user_id"/>
+ <many-to-many class="Group" column="group_id"/>
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/exception/User.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,49 @@
+// $Id: User.java 4746 2004-11-11 20:57:28Z steveebersole $
+package mapping.exception;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * Implementation of User.
+ *
+ * @author Steve Ebersole
+ */
+public class User {
+ private Long id;
+ private String username;
+ private Set memberships = new HashSet();
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public Set getMemberships() {
+ return memberships;
+ }
+
+ public void setMemberships(Set memberships) {
+ this.memberships = memberships;
+ }
+
+ public void addMembership(Group membership) {
+ if (membership == null) {
+ throw new IllegalArgumentException("Membership to add cannot be null");
+ }
+
+ this.memberships.add(membership);
+ membership.getMembers().add(this);
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Customer.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Customer.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Customer.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates
+
+-->
+
+<hibernate-mapping package="mapping.extendshbm">
+ <subclass name="Customer" extends="Person">
+ <property name="comments"/>
+ <many-to-one name="salesperson"/>
+ </subclass>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Customer.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Customer.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Customer.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,35 @@
+//$Id: Customer.java 5011 2004-12-19 22:01:25Z maxcsaucdk $
+package mapping.extendshbm;
+
+/**
+ * @author Gavin King
+ */
+public class Customer extends Person {
+ private Employee salesperson;
+ private String comments;
+
+ /**
+ * @return Returns the salesperson.
+ */
+ public Employee getSalesperson() {
+ return salesperson;
+ }
+ /**
+ * @param salesperson The salesperson to set.
+ */
+ public void setSalesperson(Employee salesperson) {
+ this.salesperson = salesperson;
+ }
+ /**
+ * @return Returns the comments.
+ */
+ public String getComments() {
+ return comments;
+ }
+ /**
+ * @param comments The comments to set.
+ */
+ public void setComments(String comments) {
+ this.comments = comments;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Employee.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Employee.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Employee.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates
+
+-->
+
+<hibernate-mapping package="mapping.extendshbm">
+ <subclass name="Employee" extends="Person">
+ <property name="title"
+ length="20"/>
+ <property name="salary"
+ length="0"/>
+ <many-to-one name="manager"/>
+ </subclass>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Employee.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Employee.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Employee.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,49 @@
+//$Id: Employee.java 5011 2004-12-19 22:01:25Z maxcsaucdk $
+package mapping.extendshbm;
+
+import java.math.BigDecimal;
+
+/**
+ * @author Gavin King
+ */
+public class Employee extends Person {
+ private String title;
+ private BigDecimal salary;
+ private Employee manager;
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @param title The title to set.
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ /**
+ * @return Returns the manager.
+ */
+ public Employee getManager() {
+ return manager;
+ }
+ /**
+ * @param manager The manager to set.
+ */
+ public void setManager(Employee manager) {
+ this.manager = manager;
+ }
+ /**
+ * @return Returns the salary.
+ */
+ public BigDecimal getSalary() {
+ return salary;
+ }
+ /**
+ * @param salary The salary to set.
+ */
+ public void setSalary(BigDecimal salary) {
+ this.salary = salary;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Person.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Person.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Person.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates
+
+-->
+
+<hibernate-mapping package="mapping.extendshbm">
+ <class name="Person">
+
+ <id name="id"
+ column="person_id"
+ unsaved-value="0">
+ <generator class="native"/>
+ </id>
+
+ <discriminator
+ type="string"
+ />
+
+ <property name="name"
+ not-null="true"
+ length="80"/>
+
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/Person.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,50 @@
+//$Id: Person.java 5011 2004-12-19 22:01:25Z maxcsaucdk $
+package mapping.extendshbm;
+
+
+/**
+ * @author Gavin King
+ */
+public class Person {
+ private long id;
+ private String name;
+ private char sex;
+
+ /**
+ * @return Returns the sex.
+ */
+ public char getSex() {
+ return sex;
+ }
+ /**
+ * @param sex The sex to set.
+ */
+ public void setSex(char sex) {
+ this.sex = sex;
+ }
+ /**
+ * @return Returns the id.
+ */
+ public long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the identity.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param identity The identity to set.
+ */
+ public void setName(String identity) {
+ this.name = identity;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/allinone.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/allinone.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/allinone.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates
+
+-->
+
+<hibernate-mapping
+ package="mapping.extendshbm">
+
+ <class name="Person">
+
+ <id name="id"
+ column="person_id"
+ unsaved-value="0">
+ <generator class="native"/>
+ </id>
+
+ <discriminator
+ type="string"/>
+
+ <property name="name"
+ not-null="true"
+ length="80"/>
+
+ <subclass name="Employee">
+ <property name="title"
+ length="20"/>
+ <property name="salary"
+ length="0"/>
+ <many-to-one name="manager"/>
+ </subclass>
+
+ <subclass name="Customer">
+ <property name="comments"/>
+ <many-to-one name="salesperson"/>
+ </subclass>
+
+ </class>
+
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/allseparateinone.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/allseparateinone.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/allseparateinone.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates
+
+-->
+
+<hibernate-mapping
+ package="mapping.extendshbm">
+
+ <class name="Person">
+
+ <id name="id"
+ column="person_id"
+ unsaved-value="0">
+ <generator class="native"/>
+ </id>
+
+ <discriminator
+ type="string"/>
+
+ <property name="name"
+ not-null="true"
+ length="80"/>
+
+ <subclass name="Employee">
+ <property name="title"
+ length="20"/>
+ <property name="salary"
+ length="0"/>
+ <many-to-one name="manager"/>
+ </subclass>
+
+
+
+ </class>
+
+
+ <subclass name="Customer" extends="Person">
+ <property name="comments"/>
+ <many-to-one name="salesperson"/>
+ </subclass>
+
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/entitynames.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/entitynames.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/entitynames.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,18 @@
+<!DOCTYPE hibernate-mapping
+ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class lazy="true" entity-name="EntityHasName" table="F5_ENTITY_HASNAME">
+ <id name="id" column="ID" type="long">
+ <generator class="native"/>
+ </id>
+ <property name="attrName" type="string">
+ <column name="NAME"/>
+ </property>
+ </class>
+ <joined-subclass lazy="true" entity-name="EntityCompany" table="F5_ENTITY_COMPANY" extends="EntityHasName">
+ <key column="REF_ID"/>
+ <many-to-one name="parent" entity-name="EntityHasName"/>
+ </joined-subclass>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/packageentitynames.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/packageentitynames.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/packageentitynames.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,18 @@
+<!DOCTYPE hibernate-mapping
+ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.extendshbm">
+ <class lazy="true" entity-name="EntityHasName" table="F5_ENTITY_HASNAME">
+ <id name="id" column="ID" type="long">
+ <generator class="native"/>
+ </id>
+ <property name="attrName" type="string">
+ <column name="NAME"/>
+ </property>
+ </class>
+ <joined-subclass lazy="true" entity-name="EntityCompany" table="F5_ENTITY_COMPANY" extends="EntityHasName">
+ <key column="REF_ID"/>
+ <many-to-one name="parent" entity-name="EntityHasName"/>
+ </joined-subclass>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/unionsubclass.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/unionsubclass.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extendshbm/unionsubclass.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping demonstrates
+
+-->
+
+<hibernate-mapping
+ package="mapping.extendshbm">
+
+ <class name="Person">
+
+ <id name="id"
+ column="person_id"
+ unsaved-value="0">
+ <generator class="native"/>
+ </id>
+
+ <discriminator
+ type="string"/>
+
+ <property name="name"
+ not-null="true"
+ length="80"/>
+
+ </class>
+
+
+ <union-subclass name="Customer" extends="Person">
+ <property name="comments"/>
+ <many-to-one name="salesperson"/>
+ </union-subclass>
+
+ <subclass name="Employee" extends="Person">
+ <property name="title"
+ length="20"/>
+ <property name="salary"
+ length="0"/>
+ <many-to-one name="manager"/>
+ </subclass>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/Document.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/Document.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/Document.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,38 @@
+//$Id: Document.java 7635 2005-07-24 23:04:30Z oneovthafew $
+package mapping.extralazy;
+
+public class Document {
+
+ private String title;
+ private String content;
+ private User owner;
+
+ Document() {}
+
+ public Document(String title, String content, User owner) {
+ this.content = content;
+ this.owner = owner;
+ this.title = title;
+ owner.getDocuments().add(this);
+ }
+
+ public String getContent() {
+ return content;
+ }
+ public void setContent(String content) {
+ this.content = content;
+ }
+ public User getOwner() {
+ return owner;
+ }
+ public void setOwner(User owner) {
+ this.owner = owner;
+ }
+ public String getTitle() {
+ return title;
+ }
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/Group.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/Group.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/Group.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,29 @@
+//$Id: Group.java 7628 2005-07-24 06:55:01Z oneovthafew $
+package mapping.extralazy;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gavin King
+ */
+public class Group {
+ private String name;
+ private Map users = new HashMap();
+ Group() {}
+ public Group(String n) {
+ name = n;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Map getUsers() {
+ return users;
+ }
+ public void setUsers(Map users) {
+ this.users = users;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/SessionAttribute.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/SessionAttribute.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/SessionAttribute.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,41 @@
+//$Id: SessionAttribute.java 7628 2005-07-24 06:55:01Z oneovthafew $
+package mapping.extralazy;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class SessionAttribute {
+ private Long id;
+ private String name;
+ private String stringData;
+ private Serializable objectData;
+ SessionAttribute() {}
+ public SessionAttribute(String name, Serializable obj) {
+ this.name = name;
+ this.objectData = obj;
+ }
+ public SessionAttribute(String name, String str) {
+ this.name = name;
+ this.stringData = str;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Serializable getObjectData() {
+ return objectData;
+ }
+ public void setObjectData(Serializable objectData) {
+ this.objectData = objectData;
+ }
+ public String getStringData() {
+ return stringData;
+ }
+ public void setStringData(String stringData) {
+ this.stringData = stringData;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/User.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,46 @@
+//$Id: User.java 7635 2005-07-24 23:04:30Z oneovthafew $
+package mapping.extralazy;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Gavin King
+ */
+public class User {
+ private String name;
+ private String password;
+ private Map session = new HashMap();
+ private Set documents = new HashSet();
+ User() {}
+ public User(String n, String pw) {
+ name=n;
+ password = pw;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public Map getSession() {
+ return session;
+ }
+ public void setSession(Map session) {
+ this.session = session;
+ }
+ public Set getDocuments() {
+ return documents;
+ }
+ public void setDocuments(Set documents) {
+ this.documents = documents;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/UserGroup.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/UserGroup.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/extralazy/UserGroup.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+-->
+
+<hibernate-mapping package="mapping.extralazy">
+
+ <class name="Group" table="groups">
+ <id name="name"/>
+ <map name="users" cascade="persist"
+ table="group_user" lazy="extra">
+ <key column="groupName"/>
+ <map-key formula="lower(personName)" type="string"/>
+ <many-to-many column="personName" class="User"/>
+ </map>
+ </class>
+
+ <class name="User" table="users">
+ <id name="name"/>
+ <property name="password"/>
+ <map name="session" lazy="extra"
+ cascade="persist,save-update,delete,delete-orphan">
+ <key column="userName" not-null="true"/>
+ <map-key column="name" type="string"/>
+ <one-to-many class="SessionAttribute"/>
+ </map>
+ <set name="documents" inverse="true"
+ lazy="extra" cascade="all,delete-orphan">
+ <key column="owner"/>
+ <one-to-many class="Document"/>
+ </set>
+ </class>
+
+ <class name="Document" table="documents">
+ <id name="title"/>
+ <property name="content" type="text"/>
+ <many-to-one name="owner" not-null="true"/>
+ </class>
+
+ <class name="SessionAttribute" table="session_attributes">
+ <id name="id" access="field">
+ <generator class="native"/>
+ </id>
+ <property name="name" not-null="true"
+ insert="false" update="false"/>
+ <property name="stringData"/>
+ <property name="objectData"/>
+ </class>
+
+ <sql-query name="userSessionData">
+ <return alias="u" class="User"/>
+ <return-join alias="s" property="u.session"/>
+ select
+ lower(u.name) as {u.name}, lower(u.password) as {u.password},
+ lower(s.userName) as {s.key}, lower(s.name) as {s.index}, s.id as {s.element},
+ {s.element.*}
+ from users u
+ join session_attributes s on lower(s.userName) = lower(u.name)
+ where u.name like :uname
+ </sql-query>
+
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Account.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Account.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Account.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,38 @@
+//$Id: Account.java 10921 2006-12-05 14:39:12Z steve.ebersole(a)jboss.com $
+package mapping.propertyref.inheritence.joined;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class Account implements Serializable {
+ private String accountId;
+ private char type;
+
+ /**
+ * @return Returns the accountId.
+ */
+ public String getAccountId() {
+ return accountId;
+ }
+ /**
+ * @param accountId The accountId to set.
+ */
+ public void setAccountId(String accountId) {
+ this.accountId = accountId;
+ }
+ /**
+ * @return Returns the type.
+ */
+ public char getType() {
+ return type;
+ }
+ /**
+ * @param type The type to set.
+ */
+ public void setType(char type) {
+ this.type = type;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/BankAccount.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/BankAccount.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/BankAccount.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,23 @@
+//$Id: BankAccount.java 10921 2006-12-05 14:39:12Z steve.ebersole(a)jboss.com $
+package mapping.propertyref.inheritence.joined;
+
+public class BankAccount extends Account {
+ private String accountNumber;
+ private String bsb;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public String getBsb() {
+ return bsb;
+ }
+
+ public void setBsb(String bsb) {
+ this.bsb = bsb;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Person.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Person.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Person.hbm.xml 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ Demonstrates the use of property-ref to map legacy data where
+ foreign keys reference something other than the primary key of
+ the associated entity. Here we show:
+
+ (1) A one-to-one foreign key association (prefer primary key
+ associations)
+
+ (2) A bidirectional one-to-many association on a key that is
+ not the primary key (prefer associations from foreign keys
+ to primary keys)
+
+-->
+
+<hibernate-mapping package="mapping.propertyref.inheritence.joined">
+
+ <class name="Person" table="J_SBCLS_PROPREF_PERS">
+ <id name="id">
+ <generator class="hilo"/>
+ </id>
+ <property name="name" length="100"/>
+ <many-to-one name="bankAccount" property-ref="bsbAccountNumber" cascade="all">
+ <column name="bsb"/>
+ <column name="accountNumber"/>
+ </many-to-one>
+ </class>
+
+ <class name="Account" table="J_SBCLS_PROPREF_ACCT">
+ <id name="accountId" length="32">
+ <generator class="uuid"/>
+ </id>
+ <property name="type" not-null="true"/>
+ <joined-subclass name="BankAccount" table="J_SBCLS_PROPREF_BACCT">
+ <key column="accountId"/>
+ <properties unique="true" name="bsbAccountNumber">
+ <property name="bsb" length="4" not-null="true"/>
+ <property name="accountNumber" length="16" not-null="true"/>
+ </properties>
+ </joined-subclass>
+
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/propertyref/inheritence/joined/Person.java 2007-07-12 15:38:49 UTC (rev 2409)
@@ -0,0 +1,44 @@
+//$Id: Person.java 10921 2006-12-05 14:39:12Z steve.ebersole(a)jboss.com $
+package mapping.propertyref.inheritence.joined;
+
+
+/**
+ * @author gavin
+ */
+public class Person {
+ private Long id;
+ private String name;
+ private BankAccount bankAccount;
+
+ /**
+ * @return Returns the id.
+ */
+ public Long getId() {
+ return id;
+ }
+ /**
+ * @param id The id to set.
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public BankAccount getBankAccount() {
+ return bankAccount;
+ }
+ public void setBankAccount(BankAccount bankAccount) {
+ this.bankAccount = bankAccount;
+ }
+}
17 years, 5 months
JBoss Tools SVN: r2408 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-12 11:37:11 -0400 (Thu, 12 Jul 2007)
New Revision: 2408
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
Log:
EXIN-366: Adding elements on the diagram by double-click on fields of classes which have additional information in mapping files
Fixed bug: not display class name when attribute name not present
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java 2007-07-12 15:36:55 UTC (rev 2407)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java 2007-07-12 15:37:11 UTC (rev 2408)
@@ -475,9 +475,9 @@
StringBuffer name = new StringBuffer();
// if (((OrmContentProvider) viewer.getContentProvider()).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) {
- name.append(clazz.getClassName());
+ name.append(clazz.getEntityName() != null ? clazz.getEntityName() : clazz.getEntityName());
// } else {
-// name.append(clazz.getClassName());
+// name.append(clazz.getEntityName());
// }
//edit tau 24.04.2006
@@ -502,7 +502,7 @@
// if (((OrmContentProvider) viewer.getContentProvider()).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) {
name.append(clazz.getEntityName());
// } else {
-// name.append(clazz.getClassName());
+// name.append(clazz.getEntityName());
// }
//edit tau 24.04.2006
17 years, 5 months
JBoss Tools SVN: r2407 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors: model and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-12 11:36:55 -0400 (Thu, 12 Jul 2007)
New Revision: 2407
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
Log:
EXIN-366: Adding elements on the diagram by double-click on fields of classes which have additional information in mapping files
Fixed bug: not display class name when attribute name not present
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java 2007-07-12 15:31:36 UTC (rev 2406)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java 2007-07-12 15:36:55 UTC (rev 2407)
@@ -95,7 +95,7 @@
ObjectEditorInput objectEditorInput = (ObjectEditorInput)input;
Configuration configuration = objectEditorInput.getConfiguration();
RootClass rootClass = (RootClass)(objectEditorInput).getObject();
- setPartName("Diagram for " + rootClass.getClassName());
+ setPartName("Diagram for " + rootClass.getEntityName());
ormDiagram = new OrmDiagram(configuration, rootClass);
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-12 15:31:36 UTC (rev 2406)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-12 15:36:55 UTC (rev 2407)
@@ -117,7 +117,7 @@
OrmShape shape = (OrmShape) getChildren().get(i);
Object ormElement = shape.getOrmElement();
if (ormElement instanceof RootClass) {
- childrenLocations[i] = ((RootClass)ormElement).getClassName() + "@";
+ childrenLocations[i] = ((RootClass)ormElement).getEntityName() + "@";
} else if (ormElement instanceof Table) {
childrenLocations[i] = ((Table)ormElement).getSchema() + "." + ((Table)ormElement).getName()+"@";
// } else if (ormElement instanceof Component) {
@@ -132,7 +132,7 @@
if (ormElement instanceof RootClass) {
ormShape = new OrmShape(ormElement);
getChildren().add(ormShape);
- elements.put(((RootClass)ormElement).getClassName(), ormShape);
+ elements.put(((RootClass)ormElement).getEntityName(), ormShape);
} else if (ormElement instanceof Table) {
ormShape = new OrmShape(ormElement);
getChildren().add(ormShape);
@@ -142,11 +142,11 @@
SpecialRootClass specialRootClass = new SpecialRootClass((Property)ormElement);
ormShape = new SpecialOrmShape(specialRootClass);
getChildren().add(ormShape);
- elements.put(specialRootClass.getClassName(), ormShape);
+ elements.put(specialRootClass.getEntityName(), ormShape);
} else if (ormElement instanceof Subclass) {
ormShape = new OrmShape(ormElement);
getChildren().add(ormShape);
- elements.put(((Subclass)ormElement).getClassName(), ormShape);
+ elements.put(((Subclass)ormElement).getEntityName(), ormShape);
}
return ormShape;
}
@@ -154,13 +154,13 @@
private OrmShape getShape(Object ormElement) {
OrmShape ormShape = null;
if (ormElement instanceof RootClass) {
- ormShape = elements.get(((RootClass)ormElement).getClassName());
+ ormShape = elements.get(((RootClass)ormElement).getEntityName());
} else if (ormElement instanceof Table) {
Table table = (Table)ormElement;
ormShape = elements.get(table.getSchema() + "." + table.getName());
} else if (ormElement instanceof Property) {
SpecialRootClass specialRootClass = new SpecialRootClass((Property)ormElement);
- ormShape = elements.get(specialRootClass.getClassName());
+ ormShape = elements.get(specialRootClass.getEntityName());
} else if (ormElement instanceof SingleTableSubclass) {
ormShape = elements.get(((SingleTableSubclass)ormElement).getEntityName());
}
@@ -171,7 +171,7 @@
OrmShape classShape = null;
OrmShape shape = null;
if(persistentClass != null) {
- classShape = elements.get(persistentClass.getClassName());
+ classShape = elements.get(persistentClass.getEntityName());
if (classShape == null) classShape = createShape(persistentClass);
if(componentClassDatabaseTable == null && persistentClass.getTable() != null)
componentClassDatabaseTable = persistentClass.getTable();
@@ -188,7 +188,7 @@
Object element = iter.next();
if (element instanceof Subclass) {
Subclass subclass = (Subclass)element;
- OrmShape subclassShape = elements.get(subclass.getClassName());
+ OrmShape subclassShape = elements.get(subclass.getEntityName());
if (subclassShape == null) subclassShape = createShape(subclass);
if (((Subclass)element).isJoinedSubclass()) {
Table jcTable = ((Subclass)element).getTable();
@@ -206,7 +206,7 @@
if (persistentClass.getIdentifier() instanceof Component) {
Component identifier = (Component)persistentClass.getIdentifier();
- if (!identifier.getComponentClassName().equals(identifier.getOwner().getClassName())) {
+ if (!identifier.getComponentClassName().equals(identifier.getOwner().getEntityName())) {
OrmShape componentClassShape = elements.get(identifier.getComponentClassName());
if (componentClassShape == null && persistentClass instanceof RootClass) {
componentClassShape = getOrCreateComponentClass(((RootClass)persistentClass).getIdentifierProperty());
@@ -233,7 +233,7 @@
RootClass cls = (RootClass)clazz;
Table table = cls.getTable();
if (tableName.equals(table.getName() + "." + table.getName())) {
- if (elements.get(cls.getClassName()) == null)
+ if (elements.get(cls.getEntityName()) == null)
getOrCreatePersistentClass(cls, null);
}
// } else if (clazz instanceof SingleTableSubclass) {
@@ -325,7 +325,7 @@
if (el instanceof Column) {
targets.put(((Column)el).getName(), connection.getTarget());
} else if (el instanceof RootClass) {
- targets.put(((RootClass)el).getClassName(), connection.getTarget());
+ targets.put(((RootClass)el).getEntityName(), connection.getTarget());
}
}
KeyValue id = rootClass.getIdentifier();
@@ -384,9 +384,9 @@
Shape sh = elements.get(comp.getAssociatedClass().getTable().getSchema() + "." + comp.getAssociatedClass().getTable().getName());
removeLinks(sh);
elements.remove(comp.getAssociatedClass().getTable().getSchema() + "." + comp.getAssociatedClass().getTable().getName());
- Shape sh2 = elements.get(comp.getAssociatedClass().getClassName());
+ Shape sh2 = elements.get(comp.getAssociatedClass().getEntityName());
removeLinks(sh2);
- elements.remove(comp.getAssociatedClass().getClassName());
+ elements.remove(comp.getAssociatedClass().getEntityName());
}
} else if (collection.isMap() || collection.isSet()) {
Table databaseTable = collection.getCollectionTable();
@@ -402,8 +402,8 @@
RootClass cls = (RootClass)clazz;
Table table = cls.getTable();
if (tableName.equals(table.getName() + "." + table.getName())) {
- if (elements.get(cls.getClassName()) != null)
- elements.remove(cls.getClassName());
+ if (elements.get(cls.getEntityName()) != null)
+ elements.remove(cls.getEntityName());
}
}
}
@@ -500,7 +500,7 @@
if(!isConnectionExist(classShape, tableShape))
new Connection(classShape, tableShape);
Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
- OrmShape parentClassShape = (OrmShape)elements.get(((Property)parentShape.getOrmElement()).getPersistentClass().getClassName());
+ OrmShape parentClassShape = (OrmShape)elements.get(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName());
if(!isConnectionExist(parentShape, parentClassShape))
new Connection(parentShape, parentClassShape);
}
@@ -514,7 +514,7 @@
OrmShape classShape = null;
OneToMany component = (OneToMany)((Collection)property.getValue()).getElement();
if (component != null) {
- classShape = (OrmShape)elements.get(component.getAssociatedClass().getClassName());
+ classShape = (OrmShape)elements.get(component.getAssociatedClass().getEntityName());
if (classShape == null) classShape = createShape(component.getAssociatedClass());
OrmShape tableShape = (OrmShape)elements.get(component.getAssociatedClass().getTable().getSchema() + "." + component.getAssociatedClass().getTable().getName());
if (tableShape == null) tableShape = getOrCreateDatabaseTable(component.getAssociatedClass().getTable());
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2007-07-12 15:31:36 UTC (rev 2406)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2007-07-12 15:36:55 UTC (rev 2407)
@@ -122,7 +122,7 @@
RootClass persistentClass = (RootClass) getCastedModel()
.getOrmElement();
ormShape = (OrmShape) hashMap
- .remove(persistentClass.getClassName());
+ .remove(persistentClass.getEntityName());
if (ormShape != null) {
ormShape.setLocation(new Point(20, 20));
tempPoint = 40 + getChildrenFigurePreferredHeight(ormShape);
17 years, 5 months
JBoss Tools SVN: r2406 - trunk/as/plugins/org.jboss.ide.eclipse.as.core.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-07-12 11:31:36 -0400 (Thu, 12 Jul 2007)
New Revision: 2406
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
enabled new versions of WTP components (jst.web=2.5, jst.ejb=3.0, jst.ear=5.0)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-07-12 15:15:44 UTC (rev 2405)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-07-12 15:31:36 UTC (rev 2406)
@@ -137,13 +137,13 @@
version="4.2">
<moduleType
types="jst.web"
- versions="2.2, 2.3, 2.4"/>
+ versions="2.2, 2.3, 2.4, 2.5"/>
<moduleType
types="jst.ejb"
- versions="1.0, 1.1, 2.0, 2.1"/>
+ versions="1.0, 1.1, 2.0, 2.1, 3.0"/>
<moduleType
types="jst.ear"
- versions="1.2, 1.3, 1.4"/>
+ versions="1.2, 1.3, 1.4, 5.0"/>
<moduleType
types="jbide.ejb30"
versions="1.0"/>
17 years, 5 months
JBoss Tools SVN: r2405 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-12 11:15:44 -0400 (Thu, 12 Jul 2007)
New Revision: 2405
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamOpenAction.java
Log:
EXIN-218 classes annotated
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java 2007-07-12 15:01:20 UTC (rev 2404)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java 2007-07-12 15:15:44 UTC (rev 2405)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.ui.views.actions;
import org.eclipse.jface.action.IMenuManager;
@@ -8,6 +18,10 @@
import org.jboss.tools.seam.core.IOpenableElement;
import org.jboss.tools.seam.core.ISeamElement;
+/**
+ * Action provider for Seam Components view.
+ * @author Viacheslav Kabanovich
+ */
public class SeamActionProvider extends CommonActionProvider {
public SeamActionProvider() {}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamOpenAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamOpenAction.java 2007-07-12 15:01:20 UTC (rev 2404)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamOpenAction.java 2007-07-12 15:15:44 UTC (rev 2405)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.ui.views.actions;
import org.eclipse.jface.action.Action;
@@ -3,4 +13,7 @@
import org.jboss.tools.seam.core.IOpenableElement;
+/**
+ * @author Viacheslav Kabanovich
+ */
public class SeamOpenAction extends Action {
IOpenableElement element;
17 years, 5 months
JBoss Tools SVN: r2404 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-12 11:01:20 -0400 (Thu, 12 Jul 2007)
New Revision: 2404
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
Log:
EXIN-217 bijected fields processed in java scanner
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-07-12 14:43:41 UTC (rev 2403)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IBijectedAttribute.java 2007-07-12 15:01:20 UTC (rev 2404)
@@ -27,5 +27,12 @@
* @return
*/
public boolean isOfType(BijectedAttributeType type);
+
+ /**
+ * Though this interface extends ISeamContextVariable, not all
+ * types are allowed to be context variables
+ * @return
+ */
+ public boolean isContextVariable();
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-12 14:43:41 UTC (rev 2403)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-12 15:01:20 UTC (rev 2404)
@@ -30,6 +30,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamContextVariable;
@@ -284,7 +285,10 @@
if(loaded instanceof ISeamJavaComponentDeclaration) {
SeamJavaComponentDeclaration jd = (SeamJavaComponentDeclaration)loaded;
javaDeclarations.put(jd.getClassName(), jd);
- allVariables.addAll(jd.getBijectedAttributes());
+ Set<IBijectedAttribute> as = jd.getBijectedAttributes();
+ for (IBijectedAttribute a : as) {
+ if(a.isContextVariable()) allVariables.add(a);
+ }
allVariables.addAll(jd.getRoles());
Set<ISeamComponent> cs = getComponentsByClass(jd.getClassName());
for (ISeamComponent ci: cs) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-12 14:43:41 UTC (rev 2403)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2007-07-12 15:01:20 UTC (rev 2404)
@@ -163,6 +163,41 @@
att.setSourceMember(findMethod(m));
}
+
+ for (AnnotatedASTNode<FieldDeclaration> n: annotatedFields) {
+ Map<BijectedAttributeType, Annotation> as = new HashMap<BijectedAttributeType, Annotation>();
+ List<BijectedAttributeType> types = new ArrayList<BijectedAttributeType>();
+ Annotation main = null;
+ for (int i = 0; i < BijectedAttributeType.values().length; i++) {
+ Annotation a = findAnnotation(n, BijectedAttributeType.values()[i].getAnnotationType());
+ if(a != null) {
+ as.put(BijectedAttributeType.values()[i], a);
+ if(main == null) main = a;
+ types.add(BijectedAttributeType.values()[i]);
+ }
+ }
+ if(as.size() == 0) continue;
+
+ FieldDeclaration m = n.getNode();
+
+ BijectedAttribute att = new BijectedAttribute();
+ component.addBijectedAttribute(att);
+
+ att.setTypes(types.toArray(new BijectedAttributeType[0]));
+
+ ValueInfo name = ValueInfo.getValueInfo(main, null);
+ if(name == null) {
+ name = new ValueInfo();
+ name.value = getFieldName(m);
+ }
+
+ att.setName(name.getValue());
+
+ ValueInfo scope = ValueInfo.getValueInfo(main, "scope");
+ if(scope != null) att.setScopeAsString(scope.getValue());
+
+ att.setSourceMember(findField(m));
+ }
}
void processComponentMethods() {
@@ -272,7 +307,7 @@
}
return null;
}
-
+
/**
* Returns name of first field
* @param node
17 years, 5 months
JBoss Tools SVN: r2403 - in trunk/seam/plugins/org.jboss.tools.seam.ui: src/org/jboss/tools/seam/ui/views and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-12 10:43:41 -0400 (Thu, 12 Jul 2007)
New Revision: 2403
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
Log:
EXIN-218 content provider added as listener to workspace
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-12 14:41:42 UTC (rev 2402)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2007-07-12 14:43:41 UTC (rev 2403)
@@ -19,6 +19,7 @@
org.eclipse.jdt.core,
org.eclipse.jst.jsf.ui,
org.eclipse.wst.common.frameworks.ui,
+ org.jboss.tools.common,
org.jboss.tools.seam.core,
org.apache.log4j,
org.hibernate.eclipse.console,
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-12 14:41:42 UTC (rev 2402)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-12 14:43:41 UTC (rev 2403)
@@ -2,12 +2,19 @@
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -27,12 +34,16 @@
Set<ISeamProject> processed = new HashSet<ISeamProject>();
+ IResourceChangeListener listener = new ResourceChangeListener();
+
+
public Object[] getChildren(Object parentElement) {
if(parentElement instanceof IWorkspaceRoot) {
IWorkspaceRoot root = (IWorkspaceRoot)parentElement;
IProject[] ps = root.getProjects();
List<ISeamProject> children = new ArrayList<ISeamProject>();
for (int i = 0; i < ps.length; i++) {
+ if(!isGoodProject(ps[i])) continue;
ISeamProject p = SeamCorePlugin.getSeamProject(ps[i], false);
if(p != null) {
if(!processed.contains(p)) {
@@ -73,6 +84,9 @@
}
public void dispose() {
+ if(root != null) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
+ }
root = null;
viewer = null;
if(processed != null) {
@@ -85,6 +99,7 @@
this.viewer = viewer;
if(newInput instanceof IWorkspaceRoot || newInput == null) {
root = (IWorkspaceRoot)newInput;
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(listener);
}
}
@@ -103,10 +118,62 @@
if(!(viewer instanceof StructuredViewer)) return;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- ((StructuredViewer)viewer).refresh(o);
+ if(o == null) {
+ ((StructuredViewer)viewer).refresh();
+ } else {
+ ((StructuredViewer)viewer).refresh(o);
+ }
}
});
}
+ boolean isGoodProject(IProject project) {
+ if(project == null || !project.exists() || !project.isOpen()) return false;
+ try {
+ if(!project.hasNature("org.jboss.tools.jsf.jsfnature")) return false;
+ } catch (CoreException e) {
+ //ignore - all checks are done above
+ return false;
+ }
+ return true;
+ }
+
+ class ResourceChangeListener implements IResourceChangeListener {
+ ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ try {
+ event.getDelta().accept(visitor);
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ }
+
+ class ResourceDeltaVisitor implements IResourceDeltaVisitor {
+
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ int kind = delta.getKind();
+ IResource r = delta.getResource();
+ if(kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) {
+ if(r instanceof IProject) {
+ refresh(null);
+ }
+ } else if(kind == IResourceDelta.CHANGED) {
+ IResourceDelta[] cs = delta.getAffectedChildren();
+ if(cs != null) for (int i = 0; i < cs.length; i++) {
+ IResource c = cs[i].getResource();
+ if(c instanceof IFile && c.getName().endsWith(".project")) {
+ refresh(null);
+ }
+ }
+ }
+ if(r instanceof IProject) return false;
+ return true;
+ }
+
+ }
+
}
17 years, 5 months