Commit 1aeabaac by Tuomas Riihimäki

Hmm.. Stuff:

  - Removed commons-codec ( Could not get it to propagate via EAR, or otherwise )
  - Added commons-codec base64 libs to LanBortalUtils..
  - Fixed JVM crash problem ( maybe Place FetchType.EAGER )
  - Added graniteds and AXDT flash stuff.. :)
  - Broke everything else!!
1 parent 608b95a5
Showing with 1275 additions and 104 deletions
...@@ -20,9 +20,12 @@ bortalRealm { ...@@ -20,9 +20,12 @@ bortalRealm {
3. suorita seuraava komento hakemistossa glassfish/glassfish/bin/ 3. suorita seuraava komento hakemistossa glassfish/glassfish/bin/
./asadmin create-auth-realm --classname fi.insomnia.bortal.BortalRealm --property jaas-context=bortalRealm omniarealm # ./asadmin create-auth-realm --classname fi.insomnia.bortal.BortalRealm --property jaas-context=bortalRealm omniarealm
./asadmin create-jdbc-connection-pool --datasourceclassname org.postgresql.ds.PGSimpleDataSource --restype javax.sql.DataSource --ping true --property DatabaseName=BortalDb:Password=derkoppa:User=bortal Omniapossu # ./asadmin create-jdbc-connection-pool --datasourceclassname org.postgresql.ds.PGSimpleDataSource --restype javax.sql.DataSource --ping true --property DatabaseName=BortalDb:Password=derkoppa:User=bortal Omniapossu
Lis JDBC resource jdbc/bortal connection poolille Omniapossu wepiklist. Lis JDBC resource jdbc/bortal connection poolille Omniapossu wepiklist.
Debug-tulosteet fi namespacesta saa nkyviin seuraavasti:
# echo fi.level=FINEST >> glassfish/domains/domain1/config/logging.properties
\ No newline at end of file
...@@ -16,5 +16,17 @@ ...@@ -16,5 +16,17 @@
<dependent-module archiveName="LanBortalUtilities.jar" deploy-path="/lib" handle="module:/resource/LanBortalUtilities/LanBortalUtilities"> <dependent-module archiveName="LanBortalUtilities.jar" deploy-path="/lib" handle="module:/resource/LanBortalUtilities/LanBortalUtilities">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="granite.jar" deploy-path="/lib" handle="module:/classpath/lib/LanBortal/ExtraLibs/granite.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="granite-eclipselink.jar" deploy-path="/lib" handle="module:/classpath/lib/LanBortal/ExtraLibs/granite-eclipselink.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="slf4j-api-1.5.8.jar" deploy-path="/lib" handle="module:/classpath/lib/LanBortal/ExtraLibs/slf4j-api-1.5.8.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="slf4j-jdk14-1.5.8.jar" deploy-path="/lib" handle="module:/classpath/lib/LanBortal/ExtraLibs/slf4j-jdk14-1.5.8.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
</wb-module> </wb-module>
</project-modules> </project-modules>
No preview for this file type
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/LanBortalAuthModuleClient"/> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/LanBortalAuthModuleClient"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6"/> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6"/>
<classpathentry kind="lib" path="/Users/tuomari/bin/glassfishv31_0507_2/glassfish/lib/appserv-rt.jar"/> <classpathentry kind="lib" path="/Users/tuomari/bin/glassfishv31_0507_2/glassfish/lib/appserv-rt.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name> <name>org.eclipse.jdt.core.javabuilder</name>
<arguments> <arguments>
</arguments> </arguments>
...@@ -14,5 +19,6 @@ ...@@ -14,5 +19,6 @@
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures> </natures>
</projectDescription> </projectDescription>
#Sat Apr 17 01:39:34 EEST 2010 #Fri Jul 16 17:41:25 EEST 2010
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
......
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.6"/>
</faceted-project>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
<?xml version="1.0" encoding="UTF-8"?>
<graniteProperties version="2.0">
<gas3 uid="uid" as3TypeFactory="org.granite.generator.as3.DefaultAs3TypeFactory" entityFactory="org.granite.generator.as3.DefaultEntityFactory" remoteDestinationFactory="org.granite.generator.as3.DefaultRemoteDestinationFactory" debugEnabled="false" flexConfig="false">
<source path="src" includes="" excludes="" output="as3;"/>
<template kind="ENTITY" uris="class:org/granite/generator/template/entity.gsp;class:org/granite/generator/template/entityBase.gsp"/>
<template kind="BEAN" uris="class:org/granite/generator/template/bean.gsp;class:org/granite/generator/template/beanBase.gsp"/>
<template kind="REMOTE_DESTINATION" uris="class:org/granite/generator/template/remote.gsp;class:org/granite/generator/template/remoteBase.gsp"/>
<template kind="INTERFACE" uris="class:org/granite/generator/template/interface.gsp"/>
<template kind="ENUM" uris="class:org/granite/generator/template/enum.gsp"/>
<transformer type="org.granite.generator.as3.JavaAs3GroovyTransformer"/>
</gas3>
</graniteProperties>
\ No newline at end of file
...@@ -20,11 +20,17 @@ ...@@ -20,11 +20,17 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.granite.builder.granitebuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.granite.builder.granitenature</nature>
</natures> </natures>
</projectDescription> </projectDescription>
#Sat Jun 12 04:35:47 EEST 2010 #Fri Jul 16 17:41:15 EEST 2010
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<runtime name="GlassFish v3 Java EE 6"/> <runtime name="GlassFish v3 Java EE 6"/>
<fixed facet="java"/> <fixed facet="java"/>
<fixed facet="jst.utility"/> <fixed facet="jst.utility"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.6"/>
</faceted-project> </faceted-project>
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal {
public interface RealmBeanRemote {
}
}
\ No newline at end of file
...@@ -2,14 +2,22 @@ ...@@ -2,14 +2,22 @@
<classpath> <classpath>
<classpathentry kind="src" path="ejbModule"/> <classpathentry kind="src" path="ejbModule"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6"/> <classpathentry kind="lib" path="libs/PDFjet.jar">
<classpathentry kind="lib" path="libs/PDFjet.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="org.eclipse.jst.component.dependency" value="../"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/LanBortalBeansClient"/> <classpathentry combineaccessrules="false" kind="src" path="/LanBortalBeansClient"/>
<classpathentry combineaccessrules="false" kind="src" path="/LanBortalAuthModuleClient"/> <classpathentry combineaccessrules="false" kind="src" path="/LanBortalAuthModuleClient"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish Server Open Source Edition 3 (Java EE 6)">
<attributes>
<attribute name="owner.project.facets" value="jst.ejb"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
<?xml version="1.0" encoding="UTF-8"?>
<graniteProperties version="2.0">
<gas3 uid="uid" as3TypeFactory="org.granite.generator.as3.DefaultAs3TypeFactory" entityFactory="org.granite.generator.as3.DefaultEntityFactory" remoteDestinationFactory="org.granite.generator.as3.DefaultRemoteDestinationFactory" debugEnabled="false" flexConfig="false">
<source path="ejbModule" includes="" excludes="" output="../LanBortalWeb/as3;"/>
<project path="LanBortalAuthModuleClient"/>
<project path="LanBortalBeansClient"/>
<template kind="REMOTE_DESTINATION" uris="class:org/granite/generator/template/remote.gsp;class:org/granite/generator/template/remoteBase.gsp"/>
<template kind="ENTITY" uris="class:org/granite/generator/template/entity.gsp;class:org/granite/generator/template/entityBase.gsp"/>
<template kind="INTERFACE" uris="class:org/granite/generator/template/interface.gsp"/>
<template kind="ENUM" uris="class:org/granite/generator/template/enum.gsp"/>
<template kind="BEAN" uris="class:org/granite/generator/template/bean.gsp;class:org/granite/generator/template/beanBase.gsp"/>
<transformer type="org.granite.generator.as3.JavaAs3GroovyTransformer"/>
</gas3>
</graniteProperties>
\ No newline at end of file
...@@ -20,11 +20,17 @@ ...@@ -20,11 +20,17 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.granite.builder.granitebuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.granite.builder.granitenature</nature>
</natures> </natures>
</projectDescription> </projectDescription>
#Sat Jul 17 22:07:14 EEST 2010
XDOCLETBUILDERACTIVE=true
XDOCLETHOME=
XDOCLETUSEGLOBAL=true
XDOCLETVERSION=1.2.1
eclipse.preferences.version=1
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<runtime name="GlassFish Server Open Source Edition 3 (Java EE 6)"/>
<fixed facet="jst.ejb"/> <fixed facet="jst.ejb"/>
<fixed facet="jst.java"/> <fixed facet="jst.java"/>
<installed facet="jst.java" version="6.0"/> <installed facet="jst.java" version="6.0"/>
......
...@@ -2,18 +2,13 @@ package fi.insomnia.bortal.beans; ...@@ -2,18 +2,13 @@ package fi.insomnia.bortal.beans;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import javax.annotation.security.DeclareRoles;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.servlet.ServletOutputStream;
import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal;
import fi.insomnia.bortal.beanutil.AuthorisationBean; import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal.Right;
import fi.insomnia.bortal.beanutil.AuthorisationBean.Right; import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal.RightType;
import fi.insomnia.bortal.beanutil.AuthorisationBean.RightType;
import fi.insomnia.bortal.beanutil.PdfPrinter; import fi.insomnia.bortal.beanutil.PdfPrinter;
import fi.insomnia.bortal.enums.BeanRole;
import fi.insomnia.bortal.facade.BillFacade; import fi.insomnia.bortal.facade.BillFacade;
import fi.insomnia.bortal.model.Bill; import fi.insomnia.bortal.model.Bill;
import fi.insomnia.bortal.model.Event; import fi.insomnia.bortal.model.Event;
...@@ -31,10 +26,10 @@ public class BillBean implements BillBeanLocal { ...@@ -31,10 +26,10 @@ public class BillBean implements BillBeanLocal {
private UserBeanLocal userBean; private UserBeanLocal userBean;
@EJB @EJB
private SecurityBean secubean; private SecurityBeanLocal secubean;
@EJB @EJB
private AuthorisationBean authbean; private AuthorisationBeanLocal authbean;
/** /**
* Default constructor. * Default constructor.
......
...@@ -3,6 +3,10 @@ package fi.insomnia.bortal.beans; ...@@ -3,6 +3,10 @@ package fi.insomnia.bortal.beans;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import org.granite.messaging.service.annotations.RemoteDestination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.facade.EventFacade; import fi.insomnia.bortal.facade.EventFacade;
import fi.insomnia.bortal.facade.EventOrganiserFacade; import fi.insomnia.bortal.facade.EventOrganiserFacade;
import fi.insomnia.bortal.facade.UserFacade; import fi.insomnia.bortal.facade.UserFacade;
...@@ -18,7 +22,7 @@ public class EventBean implements EventBeanLocal { ...@@ -18,7 +22,7 @@ public class EventBean implements EventBeanLocal {
private static final String DEFAULT_EVENT_NAME = "Default event"; private static final String DEFAULT_EVENT_NAME = "Default event";
private static final String DEFAULT_ORGANISATION_NAME = "Default organisation"; private static final String DEFAULT_ORGANISATION_NAME = "Default organisation";
private static final Logger logger = LoggerFactory.getLogger(EventBean.class);
@EJB @EJB
private EventFacade eventFacade; private EventFacade eventFacade;
...@@ -69,4 +73,8 @@ public class EventBean implements EventBeanLocal { ...@@ -69,4 +73,8 @@ public class EventBean implements EventBeanLocal {
return settings; return settings;
} }
} }
...@@ -15,8 +15,13 @@ import javax.ejb.Stateless; ...@@ -15,8 +15,13 @@ import javax.ejb.Stateless;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.facade.AccessRightFacade;
import fi.insomnia.bortal.facade.RoleFacade; import fi.insomnia.bortal.facade.RoleFacade;
import fi.insomnia.bortal.facade.RoleRightFacade;
import fi.insomnia.bortal.model.AccessRight;
import fi.insomnia.bortal.model.Event;
import fi.insomnia.bortal.model.Role; import fi.insomnia.bortal.model.Role;
import fi.insomnia.bortal.model.RoleRight;
/** /**
* *
...@@ -25,15 +30,14 @@ import fi.insomnia.bortal.model.Role; ...@@ -25,15 +30,14 @@ import fi.insomnia.bortal.model.Role;
@Stateless @Stateless
public class RoleBean implements RoleBeanLocal { public class RoleBean implements RoleBeanLocal {
// public static final String[] DECLARED_ROLES =
// {
// BeanRole.SUPERADMIN.toString(),
// BeanRole.ADMIN_BASE.name(),
// BeanRole.USER_BASE.name()
// };
@EJB @EJB
private RoleFacade roleFacade; private RoleFacade roleFacade;
@EJB
private AccessRightFacade arf;
@EJB
private RoleRightFacade rrfacade;
@EJB
private AccessRightFacade accessrightFacade;
private static final Logger logger = LoggerFactory.getLogger(RoleBean.class); private static final Logger logger = LoggerFactory.getLogger(RoleBean.class);
public List<Role> listRoles() { public List<Role> listRoles() {
...@@ -47,7 +51,6 @@ public class RoleBean implements RoleBeanLocal { ...@@ -47,7 +51,6 @@ public class RoleBean implements RoleBeanLocal {
public Role create(Role role) { public Role create(Role role) {
roleFacade.create(role); roleFacade.create(role);
return role; return role;
} }
...@@ -86,11 +89,30 @@ public class RoleBean implements RoleBeanLocal { ...@@ -86,11 +89,30 @@ public class RoleBean implements RoleBeanLocal {
return returnList; return returnList;
} }
// public static String[] getDeclaredRoles() { public List<RoleRight> getEventRoleRights(Event e, Role r) {
// return DECLARED_ROLES;
// } List<AccessRight> rights = arf.findAll();
List<RoleRight> ret = new ArrayList<RoleRight>();
for(AccessRight ar : rights)
{
RoleRight roleright = rrfacade.find(e, ar, r);
if(roleright == null)
{
roleright = new RoleRight(e);
roleright.setAccessRight(ar);
roleright.setRole(r);
rrfacade.create(roleright);
}
ret.add(roleright);
}
return ret;
}
@Override
public RoleRight mergeChanges(RoleRight row) {
return rrfacade.merge(row);
}
// Add business logic below. (Right-click in editor and choose // Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method") // "Insert Code > Add Business Method")
......
...@@ -72,7 +72,7 @@ public class SecurityBean implements SecurityBeanLocal { ...@@ -72,7 +72,7 @@ public class SecurityBean implements SecurityBeanLocal {
return entry; return entry;
} }
public void logPermissionDenied(User currentuser, String string) { public LogEntry logPermissionDenied(User currentuser, String message) {
return logMessage(SecurityLogType.permissionDenied, currentuser, message);
} }
} }
...@@ -12,6 +12,9 @@ import java.util.logging.Logger; ...@@ -12,6 +12,9 @@ import java.util.logging.Logger;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -31,6 +34,7 @@ import fi.insomnia.bortal.model.Event; ...@@ -31,6 +34,7 @@ import fi.insomnia.bortal.model.Event;
import fi.insomnia.bortal.model.EventMap; import fi.insomnia.bortal.model.EventMap;
import fi.insomnia.bortal.model.Place; import fi.insomnia.bortal.model.Place;
import fi.insomnia.bortal.model.User; import fi.insomnia.bortal.model.User;
import fi.insomnia.bortal.utilities.apachecodec.binary.Base64;
/** /**
* Session Bean implementation class TestDataBean * Session Bean implementation class TestDataBean
...@@ -39,6 +43,8 @@ import fi.insomnia.bortal.model.User; ...@@ -39,6 +43,8 @@ import fi.insomnia.bortal.model.User;
// @DeclareRoles("ADMIN_BASE") // @DeclareRoles("ADMIN_BASE")
// @RolesAllowed("ADMIN_BASE") // @RolesAllowed("ADMIN_BASE")
public class TestDataBean implements TestDataBeanLocal { public class TestDataBean implements TestDataBeanLocal {
@PersistenceContext
private EntityManager em;
public static final String TEST_MAP_IMAGE_NAME = "testmap.png"; public static final String TEST_MAP_IMAGE_NAME = "testmap.png";
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(TestDataBean.class); private static final org.slf4j.Logger logger = LoggerFactory.getLogger(TestDataBean.class);
...@@ -67,9 +73,29 @@ public class TestDataBean implements TestDataBeanLocal { ...@@ -67,9 +73,29 @@ public class TestDataBean implements TestDataBeanLocal {
@EJB @EJB
private UserBeanLocal userbean; private UserBeanLocal userbean;
// @PersistenceUnit
// private EntityManagerFactory emf;
//
public void bootstrap() public void bootstrap() {
{
}
public void writeMap(Event e, long bytes) {
EventMap map = new EventMap(e);
map.setName("test" + bytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes; ++i) {
sb.append((char) (33 + i % 92));
}
map.setMapData(sb.toString());
eventMapFacade.create(map);
}
public EventMap readMap(long bytes) {
return eventMapFacade.findByName("test" + bytes);
} }
...@@ -190,7 +216,6 @@ public class TestDataBean implements TestDataBeanLocal { ...@@ -190,7 +216,6 @@ public class TestDataBean implements TestDataBeanLocal {
File file = new File(getClass().getResource(TEST_MAP_IMAGE_NAME).toURI()); File file = new File(getClass().getResource(TEST_MAP_IMAGE_NAME).toURI());
long length = file.length(); long length = file.length();
// Create the byte array to hold the data // Create the byte array to hold the data
byte[] bytes = new byte[(int) length]; byte[] bytes = new byte[(int) length];
...@@ -208,9 +233,10 @@ public class TestDataBean implements TestDataBeanLocal { ...@@ -208,9 +233,10 @@ public class TestDataBean implements TestDataBeanLocal {
} }
stream.close(); stream.close();
String str = Base64.encodeBase64String(bytes);
map.setMapData(bytes); logger.debug("Saving image with {} base64 encoded chars", str.length());
map.setMapData(str );
map.setName("test0");
eventMapFacade.create(map); eventMapFacade.create(map);
return map; return map;
...@@ -283,4 +309,10 @@ public class TestDataBean implements TestDataBeanLocal { ...@@ -283,4 +309,10 @@ public class TestDataBean implements TestDataBeanLocal {
compoEntry2.setName("Another test entry for test compo"); compoEntry2.setName("Another test entry for test compo");
compoEntryFacade.create(compoEntry2); compoEntryFacade.create(compoEntry2);
} }
@Override
public void flushMaps() {
Query q = em.createQuery("delete from EventMap");
q.executeUpdate();
}
} }
...@@ -11,6 +11,7 @@ import javax.ejb.EJB; ...@@ -11,6 +11,7 @@ import javax.ejb.EJB;
import javax.ejb.LocalBean; import javax.ejb.LocalBean;
import javax.ejb.SessionContext; import javax.ejb.SessionContext;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.enterprise.deploy.spi.Target;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -120,6 +121,7 @@ public class UserBean implements UserBeanLocal { ...@@ -120,6 +121,7 @@ public class UserBean implements UserBeanLocal {
// TODO: FIX THIS!! really bad idea.... // TODO: FIX THIS!! really bad idea....
if (user.isSuperadmin()) { if (user.isSuperadmin()) {
logger.debug("Returning true for superadmin for {} perm {}", target.name(),permission);
return true; return true;
} }
...@@ -147,12 +149,12 @@ public class UserBean implements UserBeanLocal { ...@@ -147,12 +149,12 @@ public class UserBean implements UserBeanLocal {
if (rr.getAccessRight().equals(expectedRight)) { if (rr.getAccessRight().equals(expectedRight)) {
switch (permission) { switch (permission) {
case READ: case READ:
if (rr.getRead()) { if (rr.isRead()) {
return true; return true;
} }
break; break;
case WRITE: case WRITE:
if (rr.getWrite()) { if (rr.isWrite()) {
return true; return true;
} }
break; break;
......
package fi.insomnia.bortal.beans.flash;
public class Dummyclass {
private String name;
private Integer id;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
}
package fi.insomnia.bortal.beans.flash;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceUnit;
import org.granite.messaging.service.annotations.RemoteDestination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.facade.EventFacade;
import fi.insomnia.bortal.facade.EventMapFacade;
import fi.insomnia.bortal.model.EventMap;
import fi.insomnia.bortal.model.EventPk;
import fi.insomnia.bortal.model.Place;
import fi.insomnia.bortal.utilities.apachecodec.binary.Base64;
/**
* Session Bean implementation class FlashMapBean
*/
@Stateless
@RemoteDestination
public class FlashMapBean implements FlashMapBeanLocal {
private static final Logger logger = LoggerFactory.getLogger(FlashMapBean.class);
@EJB
private EventFacade eventFacade;
@EJB
private EventMapFacade mapFacade;
@PersistenceUnit
private EntityManagerFactory emf;
/**
* Default constructor.
*/
public FlashMapBean() {
// TODO Auto-generated constructor stub
}
public byte[] getMapBackground(Integer eventId, Integer mapId)
{
logger.debug("Fetching data with eventid {}, mapid {}", eventId, mapId);
EntityManager em = emf.createEntityManager();
EventMap map = em.find(EventMap.class, new EventPk(eventId, mapId));
logger.debug("Got map: {}", map);
return Base64.decodeBase64(map.getMapData());
}
public List<Place> getMapPlaces(Integer eventId, Integer mapId)
{
EventMap map = mapFacade.getMapById(eventId, mapId);
return map.getPlaces();
}
public String getEventById(Integer id)
{
return "returning event with id " + id;
}
}
package fi.insomnia.bortal.beans.flash;
import java.util.List;
import javax.ejb.Local;
import fi.insomnia.bortal.model.Event;
import fi.insomnia.bortal.model.Place;
@Local
public interface FlashMapBeanLocal {
byte[] getMapBackground(Integer eventId, Integer mapId);
List<Place> getMapPlaces(Integer eventId, Integer mapId);
String getEventById(Integer id);
}
...@@ -10,13 +10,7 @@ import fi.insomnia.bortal.model.User; ...@@ -10,13 +10,7 @@ import fi.insomnia.bortal.model.User;
@Stateless @Stateless
public class AuthorisationBean implements AuthorisationBeanLocal { public class AuthorisationBean implements AuthorisationBeanLocal {
public enum Right {
ADMIN
}
public enum RightType {
READ, WRITE, EXECUTE
}
/** /**
* Default constructor. * Default constructor.
......
package fi.insomnia.bortal.beanutil; package fi.insomnia.bortal.beanutil;
import javax.ejb.Local; import javax.ejb.Local;
import fi.insomnia.bortal.model.User;
@Local @Local
public interface AuthorisationBeanLocal { public interface AuthorisationBeanLocal {
public enum Right {
ADMIN
}
public enum RightType {
READ, WRITE, EXECUTE
}
boolean isAuthorised(User currentuser, Right admin, RightType read);
} }
...@@ -8,6 +8,8 @@ import javax.persistence.PersistenceContext; ...@@ -8,6 +8,8 @@ import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import fi.insomnia.bortal.model.AccessRight; import fi.insomnia.bortal.model.AccessRight;
import fi.insomnia.bortal.model.Event;
import fi.insomnia.bortal.model.Role;
@Stateless @Stateless
@LocalBean @LocalBean
...@@ -53,4 +55,8 @@ public class AccessRightFacade extends IntegerPkGenericFacade<AccessRight> { ...@@ -53,4 +55,8 @@ public class AccessRightFacade extends IntegerPkGenericFacade<AccessRight> {
return right; return right;
} }
public void find(Event e, Role r) {
}
} }
...@@ -20,9 +20,9 @@ public abstract class EventChildGenericFacade<T extends EventChildInterface> ext ...@@ -20,9 +20,9 @@ public abstract class EventChildGenericFacade<T extends EventChildInterface> ext
public T find(Integer eventId, Integer id) { public T find(Integer eventId, Integer id) {
EventPk pk = new EventPk(eventId); EventPk pk = new EventPk(eventId);
pk.setId(id); pk.setId(id);
logger.debug("Fetching object {} with key {}", this.getEntityClass(), pk); logger.debug("Fetching object {} with key {}", this.getEntityClass(), pk);
return find(pk); return find(pk);
} }
......
...@@ -6,12 +6,16 @@ import javax.persistence.EntityManager; ...@@ -6,12 +6,16 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.model.Event; import fi.insomnia.bortal.model.Event;
@Stateless @Stateless
@LocalBean @LocalBean
public class EventFacade extends GenericFacade<Integer, Event> { public class EventFacade extends GenericFacade<Integer, Event> {
private static final Logger logger = LoggerFactory.getLogger(EventFacade.class);
@PersistenceContext @PersistenceContext
private EntityManager em; private EntityManager em;
...@@ -24,6 +28,7 @@ public class EventFacade extends GenericFacade<Integer, Event> { ...@@ -24,6 +28,7 @@ public class EventFacade extends GenericFacade<Integer, Event> {
} }
public Event findByHostname(String hostname) { public Event findByHostname(String hostname) {
logger.debug("finding event with hostname {}", hostname);
TypedQuery<Event> q = em.createNamedQuery("Event.findByReferer", Event.class); TypedQuery<Event> q = em.createNamedQuery("Event.findByReferer", Event.class);
q.setParameter("referer", hostname); q.setParameter("referer", hostname);
return this.getSingleNullableResult(q); return this.getSingleNullableResult(q);
......
package fi.insomnia.bortal.facade; package fi.insomnia.bortal.facade;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.LocalBean; import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.model.EventMap; import fi.insomnia.bortal.model.EventMap;
@Stateless @Stateless
...@@ -13,6 +21,9 @@ public class EventMapFacade extends EventChildGenericFacade<EventMap> { ...@@ -13,6 +21,9 @@ public class EventMapFacade extends EventChildGenericFacade<EventMap> {
@PersistenceContext @PersistenceContext
private EntityManager em; private EntityManager em;
@EJB
private EventMapFacade mapfacade;
public EventMapFacade() { public EventMapFacade() {
super(EventMap.class); super(EventMap.class);
} }
...@@ -21,4 +32,14 @@ public class EventMapFacade extends EventChildGenericFacade<EventMap> { ...@@ -21,4 +32,14 @@ public class EventMapFacade extends EventChildGenericFacade<EventMap> {
return em; return em;
} }
public EventMap getMapById(Integer eventId, Integer id) {
return mapfacade.find(eventId, id);
}
public EventMap findByName(String name) {
TypedQuery<EventMap> q = em.createNamedQuery("EventMap.findByName", EventMap.class);
q.setParameter("name", name);
return this.getSingleNullableResult(q);
}
} }
...@@ -47,6 +47,7 @@ public abstract class GenericFacade<PK,T extends ModelInterface<PK>>{ ...@@ -47,6 +47,7 @@ public abstract class GenericFacade<PK,T extends ModelInterface<PK>>{
} }
public T find(PK id) { public T find(PK id) {
logger.debug("GenericFacade Find class {} By pk {}", new Object[]{getEntityClass(), id});
T ret = getEm().find(getEntityClass(), id); T ret = getEm().find(getEntityClass(), id);
return ret; return ret;
} }
......
...@@ -4,6 +4,11 @@ import javax.ejb.LocalBean; ...@@ -4,6 +4,11 @@ import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import fi.insomnia.bortal.model.AccessRight;
import fi.insomnia.bortal.model.Event;
import fi.insomnia.bortal.model.Role;
import fi.insomnia.bortal.model.RoleRight; import fi.insomnia.bortal.model.RoleRight;
@Stateless @Stateless
...@@ -21,4 +26,12 @@ public class RoleRightFacade extends EventChildGenericFacade<RoleRight> { ...@@ -21,4 +26,12 @@ public class RoleRightFacade extends EventChildGenericFacade<RoleRight> {
return em; return em;
} }
public RoleRight find(Event event, AccessRight right, Role role) {
TypedQuery<RoleRight> q = this.getEm().createNamedQuery("RoleRight.findByRightAndRoleForEvent", RoleRight.class);
q.setParameter("accessright", right);
q.setParameter("role", role);
q.setParameter("event_id", event.getId());
return this.getSingleNullableResult(q);
}
} }
...@@ -2,12 +2,16 @@ ...@@ -2,12 +2,16 @@
<classpath> <classpath>
<classpathentry kind="src" path="ejbModule"/> <classpathentry kind="src" path="ejbModule"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6"/> <classpathentry combineaccessrules="false" kind="src" path="/LanBortalAuthModuleClient"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish Server Open Source Edition 3 (Java EE 6)">
<attributes>
<attribute name="owner.project.facets" value="jst.utility"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/LanBortalAuthModuleClient"/>
<classpathentry kind="output" path="ejbModule"/> <classpathentry kind="output" path="ejbModule"/>
</classpath> </classpath>
<?xml version="1.0" encoding="UTF-8"?>
<graniteProperties version="2.0">
<gas3 uid="uid" as3TypeFactory="org.granite.generator.as3.DefaultAs3TypeFactory" entityFactory="org.granite.generator.as3.DefaultEntityFactory" remoteDestinationFactory="org.granite.generator.as3.DefaultRemoteDestinationFactory" debugEnabled="false" flexConfig="false">
<source path="ejbModule" includes="" excludes="" output="../LanBortalWeb/as3;"/>
<project path="LanBortalAuthModuleClient"/>
<project path="LanBortalDatabase"/>
<template kind="ENTITY" uris="class:org/granite/generator/template/entity.gsp;class:org/granite/generator/template/entityBase.gsp"/>
<template kind="BEAN" uris="class:org/granite/generator/template/bean.gsp;class:org/granite/generator/template/beanBase.gsp"/>
<template kind="REMOTE_DESTINATION" uris="class:org/granite/generator/template/remote.gsp;class:org/granite/generator/template/remoteBase.gsp"/>
<template kind="INTERFACE" uris="class:org/granite/generator/template/interface.gsp"/>
<template kind="ENUM" uris="class:org/granite/generator/template/enum.gsp"/>
<transformer type="org.granite.generator.as3.JavaAs3GroovyTransformer"/>
</gas3>
</graniteProperties>
\ No newline at end of file
...@@ -20,11 +20,17 @@ ...@@ -20,11 +20,17 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.granite.builder.granitebuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.granite.builder.granitenature</nature>
</natures> </natures>
</projectDescription> </projectDescription>
#Thu Jun 10 02:19:46 EEST 2010 #Thu Jul 15 01:16:17 EEST 2010
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<runtime name="GlassFish Server Open Source Edition 3 (Java EE 6)"/>
<fixed facet="jst.utility"/> <fixed facet="jst.utility"/>
<fixed facet="jst.java"/> <fixed facet="jst.java"/>
<installed facet="jst.java" version="5.0"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="jst.java" version="1.6"/>
</faceted-project> </faceted-project>
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface AccessRightBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface BillBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface EventBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR. INSTEAD, EDIT THE INHERITED CLASS (EventBeanLocal.as).
*/
package fi.insomnia.bortal.beans {
import mx.messaging.ChannelSet;
import mx.messaging.config.ServerConfig;
import mx.rpc.remoting.mxml.RemoteObject;
public class EventBeanLocalBase extends RemoteObject {
private var _initRemote:Boolean = false;
private function initRemote():void {
destination = "";
channelSet = new ChannelSet();
channelSet.addChannel(ServerConfig.getChannel(""));
_initRemote = true;
}
public function getEvent(arg0:Number):void {
if (!_initRemote)
initRemote();
getOperation("getEvent").send(arg0);
}
public function getEventByHostname(arg0:String):void {
if (!_initRemote)
initRemote();
getOperation("getEventByHostname").send(arg0);
}
public function addOperationListener(op:Function, type:String, handler:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void {
if (op == this.getEvent)
this.getOperation("getEvent").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.getEventByHostname)
this.getOperation("getEventByHostname").addEventListener(type, handler, useCapture, priority, useWeakReference);
}
public function removeOperationListener(op:Function, event:String, handler:Function):void {
if (op == this.getEvent)
this.getOperation("getEvent").removeEventListener(event, handler);
if (op == this.getEventByHostname)
this.getOperation("getEventByHostname").removeEventListener(event, handler);
}
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface EventStatusBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface JaasBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
import fi.insomnia.bortal.RealmBeanRemote;
public interface JaasBeanRemote extends RealmBeanRemote {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface PlaceBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR. INSTEAD, EDIT THE INHERITED CLASS (PlaceBeanLocal.as).
*/
package fi.insomnia.bortal.beans {
import fi.insomnia.bortal.model.Place;
import mx.messaging.ChannelSet;
import mx.messaging.config.ServerConfig;
import mx.rpc.remoting.mxml.RemoteObject;
public class PlaceBeanLocalBase extends RemoteObject {
private var _initRemote:Boolean = false;
private function initRemote():void {
destination = "";
channelSet = new ChannelSet();
channelSet.addChannel(ServerConfig.getChannel(""));
_initRemote = true;
}
public function mergeChanges(arg0:Place):void {
if (!_initRemote)
initRemote();
getOperation("mergeChanges").send(arg0);
}
public function addOperationListener(op:Function, type:String, handler:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void {
if (op == this.mergeChanges)
this.getOperation("mergeChanges").addEventListener(type, handler, useCapture, priority, useWeakReference);
}
public function removeOperationListener(op:Function, event:String, handler:Function):void {
if (op == this.mergeChanges)
this.getOperation("mergeChanges").removeEventListener(event, handler);
}
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface PlaceMapBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR. INSTEAD, EDIT THE INHERITED CLASS (PlaceMapBeanLocal.as).
*/
package fi.insomnia.bortal.beans {
import fi.insomnia.bortal.model.Event;
import fi.insomnia.bortal.model.EventMap;
import fi.insomnia.bortal.model.User;
import java.io.OutputStream;
import mx.collections.ListCollectionView;
import mx.messaging.ChannelSet;
import mx.messaging.config.ServerConfig;
import mx.rpc.remoting.mxml.RemoteObject;
public class PlaceMapBeanLocalBase extends RemoteObject {
private var _initRemote:Boolean = false;
private function initRemote():void {
destination = "";
channelSet = new ChannelSet();
channelSet.addChannel(ServerConfig.getChannel(""));
_initRemote = true;
}
public function printPlaceMapToStream(arg0:OutputStream, arg1:String, arg2:Event, arg3:Number, arg4:ListCollectionView):void {
if (!_initRemote)
initRemote();
getOperation("printPlaceMapToStream").send(arg0, arg1, arg2, arg3, arg4);
}
public function getSelectPlaceMapUrl(arg0:EventMap, arg1:ListCollectionView, arg2:User):void {
if (!_initRemote)
initRemote();
getOperation("getSelectPlaceMapUrl").send(arg0, arg1, arg2);
}
public function selectablePlaceCount(arg0:User, arg1:Event):void {
if (!_initRemote)
initRemote();
getOperation("selectablePlaceCount").send(arg0, arg1);
}
public function addOperationListener(op:Function, type:String, handler:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void {
if (op == this.printPlaceMapToStream)
this.getOperation("printPlaceMapToStream").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.getSelectPlaceMapUrl)
this.getOperation("getSelectPlaceMapUrl").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.selectablePlaceCount)
this.getOperation("selectablePlaceCount").addEventListener(type, handler, useCapture, priority, useWeakReference);
}
public function removeOperationListener(op:Function, event:String, handler:Function):void {
if (op == this.printPlaceMapToStream)
this.getOperation("printPlaceMapToStream").removeEventListener(event, handler);
if (op == this.getSelectPlaceMapUrl)
this.getOperation("getSelectPlaceMapUrl").removeEventListener(event, handler);
if (op == this.selectablePlaceCount)
this.getOperation("selectablePlaceCount").removeEventListener(event, handler);
}
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface ProductBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface RoleBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface SecurityBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
import org.granite.util.Enum;
[Bindable]
[RemoteClass(alias="fi.insomnia.bortal.beans.SecurityLogType")]
public class SecurityLogType extends Enum {
public static const permissionDenied:SecurityLogType = new SecurityLogType("permissionDenied", _);
public static const unknownException:SecurityLogType = new SecurityLogType("unknownException", _);
public static const genericMessage:SecurityLogType = new SecurityLogType("genericMessage", _);
function SecurityLogType(value:String = null, restrictor:* = null) {
super((value || permissionDenied.name), restrictor);
}
override protected function getConstants():Array {
return constants;
}
public static function get constants():Array {
return [permissionDenied, unknownException, genericMessage];
}
public static function valueOf(name:String):SecurityLogType {
return SecurityLogType(permissionDenied.constantOf(name));
}
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface TestDataBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
import mx.collections.ListCollectionView;
public interface UserBeanLocal {
function get users():ListCollectionView;
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR. INSTEAD, EDIT THE INHERITED CLASS (UserBeanLocal.as).
*/
package fi.insomnia.bortal.beans {
import fi.insomnia.bortal.enums.Permission;
import fi.insomnia.bortal.enums.RolePermission;
import fi.insomnia.bortal.model.Event;
import fi.insomnia.bortal.model.User;
import mx.messaging.ChannelSet;
import mx.messaging.config.ServerConfig;
import mx.rpc.remoting.mxml.RemoteObject;
public class UserBeanLocalBase extends RemoteObject {
private var _initRemote:Boolean = false;
private function initRemote():void {
destination = "";
channelSet = new ChannelSet();
channelSet.addChannel(ServerConfig.getChannel(""));
_initRemote = true;
}
public function hasPermission(arg0:Permission, arg1:User, arg2:RolePermission):void {
if (!_initRemote)
initRemote();
getOperation("hasPermission").send(arg0, arg1, arg2);
}
public function getUsers():void {
if (!_initRemote)
initRemote();
getOperation("getUsers").send();
}
public function mergeChanges(arg0:User):void {
if (!_initRemote)
initRemote();
getOperation("mergeChanges").send(arg0);
}
public function getUser(arg0:String):void {
if (!_initRemote)
initRemote();
getOperation("getUser").send(arg0);
}
public function getDefaultUser(arg0:Event):void {
if (!_initRemote)
initRemote();
getOperation("getDefaultUser").send(arg0);
}
public function createNewUser(arg0:String, arg1:String):void {
if (!_initRemote)
initRemote();
getOperation("createNewUser").send(arg0, arg1);
}
public function getCurrentUser(arg0:Event):void {
if (!_initRemote)
initRemote();
getOperation("getCurrentUser").send(arg0);
}
public function isCurrentUser(arg0:User):void {
if (!_initRemote)
initRemote();
getOperation("isCurrentUser").send(arg0);
}
public function addOperationListener(op:Function, type:String, handler:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void {
if (op == this.hasPermission)
this.getOperation("hasPermission").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.getUsers)
this.getOperation("getUsers").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.mergeChanges)
this.getOperation("mergeChanges").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.getUser)
this.getOperation("getUser").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.getDefaultUser)
this.getOperation("getDefaultUser").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.createNewUser)
this.getOperation("createNewUser").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.getCurrentUser)
this.getOperation("getCurrentUser").addEventListener(type, handler, useCapture, priority, useWeakReference);
if (op == this.isCurrentUser)
this.getOperation("isCurrentUser").addEventListener(type, handler, useCapture, priority, useWeakReference);
}
public function removeOperationListener(op:Function, event:String, handler:Function):void {
if (op == this.hasPermission)
this.getOperation("hasPermission").removeEventListener(event, handler);
if (op == this.getUsers)
this.getOperation("getUsers").removeEventListener(event, handler);
if (op == this.mergeChanges)
this.getOperation("mergeChanges").removeEventListener(event, handler);
if (op == this.getUser)
this.getOperation("getUser").removeEventListener(event, handler);
if (op == this.getDefaultUser)
this.getOperation("getDefaultUser").removeEventListener(event, handler);
if (op == this.createNewUser)
this.getOperation("createNewUser").removeEventListener(event, handler);
if (op == this.getCurrentUser)
this.getOperation("getCurrentUser").removeEventListener(event, handler);
if (op == this.isCurrentUser)
this.getOperation("isCurrentUser").removeEventListener(event, handler);
}
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.enums {
import org.granite.util.Enum;
[Bindable]
[RemoteClass(alias="fi.insomnia.bortal.enums.BeanRole")]
public class BeanRole extends Enum {
public static const ANONYMOUS:BeanRole = new BeanRole("ANONYMOUS", _);
public static const USER_BASE:BeanRole = new BeanRole("USER_BASE", _);
public static const ADMIN_BASE:BeanRole = new BeanRole("ADMIN_BASE", _);
public static const SUPERADMIN:BeanRole = new BeanRole("SUPERADMIN", _);
public static const ORGANIZATION_ROOT:BeanRole = new BeanRole("ORGANIZATION_ROOT", _);
function BeanRole(value:String = null, restrictor:* = null) {
super((value || ANONYMOUS.name), restrictor);
}
override protected function getConstants():Array {
return constants;
}
public static function get constants():Array {
return [ANONYMOUS, USER_BASE, ADMIN_BASE, SUPERADMIN, ORGANIZATION_ROOT];
}
public static function valueOf(name:String):BeanRole {
return BeanRole(ANONYMOUS.constantOf(name));
}
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.enums {
import org.granite.util.Enum;
[Bindable]
[RemoteClass(alias="fi.insomnia.bortal.enums.EventStatusEnum")]
public class EventStatusEnum extends Enum {
public static const INACTIVE:EventStatusEnum = new EventStatusEnum("INACTIVE", _);
public static const TICKET_SALES:EventStatusEnum = new EventStatusEnum("TICKET_SALES", _);
public static const PRE_EVENT:EventStatusEnum = new EventStatusEnum("PRE_EVENT", _);
public static const RUNNING:EventStatusEnum = new EventStatusEnum("RUNNING", _);
public static const SPLITTED:EventStatusEnum = new EventStatusEnum("SPLITTED", _);
public static const ARCHIVED:EventStatusEnum = new EventStatusEnum("ARCHIVED", _);
function EventStatusEnum(value:String = null, restrictor:* = null) {
super((value || INACTIVE.name), restrictor);
}
override protected function getConstants():Array {
return constants;
}
public static function get constants():Array {
return [INACTIVE, TICKET_SALES, PRE_EVENT, RUNNING, SPLITTED, ARCHIVED];
}
public static function valueOf(name:String):EventStatusEnum {
return EventStatusEnum(INACTIVE.constantOf(name));
}
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.enums {
import org.granite.util.Enum;
[Bindable]
[RemoteClass(alias="fi.insomnia.bortal.enums.Permission")]
public class Permission extends Enum {
public static const PERMISSION:Permission = new Permission("PERMISSION", _);
public static const LOGIN:Permission = new Permission("LOGIN", _);
public static const USER_MANAGEMENT:Permission = new Permission("USER_MANAGEMENT", _);
public static const TICKET_SALES:Permission = new Permission("TICKET_SALES", _);
public static const ROLE_MANAGEMENT:Permission = new Permission("ROLE_MANAGEMENT", _);
function Permission(value:String = null, restrictor:* = null) {
super((value || PERMISSION.name), restrictor);
}
override protected function getConstants():Array {
return constants;
}
public static function get constants():Array {
return [PERMISSION, LOGIN, USER_MANAGEMENT, TICKET_SALES, ROLE_MANAGEMENT];
}
public static function valueOf(name:String):Permission {
return Permission(PERMISSION.constantOf(name));
}
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.enums {
import org.granite.util.Enum;
[Bindable]
[RemoteClass(alias="fi.insomnia.bortal.enums.RolePermission")]
public class RolePermission extends Enum {
public static const READ:RolePermission = new RolePermission("READ", _);
public static const WRITE:RolePermission = new RolePermission("WRITE", _);
public static const EXECUTE:RolePermission = new RolePermission("EXECUTE", _);
function RolePermission(value:String = null, restrictor:* = null) {
super((value || READ.name), restrictor);
}
override protected function getConstants():Array {
return constants;
}
public static function get constants():Array {
return [READ, WRITE, EXECUTE];
}
public static function valueOf(name:String):RolePermission {
return RolePermission(READ.constantOf(name));
}
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* NOTE: this file is only generated if it does not exist. You may safely put
* your custom code here.
*/
package fi.insomnia.bortal.exceptions {
[Bindable]
[RemoteClass(alias="fi.insomnia.bortal.exceptions.EjbPermissionDeniedException")]
public class EjbPermissionDeniedException extends EjbPermissionDeniedExceptionBase {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR. INSTEAD, EDIT THE INHERITED CLASS (EjbPermissionDeniedException.as).
*/
package fi.insomnia.bortal.exceptions {
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
import flash.utils.IExternalizable;
[Bindable]
public class EjbPermissionDeniedExceptionBase implements IExternalizable {
public function readExternal(input:IDataInput):void {
}
public function writeExternal(output:IDataOutput):void {
}
}
}
\ No newline at end of file
Manifest-Version: 1.0 Manifest-Version: 1.0
Class-Path: lib/LanBortalDatabase.jar Class-Path: lib/LanBortalDatabase.jar lib/granite.jar
...@@ -8,11 +8,14 @@ package fi.insomnia.bortal.beans; ...@@ -8,11 +8,14 @@ package fi.insomnia.bortal.beans;
import fi.insomnia.bortal.model.Place; import fi.insomnia.bortal.model.Place;
import javax.ejb.Local; import javax.ejb.Local;
import org.granite.messaging.service.annotations.RemoteDestination;
/** /**
* *
* @author tuukka * @author tuukka
*/ */
@Local @Local
@RemoteDestination
public interface PlaceBeanLocal { public interface PlaceBeanLocal {
public Place mergeChanges(Place place); public Place mergeChanges(Place place);
......
...@@ -6,6 +6,8 @@ import java.util.List; ...@@ -6,6 +6,8 @@ import java.util.List;
import javax.ejb.Local; import javax.ejb.Local;
import org.granite.messaging.service.annotations.RemoteDestination;
import fi.insomnia.bortal.exceptions.EjbPermissionDeniedException; import fi.insomnia.bortal.exceptions.EjbPermissionDeniedException;
import fi.insomnia.bortal.model.Event; import fi.insomnia.bortal.model.Event;
import fi.insomnia.bortal.model.EventMap; import fi.insomnia.bortal.model.EventMap;
...@@ -13,6 +15,7 @@ import fi.insomnia.bortal.model.Place; ...@@ -13,6 +15,7 @@ import fi.insomnia.bortal.model.Place;
import fi.insomnia.bortal.model.User; import fi.insomnia.bortal.model.User;
@Local @Local
@RemoteDestination
public interface PlaceMapBeanLocal { public interface PlaceMapBeanLocal {
void printPlaceMapToStream(OutputStream outputStream, String filetype, Event event, Integer mapId, List<Integer> placeIds) throws EjbPermissionDeniedException,IOException; void printPlaceMapToStream(OutputStream outputStream, String filetype, Event event, Integer mapId, List<Integer> placeIds) throws EjbPermissionDeniedException,IOException;
......
...@@ -5,11 +5,15 @@ ...@@ -5,11 +5,15 @@
package fi.insomnia.bortal.beans; package fi.insomnia.bortal.beans;
import fi.insomnia.bortal.model.Role;
import java.util.List; import java.util.List;
import javax.ejb.Local; import javax.ejb.Local;
import fi.insomnia.bortal.model.AccessRight;
import fi.insomnia.bortal.model.Event;
import fi.insomnia.bortal.model.Role;
import fi.insomnia.bortal.model.RoleRight;
/** /**
* *
* @author tuukka * @author tuukka
...@@ -25,4 +29,10 @@ public interface RoleBeanLocal { ...@@ -25,4 +29,10 @@ public interface RoleBeanLocal {
public List<Role> getPossibleParents(Role role); public List<Role> getPossibleParents(Role role);
public List<RoleRight> getEventRoleRights(Event e, Role r);
public RoleRight mergeChanges(RoleRight row);
} }
...@@ -20,4 +20,6 @@ public interface SecurityBeanLocal { ...@@ -20,4 +20,6 @@ public interface SecurityBeanLocal {
LogEntry logMessage(SecurityLogType type, String description); LogEntry logMessage(SecurityLogType type, String description);
LogEntry logPermissionDenied(User currentuser, String message);
} }
...@@ -28,4 +28,10 @@ public interface TestDataBeanLocal { ...@@ -28,4 +28,10 @@ public interface TestDataBeanLocal {
User createAdmin(); User createAdmin();
EventMap readMap(long bytes);
void writeMap(Event e, long bytes);
void flushMaps();
} }
...@@ -4,6 +4,8 @@ import java.util.List; ...@@ -4,6 +4,8 @@ import java.util.List;
import javax.ejb.Local; import javax.ejb.Local;
import org.granite.messaging.service.annotations.RemoteDestination;
import fi.insomnia.bortal.enums.Permission; import fi.insomnia.bortal.enums.Permission;
import fi.insomnia.bortal.enums.RolePermission; import fi.insomnia.bortal.enums.RolePermission;
import fi.insomnia.bortal.model.Event; import fi.insomnia.bortal.model.Event;
......
...@@ -2,12 +2,17 @@ ...@@ -2,12 +2,17 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/LanBortalUtilities"/> <classpathentry combineaccessrules="false" kind="src" path="/LanBortalUtilities"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish Server Open Source Edition 3 (Java EE 6)">
<attributes>
<attribute name="owner.project.facets" value="jst.utility"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6"/> <classpathentry kind="lib" path="/LanBortal/ExtraLibs/granite.jar"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
<?xml version="1.0" encoding="UTF-8"?>
<graniteProperties version="2.0">
<gas3 uid="uid" as3TypeFactory="org.granite.generator.as3.DefaultAs3TypeFactory" entityFactory="org.granite.generator.as3.DefaultEntityFactory" remoteDestinationFactory="org.granite.generator.as3.DefaultRemoteDestinationFactory" debugEnabled="false" flexConfig="false">
<source path="src" includes="" excludes="" output="../LanBortalWeb/as3;"/>
<template kind="ENTITY" uris="class:org/granite/generator/template/entity.gsp;class:org/granite/generator/template/entityBase.gsp"/>
<template kind="BEAN" uris="class:org/granite/generator/template/bean.gsp;class:org/granite/generator/template/beanBase.gsp"/>
<template kind="REMOTE_DESTINATION" uris="class:org/granite/generator/template/remote.gsp;class:org/granite/generator/template/remoteBase.gsp"/>
<template kind="INTERFACE" uris="class:org/granite/generator/template/interface.gsp"/>
<template kind="ENUM" uris="class:org/granite/generator/template/enum.gsp"/>
<transformer type="org.granite.generator.as3.JavaAs3GroovyTransformer"/>
</gas3>
</graniteProperties>
\ No newline at end of file
...@@ -31,11 +31,23 @@ ...@@ -31,11 +31,23 @@
</dictionary> </dictionary>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.granite.builder.granitebuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.axdt.as3.imp.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.granite.builder.granitenature</nature>
<nature>org.axdt.as3.imp.nature</nature>
</natures> </natures>
</projectDescription> </projectDescription>
#Thu Jul 15 02:45:50 EEST 2010
SOURCE_PATHS=../LanBortalWeb/as3
eclipse.preferences.version=1
#Sun Dec 20 03:33:41 EET 2009 #Thu Jul 15 01:17:01 EEST 2010
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jpt.core.discoverAnnotatedClasses=true org.eclipse.jpt.core.discoverAnnotatedClasses=true
org.eclipse.jpt.core.platform=eclipselink1_1 org.eclipse.jpt.core.platform=eclipselink2_1
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<runtime name="GlassFish Server Open Source Edition 3 (Java EE 6)"/>
<fixed facet="jst.utility"/> <fixed facet="jst.utility"/>
<fixed facet="jst.java"/> <fixed facet="jst.java"/>
<fixed facet="jpt.jpa"/> <fixed facet="jpt.jpa"/>
<installed facet="jst.java" version="6.0"/> <installed facet="jst.java" version="6.0"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="jpt.jpa" version="1.0"/> <installed facet="jpt.jpa" version="2.0"/>
</faceted-project> </faceted-project>
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* NOTE: this file is only generated if it does not exist. You may safely put
* your custom code here.
*/
package fi.insomnia.bortal.model {
[Bindable]
[RemoteClass(alias="fi.insomnia.bortal.model.Event")]
public class Event extends EventBase {
}
}
\ No newline at end of file
...@@ -13,4 +13,5 @@ ...@@ -13,4 +13,5 @@
<jar destfile="${LanBortalDatabase.jar}" basedir="build/classes" /> <jar destfile="${LanBortalDatabase.jar}" basedir="build/classes" />
</target> </target>
</project> </project>
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="both"/> <property name="eclipselink.ddl-generation.output-mode" value="both"/>
<property name="eclipselink.cache.type.default" value="NONE"/> <property name="eclipselink.cache.type.default" value="NONE"/>
<property name="eclipselink.logging.level" value="ALL"/>
</properties> </properties>
</persistence-unit> </persistence-unit>
......
...@@ -99,7 +99,7 @@ public class Event implements ModelInterface<Integer> { ...@@ -99,7 +99,7 @@ public class Event implements ModelInterface<Integer> {
private List<Role> roles; private List<Role> roles;
@Version @Version
@Column(nullable = false) @Column(nullable = true)
private int jpaVersionField = 0; private int jpaVersionField = 0;
@OneToMany(mappedBy = "event") @OneToMany(mappedBy = "event")
......
...@@ -28,6 +28,8 @@ import javax.persistence.Version; ...@@ -28,6 +28,8 @@ import javax.persistence.Version;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.utilities.apachecodec.binary.Base64;
/** /**
* *
*/ */
...@@ -44,10 +46,11 @@ public class EventMap implements EventChildInterface { ...@@ -44,10 +46,11 @@ public class EventMap implements EventChildInterface {
private EventPk id; private EventPk id;
@Lob @Lob
@Column(name = "map_data") @Column(name = "map_data")
private byte[] mapData; private String mapData;
@Column(name = "map_name") @Column(name = "map_name")
private String name; private String name;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "map") @OneToMany(cascade = CascadeType.ALL, mappedBy = "map")
private List<Place> places = new ArrayList<Place>(); private List<Place> places = new ArrayList<Place>();
@ManyToOne(optional = false) @ManyToOne(optional = false)
@JoinColumn(name = "event_id", referencedColumnName = "event_id", insertable = false, updatable = false, nullable = false) @JoinColumn(name = "event_id", referencedColumnName = "event_id", insertable = false, updatable = false, nullable = false)
...@@ -65,13 +68,6 @@ public class EventMap implements EventChildInterface { ...@@ -65,13 +68,6 @@ public class EventMap implements EventChildInterface {
this.id = new EventPk(event); this.id = new EventPk(event);
} }
public byte[] getMapData() {
return mapData;
}
public void setMapData(byte[] mapData) {
this.mapData = mapData;
}
public String getName() { public String getName() {
return name; return name;
...@@ -167,7 +163,7 @@ public class EventMap implements EventChildInterface { ...@@ -167,7 +163,7 @@ public class EventMap implements EventChildInterface {
public BufferedImage getMapWithPlaces() throws IOException { public BufferedImage getMapWithPlaces() throws IOException {
BufferedImage image = ImageIO.read(new ByteArrayInputStream(getMapData())); BufferedImage image = ImageIO.read(new ByteArrayInputStream(Base64.decodeBase64( getMapData())));
List<Place> myplaces = getPlaces(); List<Place> myplaces = getPlaces();
logger.info("Getting places in Event map {}, found {}", this, myplaces.size()); logger.info("Getting places in Event map {}, found {}", this, myplaces.size());
...@@ -197,4 +193,12 @@ public class EventMap implements EventChildInterface { ...@@ -197,4 +193,12 @@ public class EventMap implements EventChildInterface {
return null; return null;
} }
public void setMapData(String mapData) {
this.mapData = mapData;
}
public String getMapData() {
return mapData;
}
} }
...@@ -9,6 +9,7 @@ import java.util.List; ...@@ -9,6 +9,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -46,7 +47,7 @@ public class EventOrganiser implements ModelInterface<Integer> { ...@@ -46,7 +47,7 @@ public class EventOrganiser implements ModelInterface<Integer> {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "organiser") @OneToMany(cascade = CascadeType.ALL, mappedBy = "organiser")
private List<Event> events; private List<Event> events;
@ManyToOne @ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name = "admin_user_id", referencedColumnName = "user_id", nullable = false) @JoinColumn(name = "admin_user_id", referencedColumnName = "user_id", nullable = false)
private User admin; private User admin;
......
...@@ -31,6 +31,12 @@ public class EventPk implements Serializable { ...@@ -31,6 +31,12 @@ public class EventPk implements Serializable {
super(); super();
this.setEventId(eventId); this.setEventId(eventId);
} }
public EventPk(Integer eventId, Integer id)
{
super();
this.setEventId(eventId);
this.setId(id);
}
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
......
...@@ -17,14 +17,13 @@ import javax.persistence.NamedQueries; ...@@ -17,14 +17,13 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version; import javax.persistence.Version;
/** /**
* *
*/ */
@Entity @Entity
@Table(name = "event_log_types", uniqueConstraints = { @UniqueConstraint(columnNames = { "events_pk_id", "logentry_name" }) }) @Table(name = "event_log_types") //, uniqueConstraints = { @UniqueConstraint(columnNames = { "events_pk_id", "type_name" }) })
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "LogEntryType.findAll", query = "SELECT l FROM LogEntryType l"), @NamedQuery(name = "LogEntryType.findAll", query = "SELECT l FROM LogEntryType l"),
@NamedQuery(name = "LogEntryType.findByName", query = "SELECT l FROM LogEntryType l WHERE l.name = :name"), @NamedQuery(name = "LogEntryType.findByName", query = "SELECT l FROM LogEntryType l WHERE l.name = :name"),
...@@ -41,7 +40,7 @@ public class LogEntryType implements ModelInterface<Integer> { ...@@ -41,7 +40,7 @@ public class LogEntryType implements ModelInterface<Integer> {
/** /**
* Do not change this.. log entries are added to this field.. * Do not change this.. log entries are added to this field..
*/ */
@Column(name = "type_name", nullable = false, updatable = false) @Column(name = "type_name", nullable = false, updatable = false, unique = true)
private String name; private String name;
@Lob @Lob
......
...@@ -2,6 +2,12 @@ package fi.insomnia.bortal.model; ...@@ -2,6 +2,12 @@ package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.EntityListeners;
import org.granite.tide.data.DataPublishListener;
@EntityListeners(DataPublishListener.class)
public interface ModelInterface<T> extends Serializable { public interface ModelInterface<T> extends Serializable {
public T getId(); public T getId();
......
...@@ -27,7 +27,7 @@ import javax.persistence.Version; ...@@ -27,7 +27,7 @@ import javax.persistence.Version;
* *
*/ */
@Entity @Entity
@Table(name = "roles", uniqueConstraints = { @UniqueConstraint(columnNames = { "events_id", "role_name" }) }) @Table(name = "roles", uniqueConstraints = { @UniqueConstraint(columnNames = { "event_id", "role_name" }) })
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "Role.findAll", query = "SELECT r FROM Role r"), @NamedQuery(name = "Role.findAll", query = "SELECT r FROM Role r"),
@NamedQuery(name = "Role.findByRoleName", query = "SELECT r FROM Role r WHERE r.name = :name") }) @NamedQuery(name = "Role.findByRoleName", query = "SELECT r FROM Role r WHERE r.name = :name") })
......
...@@ -13,6 +13,7 @@ import javax.persistence.ManyToOne; ...@@ -13,6 +13,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version; import javax.persistence.Version;
/** /**
...@@ -20,20 +21,9 @@ import javax.persistence.Version; ...@@ -20,20 +21,9 @@ import javax.persistence.Version;
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "role_rights") @Table(name = "role_rights", uniqueConstraints = {@UniqueConstraint(columnNames = { "event_id","role_id", "access_right_id" })})
@NamedQueries( { @NamedQuery(name = "RoleRight.findAll", query = "SELECT r FROM RoleRight r") @NamedQueries( { @NamedQuery(name = "RoleRight.findAll", query = "SELECT r FROM RoleRight r"),
/* @NamedQuery(name = "RoleRight.findByRightAndRoleForEvent", query = "SELECT r FROM RoleRight r where r.role = :role and r.accessRight = :accessright and r.id.eventId = :event_id")})
* ,
*
* @ NamedQuery ( name = "RoleRight.findByRead" , query =
* "SELECT r FROM RoleRight r WHERE r.read = :read" ) ,
*
* @ NamedQuery ( name = "RoleRight.findByWrite" , query =
* "SELECT r FROM RoleRight r WHERE r.write = :write" ) ,
*
* @ NamedQuery ( name = "RoleRight.findByExecute" , query =
* "SELECT r FROM RoleRight r WHERE r.execute = :execute" )
*/})
public class RoleRight implements EventChildInterface { public class RoleRight implements EventChildInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -79,7 +69,7 @@ public class RoleRight implements EventChildInterface { ...@@ -79,7 +69,7 @@ public class RoleRight implements EventChildInterface {
this.execute = execute; this.execute = execute;
} }
public boolean getRead() { public boolean isRead() {
return read; return read;
} }
...@@ -87,7 +77,7 @@ public class RoleRight implements EventChildInterface { ...@@ -87,7 +77,7 @@ public class RoleRight implements EventChildInterface {
this.read = read; this.read = read;
} }
public boolean getWrite() { public boolean isWrite() {
return write; return write;
} }
......
...@@ -10,6 +10,7 @@ import java.util.List; ...@@ -10,6 +10,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -143,7 +144,7 @@ public class User implements ModelInterface<Integer> { ...@@ -143,7 +144,7 @@ public class User implements ModelInterface<Integer> {
/** /**
* The places this user has registered into. * The places this user has registered into.
*/ */
@OneToMany(mappedBy = "currentUser") @OneToMany(mappedBy = "currentUser", fetch=FetchType.LAZY)
private List<Place> currentPlaces; private List<Place> currentPlaces;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user") @OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
......
...@@ -24,11 +24,9 @@ import javax.persistence.Version; ...@@ -24,11 +24,9 @@ import javax.persistence.Version;
* A vote for a compo entry * A vote for a compo entry
*/ */
@Entity @Entity
@Table(name = "votes", uniqueConstraints = { @UniqueConstraint(columnNames = { @Table(name = "votes", uniqueConstraints = { @UniqueConstraint(columnNames = { "entry_id", "event_id", "voter_user_id" }) })
"entries_id", "users_id" }) }) @NamedQueries({
@NamedQueries( {
@NamedQuery(name = "Vote.findAll", query = "SELECT v FROM Vote v"), @NamedQuery(name = "Vote.findAll", query = "SELECT v FROM Vote v"),
@NamedQuery(name = "Vote.findByScore", query = "SELECT v FROM Vote v WHERE v.score = :score"), @NamedQuery(name = "Vote.findByScore", query = "SELECT v FROM Vote v WHERE v.score = :score"),
@NamedQuery(name = "Vote.findByTime", query = "SELECT v FROM Vote v WHERE v.time = :time") }) @NamedQuery(name = "Vote.findByTime", query = "SELECT v FROM Vote v WHERE v.time = :time") })
public class Vote implements EventChildInterface { public class Vote implements EventChildInterface {
...@@ -44,7 +42,7 @@ public class Vote implements EventChildInterface { ...@@ -44,7 +42,7 @@ public class Vote implements EventChildInterface {
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar time; private Calendar time;
@JoinColumns( { @JoinColumns({
@JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false, updatable = false, insertable = false), @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false, updatable = false, insertable = false),
@JoinColumn(name = "event_id", referencedColumnName = "event_id", nullable = false, updatable = false, insertable = false) }) @JoinColumn(name = "event_id", referencedColumnName = "event_id", nullable = false, updatable = false, insertable = false) })
@ManyToOne(optional = false) @ManyToOne(optional = false)
......
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>LanBortalFlash</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.axdt.as3.imp.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.axdt.as3.imp.nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
#Wed Jul 14 04:57:37 EEST 2010
DEPLOY_PATH=flashdeploy
LIBRARY_PATHS=flashlibs
SOURCE_PATHS=flashsrc
eclipse.preferences.version=1
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal {
public interface RealmBeanRemote {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface AccessRightBeanLocal {
}
}
\ No newline at end of file
/**
* Generated by Gas3 v2.1.0 (Granite Data Services).
*
* WARNING: DO NOT CHANGE THIS FILE. IT MAY BE OVERWRITTEN EACH TIME YOU USE
* THE GENERATOR.
*/
package fi.insomnia.bortal.beans {
public interface BillBeanLocal {
}
}
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!