Convert ThingyRecord over to Moose.

This commit is contained in:
Colin Kuskie 2010-11-10 09:58:08 -08:00
parent 2ad9fc1c16
commit 882317c2c9

View file

@ -34,51 +34,45 @@ for a list of base methods that are available.
=cut
use base 'WebGUI::Crud';
#----------------------------------------------------------------
=head2 crud_definition ($session)
Defintion subroutine to set up CRUD.
=cut
sub crud_definition {
my ($class, $session) = @_;
my $definition = $class->SUPER::crud_definition($session);
$definition->{tableName} = 'ThingyRecord_record';
$definition->{tableKey} = 'recordId';
my $properties = $definition->{properties};
$properties->{transactionId} = {
fieldType => "hidden",
defaultValue => undef,
};
$properties->{assetId} = {
fieldType => "hidden",
defaultValue => undef,
};
$properties->{expires} = {
fieldType => "DateTime",
defaultValue => 0,
};
$properties->{userId} = {
fieldType => "hidden",
defaultValue => undef,
};
$properties->{fields} = {
fieldType => 'textarea',
defaultValue => '',
};
$properties->{isHidden} = {
fieldType => 'yesNo',
defaultValue => 0,
};
$properties->{sentExpiresNotice} = {
fieldType => 'yesNo',
defaultValue => 0,
};
return $definition;
}
use Moose;
use WebGUI::Definition::Crud;
extends 'WebGUI::Crud';
define tableName => 'ThingyRecord_record';
define tableKey => 'recordId';
has recordId => (
required => 1,
is => 'ro',
);
property transactionId => (
label => 'transactionId',
fieldType => "hidden",
);
property assetId => (
label => 'assetId',
fieldType => "hidden",
);
property expires => (
label => 'expires',
fieldType => "DateTime",
);
property userId => (
label => 'userId',
fieldType => "hidden",
);
property fields => (
label => 'fields',
fieldType => 'textarea',
default => '',
);
property isHidden => (
label => 'isHidden',
fieldType => 'yesNo',
default => 0,
);
property sentExpiresNotice => (
label => 'sentExpiresNotice',
fieldType => 'yesNo',
default => 0,
);
1;