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

org.openl.rules.rest.resolver.ProjectStatusConverter Maven / Gradle / Ivy

There is a newer version: 5.27.9
Show newest version
package org.openl.rules.rest.resolver;

import javax.annotation.ParametersAreNonnullByDefault;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import org.openl.rules.project.abstraction.ProjectStatus;

/**
 * Custom converter for {@link ProjectStatus} enum.
 *
 * @author Vladyslav Pikus
 */
@Component
@ParametersAreNonnullByDefault
public class ProjectStatusConverter implements Converter {

    @Override
    public ProjectStatus convert(String source) {
        if (source.isEmpty()) {
            return null;
        }
        if ("OPENED".equals(source)) {
            return ProjectStatus.VIEWING;
        }

        return ProjectStatus.valueOf(source);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy