/[cvs]/nfo/perl/libs/Data/Storage/Handler/Tangram.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Storage/Handler/Tangram.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.44 by joko, Thu Dec 4 01:01:50 2003 UTC revision 1.49 by jonen, Wed Nov 3 14:12:34 2004 UTC
# Line 3  Line 3 
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  #  #
# Line 525  sub getListFiltered { Line 541  sub getListFiltered {
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});
# Line 581  sub getListFiltered { Line 597  sub getListFiltered {
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);
# Line 590  sub getListFiltered { Line 606  sub getListFiltered {
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    
# Line 711  sub sendQuery { Line 730  sub sendQuery {
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
# Line 831  sub sendQuery { Line 857  sub sendQuery {
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    
# Line 1020  sub createNode { Line 1047  sub createNode {
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        }        }

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.49

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed