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

org.visallo.web.clientapi.model.SandboxStatus Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
package org.visallo.web.clientapi.model;

import java.util.Set;

public enum SandboxStatus {
    PUBLIC,
    PUBLIC_CHANGED,
    PRIVATE;

    public static SandboxStatus getFromVisibilityString(String visibility, String workspaceId) {
        if (visibility == null) {
            return SandboxStatus.PUBLIC;
        }
        if (workspaceId == null || !visibility.contains(workspaceId)) {
            return SandboxStatus.PUBLIC;
        }
        return SandboxStatus.PRIVATE;
    }

    public static SandboxStatus getFromVisibilityJsonString(VisibilityJson visibilityJson, String workspaceId) {
        if (visibilityJson == null) {
            return SandboxStatus.PUBLIC;
        }
        Set workspacesList = visibilityJson.getWorkspaces();
        if (workspacesList == null || workspacesList.size() == 0) {
            return SandboxStatus.PUBLIC;
        }
        if (workspaceId == null || !workspacesList.contains(workspaceId)) {
            return SandboxStatus.PUBLIC;
        }
        return SandboxStatus.PRIVATE;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy