[mb-commits] r10279 - in mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server: . Model Moderation

root at musicbrainz.org root at musicbrainz.org
Mon Sep 1 23:39:18 UTC 2008


Author: acid2
Date: 2008-09-01 23:39:18 +0000 (Mon, 01 Sep 2008)
New Revision: 10279

Modified:
   mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Annotation.pm
   mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Model/Annotation.pm
   mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_ARTIST_ANNOTATION.pm
   mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_LABEL_ANNOTATION.pm
   mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_RELEASE_ANNOTATION.pm
   mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_TRACK_ANNOTATION.pm
Log:
[GS]etChangeLog -> change_log
[GS]etEntity -> entity_id

Both in Annotation

Modified: mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Annotation.pm
===================================================================
--- mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Annotation.pm	2008-09-01 23:38:36 UTC (rev 10278)
+++ mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Annotation.pm	2008-09-01 23:39:18 UTC (rev 10279)
@@ -93,14 +93,31 @@
     return $self->{moderation};
 }
 
-sub GetChangeLog
+sub change_log
 {
-	return $_[0]->{changelog};
+    my ($self, $new_change_log) = @_;
+
+    if (defined $new_change_log) { $self->{changelog} = $new_change_log; }
+    return $self->{changelog};
 }
 
-sub GetEntity
+sub entity_id
 {
-	return $_[0]->{rowid};
+    my ($self, $new_id, $entity_type) = @_;
+
+    if (defined $new_id and defined $entity_type)
+    {
+        use Switch;
+        switch ($entity_type)
+        {
+            case('artist')  { $self->SetArtist($new_id); }
+            case('label')   { $self->SetLabel($new_id); }
+            case('release') { $self->SetRelease($new_id); }
+            case('track')   { $self->SetTrack($new_id); }
+        }
+    }
+
+	return $self->{rowid};
 }
 
 sub GetRelease
@@ -198,11 +215,6 @@
 	$text;
 }
 
-sub SetChangeLog
-{
-	$_[0]->{changelog} = $_[1];
-}
-
 sub SetRelease
 {
 	$_[0]->{type} = RELEASE_ANNOTATION;
@@ -227,20 +239,6 @@
 	$_[0]->{rowid} = $_[1];
 }
 
-sub SetEntity
-{
-    my ($self, $entity_type, $entity_id) = @_;
-
-    use Switch;
-    switch ($entity_type)
-    {
-        case('artist')  { $self->SetArtist($entity_id); }
-        case('label')   { $self->SetLabel($entity_id); }
-        case('release') { $self->SetRelease($entity_id); }
-        case('track')   { $self->SetTrack($entity_id); }
-    }
-}
-
 sub SetCreationTime
 {
 	$_[0]->{creation_time} = $_[1];

Modified: mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Model/Annotation.pm
===================================================================
--- mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Model/Annotation.pm	2008-09-01 23:38:36 UTC (rev 10278)
+++ mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Model/Annotation.pm	2008-09-01 23:39:18 UTC (rev 10279)
@@ -12,7 +12,7 @@
     my ($self, $entity) = @_;
 
     my $annotation = MusicBrainz::Server::Annotation->new($self->dbh);
-    $annotation->SetEntity($entity->entity_type, $entity->id);
+    $annotation->entity_id($entity->entity_type, $entity->id);
 
     $annotation->GetLatestAnnotation
         or return;

Modified: mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_ARTIST_ANNOTATION.pm
===================================================================
--- mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_ARTIST_ANNOTATION.pm	2008-09-01 23:38:36 UTC (rev 10278)
+++ mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_ARTIST_ANNOTATION.pm	2008-09-01 23:39:18 UTC (rev 10279)
@@ -68,7 +68,7 @@
 	$an->moderation($this->GetId());
 	if ($an->LoadFromId())
 	{
-		my $log = $an->GetChangeLog;
+		my $log = $an->change_log;
 		$log = "(no change log)"
 			unless ($log =~ /\S/);
 		$this->{'changelog'} = $log;
@@ -92,7 +92,7 @@
 	$an->type(ARTIST_ANNOTATION);
 	$an->SetArtist($self->row_id());
 	$an->SetText($text);
-	$an->SetChangeLog($changelog);
+	$an->change_log($changelog);
 	$an->Insert();
 
 	return &ModDefs::STATUS_APPLIED;

Modified: mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_LABEL_ANNOTATION.pm
===================================================================
--- mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_LABEL_ANNOTATION.pm	2008-09-01 23:38:36 UTC (rev 10278)
+++ mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_LABEL_ANNOTATION.pm	2008-09-01 23:39:18 UTC (rev 10279)
@@ -68,7 +68,7 @@
 	$an->moderation($this->GetId());
 	if ($an->LoadFromId())
 	{
-		my $log = $an->GetChangeLog;
+		my $log = $an->change_log;
 		$log = "(no change log)"
 			unless ($log =~ /\S/);
 		$this->{'changelog'} = $log;
@@ -92,7 +92,7 @@
 	$an->type(LABEL_ANNOTATION);
 	$an->SetLabel($self->row_id());
 	$an->SetText($text);
-	$an->SetChangeLog($changelog);
+	$an->change_log($changelog);
 	$an->Insert();
 
 	return &ModDefs::STATUS_APPLIED;

Modified: mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_RELEASE_ANNOTATION.pm
===================================================================
--- mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_RELEASE_ANNOTATION.pm	2008-09-01 23:38:36 UTC (rev 10278)
+++ mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_RELEASE_ANNOTATION.pm	2008-09-01 23:39:18 UTC (rev 10279)
@@ -76,7 +76,7 @@
 	$an->moderation($this->GetId());
 	if ($an->LoadFromId())
 	{
-		my $log = $an->GetChangeLog;
+		my $log = $an->change_log;
 		$log = "(no change log)"
 			unless ($log =~ /\S/);
 		$this->{'changelog'} = $log;
@@ -100,7 +100,7 @@
 	$an->type(RELEASE_ANNOTATION);
 	$an->SetRelease($self->row_id());
 	$an->SetText($text);
-	$an->SetChangeLog($changelog);
+	$an->change_log($changelog);
 	$an->Insert();
 
 	return &ModDefs::STATUS_APPLIED;

Modified: mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_TRACK_ANNOTATION.pm
===================================================================
--- mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_TRACK_ANNOTATION.pm	2008-09-01 23:38:36 UTC (rev 10278)
+++ mb_server/branches/TemplateToolkit/lib/MusicBrainz/Server/Moderation/MOD_ADD_TRACK_ANNOTATION.pm	2008-09-01 23:39:18 UTC (rev 10279)
@@ -76,7 +76,7 @@
 	$an->moderation($this->GetId());
 	if ($an->LoadFromId())
 	{
-		my $log = $an->GetChangeLog;
+		my $log = $an->change_log;
 		$log = "(no change log)"
 			unless ($log =~ /\S/);
 		$this->{'changelog'} = $log;
@@ -102,7 +102,7 @@
 	$an->type(TRACK_ANNOTATION);
 	$an->SetTrack($self->row_id());
 	$an->SetText($text);
-	$an->SetChangeLog($changelog);
+	$an->change_log($changelog);
 	$an->Insert();
 
 	return &ModDefs::STATUS_APPLIED;




More information about the MusicBrainz-commits mailing list