Changeset 22834
- Timestamp:
- 09/09/10 10:57:49 (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mnw21/pathquery_refactor/intermine/perl/lib/InterMine/ItemFactory.pm
r22016 r22834 126 126 127 127 =cut 128 sub make_item 129 { 128 sub make_item { 130 129 my $self = shift; 131 130 my %args; 131 my %attr; 132 132 133 133 if (@_ == 1) { 134 $args{implements} = $_[0]; 134 $args{implements} = shift; 135 } elsif (@_ % 2 == 1) { 136 $args{implements} = shift; 137 %attr = @_; 135 138 } else { 136 139 %args = @_; … … 139 142 $self->{id_counter}++; 140 143 141 my $classname = ''; 142 if (defined $args{classname}) { 143 $classname = $args{classname}; 144 $classname = $args{classname} || ''; 145 $implements = $args{implements} || ''; 146 147 my $item = new InterMine::Item( 148 classname => $classname, 149 implements => $implements, 150 model => $self->{model}, 151 id => $self->{id_counter} 152 ); 153 154 while (my ($k, $v) = each %attr) { 155 $item->set($k, $v); 144 156 } 145 157 146 my $implements = ''; 147 if (defined $args{implements}) { 148 $implements = $args{implements}; 149 } 150 151 return new InterMine::Item(classname => $classname, implements => $implements, 152 model => $self->{model}, 153 id => $self->{id_counter}); 158 return $item; 154 159 } 155 160
Note: See TracChangeset
for help on using the changeset viewer.
