3 |
# $Id$ |
# $Id$ |
4 |
# |
# |
5 |
# $Log$ |
# $Log$ |
6 |
|
# Revision 1.47 2004/08/31 14:26:08 jonen |
7 |
|
# updated |
8 |
|
# |
9 |
|
# Revision 1.46 2004/05/06 12:54:34 jonen |
10 |
|
# + bugfix related to multiple select-'filter' |
11 |
|
# |
12 |
|
# Revision 1.45 2003/12/14 01:48:36 jonen |
13 |
|
# small HACK at _insertChildNode: some special Childnodes should not be created because existing objects have to be selected! |
14 |
|
# TODO: make this more generic, e.g. implement a special flag at Schema |
15 |
|
# |
16 |
|
# Revision 1.44 2003/12/04 01:01:50 joko |
17 |
|
# + sendQuery now returns result even on crud=UPDATE |
18 |
|
# |
19 |
|
# Revision 1.43 2003/07/02 11:07:12 jonen |
20 |
|
# re-activate filtering of results *after* results are fetched from tangram |
21 |
|
# (needed for e.g. UserManagment) |
22 |
|
# |
23 |
# Revision 1.42 2003/07/01 23:24:17 joko |
# Revision 1.42 2003/07/01 23:24:17 joko |
24 |
# now using package before using function |
# now using package before using function |
25 |
# |
# |
196 |
# get logger instance |
# get logger instance |
197 |
my $logger = Log::Dispatch::Config->instance; |
my $logger = Log::Dispatch::Config->instance; |
198 |
|
|
199 |
|
#$Tangram::TRACE = *STDOUT; |
200 |
|
|
201 |
# this holds the complete instantiated schema from tangram |
# this holds the complete instantiated schema from tangram |
202 |
my $schema_tangram; |
my $schema_tangram; |
535 |
my @results; |
my @results; |
536 |
$logger->debug( __PACKAGE__ . "->getListFiltered( nodename => '" . $in->{nodename} . "' )" ); |
$logger->debug( __PACKAGE__ . "->getListFiltered( nodename => '" . $in->{nodename} . "' )" ); |
537 |
|
|
538 |
#print Dumper($filters); |
#print "Filter_payload: " . Dumper($in->{filters}) . "\n"; |
539 |
|
|
540 |
# 1. "Remote Object Handle" - get set of objects from odbms by object name |
# 1. "Remote Object Handle" - get set of objects from odbms by object name |
541 |
my $remote = $self->{_COREHANDLE}->remote($in->{nodename}); |
my $remote = $self->{_COREHANDLE}->remote($in->{nodename}); |
591 |
$orm_filter_tmp = $left->$op($right); |
$orm_filter_tmp = $left->$op($right); |
592 |
} |
} |
593 |
|
|
594 |
if (not $orm_filter) { |
if (!ref($orm_filter)) { |
595 |
$orm_filter = $orm_filter_tmp; |
$orm_filter = $orm_filter_tmp; |
596 |
} else { |
} else { |
597 |
$orm_filter = $orm_filter->and($orm_filter_tmp); |
$orm_filter = $orm_filter->and($orm_filter_tmp); |
600 |
} |
} |
601 |
|
|
602 |
$orm_query->{filter} = $orm_filter; |
$orm_query->{filter} = $orm_filter; |
603 |
|
|
604 |
|
# debug point: |
605 |
|
#print "Filter: " . Dumper($orm_query->{filter}) . "\n"; |
606 |
|
|
607 |
# was: |
# was: |
608 |
|
|
640 |
#@results = eval($evalstring); |
#@results = eval($evalstring); |
641 |
#die $@ if $@; |
#die $@ if $@; |
642 |
|
|
643 |
=pod |
# filter results - NEEDED for e.g. UserManagment !! |
644 |
# filter results |
if ($in->{filters}->[0]->{op} && ($in->{filters}->[0]->{op} eq "ref")) { |
|
if ($filters->[0]->{op} && ($filters->[0]->{op} eq "ref")) { |
|
645 |
#print "Filter->op eq 'ref'.\n"; |
#print "Filter->op eq 'ref'.\n"; |
646 |
my $att_name = $filters->[0]->{key}; |
my $att_name = $in->{filters}->[0]->{key}; |
647 |
my $att_val = $filters->[0]->{val}; |
my $att_val = $in->{filters}->[0]->{val}; |
648 |
my @filtered; |
my @filtered; |
649 |
foreach(@results) { |
foreach(@results) { |
650 |
if(ref($_->{$att_name}) eq $att_val) { |
if(ref($_->{$att_name}) eq $att_val) { |
653 |
} |
} |
654 |
@results = @filtered; |
@results = @filtered; |
655 |
} |
} |
|
=cut |
|
656 |
|
|
657 |
#print "results: " . Dumper(\@results); |
#print "results: " . Dumper(\@results); |
658 |
|
|
826 |
my $options = { utf8 => 1, php => 1 }; |
my $options = { utf8 => 1, php => 1 }; |
827 |
merge_to($object, $query->{payload}, $options); |
merge_to($object, $query->{payload}, $options); |
828 |
|
|
829 |
|
#print Dumper($object); |
830 |
|
|
831 |
# Execute update operation at orm. |
# Execute update operation at orm. |
832 |
$self->update($object); |
$self->update($object); |
833 |
|
$result = $self->createResult([ $object ]); |
834 |
|
|
835 |
} elsif ($crud eq 'DELETE') { |
} elsif ($crud eq 'DELETE') { |
836 |
|
|
844 |
my $object = $cursor->getNextEntry(); |
my $object = $cursor->getNextEntry(); |
845 |
|
|
846 |
$self->erase($object); |
$self->erase($object); |
847 |
|
$self->unload($object); |
848 |
|
|
849 |
} elsif ($crud eq 'CREATE') { |
} elsif ($crud eq 'CREATE') { |
850 |
|
|
1034 |
$obj->{$_} = '0000-00-00 00:00:00'; |
$obj->{$_} = '0000-00-00 00:00:00'; |
1035 |
} elsif($attr_types->{$_} eq 'ref') { |
} elsif($attr_types->{$_} eq 'ref') { |
1036 |
if($attr_options->{$_}->{class}) { |
if($attr_options->{$_}->{class}) { |
1037 |
$obj->{$_} = $self->createNode($attr_options->{$_}->{class}); |
# HACK!!! |
1038 |
|
# STANDALONE Objects (objects which make sense to instanciat alone) should not created automaticly |
1039 |
|
# because they maybe exists and should only be SETTED not CREATED! |
1040 |
|
# TODO: Create a flag at the scheme for that reason! |
1041 |
|
# (e.g child_node => 1 for child-nodes only like e.g. UserData) |
1042 |
|
if($attr_options->{$_}->{class} eq 'NetPerson' || $attr_options->{$_}->{class} eq 'Event' || $attr_options->{$_}->{class} eq 'BetRule') { |
1043 |
|
#$obj->{$_} = undef(); |
1044 |
|
} else { |
1045 |
|
$obj->{$_} = $self->createNode($attr_options->{$_}->{class}); |
1046 |
|
} |
1047 |
} else { |
} else { |
1048 |
#$obj->{$_} = undef(); |
#$obj->{$_} = undef(); |
1049 |
} |
} |