|
From: <tre...@us...> - 2008-02-06 01:20:43
|
Revision: 712
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=712&view=rev
Author: trevorolio
Date: 2008-02-05 17:20:50 -0800 (Tue, 05 Feb 2008)
Log Message:
-----------
Added the back end and 3D rendering of attachment geometries and appearances, but not yet morphs or skin textures.
Also no example UI for picking attachments in the body editor, yet.
The "time to private parts" for Ogoglio starts now.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/OgoglioServerMigration.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodySettingRecord.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplateRecord.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/xml/server/DocumentFactory.java
maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AttachmentRecord.java
maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-2.xml
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -10,6 +10,8 @@
import com.ogoglio.appdev.migrate.Migration;
import com.ogoglio.appdev.persist.PersistException;
+import com.ogoglio.persist.BodyDataRecord;
+import com.ogoglio.persist.BodyPersistTasks;
import com.ogoglio.persist.ServiceInitializationPersistTasks;
import com.ogoglio.util.Log;
import com.ogoglio.util.PropStorage;
@@ -21,7 +23,6 @@
}
public boolean populate(SessionFactory sessionFactory, int from, int to) throws PersistException {
-
if ((from != 0) || (to != 1)) {
Log.error("Migration called in the wrong place! Expected 0->1 but was:" + from + " -> " + to + "!");
Log.error("Migration called in the wrong place! Check the ordering of migration array!");
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/OgoglioServerMigration.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/OgoglioServerMigration.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/OgoglioServerMigration.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -1,31 +1,51 @@
package com.ogoglio.migrate;
+import javax.naming.Context;
+import javax.servlet.ServletConfig;
+
+import org.hibernate.SessionFactory;
+
import com.ogoglio.appdev.migrate.Migration;
import com.ogoglio.appdev.migrate.MigrationSupport;
+import com.ogoglio.appdev.persist.PersistException;
+import com.ogoglio.persist.ServiceStateTasks;
+import com.ogoglio.util.Log;
+import com.ogoglio.xml.ServiceStateDocument;
public class OgoglioServerMigration extends MigrationSupport {
- public static final OgoglioServerMigration SINGLETON = new OgoglioServerMigration();
-
+ public static final OgoglioServerMigration SINGLETON = new OgoglioServerMigration();
+
// THIS IS THE CRITICAL VERSION NUMBER
- private static final int DB_VERSION_NUMBER = 1;
+ private static final int DB_VERSION_NUMBER = 2;
// this is the set of semantic migrations, in order
- private static final Migration[] migration = { new AccountsForTesting() };
+ private static final Migration[] migration = { new AccountsForTesting(), new NoopMigration() };
- public Migration[] getMigrationList() {
- return migration;
- }
+ public Migration[] getMigrationList() {
+ return migration;
+ }
- public int getVersionNumber() {
- return DB_VERSION_NUMBER;
- }
+ public int getVersionNumber() {
+ return DB_VERSION_NUMBER;
+ }
- public String getResourcePath() { return "com/ogoglio/migrate"; }
-
- private OgoglioServerMigration() {
-
- }
-
-
+ public String getResourcePath() {
+ return "com/ogoglio/migrate";
+ }
+
+ private OgoglioServerMigration() {
+
+ }
+
+ public static class NoopMigration implements Migration {
+ public boolean patch(SessionFactory sessionFactory, ServletConfig servletConfig, Context ctx, int from, int to) throws PersistException {
+ return true;
+ }
+
+ public boolean populate(SessionFactory sessionFactory, int from, int to) throws PersistException {
+ return true;
+ }
+ }
+
}
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AttachmentRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AttachmentRecord.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AttachmentRecord.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -0,0 +1,71 @@
+/* Copyright 2008 Transmutable (http://transmutable.com/)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. */
+package com.ogoglio.persist;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class AttachmentRecord {
+
+ private long attachmentID = -1;
+
+ private String templateOwner = null;
+
+ private long templateID = -1;
+
+ private long bodyConfigurationID = -1;
+
+ public AttachmentRecord(){
+ }
+
+ public AttachmentRecord(String templateOwner, long templateID, long bodyConfigurationID){
+ ArgumentUtils.assertNotEmpty(templateOwner);
+ this.templateOwner = templateOwner;
+ ArgumentUtils.assertNotNegative(templateID);
+ this.templateID = templateID;
+ ArgumentUtils.assertNotNegative(bodyConfigurationID);
+ this.bodyConfigurationID = bodyConfigurationID;
+ }
+
+ public long getBodyConfigurationID() {
+ return bodyConfigurationID;
+ }
+
+ public void setBodyConfigurationID(long bodyConfigurationID) {
+ this.bodyConfigurationID = bodyConfigurationID;
+ }
+
+ public long getAttachmentID() {
+ return attachmentID;
+ }
+
+ public void setAttachmentID(long attachmentID) {
+ this.attachmentID = attachmentID;
+ }
+
+ public long getTemplateID() {
+ return templateID;
+ }
+
+ public void setTemplateID(long templateID) {
+ this.templateID = templateID;
+ }
+
+ public String getTemplateOwner() {
+ return templateOwner;
+ }
+
+ public void setTemplateOwner(String templateOwner) {
+ this.templateOwner = templateOwner;
+ }
+}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -8,9 +8,8 @@
import com.ogoglio.appdev.persist.HibernateTask;
import com.ogoglio.appdev.persist.PersistException;
-import com.ogoglio.site.AuthServlet;
import com.ogoglio.util.WebConstants;
-import com.ogoglio.xml.AccountDocument;
+import com.ogoglio.xml.AttachmentDocument;
import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.BodySettingDocument;
import com.ogoglio.xml.server.DocumentFactory;
@@ -33,6 +32,10 @@
public static final String BODY_SETTING_BY_CONFIGURATION_ID_AND_SETTING_NAME = "com.ogoglio.persist.bodySettingByConfigurationIDAndSettingName";
+ public static final String ATTACHMENTS_BY_CONFIGURATION_ID = "com.ogoglio.persist.attachmentsByConfigurationID";
+
+ public static final String ATTACHMENT_BY_ID = "com.ogoglio.persist.attachmentByID";
+
public static BodySettingRecord createOrUpdateBodySetting(final long bodyConfigurationID, final String settingName, final float setting, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
public Object run(Session session) throws PersistException {
@@ -97,6 +100,13 @@
for (int i = 0; i < settings.length; i++) {
session.delete(settings[i]);
}
+
+ Query attachmentsQuery = session.getNamedQuery(ATTACHMENTS_BY_CONFIGURATION_ID);
+ attachmentsQuery.setLong("bodyConfigurationID", record.getBodyConfigurationID());
+ AttachmentRecord[] attachments = (AttachmentRecord[])attachmentsQuery.list().toArray(new AttachmentRecord[0]);
+ for (int j = 0; j < attachments.length; j++) {
+ session.delete(attachments[j]);
+ }
session.delete(record);
return Boolean.TRUE;
@@ -142,6 +152,18 @@
return (BodySettingRecord[]) task.execute();
}
+ public static AttachmentRecord[] findAttachmentsByConfigurationID(final long bodyConfigurationID, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(ATTACHMENTS_BY_CONFIGURATION_ID);
+ query.setLong("bodyConfigurationID", bodyConfigurationID);
+ return query.list().toArray(new AttachmentRecord[0]);
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (AttachmentRecord[]) task.execute();
+ }
+
public static BodyDataRecord findBodyDataRecord(final String fileName, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
public Object run(Session session) throws PersistException {
@@ -211,8 +233,6 @@
HibernateTask task = new HibernateTask() {
public Object run(Session session) throws PersistException {
if(username.startsWith(WebConstants.GUEST_COOKIE_PREFIX)){ //fake up a configuration for our guests
- Query bodyDataQuery = session.getNamedQuery(BODY_DATA);
- BodyDataRecord[] bodyDataRecs = (BodyDataRecord[])bodyDataQuery.list().toArray(new BodyDataRecord[0]);
BodyConfigurationDocument doc = new BodyConfigurationDocument(0, username, "Guest Body", -1, null);
return doc;
}
@@ -227,12 +247,19 @@
Query bodyConfigQuery = session.getNamedQuery(BODY_CONFIGURATION_BY_ID);
bodyConfigQuery.setLong("bodyConfigurationID", accountRecord.getDefaultBodyConfigurationID());
BodyConfigurationRecord rec = (BodyConfigurationRecord)bodyConfigQuery.uniqueResult();
+ if(rec == null){
+ throw new IllegalStateException("User has an invalid body configuration: " + accountRecord.getUsername());
+ }
Query bodySettingQuery = session.getNamedQuery(BODY_SETTINGS_BY_CONFIGURATION_ID);
bodySettingQuery.setLong("bodyConfigurationID", rec.getBodyConfigurationID());
BodySettingRecord[] settingRecords = (BodySettingRecord[])bodySettingQuery.list().toArray(new BodySettingRecord[0]);
- return DocumentFactory.documentFromRecord(rec, settingRecords);
+ Query attachmentsQuery = session.getNamedQuery(ATTACHMENTS_BY_CONFIGURATION_ID);
+ attachmentsQuery.setLong("bodyConfigurationID", rec.getBodyConfigurationID());
+ AttachmentRecord[] attachmentRecords = (AttachmentRecord[])bodySettingQuery.list().toArray(new AttachmentRecord[0]);
+
+ return DocumentFactory.documentFromRecord(rec, settingRecords, attachmentRecords);
}
};
task.setSessionFactory(sessionFactory);
@@ -299,6 +326,20 @@
session.update(changedRec);
}
+ Query attachmentsQuery = session.getNamedQuery(ATTACHMENTS_BY_CONFIGURATION_ID);
+ attachmentsQuery.setLong("bodyConfigurationID", configRec.getBodyConfigurationID());
+ AttachmentRecord[] attachmentRecs = (AttachmentRecord[])attachmentsQuery.list().toArray(new AttachmentRecord[0]);
+ Vector deletedAttachmentRecs = getDeletedAttachmentRecords(proposedDoc.getAttachmentDocuments(), attachmentRecs);
+ for (int i = 0; i < deletedAttachmentRecs.size(); i++) {
+ AttachmentRecord deletedRec = (AttachmentRecord)deletedAttachmentRecs.get(i);
+ session.delete(deletedRec);
+ }
+ Vector addedAttachmentDocs = getAddedAttachmentDocuments(proposedDoc.getAttachmentDocuments(), attachmentRecs);
+ for (int i = 0; i < addedAttachmentDocs.size(); i++) {
+ AttachmentDocument doc = (AttachmentDocument)addedAttachmentDocs.get(i);
+ AttachmentRecord rec = new AttachmentRecord(doc.getTemplateOwner(), doc.getTemplateID(), configRec.getBodyConfigurationID());
+ session.save(rec);
+ }
return proposedDoc;
}
};
@@ -325,6 +366,40 @@
return result;
}
+ private static Vector getAddedAttachmentDocuments(AttachmentDocument[] attachmentDocs, AttachmentRecord[] attachmentRecs) {
+ Vector result = new Vector();
+ for (int i = 0; i < attachmentDocs.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < attachmentRecs.length; j++) {
+ if(attachmentDocs[i].getAttachmentID() == attachmentRecs[j].getAttachmentID()){
+ found = true;
+ break;
+ }
+ }
+ if(!found){
+ result.add(attachmentDocs[i]);
+ }
+ }
+ return result;
+ }
+
+ private static Vector getDeletedAttachmentRecords(AttachmentDocument[] attachmentDocs, AttachmentRecord[] attachmentRecs) {
+ Vector result = new Vector();
+ for (int i = 0; i < attachmentRecs.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < attachmentDocs.length; j++) {
+ if(attachmentRecs[i].getAttachmentID() == attachmentDocs[j].getAttachmentID()){
+ found = true;
+ break;
+ }
+ }
+ if(!found){
+ result.add(attachmentRecs[i]);
+ }
+ }
+ return result;
+ }
+
private static Vector getAddedBodySettingDocuments(BodySettingDocument[] settingDocs, BodySettingRecord[] settingRecs) {
Vector result = new Vector();
for (int i = 0; i < settingDocs.length; i++) {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodySettingRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodySettingRecord.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodySettingRecord.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -1,3 +1,16 @@
+/* Copyright 2008 Transmutable (http://transmutable.com/)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. */
package com.ogoglio.persist;
import com.ogoglio.util.ArgumentUtils;
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplatePersistTasks.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -28,11 +28,12 @@
import com.ogoglio.util.Log;
import com.ogoglio.xml.TemplateDocument;
-
public class TemplatePersistTasks {
public static final String TEMPLATE_BY_ID = "com.ogoglio.persist.templateByID";
+
public static final String TEMPLATE_BY_IDS = "com.ogoglio.persist.templateByIDs";
+
protected static final String TEMPLATE_BY_OWNER = "com.ogoglio.persist.templateByOwner";
public static TemplateRecord createTemplate(final String displayName, final String ownerUsername, SessionFactory sessionFactory) throws PersistException {
@@ -41,7 +42,7 @@
public Object run(Session session) throws PersistException {
Query accountQuery = session.getNamedQuery(AccountPersistTasks.ACCOUNT_BY_USERNAME);
accountQuery.setString("username", ownerUsername);
- if(accountQuery.uniqueResult() == null) {
+ if (accountQuery.uniqueResult() == null) {
Log.error("Tried to create a template for a nonexistent user: " + ownerUsername);
return null;
}
@@ -50,15 +51,15 @@
}
};
task.setSessionFactory(sessionFactory);
- return (TemplateRecord)task.execute();
+ return (TemplateRecord) task.execute();
}
-
+
public static TemplateRecord findTemplateByTemplateID(final long templateID, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
public Object run(Session session) throws PersistException {
Query query = session.getNamedQuery(TEMPLATE_BY_ID);
query.setLong("templateID", templateID);
- TemplateRecord rec = (TemplateRecord)query.uniqueResult();
+ TemplateRecord rec = (TemplateRecord) query.uniqueResult();
initializeCollection(rec);
return rec;
}
@@ -68,10 +69,10 @@
}
private static void initializeCollection(TemplateRecord rec) {
- if (rec!=null) {
- Hibernate.initialize(rec.getSupportFiles());
+ if (rec != null) {
+ Hibernate.initialize(rec.getSupportFiles());
}
- }
+ }
public static TemplateRecord[] findTemplatesByTemplateIDs(final long[] ids, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
@@ -89,13 +90,14 @@
task.setSessionFactory(sessionFactory);
return (TemplateRecord[]) task.execute();
}
- private static TemplateRecord[] prepareTemplatesCollections(Query query) {
- TemplateRecord[] allRecs=(TemplateRecord[])query.list().toArray(new TemplateRecord[0]);
- for(int i=0; i<allRecs.length;++i) {
- initializeCollection(allRecs[i]);
+
+ private static TemplateRecord[] prepareTemplatesCollections(Query query) {
+ TemplateRecord[] allRecs = (TemplateRecord[]) query.list().toArray(new TemplateRecord[0]);
+ for (int i = 0; i < allRecs.length; ++i) {
+ initializeCollection(allRecs[i]);
}
return allRecs;
- }
+ }
public static TemplateRecord[] findTemplatesByOwnerUsername(final String username, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
@@ -111,24 +113,24 @@
public static TemplateRecord update(TemplateDocument newDoc, TemplateRecord record, SessionFactory sessionFactory) throws PersistException {
boolean dirty = false;
- if(newDoc.getDisplayName() != null && newDoc.getDisplayName().trim().length() != 0 && !newDoc.getDisplayName().trim().equals(record.getDisplayName())) {
+ if (newDoc.getDisplayName() != null && newDoc.getDisplayName().trim().length() != 0 && !newDoc.getDisplayName().trim().equals(record.getDisplayName())) {
dirty = true;
record.setDisplayName(newDoc.getDisplayName().trim());
}
- if(newDoc.isSeat() != record.isSeat()){
+ if (newDoc.isSeat() != record.isSeat()) {
dirty = true;
record.setSeat(newDoc.isSeat());
}
Point3d seatPosition = newDoc.getSeatPosition();
- if(seatPosition.x != record.getSeatX() || seatPosition.y != record.getSeatY() || seatPosition.z != record.getSeatZ()){
+ if (seatPosition.x != record.getSeatX() || seatPosition.y != record.getSeatY() || seatPosition.z != record.getSeatZ()) {
dirty = true;
record.setSeatX(seatPosition.x);
record.setSeatY(seatPosition.y);
record.setSeatZ(seatPosition.z);
}
Quat4d seatRotation = newDoc.getSeatRotation();
- if(seatRotation.w != record.getSeatRW() || seatRotation.x != record.getSeatRX() || seatRotation.y != record.getSeatRY() || seatRotation.z != record.getSeatRZ()){
+ if (seatRotation.w != record.getSeatRW() || seatRotation.x != record.getSeatRX() || seatRotation.y != record.getSeatRY() || seatRotation.z != record.getSeatRZ()) {
dirty = true;
record.setSeatRW(seatRotation.w);
record.setSeatRX(seatRotation.x);
@@ -136,7 +138,12 @@
record.setSeatRZ(seatRotation.z);
}
- if(dirty) {
+ if (record.isAttachment() != newDoc.isAttachment()) {
+ record.setAttachment(newDoc.isAttachment());
+ dirty = true;
+ }
+
+ if (dirty) {
return update(record, sessionFactory);
}
return record;
@@ -153,111 +160,111 @@
return (TemplateRecord) task.execute();
}
- public static boolean deleteTemplate(final TemplateRecord record, SessionFactory sessionFactory) throws PersistException{
- HibernateTask task = new HibernateTask() {
- public Object run(Session session) throws PersistException {
- Query accountQuery = session.getNamedQuery(AccountPersistTasks.ACCOUNT_BY_USERNAME);
- accountQuery.setString("username", record.getOwnerUsername());
- AccountRecord accountRecord = (AccountRecord) accountQuery.uniqueResult();
- if (accountRecord == null) {
- return null;
- }
-
- Query possQuery = session.getNamedQuery(PossessionPersistTasks.POSSESSIONS_BY_TEMPLATE_ID);
- possQuery.setLong("templateID", record.getTemplateID());
- PossessionRecord[] currentPossessions = (PossessionRecord[])possQuery.list().toArray(new PossessionRecord[0]);
- if(currentPossessions.length > 0){
- return Boolean.FALSE;
- }
+ public static boolean deleteTemplate(final TemplateRecord record, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query accountQuery = session.getNamedQuery(AccountPersistTasks.ACCOUNT_BY_USERNAME);
+ accountQuery.setString("username", record.getOwnerUsername());
+ AccountRecord accountRecord = (AccountRecord) accountQuery.uniqueResult();
+ if (accountRecord == null) {
+ return null;
+ }
- session.delete(record);
- return Boolean.TRUE;
- }
- };
- task.setSessionFactory(sessionFactory);
- return task.execute() == Boolean.TRUE;
- }
+ Query possQuery = session.getNamedQuery(PossessionPersistTasks.POSSESSIONS_BY_TEMPLATE_ID);
+ possQuery.setLong("templateID", record.getTemplateID());
+ PossessionRecord[] currentPossessions = (PossessionRecord[]) possQuery.list().toArray(new PossessionRecord[0]);
+ if (currentPossessions.length > 0) {
+ return Boolean.FALSE;
+ }
+
+ session.delete(record);
+ return Boolean.TRUE;
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return task.execute() == Boolean.TRUE;
+ }
+
// XXX this should be unified with its brothers that updates the same for scripts and geom
- public static void updateSupportFileTemplateLastModified(TemplateRecord record, String name, boolean newValue, SessionFactory sessionFactory) throws PersistException {
- TemplateSupportFileRecord scriptRec = record.findSupportFile(name);
- boolean currentValue;
+ public static void updateSupportFileTemplateLastModified(TemplateRecord record, String name, boolean newValue, SessionFactory sessionFactory) throws PersistException {
+ TemplateSupportFileRecord scriptRec = record.findSupportFile(name);
+ boolean currentValue;
- if (scriptRec==null) {
- currentValue = false;
- } else {
- currentValue=true;
- }
+ if (scriptRec == null) {
+ currentValue = false;
+ } else {
+ currentValue = true;
+ }
- if (currentValue==newValue) {
- if (newValue==false) {
- return; //nothing to do
- }
- //only thing to do is refresh timestamp
- scriptRec.setLastChanged(new Date());
- } else {
- if (newValue==true) {
- scriptRec= TemplateSupportFilePersistTasks.createSupportFileForMaterial(name, sessionFactory);
- record.addTemplateSupportFileRecord(scriptRec);
- } else {
- record.getSupportFiles().remove(scriptRec);
- }
- }
- TemplatePersistTasks.update(record, sessionFactory);
- }
- // XXX this should be unified with its brother that updates the same for scripts or support files
- public static void updateGeometryFileTemplateLastModified(TemplateRecord record, int LOD, boolean newValue, SessionFactory sessionFactory) throws PersistException {
- TemplateSupportFileRecord scriptRec = record.findGeometryFileRec(LOD);
- boolean currentValue;
+ if (currentValue == newValue) {
+ if (newValue == false) {
+ return; //nothing to do
+ }
+ //only thing to do is refresh timestamp
+ scriptRec.setLastChanged(new Date());
+ } else {
+ if (newValue == true) {
+ scriptRec = TemplateSupportFilePersistTasks.createSupportFileForMaterial(name, sessionFactory);
+ record.addTemplateSupportFileRecord(scriptRec);
+ } else {
+ record.getSupportFiles().remove(scriptRec);
+ }
+ }
+ TemplatePersistTasks.update(record, sessionFactory);
+ }
- if (scriptRec==null) {
- currentValue = false;
- } else {
- currentValue=true;
- }
+ // XXX this should be unified with its brother that updates the same for scripts or support files
+ public static void updateGeometryFileTemplateLastModified(TemplateRecord record, int LOD, boolean newValue, SessionFactory sessionFactory) throws PersistException {
+ TemplateSupportFileRecord scriptRec = record.findGeometryFileRec(LOD);
+ boolean currentValue;
- if (currentValue==newValue) {
- if (newValue==false) {
- return; //nothing to do
- }
- //only thing to do is refresh timestamp
- scriptRec.setLastChanged(new Date());
- } else {
- if (newValue==true) {
- scriptRec= TemplateSupportFilePersistTasks.createSupportFileForGeometry(LOD, sessionFactory);
- record.addTemplateSupportFileRecord(scriptRec);
- } else {
- record.getSupportFiles().remove(scriptRec);
- }
- }
- TemplatePersistTasks.update(record, sessionFactory);
- }
- public static void updateScriptFilePropOfTemplate(TemplateRecord record, boolean newValue, SessionFactory sessionFactory) throws PersistException {
- TemplateSupportFileRecord scriptRec = record.findScriptFileRec();
- boolean currentValue;
+ if (scriptRec == null) {
+ currentValue = false;
+ } else {
+ currentValue = true;
+ }
- if (scriptRec==null) {
- currentValue = false;
- } else {
- currentValue=true;
- }
-
- if (currentValue==newValue) {
- if (newValue==false) {
- return; //nothing to do
- }
- //only thing to do is refresh timestamp
- scriptRec.setLastChanged(new Date());
- } else {
- if (newValue==true) {
- scriptRec= TemplateSupportFilePersistTasks.createSupportFileForScript(sessionFactory);
- record.addTemplateSupportFileRecord(scriptRec);
- } else {
- record.getSupportFiles().remove(scriptRec);
- }
- }
+ if (currentValue == newValue) {
+ if (newValue == false) {
+ return; //nothing to do
+ }
+ //only thing to do is refresh timestamp
+ scriptRec.setLastChanged(new Date());
+ } else {
+ if (newValue == true) {
+ scriptRec = TemplateSupportFilePersistTasks.createSupportFileForGeometry(LOD, sessionFactory);
+ record.addTemplateSupportFileRecord(scriptRec);
+ } else {
+ record.getSupportFiles().remove(scriptRec);
+ }
+ }
TemplatePersistTasks.update(record, sessionFactory);
- }
-}
+ }
+ public static void updateScriptFilePropOfTemplate(TemplateRecord record, boolean newValue, SessionFactory sessionFactory) throws PersistException {
+ TemplateSupportFileRecord scriptRec = record.findScriptFileRec();
+ boolean currentValue;
+ if (scriptRec == null) {
+ currentValue = false;
+ } else {
+ currentValue = true;
+ }
+ if (currentValue == newValue) {
+ if (newValue == false) {
+ return; //nothing to do
+ }
+ //only thing to do is refresh timestamp
+ scriptRec.setLastChanged(new Date());
+ } else {
+ if (newValue == true) {
+ scriptRec = TemplateSupportFilePersistTasks.createSupportFileForScript(sessionFactory);
+ record.addTemplateSupportFileRecord(scriptRec);
+ } else {
+ record.getSupportFiles().remove(scriptRec);
+ }
+ }
+ TemplatePersistTasks.update(record, sessionFactory);
+ }
+}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplateRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplateRecord.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/TemplateRecord.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -40,6 +40,8 @@
private Set supportFiles = new HashSet();
+ private boolean attachment = false;
+
public TemplateRecord() {
}
@@ -262,4 +264,12 @@
public void setSeat(boolean seat) {
this.seat = seat;
}
+
+ public boolean isAttachment() {
+ return attachment;
+ }
+
+ public void setAttachment(boolean attachment) {
+ this.attachment = attachment;
+ }
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -29,6 +29,7 @@
import javax.vecmath.Vector3d;
import com.ogoglio.client.UserInputListener;
+import com.ogoglio.client.model.Attachment;
import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.client.model.BodyDataProvider;
import com.ogoglio.client.model.Door;
@@ -47,7 +48,9 @@
import com.ogoglio.util.Log;
import com.ogoglio.util.BlockingQueue.QueueClosedException;
import com.ogoglio.viewer.j3d.J3DRenderer;
+import com.ogoglio.xml.AttachmentDocument;
import com.ogoglio.xml.BodyConfigurationDocument;
+import com.ogoglio.xml.BodySettingDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.SettingDocument;
@@ -75,7 +78,7 @@
//TODO stop shoving the log into memory
private Vector log = new Vector();
- private Space space = null;
+ private Space space = null;
private J3DRenderer renderer = null;
@@ -885,7 +888,7 @@
String role = listener.getUserRole(space.getSpaceID(), username);
String voiceURI = listener.getUserVoiceU1RI(username);
String textURI = listener.getUserTextURI(username);
- User user = new User(space, username, position, new BodyConfiguration(bodyConfigDoc), null, role, voiceURI, textURI);
+ User user = new User(space, username, position, createBodyConfiguration(bodyConfigDoc), null, role, voiceURI, textURI);
space.addUser(user);
SpaceEvent spaceEvent = new SpaceEvent(SpaceEvent.ADD_USER_EVENT);
@@ -953,6 +956,30 @@
return space.getSpaceID();
}
+ private BodyConfiguration createBodyConfiguration(BodyConfigurationDocument configDoc) {
+ BodyConfiguration config = new BodyConfiguration(configDoc.getBodyConfigurationID(), configDoc.getDisplayName(), configDoc.getBodyDataID(), configDoc.getBaseTextureName());
+ BodySettingDocument[] settingDocs = configDoc.getBodySettingDocuments();
+ for (int i = 0; i < settingDocs.length; i++) {
+ config.addSetting(settingDocs[i].getSettingName(), settingDocs[i].getSetting());
+ }
+ AttachmentDocument[] attachmentDocs = configDoc.getAttachmentDocuments();
+ for (int i = 0; i < attachmentDocs.length; i++) {
+ Template template = space.getTemplate(attachmentDocs[i].getTemplateID());
+ if(template == null){
+ TemplateDocument templateDoc = listener.getTemplateDocument(attachmentDocs[i].getTemplateID());
+ if(templateDoc == null){
+ Log.warn("Could not load an attachment template: " + attachmentDocs[i].getTemplateID());
+ continue;
+ }
+ template = new Template(templateDoc);
+ space.addTemplate(template);
+ }
+ Attachment attachment = new Attachment(attachmentDocs[i].getAttachmentID(), template, config);
+ config.addAttachment(attachment);
+ }
+ return config;
+ }
+
public SpaceDocument toSpaceDocument() {
SpaceDocument spaceDoc = new SpaceDocument(space.getSpaceID(), space.getDisplayName(), space.getOwnerUsername(), false, 0, space.shouldDisplaySea(), space.getSeaLevel(), -1, null, new float[] {space.getBackgroundColor().x, space.getBackgroundColor().y, space.getBackgroundColor().z });
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -40,6 +40,7 @@
import com.ogoglio.media.MediaService;
import com.ogoglio.persist.AccountPersistTasks;
import com.ogoglio.persist.AccountRecord;
+import com.ogoglio.persist.AttachmentRecord;
import com.ogoglio.persist.BodyConfigurationRecord;
import com.ogoglio.persist.BodyPersistTasks;
import com.ogoglio.persist.BodySettingRecord;
@@ -286,8 +287,7 @@
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
- BodySettingRecord[] settingRecords = BodyPersistTasks.findBodySettingsByConfigurationID(bodyConfigID, getSessionFactory());
- sendStringResponse(DocumentFactory.documentFromRecord(record, settingRecords).toString(), "text/xml", response);
+ sendStringResponse(createBodyConfigurationDocument(record).toString(), "text/xml", response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, IOException {
@@ -402,7 +402,8 @@
private BodyConfigurationDocument createBodyConfigurationDocument(BodyConfigurationRecord record) throws PersistException {
BodySettingRecord[] settingRecords = BodyPersistTasks.findBodySettingsByConfigurationID(record.getBodyConfigurationID(), getSessionFactory());
- return DocumentFactory.documentFromRecord(record, settingRecords);
+ AttachmentRecord[] attachmentRecords = BodyPersistTasks.findAttachmentsByConfigurationID(record.getBodyConfigurationID(), getSessionFactory());
+ return DocumentFactory.documentFromRecord(record, settingRecords, attachmentRecords);
}
private void sendValidationMail(PendingEmailValidationRecord validationRecord) throws MailSendException {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -242,14 +242,14 @@
}
public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- handleRequest(request, response, pathElements, new TemplateSupportFileDelete());
+ handleModifyRequest(request, response, pathElements, new TemplateSupportFileDelete());
}
public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- handleRequest(request, response, pathElements, new TemplateSupportFilePost());
+ handleModifyRequest(request, response, pathElements, new TemplateSupportFilePost());
}
- public void handleRequest(HttpServletRequest request, HttpServletResponse response, String[] pathElements, TemplateSupportFileAction action) throws ServletException, IOException {
+ public void handleModifyRequest(HttpServletRequest request, HttpServletResponse response, String[] pathElements, TemplateSupportFileAction action) throws ServletException, IOException {
String usernameParam = pathElements[1];
try {
AccountRecord authedAccount = getAuthedAccount(request, response);
@@ -389,21 +389,9 @@
public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
String usernameParam = pathElements[1];
try {
- AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
- if (authedAccount == null && !AuthServlet.isGuest(request)) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
long templateID = Long.parseLong(pathElements[3]);
TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
+ if (record == null || !record.getOwnerUsername().equals(usernameParam)) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/xml/server/DocumentFactory.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/xml/server/DocumentFactory.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/xml/server/DocumentFactory.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -4,6 +4,7 @@
import java.util.Iterator;
import java.util.Set;
+import com.ogoglio.persist.AttachmentRecord;
import com.ogoglio.persist.BodyConfigurationRecord;
import com.ogoglio.persist.BodyDataRecord;
import com.ogoglio.persist.BodySettingRecord;
@@ -14,6 +15,7 @@
import com.ogoglio.persist.SpaceRecord;
import com.ogoglio.persist.TemplateRecord;
import com.ogoglio.persist.TemplateSupportFileRecord;
+import com.ogoglio.xml.AttachmentDocument;
import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.BodyDataDocument;
import com.ogoglio.xml.PossessionDocument;
@@ -55,7 +57,7 @@
TemplateSupportFileDocument doc = documentFromRecord(rec);
supportSet.add(doc);
}
- return new TemplateDocument(templateRecord.getTemplateID(), templateRecord.getDisplayName(), templateRecord.getOwnerUsername(), templateRecord.getDescription(), supportSet, templateRecord.isSeat(), templateRecord.getSeatX(), templateRecord.getSeatY(), templateRecord.getSeatZ(), templateRecord.getSeatRW(), templateRecord.getSeatRX(), templateRecord.getSeatRY(), templateRecord.getSeatRZ());
+ return new TemplateDocument(templateRecord.getTemplateID(), templateRecord.getDisplayName(), templateRecord.getOwnerUsername(), templateRecord.getDescription(), supportSet, templateRecord.isAttachment(), templateRecord.isSeat(), templateRecord.getSeatX(), templateRecord.getSeatY(), templateRecord.getSeatZ(), templateRecord.getSeatRW(), templateRecord.getSeatRX(), templateRecord.getSeatRY(), templateRecord.getSeatRZ());
}
public static TemplateSupportFileDocument documentFromRecord(TemplateSupportFileRecord rec) {
@@ -76,11 +78,14 @@
}
}
- public static BodyConfigurationDocument documentFromRecord(BodyConfigurationRecord record, BodySettingRecord[] settingRecords) {
+ public static BodyConfigurationDocument documentFromRecord(BodyConfigurationRecord record, BodySettingRecord[] settingRecords, AttachmentRecord[] attachmentRecords) {
BodyConfigurationDocument doc = new BodyConfigurationDocument(record.getBodyConfigurationID(), record.getOwnerUsername(), record.getDisplayName(), record.getBodyDataID(), record.getBaseTextureName());
for (int i = 0; i < settingRecords.length; i++) {
doc.addBodySetting(settingRecords[i].getSettingName(), settingRecords[i].getSetting());
}
+ for (int i = 0; i < attachmentRecords.length; i++) {
+ doc.toElement().addChild(new AttachmentDocument(attachmentRecords[i].getAttachmentID(), attachmentRecords[i].getTemplateOwner(), attachmentRecords[i].getTemplateID(), attachmentRecords[i].getBodyConfigurationID()).toElement());
+ }
return doc;
}
}
Added: maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-2.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-2.xml (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-2.xml 2008-02-06 01:20:50 UTC (rev 712)
@@ -0,0 +1,335 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ Copyright 2007,2008 Transmutable (http://transmutable.com/)
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+-->
+
+<hibernate-mapping>
+
+ <class name="com.ogoglio.persist.ServiceStateRecord"
+ table="ServiceStateRecords">
+ <id name="serviceStateID">
+ <generator class="identity" />
+ </id>
+ <property name="registrationState" not-null="true" />
+ </class>
+
+ <class name="com.ogoglio.persist.PendingEmailValidationRecord"
+ table="PendingEmailValidationRecords">
+ <id name="email">
+ <generator class="assigned" />
+ </id>
+ <property name="username" not-null="true" />
+ <property name="secret" not-null="true" />
+ <property name="creationDate" />
+ </class>
+
+ <class name="com.ogoglio.persist.PossessionRecord"
+ table="PossessionRecords">
+ <id name="possessionID">
+ <generator class="identity" />
+ </id>
+
+ <property name="ownerUsername" not-null="true" />
+ <property name="templateID" />
+ <property name="spaceID" />
+ <property name="thingID" />
+ </class>
+
+ <class name="com.ogoglio.persist.SpaceRecord"
+ table="SpaceRecords">
+ <id name="spaceID" access="field">
+ <generator class="identity" />
+ </id>
+
+ <property name="displayName" not-null="true" />
+ <property name="ownerUsername" not-null="true" update="false" />
+ <property name="published" />
+ <property name="maxGuests" />
+ <property name="displaySea" access="field" />
+ <property name="seaLevel" />
+ <property name="simID" />
+ <property name="lastModifiedTime" />
+ <property name="bgRed" />
+ <property name="bgGreen" />
+ <property name="bgBlue" />
+ </class>
+
+ <class name="com.ogoglio.persist.SpaceMemberRecord"
+ table="SpaceMemberRecords">
+ <id name="spaceMemberID">
+ <generator class="identity" />
+ </id>
+
+ <property name="spaceID" update="false" />
+ <property name="memberUsername" not-null="true" />
+ <property name="banned" />
+ <property name="role" />
+ </class>
+
+ <class name="com.ogoglio.persist.SimRecord" table="SimRecords">
+ <id name="simID">
+ <generator class="identity" />
+ </id>
+
+ <property name="displayName" />
+ <property name="simURIString" column="simURI" />
+ <property name="active" />
+ <property name="eventPort" />
+ </class>
+
+ <class name="com.ogoglio.persist.AccountRecord"
+ table="AccountRecords">
+ <id name="username">
+ <generator class="assigned" />
+ </id>
+ <property name="email" not-null="true" unique="true" />
+ <property name="emailValid" />
+ <property name="accountlevel" not-null="true" />
+ <property name="passwordHash" />
+ <property name="firstName" />
+ <property name="lastName" />
+ <property name="homepage" />
+ <property name="creationDate" update="false" />
+ <property name="cookie" />
+ <property name="frozenUntil" />
+ <property name="defaultBodyConfigurationID" />
+ <property name="voiceURI" />
+ <property name="textURI" />
+ </class>
+
+ <class name="com.ogoglio.persist.TemplateRecord"
+ table="TemplateRecords">
+ <id name="templateID">
+ <generator class="identity" />
+ </id>
+
+ <property name="ownerUsername" not-null="true" />
+ <property name="displayName" not-null="true" />
+ <property name="description" />
+ <property name="seat" />
+ <property name="attachment" />
+
+ <set name="supportFiles" table="TemplateTemplateSupportFiles"
+ cascade="all">
+ <key column="templateID" />
+ <many-to-many column="templateSupportFileID" unique="true"
+ class="com.ogoglio.persist.TemplateSupportFileRecord" />
+ </set>
+
+ <property name="seatX" />
+ <property name="seatY" />
+ <property name="seatZ" />
+ <property name="seatRX" />
+ <property name="seatRY" />
+ <property name="seatRZ" />
+ <property name="seatRW" />
+
+ </class>
+
+ <class name="com.ogoglio.appdev.migrate.DBVersionRecord"
+ table="DBVersion">
+ <id name="versionId">
+ <generator class="identity" />
+ </id>
+ <property name="version" not-null="true" />
+ </class>
+
+ <class name="com.ogoglio.persist.TemplateSupportFileRecord"
+ table="TemplateSupportFileRecords">
+ <id name="templateSupportFileID">
+ <generator class="identity" />
+ </id>
+ <property name="supportFile" />
+ <property name="script" not-null="true" />
+ <property name="levelOfDetail" not-null="true" />
+ <property name="lastChanged" not-null="true" />
+ </class>
+
+ <class name="com.ogoglio.persist.BodyDataRecord"
+ table="BodyDataRecords">
+ <id name="bodyDataID">
+ <generator class="identity" />
+ </id>
+ <property name="displayName" not-null="true" />
+ <property name="fileName" not-null="true" unique="true" />
+ </class>
+
+ <class name="com.ogoglio.persist.BodyConfigurationRecord"
+ table="BodyConfigurationRecords">
+ <id name="bodyConfigurationID">
+ <generator class="identity" />
+ </id>
+ <property name="ownerUsername" not-null="true" />
+ <property name="displayName" not-null="true" />
+ <property name="bodyDataID" />
+ <property name="baseTextureName" />
+ </class>
+
+ <class name="com.ogoglio.persist.BodySettingRecord"
+ table="BodySettingRecords">
+ <id name="bodySettingID">
+ <generator class="identity" />
+ </id>
+ <property name="settingName" not-null="true" />
+ <property name="setting" />
+ <property name="bodyConfigurationID" />
+ </class>
+
+ <class name="com.ogoglio.persist.AttachmentRecord"
+ table="AttachmentRecords">
+ <id name="attachmentID">
+ <generator class="identity" />
+ </id>
+ <property name="templateOwner" />
+ <property name="templateID" />
+ <property name="bodyConfigurationID" />
+ </class>
+
+ <query name="com.ogoglio.persist.bodyData">
+ <![CDATA[ from com.ogoglio.persist.BodyDataRecord order by bodyDataID asc ]]>
+ </query>
+ <query name="com.ogoglio.persist.bodyDataByID">
+ <![CDATA[ from com.ogoglio.persist.BodyDataRecord as record where record.bodyDataID = :bodyDataID ]]>
+ </query>
+ <query name="com.ogoglio.persist.bodyDataByFileName">
+ <![CDATA[ from com.ogoglio.persist.BodyDataRecord as record where record.fileName = :fileName ]]>
+ </query>
+ <query
+ name="com.ogoglio.persist.bodyConfigurationByUsernameAndBodyDataID">
+ <![CDATA[ from com.ogoglio.persist.BodyConfigurationRecord as record where record.ownerUsername = :username and record.bodyDataID = :bodyDataID ]]>
+ </query>
+ <query name="com.ogoglio.persist.bodyConfigurationsByUsername">
+ <![CDATA[ from com.ogoglio.persist.BodyConfigurationRecord as record where record.ownerUsername = :username ]]>
+ </query>
+ <query name="com.ogoglio.persist.bodyConfigurationByID">
+ <![CDATA[ from com.ogoglio.persist.BodyConfigurationRecord as record where record.bodyConfigurationID = :bodyConfigurationID ]]>
+ </query>
+ <query name="com.ogoglio.persist.bodySettingsByConfigurationID">
+ <![CDATA[ from com.ogoglio.persist.BodySettingRecord as record where record.bodyConfigurationID = :bodyConfigurationID ]]>
+ </query>
+ <query
+ name="com.ogoglio.persist.bodySettingByConfigurationIDAndSettingName">
+ <![CDATA[ from com.ogoglio.persist.BodySettingRecord as record where record.bodyConfigurationID = :bodyConfigurationID and record.settingName = :settingName ]]>
+ </query>
+ <query name="com.ogoglio.persist.attachmentsByConfigurationID">
+ <![CDATA[ from com.ogoglio.persist.AttachmentRecord as record where record.bodyConfigurationID = :bodyConfigurationID ]]>
+ </query>
+ <query name="com.ogoglio.persist.attachmentByID">
+ <![CDATA[ from com.ogoglio.persist.AttachmentRecord as record where record.attachmentID = :attachmentID ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.serviceStateRecords">
+ <![CDATA[ from com.ogoglio.persist.ServiceStateRecord ]]>
+ </query>
+
+ <query
+ name="com.ogoglio.persist.pendingEmailValidationsByUsername">
+ <![CDATA[ from com.ogoglio.persist.PendingEmailValidationRecord as record where record.username = :username ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.pendingEmailValidationByEmail">
+ <![CDATA[ from com.ogoglio.persist.PendingEmailValidationRecord as record where record.email = :email ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.pendingEmailValidationBySecret">
+ <![CDATA[ from com.ogoglio.persist.PendingEmailValidationRecord as record where record.secret = :secret ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.possessionByPossessionID">
+ <![CDATA[ from com.ogoglio.persist.PossessionRecord as possession where possession.possessionID = :possessionID ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.possessionsByOwnerUsername">
+ <![CDATA[ from com.ogoglio.persist.PossessionRecord as possession where possession.ownerUsername = :ownerUsername ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.possessionsBySpaceID">
+ <![CDATA[ from com.ogoglio.persist.PossessionRecord as possession where possession.spaceID = :spaceID ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.possessionsByTemplateID">
+ <![CDATA[ from com.ogoglio.persist.PossessionRecord as possession where possession.templateID = :templateID ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.templateByID">
+ <![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.templateID = :templateID ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.templateByIDs">
+ <![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.templateID in ( :templateIDs ) ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.templateByOwner">
+ <![CDATA[ from com.ogoglio.persist.TemplateRecord as template where template.ownerUsername = :ownerUsername ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.accountByUsername">
+ <![CDATA[ from com.ogoglio.persist.AccountRecord as account where account.username = :username ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.accountByEmail">
+ <![CDATA[ from com.ogoglio.persist.AccountRecord as account where account.email = :email ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.accountByCookie">
+ <![CDATA[ from com.ogoglio.persist.AccountRecord as account where account.cookie = :cookie ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.simByURI">
+ <![CDATA[ from com.ogoglio.persist.SimRecord as sim where sim.simURIString = :simURI ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.simBySimID">
+ <![CDATA[ from com.ogoglio.persist.SimRecord as sim where sim.simID = :simID ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.simsByActive">
+ <![CDATA[ from com.ogoglio.persist.SimRecord as sim where sim.active = :active ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.sims">
+ <![CDATA[ from com.ogoglio.persist.SimRecord ]]>
+ </query>
+
+ <query name="com.ogoglio.appdev.migrate.dbversions">
+ <![CDATA[ from com.ogoglio.appdev.migrate.DBVersionRecord ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.accounts">
+ <![CDATA[ from com.ogoglio.persist.AccountRecord ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.possessions">
+ <![CDATA[ from com.ogoglio.persist.PossessionRecord order by PossessionID asc ]]>
+ </query>
+ <query name="com.ogoglio.persist.spaces">
+ <![CDATA[ from com.ogoglio.persist.SpaceRecord order by SpaceID asc]]>
+ </query>
+ <query name="com.ogoglio.persist.spacemembers">
+ <![CDATA[ from com.ogoglio.persist.SpaceMemberRecord order by SpaceMemberID asc]]>
+ </query>
+
+ <query name="com.ogoglio.persist.spacesByOwnerUsername">
+ <![CDATA[ from com.ogoglio.persist.SpaceRecord as space where space.ownerUsername = :ownerUsername ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.spaceBySpaceID">
+ <![CDATA[ from com.ogoglio.persist.SpaceRecord as space where space.spaceID = :spaceID ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.spaceMembersBySpaceID">
+ <![CDATA[ from com.ogoglio.persist.SpaceMemberRecord as spaceMember where spaceMember.spaceID = :spaceID ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.spaceMembershipByMemberUsername">
+ <![CDATA[ from com.ogoglio.persist.SpaceMemberRecord as spaceMember where spaceMember.memberUsername = :memberUsername ]]>
+ </query>
+
+ <query name="com.ogoglio.persist.spaceMemberByUsername">
+ <![CDATA[ from com.ogoglio.persist.SpaceMemberRecord as spaceMember where spaceMember.spaceID = :spaceID and spaceMember.memberUsername = :username ]]>
+ </query>
+</hibernate-mapping>
Modified: maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java
===================================================================
--- maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java 2008-02-06 01:20:38 UTC (rev 711)
+++ maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java 2008-02-06 01:20:50 UTC (rev 712)
@@ -33,7 +33,7 @@
spaceSimulator = new SpaceSimulator(spaceDocument, listener);
spaceSimulator.startSim();
- TemplateDocument templateDoc1 = new TemplateDocument(1, "Template 1", "trevor", "A cool template", null, false, 0, 0, 0, 1, 0, 0, 0);
+ TemplateDocument templateDoc1 = new TemplateDocument(1, "Template 1", "trevor", "A cool template", null, false, false, 0, 0, 0, 1, 0, 0, 0);
listener.templateMap.put(new Long(1), templateDoc1);
listener.scriptMap.put(new Long(1), simplestScript);
listener.objMap.put(new Long(1), "templates/TestCube.obj");
@@ -41,7 +41,7 @@
ThingDocument thingDoc = spaceSimulator.addThing(templateDoc1.getTemplateID(), templateDoc1.getOwnerUsername(), templateDoc1.getDisplayName(), "trevor", 1, new Transform3D());
assertTrue(spaceSimulator.removeThing(thingDoc.getThingID()));
- TemplateDocument templateDoc2 = new TemplateDocument(2, "Template 2", "trevor", "Another cool template", null, false, 0, 0, 0, 1, 0, 0, 0);
+ TemplateDocument templateDoc2 = new TemplateDocument(2, "Template 2", "trevor", "Another cool template", null, false, false, 0, 0, 0, 1, 0, 0, 0);
listener.templateMap.put(new Long(2), templateDoc2);
listener.scriptMap.put(new Long(2), constructorScript);
listener.objMap.put(new Long(2), "templates/TestCube.obj");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|