Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1730f446
authored
Aug 24, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unohtui edellisestä.
1 parent
3081bf18
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
448 additions
and
0 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/VerkkomaksuRunner.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/LanEventPrivatePropertyFacade.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LanEventPrivateProperty.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LanEventPrivatePropertyKey.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LanEventPrivateProperty_.java
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/apps/EventPermission.java
code/LanBortalWeb/WebContent/bill/showBill.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/CurrentEventorgEventConverter.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/MapConverter.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/VerkkomaksuRunner.java
0 → 100644
View file @
1730f44
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.util.Calendar
;
import
javax.annotation.security.RunAs
;
import
javax.ejb.EJB
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
fi.insomnia.bortal.enums.apps.SpecialPermission
;
import
fi.insomnia.bortal.model.Bill
;
@Stateless
@LocalBean
@RunAs
(
SpecialPermission
.
S_VERKKOMAKSU_CHECK
)
public
class
VerkkomaksuRunner
{
@EJB
private
BillBeanLocal
billbean
;
public
void
markPaid
(
Bill
bill
,
Calendar
when
)
{
billbean
.
markPaid
(
bill
,
when
);
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/LanEventPrivatePropertyFacade.java
0 → 100644
View file @
1730f44
package
fi
.
insomnia
.
bortal
.
facade
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
import
fi.insomnia.bortal.beans.EventBeanLocal
;
import
fi.insomnia.bortal.model.LanEventPrivateProperty
;
import
fi.insomnia.bortal.model.LanEventPrivatePropertyKey
;
import
fi.insomnia.bortal.model.LanEventPrivateProperty_
;
/**
* Session Bean implementation class EventUserFacade
*/
@Stateless
@LocalBean
public
class
LanEventPrivatePropertyFacade
extends
IntegerPkGenericFacade
<
LanEventPrivateProperty
>
{
public
LanEventPrivatePropertyFacade
()
{
super
(
LanEventPrivateProperty
.
class
);
}
@EJB
private
EventBeanLocal
eventbean
;
public
LanEventPrivateProperty
getPropertyForEvent
(
LanEventPrivatePropertyKey
key
)
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
LanEventPrivateProperty
>
cq
=
cb
.
createQuery
(
LanEventPrivateProperty
.
class
);
Root
<
LanEventPrivateProperty
>
root
=
cq
.
from
(
LanEventPrivateProperty
.
class
);
cq
.
where
(
cb
.
equal
(
root
.
get
(
LanEventPrivateProperty_
.
event
),
eventbean
.
getCurrentEvent
()),
cb
.
equal
(
root
.
get
(
LanEventPrivateProperty_
.
key
),
key
));
return
super
.
getSingleNullableResult
(
getEm
().
createQuery
(
cq
));
}
public
List
<
LanEventPrivateProperty
>
findAllForEvent
()
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
LanEventPrivateProperty
>
cq
=
cb
.
createQuery
(
getEntityClass
());
Root
<
LanEventPrivateProperty
>
root
=
cq
.
from
(
getEntityClass
());
cq
.
where
(
cb
.
equal
(
root
.
get
(
LanEventPrivateProperty_
.
event
),
eventbean
.
getCurrentEvent
()));
return
getEm
().
createQuery
(
cq
).
getResultList
();
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LanEventPrivateProperty.java
0 → 100644
View file @
1730f44
package
fi
.
insomnia
.
bortal
.
model
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.EnumType
;
import
javax.persistence.Enumerated
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
javax.persistence.UniqueConstraint
;
@Entity
@Table
(
name
=
"event_private_properties"
,
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
LanEventPrivateProperty
.
EVENT_ID_COLUMN
,
LanEventPrivateProperty
.
KEY_COLUMN
}),
@UniqueConstraint
(
columnNames
=
{
LanEventPrivateProperty
.
EVENTORG_ID_COLUMN
,
LanEventPrivateProperty
.
KEY_COLUMN
}),
})
public
class
LanEventPrivateProperty
extends
GenericEntity
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
protected
static
final
String
KEY_COLUMN
=
"key"
;
protected
static
final
String
EVENT_ID_COLUMN
=
"event_id"
;
protected
static
final
String
EVENTORG_ID_COLUMN
=
"organisation_id"
;
@ManyToOne
()
@JoinColumn
(
name
=
EVENTORG_ID_COLUMN
,
nullable
=
true
)
private
EventOrganiser
eventorg
;
@ManyToOne
()
@JoinColumn
(
name
=
EVENT_ID_COLUMN
,
nullable
=
true
)
private
LanEvent
event
;
@Column
(
name
=
KEY_COLUMN
,
nullable
=
false
)
@Enumerated
(
EnumType
.
STRING
)
private
LanEventPrivatePropertyKey
key
;
@Lob
@Column
(
name
=
"description"
)
private
String
description
;
@Column
(
name
=
"boolean_value"
)
private
boolean
booleanValue
;
@Column
(
name
=
"text_value"
)
@Lob
private
String
textvalue
;
@Column
(
precision
=
30
,
scale
=
8
,
name
=
"decimal_value"
)
private
BigDecimal
decimalValue
;
@Column
(
name
=
"long_value"
)
private
Long
longValue
;
@Column
(
name
=
"byte_mime"
)
private
String
byteMime
;
@Column
(
name
=
"byte_value"
)
@Lob
private
byte
[]
byteValue
;
@Column
(
name
=
"date_value"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
dateValue
;
public
LanEvent
getEvent
()
{
return
event
;
}
public
void
setEvent
(
LanEvent
event
)
{
this
.
event
=
event
;
}
public
LanEventPrivatePropertyKey
getKey
()
{
return
key
;
}
public
void
setKey
(
LanEventPrivatePropertyKey
key
)
{
this
.
key
=
key
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
boolean
isBooleanValue
()
{
return
booleanValue
;
}
public
void
setBooleanValue
(
boolean
booleanValue
)
{
this
.
booleanValue
=
booleanValue
;
}
public
String
getTextvalue
()
{
return
textvalue
;
}
public
void
setTextvalue
(
String
textvalue
)
{
this
.
textvalue
=
textvalue
;
}
public
BigDecimal
getDecimalValue
()
{
return
decimalValue
;
}
public
void
setDecimalValue
(
BigDecimal
decimalValue
)
{
this
.
decimalValue
=
decimalValue
;
}
public
Long
getLongValue
()
{
return
longValue
;
}
public
void
setLongValue
(
Long
longValue
)
{
this
.
longValue
=
longValue
;
}
public
String
getByteMime
()
{
return
byteMime
;
}
public
void
setByteMime
(
String
byteMime
)
{
this
.
byteMime
=
byteMime
;
}
public
byte
[]
getByteValue
()
{
return
byteValue
;
}
public
void
setByteValue
(
byte
[]
byteValue
)
{
this
.
byteValue
=
byteValue
;
}
public
Date
getDateValue
()
{
return
dateValue
;
}
public
void
setDateValue
(
Date
dateValue
)
{
this
.
dateValue
=
dateValue
;
}
public
EventOrganiser
getEventorg
()
{
return
eventorg
;
}
public
void
setEventorg
(
EventOrganiser
eventorg
)
{
this
.
eventorg
=
eventorg
;
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LanEventPrivatePropertyKey.java
0 → 100644
View file @
1730f44
package
fi
.
insomnia
.
bortal
.
model
;
// Private data that should never be allowed out of the EJB layer!
public
enum
LanEventPrivatePropertyKey
{
VERKKOMAKSU_KEY_EXPIRE
(
Type
.
DATE
,
null
),
VERKKOMAKSU_MERCHANT_ID
(
Type
.
TEXT
,
null
),
VERKKOMAKSU_MERCHANT_PASSWORD
(
Type
.
TEXT
,
null
),
;
private
enum
Type
{
TEXT
,
DATE
,
DATA
};
private
final
String
defaultvalue
;
private
final
Type
type
;
public
boolean
isText
()
{
return
Type
.
TEXT
.
equals
(
type
);
}
public
boolean
isDate
()
{
return
Type
.
DATE
.
equals
(
type
);
}
public
boolean
isData
()
{
return
Type
.
DATA
.
equals
(
type
);
}
private
LanEventPrivatePropertyKey
(
Type
t
,
String
def
)
{
this
.
type
=
t
;
defaultvalue
=
def
;
}
public
String
getDefaultvalue
()
{
return
defaultvalue
;
}
public
Type
getType
()
{
return
type
;
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LanEventPrivateProperty_.java
0 → 100644
View file @
1730f44
package
fi
.
insomnia
.
bortal
.
model
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
javax.annotation.Generated
;
import
javax.persistence.metamodel.SingularAttribute
;
import
javax.persistence.metamodel.StaticMetamodel
;
@Generated
(
value
=
"Dali"
,
date
=
"2012-08-23T03:32:15.378+0300"
)
@StaticMetamodel
(
LanEventPrivateProperty
.
class
)
public
class
LanEventPrivateProperty_
extends
GenericEntity_
{
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
EventOrganiser
>
eventorg
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
LanEvent
>
event
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
LanEventPrivatePropertyKey
>
key
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
String
>
description
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
Boolean
>
booleanValue
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
String
>
textvalue
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
BigDecimal
>
decimalValue
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
Long
>
longValue
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
String
>
byteMime
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
byte
[]>
byteValue
;
public
static
volatile
SingularAttribute
<
LanEventPrivateProperty
,
Date
>
dateValue
;
}
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/apps/EventPermission.java
0 → 100644
View file @
1730f44
package
fi
.
insomnia
.
bortal
.
enums
.
apps
;
import
fi.insomnia.bortal.enums.BortalApplication
;
public
enum
EventPermission
implements
IAppPermission
{
MANAGE_PROPERTIES
,
MANAGE_PRIVATE_PROPERTIES
,
;
public
static
final
String
S_MANAGE_PROPERTIES
=
"EVENT/MANAGE_PROPERTIES"
;
public
static
final
String
S_MANAGE_PRIVATE_PROPERTIES
=
"EVENT/MANAGE_PRIVATE_PROPERTIES"
;
private
final
String
fullName
;
private
final
String
key
;
private
static
final
String
I18N_HEADER
=
"bortalApplication.event."
;
private
EventPermission
()
{
fullName
=
new
StringBuilder
().
append
(
getParent
().
toString
()).
append
(
DELIMITER
).
append
(
toString
()).
toString
();
key
=
I18N_HEADER
+
name
();
}
@Override
public
BortalApplication
getParent
()
{
return
BortalApplication
.
EVENT
;
}
@Override
public
String
getFullName
()
{
return
fullName
;
}
@Override
public
String
getI18nKey
()
{
return
key
;
}
}
code/LanBortalWeb/WebContent/bill/showBill.xhtml
0 → 100644
View file @
1730f44
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
xmlns:bill=
"http://java.sun.com/jsf/composite/cditools/bills"
xmlns:f=
"http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:viewParam
name=
"billid"
value=
"#{billEditView.billid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{billEditView.initView}"
/>
</f:metadata>
<ui:define
name=
"title"
>
<h1>
#{i18n['page.bill.show.header']}
</h1>
</ui:define>
<ui:define
name=
"content"
>
<ui:fragment
rendered=
"#{billEditView.bill.paid}"
>
<h:outputText
value=
"#{i18n['bill.billIsPaid']}"
/>
<br
/>
<h:outputText
value=
"#{i18n['bill.billPaidDate']}"
/>
:
<h:outputText
value=
"#{billEditView.bill.paidDate}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
</ui:fragment>
<bill:showBill
bill=
"#{billEditView.bill}"
/>
<ui:fragment
rendered=
"#{!billEditView.bill.paid and billEditView.verkkomaksuAvailable}"
>
<div
id=
"svm-payment"
>
<a
href=
"#{billEditView.verkkomaksuToken.url}"
>
</a>
</div>
<script
type=
"text/javascript"
src=
"//payment.verkkomaksut.fi/js/sv-widget.min.js"
></script>
<script
type=
"text/javascript"
>
SV
.
widget
.
initWithToken
(
'svm-payment'
,
'#{billEditView.verkkomaksuToken.token}'
,
{
width
:
'800'
});
</script>
</ui:fragment>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/CurrentEventorgEventConverter.java
0 → 100644
View file @
1730f44
package
fi
.
insomnia
.
bortal
.
web
.
converter
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.RequestScoped
;
import
javax.inject.Named
;
import
fi.insomnia.bortal.beans.EventBeanLocal
;
import
fi.insomnia.bortal.model.LanEvent
;
import
fi.insomnia.bortal.utilities.jsf.GenericIntegerEntityConverter
;
@Named
()
@RequestScoped
public
class
CurrentEventorgEventConverter
extends
GenericIntegerEntityConverter
<
LanEvent
>
{
@EJB
private
EventBeanLocal
eventbean
;
@Override
protected
LanEvent
find
(
Integer
id
)
{
LanEvent
ret
=
null
;
LanEvent
curr
=
eventbean
.
getCurrentEvent
();
if
(
curr
.
getId
().
equals
(
id
))
{
ret
=
curr
;
}
else
{
for
(
LanEvent
e
:
curr
.
getOrganiser
().
getEvents
())
{
if
(
e
.
getId
().
equals
(
id
))
{
ret
=
e
;
break
;
}
}
}
return
ret
;
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/MapConverter.java
0 → 100644
View file @
1730f44
package
fi
.
insomnia
.
bortal
.
web
.
converter
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.RequestScoped
;
import
javax.inject.Named
;
import
fi.insomnia.bortal.beans.EventMapBeanLocal
;
import
fi.insomnia.bortal.model.EventMap
;
import
fi.insomnia.bortal.utilities.jsf.GenericIntegerEntityConverter
;
@Named
()
@RequestScoped
public
class
MapConverter
extends
GenericIntegerEntityConverter
<
EventMap
>
{
@EJB
private
EventMapBeanLocal
mapBean
;
@Override
protected
EventMap
find
(
Integer
id
)
{
return
mapBean
.
find
(
id
);
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment