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

org.openl.rules.webstudio.web.NotFoundBean Maven / Gradle / Ivy

There is a newer version: 5.27.9
Show newest version
package org.openl.rules.webstudio.web;

import org.springframework.stereotype.Service;
import org.springframework.web.context.annotation.RequestScope;

import org.openl.rules.project.model.ProjectDescriptor;
import org.openl.rules.webstudio.web.util.WebStudioUtils;

@Service
@RequestScope
public class NotFoundBean {
    public String getProject() {
        return WebStudioUtils.getRequestParameter("project");
    }

    public String getModule() {
        return WebStudioUtils.getRequestParameter("module");
    }

    public Type getType() {
        String repositoryId = WebStudioUtils.getRequestParameter("repositoryId");
        String project = getProject();
        if (project != null) {
            ProjectDescriptor projectDescriptor = WebStudioUtils.getWebStudio().getProjectByName(repositoryId, project);
            if (projectDescriptor == null) {
                return Type.PROJECT;
            }

            String module = getModule();
            if (module != null && WebStudioUtils.getWebStudio().getModule(projectDescriptor, module) == null) {
                return Type.MODULE;
            }
        }

        return Type.OTHER;
    }

    public enum Type {
        PROJECT,
        MODULE,
        OTHER
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy