3 |
# $Id$ |
# $Id$ |
4 |
# |
# |
5 |
# $Log$ |
# $Log$ |
6 |
|
# Revision 1.49 2004/11/03 14:12:34 jonen |
7 |
|
# replaced print with logger->info |
8 |
|
# |
9 |
|
# Revision 1.48 2004/10/28 11:35:51 jonen |
10 |
|
# + bugfix related to select-criterias(filter) |
11 |
|
# |
12 |
|
# Revision 1.47 2004/08/31 14:26:08 jonen |
13 |
|
# updated |
14 |
|
# |
15 |
|
# Revision 1.46 2004/05/06 12:54:34 jonen |
16 |
|
# + bugfix related to multiple select-'filter' |
17 |
|
# |
18 |
|
# Revision 1.45 2003/12/14 01:48:36 jonen |
19 |
|
# small HACK at _insertChildNode: some special Childnodes should not be created because existing objects have to be selected! |
20 |
|
# TODO: make this more generic, e.g. implement a special flag at Schema |
21 |
|
# |
22 |
# Revision 1.44 2003/12/04 01:01:50 joko |
# Revision 1.44 2003/12/04 01:01:50 joko |
23 |
# + sendQuery now returns result even on crud=UPDATE |
# + sendQuery now returns result even on crud=UPDATE |
24 |
# |
# |
541 |
my @results; |
my @results; |
542 |
$logger->debug( __PACKAGE__ . "->getListFiltered( nodename => '" . $in->{nodename} . "' )" ); |
$logger->debug( __PACKAGE__ . "->getListFiltered( nodename => '" . $in->{nodename} . "' )" ); |
543 |
|
|
544 |
#print Dumper($filters); |
#print "Filter_payload: " . Dumper($in->{filters}) . "\n"; |
545 |
|
|
546 |
# 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 |
547 |
my $remote = $self->{_COREHANDLE}->remote($in->{nodename}); |
my $remote = $self->{_COREHANDLE}->remote($in->{nodename}); |
597 |
$orm_filter_tmp = $left->$op($right); |
$orm_filter_tmp = $left->$op($right); |
598 |
} |
} |
599 |
|
|
600 |
if (not $orm_filter) { |
if (!ref($orm_filter)) { |
601 |
$orm_filter = $orm_filter_tmp; |
$orm_filter = $orm_filter_tmp; |
602 |
} else { |
} else { |
603 |
$orm_filter = $orm_filter->and($orm_filter_tmp); |
$orm_filter = $orm_filter->and($orm_filter_tmp); |
606 |
} |
} |
607 |
|
|
608 |
$orm_query->{filter} = $orm_filter; |
$orm_query->{filter} = $orm_filter; |
609 |
|
|
610 |
|
# debug point: |
611 |
|
#print "Filter: " . Dumper($orm_query->{filter}) . "\n"; |
612 |
|
|
613 |
# was: |
# was: |
614 |
|
|
730 |
|
|
731 |
} elsif (my $guid = $query->{options}->{GUID}) { |
} elsif (my $guid = $query->{options}->{GUID}) { |
732 |
$type = 'TRANSPARENT'; |
$type = 'TRANSPARENT'; |
733 |
$query->{criterias} = [ { key => 'guid', op => 'eq', val => $guid } ]; |
if(ref($query->{criterias}) eq 'ARRAY') { |
734 |
|
push @{$query->{criterias}}, { key => 'guid', op => 'eq', val => $guid }; |
735 |
|
} else { |
736 |
|
$query->{criterias} = [ { key => 'guid', op => 'eq', val => $guid } ]; |
737 |
|
} |
738 |
|
} |
739 |
# if operator is different (dispatcher for 'getListFiltered') |
# if operator is different (dispatcher for 'getListFiltered') |
740 |
} elsif (my $op = $query->{options}->{op}) { |
if (my $op = $query->{options}->{op}) { |
741 |
$type = 'TRANSPARENT'; |
$type = 'TRANSPARENT'; |
742 |
$query->{criterias} = [ { key => $query->{options}->{meta_label}, op => $op, val => $query->{options}->{meta_value} } ]; |
if(ref($query->{criterias}) eq 'ARRAY') { |
743 |
|
push @{$query->{criterias}}, { key => $query->{options}->{meta_label}, op => $op, val => $query->{options}->{meta_value} }; |
744 |
|
} else { |
745 |
|
$query->{criterias} = [ { key => $query->{options}->{meta_label}, op => $op, val => $query->{options}->{meta_value} } ]; |
746 |
|
} |
747 |
} |
} |
748 |
|
|
749 |
# HACK: special case: querying by id does not translate into a common tangram query |
# HACK: special case: querying by id does not translate into a common tangram query |
857 |
my $object = $cursor->getNextEntry(); |
my $object = $cursor->getNextEntry(); |
858 |
|
|
859 |
$self->erase($object); |
$self->erase($object); |
860 |
|
$self->unload($object); |
861 |
|
|
862 |
} elsif ($crud eq 'CREATE') { |
} elsif ($crud eq 'CREATE') { |
863 |
|
|
864 |
my $nodename = $query->{node}; |
my $nodename = $query->{node}; |
865 |
my $newnode = $self->createNode($nodename); |
my $newnode = $self->createNode($nodename); |
866 |
my $id = $self->{_COREHANDLE}->insert($newnode); |
my $id = $self->{_COREHANDLE}->insert($newnode); |
867 |
|
|
868 |
print "Saved new node $nodename with GUID $newnode->{guid}, OID '$id': " . Dumper($newnode) . "\n"; |
$logger->info( __PACKAGE__ . "->sendQuery: Saved new node $nodename with GUID $newnode->{guid}, OID '$id'."); |
869 |
|
|
870 |
return $newnode; |
return $newnode; |
871 |
|
|
1047 |
$obj->{$_} = '0000-00-00 00:00:00'; |
$obj->{$_} = '0000-00-00 00:00:00'; |
1048 |
} elsif($attr_types->{$_} eq 'ref') { |
} elsif($attr_types->{$_} eq 'ref') { |
1049 |
if($attr_options->{$_}->{class}) { |
if($attr_options->{$_}->{class}) { |
1050 |
$obj->{$_} = $self->createNode($attr_options->{$_}->{class}); |
# HACK!!! |
1051 |
|
# STANDALONE Objects (objects which make sense to instanciat alone) should not created automaticly |
1052 |
|
# because they maybe exists and should only be SETTED not CREATED! |
1053 |
|
# TODO: Create a flag at the scheme for that reason! |
1054 |
|
# (e.g child_node => 1 for child-nodes only like e.g. UserData) |
1055 |
|
if($attr_options->{$_}->{class} eq 'NetPerson' || $attr_options->{$_}->{class} eq 'Event' || $attr_options->{$_}->{class} eq 'BetRule') { |
1056 |
|
#$obj->{$_} = undef(); |
1057 |
|
} else { |
1058 |
|
$obj->{$_} = $self->createNode($attr_options->{$_}->{class}); |
1059 |
|
} |
1060 |
} else { |
} else { |
1061 |
#$obj->{$_} = undef(); |
#$obj->{$_} = undef(); |
1062 |
} |
} |