JBoss Tools SVN: r2809 - in trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping: unconstrained and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-08-01 12:20:50 -0400 (Wed, 01 Aug 2007)
New Revision: 2809
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/DefaultValueIntegerType.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Typedef.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Widget.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Widget.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Employee.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/Child.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/Parent.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/ParentChild.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Alien.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Being.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Beings.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Employee.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Hive.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Human.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Location.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Thing.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Address.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Customer.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Employee.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Person.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Person.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/PersonThing.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Task.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Thing.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/File.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/File.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/NumericTrueFalseType.java
Log:
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/DefaultValueIntegerType.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/DefaultValueIntegerType.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/DefaultValueIntegerType.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,79 @@
+package mapping.typeparameters;
+
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Properties;
+
+import org.hibernate.HibernateException;
+import org.hibernate.usertype.ParameterizedType;
+import org.hibernate.usertype.UserType;
+
+
+/**
+ * @author Michi
+ */
+public class DefaultValueIntegerType implements UserType, ParameterizedType, Serializable {
+
+ private Integer defaultValue;
+
+ public int[] sqlTypes() {
+ return new int[] {Types.INTEGER};
+ }
+
+ public Class returnedClass() {
+ return int.class;
+ }
+
+ public boolean equals(Object x, Object y) throws HibernateException {
+ if (x==y) return true;
+ if (x==null || y==null) return false;
+ return x.equals(y);
+ }
+
+ public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
+ Number result = (Number) rs.getObject(names[0]);
+ return result==null ? defaultValue : new Integer(result.intValue());
+ }
+
+ public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
+ if (value == null || defaultValue.equals(value) ) {
+ st.setNull(index, Types.INTEGER);
+ } else {
+ st.setInt(index, ((Integer)value).intValue());
+ }
+ }
+
+ public Object deepCopy(Object value) throws HibernateException {
+ return new Integer(((Integer)value).intValue());
+ }
+
+ public boolean isMutable() {
+ return false;
+ }
+
+ public int hashCode(Object x) throws HibernateException {
+ return x.hashCode();
+ }
+
+ public Object assemble(Serializable cached, Object owner)
+ throws HibernateException {
+ return cached;
+ }
+
+ public Serializable disassemble(Object value) throws HibernateException {
+ return (Serializable) value;
+ }
+
+ public Object replace(Object original, Object target, Object owner)
+ throws HibernateException {
+ return original;
+ }
+
+ public void setParameterValues(Properties parameters) {
+ this.defaultValue = Integer.valueOf((String) parameters.get("default"));
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Typedef.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Typedef.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Typedef.hbm.xml 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+
+ <typedef name="nullToMinusOne"
+ class="mapping.typeparameters.DefaultValueIntegerType">
+ <param name="default">-1</param>
+ </typedef>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Widget.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Widget.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Widget.hbm.xml 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="mapping.typeparameters">
+
+ <typedef name="nullToTwo"
+ class="mapping.typeparameters.DefaultValueIntegerType">
+ <param name="default">2</param>
+ </typedef>
+
+ <class name="Widget" table="STRANGE_TYPED_OBJECT">
+ <id name="id" column="ID">
+ <generator class="increment"/>
+ </id>
+ <property name="valueOne" column="VALUE_ONE">
+ <type name="mapping.typeparameters.DefaultValueIntegerType">
+ <param name="default">1</param>
+ </type>
+ </property>
+ <property name="valueTwo" column="VALUE_TWO" type="nullToTwo"/>
+ <property name="valueThree" column="VALUE_THREE" type="nullToMinusOne"/>
+ <property name="valueFour" column="VALUE_FOUR">
+ <type name="nullToTwo">
+ <param name="default">-5</param>
+ </type>
+ </property>
+ <property name="string"/>
+ </class>
+
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Widget.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Widget.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/Widget.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,62 @@
+package mapping.typeparameters;
+
+/**
+ * @author Michael Gloegl
+ */
+public class Widget {
+
+ private int valueOne = 1;
+ private int valueTwo = 2;
+ private int valueThree = -1;
+ private int valueFour = -5;
+ private Integer id;
+ private String string;
+
+ public int getValueOne() {
+ return valueOne;
+ }
+
+ public void setValueOne(int valueOne) {
+ this.valueOne = valueOne;
+ }
+
+ public int getValueThree() {
+ return valueThree;
+ }
+
+ public void setValueThree(int valueThree) {
+ this.valueThree = valueThree;
+ }
+
+ public int getValueTwo() {
+ return valueTwo;
+ }
+
+ public void setValueTwo(int valueTwo) {
+ this.valueTwo = valueTwo;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getString() {
+ return string;
+ }
+
+ public void setString(String string) {
+ this.string = string;
+ }
+
+ public int getValueFour() {
+ return valueFour;
+ }
+
+ public void setValueFour(int valueFour) {
+ this.valueFour = valueFour;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Employee.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Employee.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Employee.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,28 @@
+//$Id: Employee.java 6298 2005-04-03 03:56:22Z oneovthafew $
+package mapping.unconstrained;
+
+/**
+ * @author Gavin King
+ */
+public class Employee {
+
+ private String id;
+
+ public Employee() {
+ }
+
+ public Employee(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Person.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Person.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Person.hbm.xml 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,31 @@
+<?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.unconstrained"
+ default-access="field">
+
+ <class name="Person"
+ dynamic-update="true">
+
+ <id name="name"/>
+
+ <property name="employeeId"
+ unique="true"/>
+
+ <many-to-one name="employee"
+ formula="employeeId"
+ not-found="ignore"
+ cascade="all"/>
+
+ </class>
+
+ <class name="Employee">
+
+ <id name="id"/>
+
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/Person.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,43 @@
+//$Id: Person.java 6298 2005-04-03 03:56:22Z oneovthafew $
+package mapping.unconstrained;
+
+/**
+ * @author Gavin King
+ */
+public class Person {
+
+ private String name;
+ private String employeeId;
+ private Employee employee;
+
+ public Person() {}
+ public Person(String name) {
+ this.name = name;
+ }
+
+ public Employee getEmployee() {
+ return employee;
+ }
+
+ public void setEmployee(Employee employee) {
+ this.employee = employee;
+ }
+
+ public String getEmployeeId() {
+ return employeeId;
+ }
+
+ public void setEmployeeId(String employeeId) {
+ this.employeeId = employeeId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/Child.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/Child.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/Child.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,27 @@
+//$Id: Child.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.unidir;
+
+
+/**
+ * @author Gavin King
+ */
+public class Child {
+ private String name;
+ private int age;
+ Child() {}
+ public Child(String name) {
+ this.name = name;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public int getAge() {
+ return age;
+ }
+ public void setAge(int age) {
+ this.age = age;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/Parent.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/Parent.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/Parent.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,29 @@
+//$Id: Parent.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.unidir;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gavin King
+ */
+public class Parent {
+ private String name;
+ private List children = new ArrayList();
+ Parent() {}
+ public Parent(String name) {
+ this.name = name;
+ }
+ public List getChildren() {
+ return children;
+ }
+ public void setChildren(List children) {
+ this.children = children;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/ParentChild.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/ParentChild.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/ParentChild.hbm.xml 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,23 @@
+<?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.unidir">
+
+ <class name="Parent">
+ <id name="name"/>
+ <list name="children" cascade="persist,merge">
+ <key column="parentName" not-null="true"/>
+ <list-index column="sibling"/>
+ <one-to-many class="Child"/>
+ </list>
+ </class>
+
+ <class name="Child">
+ <id name="name"/>
+ <property name="age" not-null="true"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Alien.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Alien.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Alien.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,38 @@
+//$Id: Alien.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.unionsubclass;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gavin King
+ */
+public class Alien extends Being {
+ private String species;
+ private Hive hive;
+ private List hivemates = new ArrayList();
+ /**
+ * @return Returns the species.
+ */
+ public String getSpecies() {
+ return species;
+ }
+ /**
+ * @param species The species to set.
+ */
+ public void setSpecies(String species) {
+ this.species = species;
+ }
+ public Hive getHive() {
+ return hive;
+ }
+ public void setHive(Hive hive) {
+ this.hive = hive;
+ }
+ public List getHivemates() {
+ return hivemates;
+ }
+ public void setHivemates(List hivemates) {
+ this.hivemates = hivemates;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Being.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Being.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Being.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,72 @@
+//$Id: Being.java 6007 2005-03-04 12:01:43Z oneovthafew $
+package mapping.unionsubclass;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Gavin King
+ */
+public abstract class Being {
+ private long id;
+ private String identity;
+ private Location location;
+ private List things = new ArrayList();
+ private Map info = new HashMap();
+ /**
+ * @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 getIdentity() {
+ return identity;
+ }
+ /**
+ * @param identity The identity to set.
+ */
+ public void setIdentity(String identity) {
+ this.identity = identity;
+ }
+ /**
+ * @return Returns the location.
+ */
+ public Location getLocation() {
+ return location;
+ }
+ /**
+ * @param location The location to set.
+ */
+ public void setLocation(Location location) {
+ this.location = location;
+ }
+ public String getSpecies() {
+ return null;
+ }
+
+ public List getThings() {
+ return things;
+ }
+ public void setThings(List things) {
+ this.things = things;
+ }
+ public Map getInfo() {
+ return info;
+ }
+
+ public void setInfo(Map info) {
+ this.info = info;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Beings.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Beings.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Beings.hbm.xml 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,113 @@
+<?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.unionsubclass"
+ default-access="field">
+
+ <class name="Being" abstract="true">
+
+ <id name="id" unsaved-value="0" column="bid">
+ <generator class="increment"/>
+ <!--generator class="hilo">
+ <param name="table">being_id</param>
+ <param name="column">next_id</param>
+ </generator-->
+ </id>
+
+ <property name="identity" not-null="true" column="ident"/>
+ <many-to-one name="location" not-null="true"/>
+
+ <bag name="things" inverse="true">
+ <key column="owner"/>
+ <one-to-many class="Thing"/>
+ </bag>
+
+ <map name="info">
+ <key column="bid"/>
+ <map-key type="string" column="attribute"/>
+ <element type="string" column="value"/>
+ </map>
+
+ <union-subclass name="Human" table="humans">
+ <property name="sex"
+ not-null="true"
+ update="false"/>
+ <union-subclass name="Employee" table="employees">
+ <property name="salary"/>
+ </union-subclass>
+ </union-subclass>
+
+ <union-subclass name="Alien" table="aliens">
+ <property name="species"
+ not-null="true"
+ update="false"/>
+ <many-to-one name="hive" not-null="true"/>
+ <bag name="hivemates">
+ <key column="alien1"/>
+ <many-to-many column="alien2" class="Alien"/>
+ </bag>
+ </union-subclass>
+
+ </class>
+
+ <class name="Hive" table="hives">
+
+ <id name="id" unsaved-value="0">
+ <generator class="increment"/>
+ <!--generator class="hilo">
+ <param name="table">location_id</param>
+ <param name="column">next_id</param>
+ </generator-->
+ </id>
+
+ <many-to-one name="location" not-null="true"/>
+
+ <bag name="members"
+ inverse="true"
+ cascade="all,delete-orphan">
+ <key column="hive"/>
+ <one-to-many class="Alien"/>
+ </bag>
+
+ </class>
+
+ <class name="Location" table="locations">
+
+ <id name="id" unsaved-value="0">
+ <generator class="increment"/>
+ <!--generator class="hilo">
+ <param name="table">location_id</param>
+ <param name="column">next_id</param>
+ </generator-->
+ </id>
+
+ <property name="name" not-null="true"/>
+
+ <bag name="beings"
+ inverse="true"
+ cascade="all">
+ <key column="location"/>
+ <one-to-many class="Being"/>
+ </bag>
+
+ </class>
+
+ <class name="Thing" table="things">
+
+ <id name="id" unsaved-value="0">
+ <generator class="increment"/>
+ <!--generator class="hilo">
+ <param name="table">thing_id</param>
+ <param name="column">next_id</param>
+ </generator-->
+ </id>
+
+ <property name="description"/>
+ <many-to-one name="owner"/>
+
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Employee.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Employee.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Employee.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,17 @@
+//$Id: Employee.java 6673 2005-05-03 22:59:24Z epbernard $
+package mapping.unionsubclass;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Employee extends Human {
+ private Double salary;
+
+ public Double getSalary() {
+ return salary;
+ }
+
+ public void setSalary(Double salary) {
+ this.salary = salary;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Hive.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Hive.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Hive.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,32 @@
+//$Id: Hive.java 5686 2005-02-12 07:27:32Z steveebersole $
+package mapping.unionsubclass;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gavin King
+ */
+public class Hive {
+ private long id;
+ private Location location;
+ private List members = new ArrayList();
+ public List getMembers() {
+ return members;
+ }
+ public void setMembers(List hives) {
+ this.members = hives;
+ }
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+ public Location getLocation() {
+ return location;
+ }
+ public void setLocation(Location location) {
+ this.location = location;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Human.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Human.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Human.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,26 @@
+//$Id: Human.java 4364 2004-08-17 12:10:32Z oneovthafew $
+package mapping.unionsubclass;
+
+/**
+ * @author Gavin King
+ */
+public class Human extends Being {
+ 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;
+ }
+ public String getSpecies() {
+ return "human";
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Location.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Location.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Location.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,61 @@
+//$Id: Location.java 4357 2004-08-17 09:20:17Z oneovthafew $
+package mapping.unionsubclass;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author Gavin King
+ */
+public class Location {
+ private long id;
+ private String name;
+ private Collection beings = new ArrayList();
+
+ Location() {}
+
+ public Location(String name) {
+ this.name = name;
+ }
+
+ public void addBeing(Being b) {
+ b.setLocation(this);
+ beings.add(b);
+ }
+ /**
+ * @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;
+ }
+ /**
+ * @return Returns the beings.
+ */
+ public Collection getBeings() {
+ return beings;
+ }
+ /**
+ * @param beings The beings to set.
+ */
+ public void setBeings(Collection beings) {
+ this.beings = beings;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Thing.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Thing.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/Thing.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,47 @@
+//$Id: Thing.java 4418 2004-08-22 13:38:16Z oneovthafew $
+package mapping.unionsubclass;
+
+/**
+ * @author Gavin King
+ */
+public class Thing {
+ private long id;
+ private String description;
+ private Being owner;
+ /**
+ * @return Returns the description.
+ */
+ public String getDescription() {
+ return description;
+ }
+ /**
+ * @param description The description to set.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ /**
+ * @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 owner.
+ */
+ public Being getOwner() {
+ return owner;
+ }
+ /**
+ * @param owner The owner to set.
+ */
+ public void setOwner(Being owner) {
+ this.owner = owner;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Address.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Address.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Address.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,11 @@
+//$Id: Address.java 7192 2005-06-18 14:40:15Z oneovthafew $
+package mapping.unionsubclass2;
+
+/**
+ * @author Gavin King
+ */
+public class Address {
+ public String address;
+ public String zip;
+ public String country;
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Customer.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Customer.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Customer.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,35 @@
+//$Id: Customer.java 7192 2005-06-18 14:40:15Z oneovthafew $
+package mapping.unionsubclass2;
+
+/**
+ * @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/unionsubclass2/Employee.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Employee.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Employee.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,49 @@
+//$Id: Employee.java 7192 2005-06-18 14:40:15Z oneovthafew $
+package mapping.unionsubclass2;
+
+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/unionsubclass2/Person.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Person.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Person.hbm.xml 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,61 @@
+<?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
+
+ (1) a table-per-subclass mapping strategy
+
+ (2) a simple component mapping
+
+ (3) recursive associations withing an inheritance tree
+
+-->
+
+<hibernate-mapping
+ package="mapping.unionsubclass2"
+ default-access="field">
+
+ <class name="Person" table="UPerson">
+
+ <id name="id"
+ column="person_id"
+ unsaved-value="0">
+ <generator class="increment"/>
+ </id>
+
+ <property name="name"
+ unique-key="NameUniqueKey"
+ not-null="true"
+ length="80"/>
+ <property name="sex"
+ not-null="true"
+ update="false"/>
+
+ <component name="address">
+ <property name="address" index="AddressIndex"/>
+ <property name="zip" index="AddressIndex"/>
+ <property name="country"/>
+ </component>
+
+ <union-subclass name="Employee" table="UEmployee">
+ <property name="title"
+ not-null="true"
+ length="20"/>
+ <property name="salary"
+ length="0"/>
+ <many-to-one name="manager"/>
+ </union-subclass>
+
+ <union-subclass name="Customer" table="UCustomer">
+ <property name="comments"/>
+ <many-to-one name="salesperson"/>
+ </union-subclass>
+
+ </class>
+
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/Person.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,70 @@
+//$Id: Person.java 7192 2005-06-18 14:40:15Z oneovthafew $
+package mapping.unionsubclass2;
+
+
+/**
+ * @author Gavin King
+ */
+public class Person {
+ private long id;
+ private String name;
+ private char sex;
+ private Address address = new Address();
+ /**
+ * @return Returns the address.
+ */
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(String string) {
+ this.address.address = string;
+ }
+
+ public void setZip(String string) {
+ this.address.zip = string;
+ }
+
+ public void setCountry(String string) {
+ this.address.country = string;
+ }
+
+
+ /**
+ * @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/version/Person.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Person.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Person.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,43 @@
+//$Id: Person.java 7676 2005-07-29 06:27:10Z oneovthafew $
+package mapping.version;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Person {
+ private String name;
+ private List things;
+ private List tasks;
+ private int version;
+
+ Person() {}
+ public Person(String name) {
+ this.name = name;
+ this.things = new ArrayList();
+ this.tasks = new ArrayList();
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public List getThings() {
+ return things;
+ }
+ public void setThings(List things) {
+ this.things = things;
+ }
+ public int getVersion() {
+ return version;
+ }
+ public void setVersion(int version) {
+ this.version = version;
+ }
+ public List getTasks() {
+ return tasks;
+ }
+ public void setTasks(List tasks) {
+ this.tasks = tasks;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/PersonThing.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/PersonThing.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/PersonThing.hbm.xml 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,45 @@
+<?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 how to control the optimistic locking behavior
+ of a collection (do changes to the collection result in
+ a version increment on the owning instance)
+ -->
+<hibernate-mapping
+ package="mapping.version">
+
+ <class name="Person">
+ <id name="name"/>
+ <version name="version"/>
+ <bag name="things"
+ inverse="true"
+ cascade="all,delete-orphan">
+ <key column="person"/>
+ <one-to-many class="Thing"/>
+ </bag>
+ <bag name="tasks"
+ inverse="true"
+ cascade="all,delete-orphan"
+ optimistic-lock="false">
+ <key column="person"/>
+ <one-to-many class="Task"/>
+ </bag>
+ </class>
+
+ <class name="Thing">
+ <id name="description"/>
+ <version name="version"/>
+ <property name="longDescription"/>
+ <many-to-one name="person"/>
+ </class>
+
+ <class name="Task">
+ <id name="description"/>
+ <version name="version"/>
+ <many-to-one name="person"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Task.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Task.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Task.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,33 @@
+//$Id: Task.java 7676 2005-07-29 06:27:10Z oneovthafew $
+package mapping.version;
+
+public class Task {
+ private String description;
+ private Person person;
+ private int version;
+
+ public int getVersion() {
+ return version;
+ }
+ public void setVersion(int version) {
+ this.version = version;
+ }
+ Task() {}
+ public Task(String description, Person person) {
+ this.description = description;
+ this.person = person;
+ person.getTasks().add(this);
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public Person getPerson() {
+ return person;
+ }
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Thing.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Thing.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/Thing.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,40 @@
+//$Id: Thing.java 7715 2005-08-01 16:46:57Z oneovthafew $
+package mapping.version;
+
+public class Thing {
+ private String description;
+ private Person person;
+ private int version;
+ private String longDescription;
+
+ public int getVersion() {
+ return version;
+ }
+ public void setVersion(int version) {
+ this.version = version;
+ }
+ Thing() {}
+ public Thing(String description, Person person) {
+ this.description = description;
+ this.person = person;
+ person.getThings().add(this);
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public Person getPerson() {
+ return person;
+ }
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+ public String getLongDescription() {
+ return longDescription;
+ }
+ public void setLongDescription(String longDescription) {
+ this.longDescription = longDescription;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/File.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/File.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/File.hbm.xml 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,24 @@
+<?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 use of a class-level where restriction
+ -->
+<hibernate-mapping package="mapping.where">
+
+ <class name="File" where="deleted=0" table="T_FILE">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <property name="name"/>
+ <property name="deleted" type="mapping.where.NumericTrueFalseType"/>
+ <many-to-one name="parent"/>
+ <set name="children" inverse="true" where="deleted=0">
+ <key column="parent"/>
+ <one-to-many class="File"/>
+ </set>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/File.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/File.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/File.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,52 @@
+//$Id: File.java 8043 2005-08-30 15:20:42Z oneovthafew $
+package mapping.where;
+
+import java.util.Set;
+
+public class File {
+ private long id;
+ private String name;
+ private File parent;
+ private boolean deleted;
+ private Set children;
+
+ public Set getChildren() {
+ return children;
+ }
+ public void setChildren(Set children) {
+ this.children = children;
+ }
+
+ public File(String name, File parent) {
+ this.name = name;
+ this.parent = parent;
+ }
+
+ File() {}
+
+ public boolean isDeleted() {
+ return deleted;
+ }
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+ 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 File getParent() {
+ return parent;
+ }
+ public void setParent(File parent) {
+ this.parent = parent;
+ }
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/NumericTrueFalseType.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/NumericTrueFalseType.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/NumericTrueFalseType.java 2007-08-01 16:20:50 UTC (rev 2809)
@@ -0,0 +1,53 @@
+package mapping.where;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.PreparedStatement;
+import java.sql.Types;
+
+import org.hibernate.type.BooleanType;
+import org.hibernate.dialect.Dialect;
+
+/**
+ * Maps int db values to boolean java values. Zero is considered false; any
+ * non-zero value is considered true.
+ *
+ * @author Steve Ebersole
+ */
+public class NumericTrueFalseType extends BooleanType {
+
+ public Object get(ResultSet rs, String name) throws SQLException {
+ int value = rs.getInt( name );
+ if ( rs.wasNull() ) {
+ return getDefaultValue();
+ }
+ else if ( value == 0 ) {
+ return Boolean.FALSE;
+ }
+ else {
+ return Boolean.TRUE;
+ }
+ }
+
+ public void set(PreparedStatement st, Object value, int index) throws SQLException {
+ if ( value == null ) {
+ st.setNull( index, Types.INTEGER );
+ }
+ else {
+ boolean bool = ( ( Boolean ) value ).booleanValue();
+ st.setInt( index, bool ? 1 : 0 );
+ }
+ }
+
+ public String objectToSQLString(Object value, Dialect dialect) throws Exception {
+ return ( ( Boolean ) value ).booleanValue() ? "1" : "0";
+ }
+
+ public int sqlType() {
+ return Types.INTEGER;
+ }
+
+ public String getName() {
+ return "numeric_boolean";
+ }
+}
17 years, 4 months
JBoss Tools SVN: r2808 - in trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping: usercollection and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-08-01 12:19:55 -0400 (Wed, 01 Aug 2007)
New Revision: 2808
Added:
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/typeparameters/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unconstrained/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unidir/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/unionsubclass2/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/Email.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/IMyList.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/MyList.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/MyListType.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/PersistentMyList.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/UserPermissions.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableList.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableListImpl.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableListType.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/Entity.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/Mapping.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/PersistentDefaultableList.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Child.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Parent.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Parent.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/child.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/Group.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/Permission.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/User.hbm.xml
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/User.java
trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/where/
Log:
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/Email.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/Email.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/Email.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,39 @@
+//$Id$
+package mapping.usercollection.basic;
+
+/**
+ * @author Gavin King
+ */
+public class Email {
+
+ private Long id;
+ private String address;
+
+ Email() {}
+
+ public String getAddress() {
+ return address;
+ }
+ public void setAddress(String type) {
+ this.address = type;
+ }
+ public Email(String type) {
+ this.address = type;
+ }
+ public boolean equals(Object that) {
+ if ( !(that instanceof Email) ) return false;
+ Email p = (Email) that;
+ return this.address.equals(p.address);
+ }
+ public int hashCode() {
+ return address.hashCode();
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/IMyList.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/IMyList.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/IMyList.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,7 @@
+package mapping.usercollection.basic;
+
+import java.util.List;
+
+public interface IMyList extends List {
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/MyList.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/MyList.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/MyList.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,14 @@
+package mapping.usercollection.basic;
+
+import java.util.ArrayList;
+
+/**
+ * A custom collection class. We extend a java.util.Collection class, but that is not required.
+ * It could be totally non-java-collection type, but then we would need to implement all the PersistentCollection methods.
+ *
+ * @author max
+ *
+ */
+public class MyList extends ArrayList implements IMyList {
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/MyListType.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/MyListType.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/MyListType.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,65 @@
+package mapping.usercollection.basic;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.hibernate.EntityMode;
+import org.hibernate.HibernateException;
+import org.hibernate.collection.PersistentCollection;
+import org.hibernate.engine.SessionImplementor;
+import org.hibernate.persister.collection.CollectionPersister;
+import org.hibernate.usertype.UserCollectionType;
+
+public class MyListType implements UserCollectionType {
+
+ static int lastInstantiationRequest = -2;
+
+ public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister) throws HibernateException {
+ return new PersistentMyList(session);
+ }
+
+ public PersistentCollection wrap(SessionImplementor session, Object collection) {
+ if ( session.getEntityMode()==EntityMode.DOM4J ) {
+ throw new IllegalStateException("dom4j not supported");
+ }
+ else {
+ return new PersistentMyList( session, (IMyList) collection );
+ }
+ }
+
+ public Iterator getElementsIterator(Object collection) {
+ return ( (IMyList) collection ).iterator();
+ }
+
+ public boolean contains(Object collection, Object entity) {
+ return ( (IMyList) collection ).contains(entity);
+ }
+
+ public Object indexOf(Object collection, Object entity) {
+ int l = ( (IMyList) collection ).indexOf(entity);
+ if(l<0) {
+ return null;
+ } else {
+ return new Integer(l);
+ }
+ }
+
+ public Object replaceElements(Object original, Object target, CollectionPersister persister, Object owner, Map copyCache, SessionImplementor session) throws HibernateException {
+ IMyList result = (IMyList) target;
+ result.clear();
+ result.addAll((MyList)original);
+ return result;
+ }
+
+ public Object instantiate(int anticipatedSize) {
+ lastInstantiationRequest = anticipatedSize;
+ return new MyList();
+ }
+
+ public Object instantiate() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/PersistentMyList.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/PersistentMyList.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/PersistentMyList.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,18 @@
+package mapping.usercollection.basic;
+
+import org.hibernate.collection.PersistentList;
+import org.hibernate.engine.SessionImplementor;
+
+public class PersistentMyList extends PersistentList implements IMyList {
+
+ public PersistentMyList(SessionImplementor session) {
+ super(session);
+ }
+
+ public PersistentMyList(SessionImplementor session, IMyList list) {
+ super(session, list);
+ }
+
+
+
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/User.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,39 @@
+//$Id$
+package mapping.usercollection.basic;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Gavin King
+ */
+public class User {
+ private String userName;
+ private IMyList emailAddresses = new MyList();
+ private Map sessionData = new HashMap();
+
+ User() {}
+ public User(String name) {
+ userName = name;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+ public List getEmailAddresses() {
+ return emailAddresses;
+ }
+ public void setEmailAddresses(IMyList emailAddresses) {
+ this.emailAddresses = emailAddresses;
+ }
+ public Map getSessionData() {
+ return sessionData;
+ }
+ public void setSessionData(Map sessionData) {
+ this.sessionData = sessionData;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/UserPermissions.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/UserPermissions.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/basic/UserPermissions.hbm.xml 2007-08-01 16:19:55 UTC (rev 2808)
@@ -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 is a basic example of how to write a UserCollectionType.
+-->
+
+<hibernate-mapping package="mapping.usercollection.basic">
+
+ <import class="Permission"/>
+
+ <class name="User" table="UC_BSC_USER">
+ <id name="userName"/>
+ <list name="emailAddresses" fetch="join" cascade="all, delete-orphan" collection-type="mapping.usercollection.basic.MyListType">
+ <key column="userName"/>
+ <list-index column="displayOrder" base="1"/>
+ <one-to-many class="Email"/>
+ </list>
+ </class>
+
+ <class name="Email">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="address"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableList.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableList.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableList.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,13 @@
+package mapping.usercollection.parameterized;
+
+import java.util.List;
+
+/**
+ * Our specialized collection contract
+ *
+ * @author Holger Brands
+ * @author Steve Ebersole
+ */
+public interface DefaultableList extends List {
+ public String getDefaultValue();
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableListImpl.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableListImpl.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableListImpl.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,28 @@
+package mapping.usercollection.parameterized;
+
+import java.util.ArrayList;
+
+/**
+ * Implementation of our specialized collection contract
+ *
+ * @author Holger Brands
+ * @author Steve Ebersole
+ */
+public class DefaultableListImpl extends ArrayList implements DefaultableList {
+ private String defaultValue;
+
+ public DefaultableListImpl() {
+ }
+
+ public DefaultableListImpl(int anticipatedSize) {
+ super( anticipatedSize + ( int ) Math.ceil( anticipatedSize * .75f ) );
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableListType.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableListType.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/DefaultableListType.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,80 @@
+package mapping.usercollection.parameterized;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.List;
+
+import org.hibernate.usertype.UserCollectionType;
+import org.hibernate.usertype.ParameterizedType;
+import org.hibernate.collection.PersistentCollection;
+import org.hibernate.engine.SessionImplementor;
+import org.hibernate.persister.collection.CollectionPersister;
+import org.hibernate.EntityMode;
+
+/**
+ * Our Hibernate type-system extension for defining our specialized collection
+ * contract.
+ *
+ * @author Holger Brands
+ * @author Steve Ebersole
+ */
+public class DefaultableListType implements UserCollectionType, ParameterizedType {
+ private String defaultValue;
+
+ public Object instantiate(int anticipatedSize) {
+ DefaultableListImpl list = anticipatedSize < 0 ? new DefaultableListImpl() : new DefaultableListImpl( anticipatedSize );
+ list.setDefaultValue( defaultValue );
+ return list;
+ }
+
+ public PersistentCollection instantiate(
+ SessionImplementor session,
+ CollectionPersister persister) {
+ return new PersistentDefaultableList( session );
+ }
+
+ public PersistentCollection wrap(SessionImplementor session, Object collection) {
+ if ( session.getEntityMode() == EntityMode.DOM4J ) {
+ throw new IllegalStateException( "dom4j not supported" );
+ }
+ else {
+ return new PersistentDefaultableList( session, ( List ) collection );
+ }
+ }
+
+ public Iterator getElementsIterator(Object collection) {
+ return ( ( DefaultableList ) collection ).iterator();
+ }
+
+ public boolean contains(Object collection, Object entity) {
+ return ( ( DefaultableList ) collection ).contains( entity );
+ }
+
+ public Object indexOf(Object collection, Object entity) {
+ int index = ( ( DefaultableList ) collection ).indexOf( entity );
+ return index >= 0 ? new Integer( index ) : null;
+ }
+
+ public Object replaceElements(
+ Object original,
+ Object target,
+ CollectionPersister persister,
+ Object owner,
+ Map copyCache,
+ SessionImplementor session) {
+ DefaultableList result = ( DefaultableList ) target;
+ result.clear();
+ result.addAll( ( DefaultableList ) original );
+ return result;
+ }
+
+ public void setParameterValues(Properties parameters) {
+ defaultValue = parameters.getProperty( "default" );
+ }
+
+ public Object instantiate() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/Entity.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/Entity.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/Entity.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,33 @@
+package mapping.usercollection.parameterized;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Our test entity
+ *
+ * @author Steve Ebersole
+ */
+public class Entity {
+ private String name;
+ private List values = new ArrayList();
+
+ public Entity() {
+ }
+
+ public Entity(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List getValues() {
+ return values;
+ }
+
+ public void setValues(List values) {
+ this.values = values;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/Mapping.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/Mapping.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/Mapping.hbm.xml 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,21 @@
+<?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.usercollection.parameterized" default-access="field">
+
+ <typedef name="DefaultableList" class="mapping.usercollection.parameterized.DefaultableListType">
+ <param name="default">Hello</param>
+ </typedef>
+
+ <class name="Entity">
+ <id name="name" type="string"/>
+ <list name="values" fetch="join" table="ENT_VAL" collection-type="DefaultableList">
+ <key column="ENT_ID"/>
+ <list-index column="POS"/>
+ <element type="string" column="VAL"/>
+ </list>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/PersistentDefaultableList.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/PersistentDefaultableList.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/usercollection/parameterized/PersistentDefaultableList.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,29 @@
+package mapping.usercollection.parameterized;
+
+import java.util.List;
+
+import org.hibernate.collection.PersistentList;
+import org.hibernate.engine.SessionImplementor;
+
+/**
+ * The "persistent wrapper" around our specialized collection contract
+ *
+ * @author Holger Brands
+ * @author Steve Ebersole
+ */
+public class PersistentDefaultableList extends PersistentList implements DefaultableList {
+ public PersistentDefaultableList(SessionImplementor session) {
+ super( session );
+ }
+
+ public PersistentDefaultableList(SessionImplementor session, List list) {
+ super( session, list );
+ }
+
+ public PersistentDefaultableList() {
+ }
+
+ public String getDefaultValue() {
+ return ( ( DefaultableList ) this.list ).getDefaultValue();
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Child.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Child.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Child.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,36 @@
+package mapping.util.dtd;
+
+/**
+ * The Child class.
+ *
+ * @author Steve Ebersole
+ */
+public class Child {
+ private Long id;
+ private int age;
+ private Parent parent;
+
+ public Child() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public Parent getParent() {
+ return parent;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+
+ /*package*/ void injectParent(Parent parent) {
+ this.parent = parent;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Parent.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Parent.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Parent.hbm.xml 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" [
+ <!ENTITY child SYSTEM "classpath://org/hibernate/test/util/dtd/child.xml">
+]>
+
+
+<hibernate-mapping package="mapping.util.dtd" default-access="field">
+
+ <class name="Parent">
+ <id name="id" column="ID">
+ <generator class="increment"/>
+ </id>
+ <list name="children" inverse="true" cascade="persist,merge">
+ <key column="PRNT_ID" not-null="true"/>
+ <list-index column="SIBLING_ORD"/>
+ <one-to-many class="Child"/>
+ </list>
+ </class>
+
+ &child;
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Parent.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Parent.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/Parent.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,33 @@
+package mapping.util.dtd;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * The Parent class.
+ *
+ * @author Steve Ebersole
+ */
+public class Parent {
+ private Long id;
+ private Set children = new HashSet();
+
+ public Long getId() {
+ return id;
+ }
+
+ public Iterator getChildren() {
+ return children.iterator();
+ }
+
+ public Child newChild() {
+ Child child = new Child();
+ child.setAge( 0 );
+
+ child.injectParent( this );
+ this.children.add( child );
+
+ return child;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/child.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/child.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/util/dtd/child.xml 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,9 @@
+
+
+ <class name="Child">
+ <id name="id" column="ID">
+ <generator class="increment"/>
+ </id>
+ <property name="age" column="AGE" not-null="true"/>
+ <many-to-one name="parent" class="Parent" column="PRNT_ID"/>
+ </class>
\ No newline at end of file
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/Group.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/Group.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/Group.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,56 @@
+// $Id: Group.java 7736 2005-08-03 20:03:34Z steveebersole $
+package mapping.version.db;
+
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * Implementation of Group.
+ *
+ * @author Steve Ebersole
+ */
+public class Group {
+ private Long id;
+ private Date timestamp;
+ private String name;
+ private Set users;
+
+ public Group() {
+ }
+
+ public Group(String name) {
+ this.name = name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Set getUsers() {
+ return users;
+ }
+
+ public void setUsers(Set users) {
+ this.users = users;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/Permission.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/Permission.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/Permission.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,66 @@
+// $Id: Permission.java 7736 2005-08-03 20:03:34Z steveebersole $
+package mapping.version.db;
+
+import java.util.Date;
+
+/**
+ * Implementation of Permission.
+ *
+ * @author Steve Ebersole
+ */
+public class Permission {
+ private Long id;
+ private Date timestamp;
+ private String name;
+ private String context;
+ private String access;
+
+ public Permission() {
+ }
+
+ public Permission(String name, String context, String access) {
+ this.name = name;
+ this.context = context;
+ this.access = access;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getContext() {
+ return context;
+ }
+
+ public void setContext(String context) {
+ this.context = context;
+ }
+
+ public String getAccess() {
+ return access;
+ }
+
+ public void setAccess(String access) {
+ this.access = access;
+ }
+}
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/User.hbm.xml
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/User.hbm.xml (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/User.hbm.xml 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,55 @@
+<?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 how to control the optimistic locking behavior
+ of a collection (do changes to the collection result in
+ a version increment on the owning instance)
+ -->
+<hibernate-mapping
+ package="mapping.version.db">
+
+ <class name="User" table="db_vers_user">
+ <id name="id" column="user_id" type="long">
+ <generator class="native"/>
+ </id>
+ <timestamp name="timestamp" column="ts" source="db"/>
+ <!--<version name="timestamp" column="ts" type="org.hibernate.type.DbTimestampType"/>-->
+ <property name="username" column="user_name" type="string" unique="true"/>
+ <set name="groups" table="db_vers_user_group" batch-size="9" inverse="true" optimistic-lock="true" lazy="true" cascade="none" >
+ <key column="user_id"/>
+ <many-to-many column="group_id" class="Group" lazy="false" fetch="join" />
+ </set>
+ <set name="permissions" table="db_vers_user_perm" batch-size="9" inverse="false" optimistic-lock="false" lazy="true" cascade="none">
+ <key column="user_id"/>
+ <many-to-many column="perm_id" class="Permission" lazy="false" fetch="join"/>
+ </set>
+ </class>
+
+ <class name="Group" table="db_vers_group">
+ <id name="id" column="group_id" type="long">
+ <generator class="native"/>
+ </id>
+ <timestamp name="timestamp" column="ts" source="db"/>
+ <!--<version name="timestamp" column="ts" type="org.hibernate.type.DbTimestampType"/>-->
+ <property name="name" column="name" type="string" unique="true"/>
+ <set name="users" table="db_vers_user_group" batch-size="9" inverse="false" lazy="true" cascade="none" >
+ <key column="group_id"/>
+ <many-to-many column="user_id" class="User" lazy="false" fetch="join" />
+ </set>
+ </class>
+
+ <class name="Permission" table="db_vers_permission">
+ <id name="id" column="perm_id" type="long">
+ <generator class="native"/>
+ </id>
+ <timestamp name="timestamp" column="ts" source="db"/>
+ <!--<version name="timestamp" column="ts" type="org.hibernate.type.DbTimestampType"/>-->
+ <property name="name" column="name" type="string" unique="true"/>
+ <property name="context" column="ctx" type="string"/>
+ <property name="access" column="priv" type="string"/>
+ </class>
+
+</hibernate-mapping>
Added: trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/User.java
===================================================================
--- trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/User.java (rev 0)
+++ trunk/hibernatetools/sampleprojects/org.jboss.tools.hibernate.sampleproject.mappingtypes/src/mapping/version/db/User.java 2007-08-01 16:19:55 UTC (rev 2808)
@@ -0,0 +1,65 @@
+// $Id: User.java 7736 2005-08-03 20:03:34Z steveebersole $
+package mapping.version.db;
+
+import java.util.Set;
+import java.sql.Timestamp;
+
+/**
+ * Implementation of User.
+ *
+ * @author Steve Ebersole
+ */
+public class User {
+ private Long id;
+ private Timestamp timestamp;
+ private String username;
+ private Set groups;
+ private Set permissions;
+
+ public User() {
+ }
+
+ public User(String username) {
+ this.username = username;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Timestamp getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Timestamp timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public Set getGroups() {
+ return groups;
+ }
+
+ public void setGroups(Set groups) {
+ this.groups = groups;
+ }
+
+ public Set getPermissions() {
+ return permissions;
+ }
+
+ public void setPermissions(Set permissions) {
+ this.permissions = permissions;
+ }
+}
17 years, 4 months
JBoss Tools SVN: r2807 - tags.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-01 11:41:24 -0400 (Wed, 01 Aug 2007)
New Revision: 2807
Added:
tags/jbossas-1.0.0.beta3/
Log:
Tagging for release
Copied: tags/jbossas-1.0.0.beta3 (from rev 2806, trunk/as)
17 years, 4 months
JBoss Tools SVN: r2806 - tags.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-08-01 11:28:59 -0400 (Wed, 01 Aug 2007)
New Revision: 2806
Added:
tags/core-2.0.0.beta3/
Log:
2.0.0.beta3 tag for core component
Copied: tags/core-2.0.0.beta3 (from rev 2805, trunk/core)
17 years, 4 months
JBoss Tools SVN: r2805 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-08-01 11:17:47 -0400 (Wed, 01 Aug 2007)
New Revision: 2805
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/TLDRegisterHelper.java
trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/WebProject.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-546
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java 2007-08-01 15:13:09 UTC (rev 2804)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java 2007-08-01 15:17:47 UTC (rev 2805)
@@ -44,15 +44,6 @@
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper;
-import org.jboss.tools.jst.jsp.editor.TLDRegisterHelper;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.util.ELParser;
-import org.jboss.tools.common.reporting.ProblemReportingHelper;
import org.jboss.tools.common.kb.AttributeDescriptor;
import org.jboss.tools.common.kb.KbConnectorFactory;
import org.jboss.tools.common.kb.KbConnectorType;
@@ -62,17 +53,23 @@
import org.jboss.tools.common.kb.wtp.JspWtpKbConnector;
import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
+import org.jboss.tools.common.model.util.ELParser;
+import org.jboss.tools.common.reporting.ProblemReportingHelper;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.editor.TLDRegisterHelper;
import org.jboss.tools.jst.jsp.outline.ValueHelper;
import org.jboss.tools.jst.jsp.support.kb.FaceletsJsfCResource;
import org.jboss.tools.jst.jsp.support.kb.WTPKbdBeanMethodResource;
import org.jboss.tools.jst.jsp.support.kb.WTPKbdBeanPropertyResource;
import org.jboss.tools.jst.jsp.support.kb.WTPKbdBundlePropertyResource;
import org.jboss.tools.jst.web.tld.TaglibData;
-import org.jboss.tools.jst.web.tld.TaglibMapping;
import org.jboss.tools.jst.web.tld.VpeTaglibListener;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
/**
* @author Igels
@@ -82,6 +79,7 @@
private JSPActiveContentAssistProcessor jspActiveCAP;
private WtpKbConnector wtpKbConnector;
private IDocument document;
+ private IEditorInput editorInput;
private VpeTaglibManager tldManager;
private boolean isFacelets = false;
public static final String faceletUri = "http://java.sun.com/jsf/facelets";
@@ -93,6 +91,7 @@
public ICompletionProposal[] computeCompletionProposals(ITextViewer textViewer, int documentPosition) {
document = textViewer.getDocument();
+ editorInput = JspEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput();
registerToTldManager(textViewer);
ICompletionProposal[] proposals = super.computeCompletionProposals(textViewer, documentPosition);
@@ -477,8 +476,8 @@
public void removeTaglib(String uri, String prefix) {
}
- public static void registerTld(TaglibData data, JspWtpKbConnector wtpKbConnector, IDocument document) {
- TLDRegisterHelper.registerTld(data, wtpKbConnector, document);
+ public static void registerTld(TaglibData data, JspWtpKbConnector wtpKbConnector, IDocument document, IEditorInput input) {
+ TLDRegisterHelper.registerTld(data, wtpKbConnector, document, input);
}
public void updateActiveContentAssistProcessor(IDocument document) {
@@ -502,7 +501,7 @@
isFacelets = false;
for(int i=0; i<list.size(); i++) {
TaglibData data = (TaglibData)list.get(i);
- registerTld(data, (JspWtpKbConnector)getWtpKbConnector(), document);
+ registerTld(data, (JspWtpKbConnector)getWtpKbConnector(), document, editorInput);
isFacelets = isFacelets || data.getUri().equals(faceletUri);
}
if(isFacelets) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java 2007-08-01 15:13:09 UTC (rev 2804)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java 2007-08-01 15:17:47 UTC (rev 2805)
@@ -52,10 +52,6 @@
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
import org.eclipse.wst.xml.ui.internal.preferences.XMLUIPreferenceNames;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.kb.KbConnectorFactory;
import org.jboss.tools.common.kb.KbConnectorType;
import org.jboss.tools.common.kb.KbException;
@@ -64,12 +60,15 @@
import org.jboss.tools.common.kb.TagDescriptor;
import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.jst.web.tld.VpeTaglibListener;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* @author Igels
@@ -80,7 +79,6 @@
private WtpKbConnector wtpKbConnector;
private IDocument document;
private boolean dontOpenTag = false;
-// private Map trackers = new HashMap();
private List registeredTagsForActiveCAP = new ArrayList();
private VpeTaglibManager tldManager;
@@ -190,7 +188,7 @@
public void addTaglib(String uri, String prefix) {
}
-
+
public void removeTaglib(String uri, String prefix) {
}
@@ -213,7 +211,7 @@
List list = tldManager.getTagLibs();
for(int i=0; i<list.size(); i++) {
TaglibData data = (TaglibData)list.get(i);
- String version = TLDVersionHelper.getTldVersion(data.getUri(), data.getPrefix(), document);
+ String version = WebProject.getTldVersion(data.getUri(), data.getPrefix(), document, null);
KbTldResource resource = new KbTldResource(data.getUri(), "", data.getPrefix(), version);
getWtpKbConnector().registerResource(resource);
addActiveContentAssistProcessorToProcessorMap(data.getUri(), data.getPrefix(), version);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/TLDRegisterHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/TLDRegisterHelper.java 2007-08-01 15:13:09 UTC (rev 2804)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/TLDRegisterHelper.java 2007-08-01 15:17:47 UTC (rev 2805)
@@ -10,21 +10,36 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.editor;
+import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorInput;
-
+import org.eclipse.ui.IFileEditorInput;
import org.jboss.tools.common.kb.KbTldResource;
import org.jboss.tools.common.kb.wtp.JspWtpKbConnector;
-import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.ui.editors.dnd.DropUtils;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.tld.TaglibData;
public class TLDRegisterHelper {
- public static void registerTld(TaglibData data, JspWtpKbConnector wtpKbConnector, IDocument document) {
- String version = TLDVersionHelper.getTldVersion(data.getUri(), data.getPrefix(), document);
+ public static void registerTld(TaglibData data, JspWtpKbConnector wtpKbConnector, IDocument document, IEditorInput input) {
+ XModel xm = null;
+ if(input!=null && input instanceof IFileEditorInput) {
+ IProject project = ((IFileEditorInput)input).getFile().getProject();
+ IModelNature mn = EclipseResourceUtil.getModelNature(project);
+ if(mn!=null) {
+ xm = mn.getModel();
+ }
+ }
+ registerTld(data, wtpKbConnector, document, xm);
+ }
+
+ public static void registerTld(TaglibData data, JspWtpKbConnector wtpKbConnector, IDocument document, XModel xm) {
+ String version = WebProject.getTldVersion(data.getUri(), data.getPrefix(), document, xm);
KbTldResource resource = new KbTldResource(data.getUri(), "", data.getPrefix(), version);
if(data.isNs()) {
resource.setJsfResource(true);
@@ -47,5 +62,4 @@
wtpKbConnector.registerResource(resource);
}
}
-
-}
+}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF 2007-08-01 15:13:09 UTC (rev 2804)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF 2007-08-01 15:17:47 UTC (rev 2805)
@@ -63,6 +63,7 @@
org.eclipse.pde.ui,
org.eclipse.core.runtime,
org.eclipse.ant.ui,
- org.eclipse.ui.externaltools
+ org.eclipse.ui.externaltools,
+ org.jboss.tools.common.kb
Bundle-Version: 2.0.0
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/WebProject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/WebProject.java 2007-08-01 15:13:09 UTC (rev 2804)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/WebProject.java 2007-08-01 15:17:47 UTC (rev 2805)
@@ -11,12 +11,15 @@
package org.jboss.tools.jst.web.project;
import org.eclipse.core.resources.IResource;
-
-import org.jboss.tools.common.model.*;
+import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
import org.jboss.tools.common.model.filesystems.impl.FileSystemImpl;
-import org.jboss.tools.jst.web.tld.*;
+import org.jboss.tools.jst.web.tld.IWebProject;
+import org.jboss.tools.jst.web.tld.TaglibMapping;
public class WebProject implements IWebProject {
@@ -116,4 +119,14 @@
return path.substring(webRoot.length() - 1);
}
-}
+ public static String getTldVersion(String uri, String prefix, IDocument document, XModel xm) {
+ String version = TLDVersionHelper.getTldVersion(uri, prefix, document);
+ if(version == null && xm!=null) {
+ XModelObject xmo = WebProject.getInstance(xm).getTaglibMapping().getTaglibObject(uri);
+ if(xmo!=null) {
+ version = xmo.getAttributeValue("tlibversion");
+ }
+ }
+ return version;
+ }
+}
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2007-08-01 15:13:09 UTC (rev 2804)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2007-08-01 15:17:47 UTC (rev 2805)
@@ -19,6 +19,7 @@
import java.util.Set;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
@@ -28,19 +29,21 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.jboss.tools.jst.jsp.editor.IVisualContext;
-import org.jboss.tools.jst.jsp.editor.TLDRegisterHelper;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.kb.KbConnectorFactory;
import org.jboss.tools.common.kb.KbConnectorType;
import org.jboss.tools.common.kb.KbTldResource;
import org.jboss.tools.common.kb.wtp.JspWtpKbConnector;
import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
-import org.jboss.tools.common.model.ui.editors.dnd.DropUtils;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jst.jsp.editor.IVisualContext;
+import org.jboss.tools.jst.jsp.editor.TLDRegisterHelper;
+import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.web.tld.TaglibData;
+import org.jboss.tools.jst.web.tld.VpeTaglibListener;
+import org.jboss.tools.jst.web.tld.VpeTaglibManager;
import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeEditorPart;
@@ -55,9 +58,8 @@
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.util.FileUtil;
-import org.jboss.tools.jst.web.tld.TaglibData;
-import org.jboss.tools.jst.web.tld.VpeTaglibListener;
-import org.jboss.tools.jst.web.tld.VpeTaglibManager;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* Contains the information on edited page.
@@ -409,7 +411,8 @@
Iterator it = list.iterator();
while(it.hasNext()) {
TaglibData data = (TaglibData)it.next();
- TLDRegisterHelper.registerTld(data, (JspWtpKbConnector)wtpKbConnector, document);
+ IEditorInput ei = editPart.getEditorInput();
+ TLDRegisterHelper.registerTld(data, (JspWtpKbConnector)wtpKbConnector, document, ei);
}
return true;
}
17 years, 4 months
JBoss Tools SVN: r2804 - trunk/as/plugins/org.jboss.ide.eclipse.as.core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-01 11:13:09 -0400 (Wed, 01 Aug 2007)
New Revision: 2804
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/build.properties
Log:
properties folder must be included
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/build.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/build.properties 2007-08-01 15:11:11 UTC (rev 2803)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/build.properties 2007-08-01 15:13:09 UTC (rev 2804)
@@ -7,5 +7,6 @@
dom4j-1.6.1.jar,\
plugin.properties,\
schema/,\
- getopt.jar
+ getopt.jar,\
+ properties/
source.jbossascore.jar = jbosscore/
17 years, 4 months
JBoss Tools SVN: r2803 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-08-01 11:11:11 -0400 (Wed, 01 Aug 2007)
New Revision: 2803
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
Log:
Moved try/catch to ensure lack of catastrophic failure
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-01 12:05:55 UTC (rev 2802)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-01 15:11:11 UTC (rev 2803)
@@ -197,13 +197,13 @@
}
protected int findPort(IPath path) {
- XPathQuery query = XPathModel.getDefault().getQuery(this, path);
- String result = query.getFirstResult();
- if( result != null ) {
- try {
- return Integer.parseInt(result);
- } catch( Exception e ) {}
- }
+ try {
+ XPathQuery query = XPathModel.getDefault().getQuery(this, path);
+ String result = query.getFirstResult();
+ if( result != null ) {
+ return Integer.parseInt(result);
+ }
+ } catch( Exception e ) {}
return -1;
}
17 years, 4 months
JBoss Tools SVN: r2802 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-08-01 08:05:55 -0400 (Wed, 01 Aug 2007)
New Revision: 2802
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/RoundPolylineConnection.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/RoundPolylineConnection.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/RoundPolylineConnection.java 2007-08-01 11:53:06 UTC (rev 2801)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/RoundPolylineConnection.java 2007-08-01 12:05:55 UTC (rev 2802)
@@ -36,10 +36,15 @@
if(points.size() == 4){
Point point1 = points.getPoint(0);
Point point2 = points.getPoint(1);
- point2.x -= delta/2;
Point point3 = points.getPoint(2);
- point3.x += delta/2;
Point point4 = points.getPoint(3);
+ if(point1.x < point4.x){
+ point2.x -= delta/2;
+ point3.x += delta/2;
+ }else{
+ point2.x += delta/2;
+ point3.x -= delta/2;
+ }
g.drawLine(point1, point2);
g.drawLine(point2, point3);
g.drawLine(point3, point4);
17 years, 4 months
JBoss Tools SVN: r2801 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-08-01 07:53:06 -0400 (Wed, 01 Aug 2007)
New Revision: 2801
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/RoundPolylineConnection.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/RoundPolylineConnection.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/RoundPolylineConnection.java 2007-07-31 23:58:34 UTC (rev 2800)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/RoundPolylineConnection.java 2007-08-01 11:53:06 UTC (rev 2801)
@@ -31,6 +31,21 @@
super.outlineShape(g);
return;
}
+ if (Math.abs(points.getFirstPoint().y - points.getLastPoint().y) < 4) {
+ int delta = Math.abs(points.getFirstPoint().y - points.getLastPoint().y);
+ if(points.size() == 4){
+ Point point1 = points.getPoint(0);
+ Point point2 = points.getPoint(1);
+ point2.x -= delta/2;
+ Point point3 = points.getPoint(2);
+ point3.x += delta/2;
+ Point point4 = points.getPoint(3);
+ g.drawLine(point1, point2);
+ g.drawLine(point2, point3);
+ g.drawLine(point3, point4);
+ return;
+ }
+ }
for (int i = 1; i < points.size(); i++) {
point = points.getPoint(i);
17 years, 4 months