com.dimajix.flowman.kernel.model.Phase Maven / Gradle / Ivy
The newest version!
/*
* Copyright (C) 2018 The Flowman Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dimajix.flowman.kernel.model;
import java.util.Locale;
import lombok.val;
import com.dimajix.flowman.kernel.proto.ExecutionPhase;
public enum Phase {
VALIDATE,
CREATE,
BUILD,
VERIFY,
TRUNCATE,
DESTROY;
public com.dimajix.flowman.kernel.proto.ExecutionPhase toProto() {
switch (this) {
case VALIDATE:
return ExecutionPhase.VALIDATE;
case CREATE:
return ExecutionPhase.CREATE;
case BUILD:
return ExecutionPhase.BUILD;
case VERIFY:
return ExecutionPhase.VERIFY;
case TRUNCATE:
return ExecutionPhase.TRUNCATE;
case DESTROY:
return ExecutionPhase.DESTROY;
}
throw new IllegalArgumentException("Unknown phase " + name());
}
public static Phase ofProto(com.dimajix.flowman.kernel.proto.ExecutionPhase phase) {
switch(phase) {
case VALIDATE:
return VALIDATE;
case CREATE:
return CREATE;
case BUILD:
return BUILD;
case VERIFY:
return VERIFY;
case TRUNCATE:
return TRUNCATE;
case DESTROY:
return DESTROY;
}
throw new IllegalArgumentException("Unknown phase " + phase.name());
}
public static Phase ofString(String phase) {
val upr = phase.toUpperCase(Locale.ROOT);
if (upr.equals("VALIDATE"))
return VALIDATE;
if (upr.equals("CREATE"))
return CREATE;
if (upr.equals("BUILD"))
return BUILD;
if (upr.equals("VERIFY"))
return VERIFY;
if (upr.equals("TRUNCATE"))
return TRUNCATE;
if (upr.equals("DESTROY"))
return DESTROY;
throw new IllegalArgumentException("Unknown phase " + phase);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy