remove label api

This commit is contained in:
Ezequiel Bergamaschi
2014-01-30 04:35:48 -03:00
committed by Ezequiel Bergamaschi
parent c8e0b92ef5
commit b79930394d
5 changed files with 31 additions and 0 deletions

View File

@@ -18,4 +18,6 @@ public interface LabelService {
Label getLabelById(int id);
public Label getLabelByTitle(@NotNull String title, @NotNull final User user);
void removeLabel(@NotNull final Label label, @NotNull final User user) throws WiseMappingException;
}

View File

@@ -40,4 +40,14 @@ public class LabelServiceImpl implements LabelService {
public Label getLabelByTitle(@NotNull String title, @NotNull final User user) {
return labelManager.getLabelByTitle(title, user);
}
@Override
public void removeLabel(@NotNull Label label, @NotNull User user) throws WiseMappingException {
if (label.getCreator().equals(user)) {
labelManager.removeLabel(label);
} else {
throw new WiseMappingException("User: "+ user.getFullName() + "has no ownership on label " + label.getTitle());
}
}
}