All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.saphyra.randwo.label.service.create.CreateLabelService Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.github.saphyra.randwo.label.service.create;

import java.util.UUID;

import org.springframework.stereotype.Service;

import com.github.saphyra.randwo.label.domain.Label;
import com.github.saphyra.randwo.label.repository.LabelDao;
import com.github.saphyra.randwo.label.service.LabelValueValidator;
import lombok.RequiredArgsConstructor;

@Service
@RequiredArgsConstructor
public class CreateLabelService {
    private final LabelDao labelDao;
    private final LabelFactory labelFactory;
    private final LabelValueValidator labelValueValidator;

    public UUID createLabel(String labelValue) {
        labelValueValidator.validate(labelValue);

        Label label = labelFactory.create(labelValue);
        labelDao.save(label);
        return label.getLabelId();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy