public ProgramType getType() { return ProgramType.valueOfPrettyName(type); }
public ProgramType getType() { return ProgramType.valueOfPrettyName(type); }
/** * Create an {@link Authorizable.AuthorizableType#PROGRAM} authorizable of the given name. * * @param programDetails Details of the {@link Authorizable.AuthorizableType#PROGRAM} which should be in the * following format {@link ProgramType programType}.programName */ public Program(String programDetails) { String splitter = "\\" + PROGRAM_DETAILS_SEPARATOR; String[] programTypeAndName = programDetails.trim().split(splitter, 2); Preconditions.checkArgument( programTypeAndName.length <= 2, "Invalid program details %s. It must be in the format: [program-type]%s[program-name], or a wildcard.", programTypeAndName, PROGRAM_DETAILS_SEPARATOR); ProgramType type = null; String name; if (programTypeAndName.length == 2) { type = ProgramType.valueOfPrettyName(programTypeAndName[0]); name = programTypeAndName[1]; } else { name = programDetails; } this.programType = type; this.programName = name; }
@SuppressWarnings("unused") public static ProgramId fromIdParts(Iterable<String> idString) { Iterator<String> iterator = idString.iterator(); return new ProgramId( new ApplicationId(next(iterator, "namespace"), next(iterator, "application"), next(iterator, "version")), ProgramType.valueOfPrettyName(next(iterator, "type")), nextAndEnd(iterator, "program")); }
@SuppressWarnings("unused") public static ProgramId fromIdParts(Iterable<String> idString) { Iterator<String> iterator = idString.iterator(); return new ProgramId( new ApplicationId(next(iterator, "namespace"), next(iterator, "application"), next(iterator, "version")), ProgramType.valueOfPrettyName(next(iterator, "type")), nextAndEnd(iterator, "program")); }
@SuppressWarnings("unused") public static ProgramRunId fromIdParts(Iterable<String> idString) { Iterator<String> iterator = idString.iterator(); return new ProgramRunId( new ApplicationId(next(iterator, "namespace"), next(iterator, "application"), next(iterator, "version")), ProgramType.valueOfPrettyName(next(iterator, "type")), next(iterator, "program"), nextAndEnd(iterator, "run")); }
@SuppressWarnings("unused") public static ProgramRunId fromIdParts(Iterable<String> idString) { Iterator<String> iterator = idString.iterator(); return new ProgramRunId( new ApplicationId(next(iterator, "namespace"), next(iterator, "application"), next(iterator, "version")), ProgramType.valueOfPrettyName(next(iterator, "type")), next(iterator, "program"), nextAndEnd(iterator, "run")); }