mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-07 08:45:34 +02:00
fix review findings
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
import lombok.Value;
|
||||
import sonia.scm.event.Event;
|
||||
|
||||
/**
|
||||
* This event is fired when a new tag was created by the SCM-Manager.
|
||||
* Warning: This event will not be fired if a new tag was pushed.
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Event
|
||||
@Value
|
||||
public class TagCreatedEvent {
|
||||
Repository repository;
|
||||
String revision;
|
||||
String tagName;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
import lombok.Value;
|
||||
import sonia.scm.event.Event;
|
||||
|
||||
/**
|
||||
* This event is fired when a tag was deleted by the SCM-Manager.
|
||||
* Warning: This event will not be fired if a tag was removed by a push of a git client.
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Event
|
||||
@Value
|
||||
public class TagDeletedEvent {
|
||||
Repository repository;
|
||||
String tagName;
|
||||
}
|
||||
@@ -386,7 +386,7 @@ public final class RepositoryService implements Closeable {
|
||||
* by the implementation of the repository service provider.
|
||||
*/
|
||||
public TagCommandBuilder getTagCommand() {
|
||||
return new TagCommandBuilder(repository, provider.getTagCommand());
|
||||
return new TagCommandBuilder(provider.getTagCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,24 +24,16 @@
|
||||
|
||||
package sonia.scm.repository.api;
|
||||
|
||||
import sonia.scm.event.ScmEventBus;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.Tag;
|
||||
import sonia.scm.repository.TagCreatedEvent;
|
||||
import sonia.scm.repository.TagDeletedEvent;
|
||||
import sonia.scm.repository.spi.TagCommand;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TagCommandBuilder {
|
||||
private final Repository repository;
|
||||
private final TagCommand command;
|
||||
private final ScmEventBus eventBus;
|
||||
|
||||
public TagCommandBuilder(Repository repository, TagCommand command) {
|
||||
this.repository = repository;
|
||||
public TagCommandBuilder(TagCommand command) {
|
||||
this.command = command;
|
||||
this.eventBus = ScmEventBus.getInstance();
|
||||
}
|
||||
|
||||
public TagCreateCommandBuilder create() {
|
||||
@@ -53,7 +45,7 @@ public class TagCommandBuilder {
|
||||
}
|
||||
|
||||
public class TagCreateCommandBuilder {
|
||||
private TagCreateRequest request = new TagCreateRequest();
|
||||
private final TagCreateRequest request = new TagCreateRequest();
|
||||
|
||||
public TagCreateCommandBuilder setRevision(String revision) {
|
||||
request.setRevision(revision);
|
||||
@@ -66,14 +58,12 @@ public class TagCommandBuilder {
|
||||
}
|
||||
|
||||
public Tag execute() throws IOException {
|
||||
Tag tag = command.create(request);
|
||||
eventBus.post(new TagCreatedEvent(repository, request.getRevision(), request.getName()));
|
||||
return tag;
|
||||
return command.create(request);
|
||||
}
|
||||
}
|
||||
|
||||
public class TagDeleteCommandBuilder {
|
||||
private TagDeleteRequest request = new TagDeleteRequest();
|
||||
private final TagDeleteRequest request = new TagDeleteRequest();
|
||||
|
||||
public TagDeleteCommandBuilder setName(String name) {
|
||||
request.setName(name);
|
||||
@@ -82,7 +72,6 @@ public class TagCommandBuilder {
|
||||
|
||||
public void execute() throws IOException {
|
||||
command.delete(request);
|
||||
eventBus.post(new TagDeletedEvent(repository, request.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ public abstract class RepositoryServiceProvider implements Closeable
|
||||
*/
|
||||
public TagCommand getTagCommand()
|
||||
{
|
||||
throw new CommandNotSupportedException(Command.TAGS);
|
||||
throw new CommandNotSupportedException(Command.TAG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user