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

ga.sdk.sdk-generate-entity-models-maven-plugin.12.60.16.source-code.Phases.vm Maven / Gradle / Ivy

The newest version!
############################################################################
## Copyright 2017 Hewlett-Packard Enterprise Development Company, L.P.
## 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.hpe.adm.nga.sdk.enums;

import com.hpe.adm.nga.sdk.model.EntityModel;
import com.hpe.adm.nga.sdk.model.StringFieldModel;
import java.util.Arrays;

/**
 * Generated class - do not edit!
 */
public final class Phases {

#foreach($phase in ${phaseMap.entrySet()})
    #set($phaseType = $phase.getKey())
    public enum ${phaseType}Phase {
        #foreach($phaseValue in $phase.getValue())
        #if($foreach.count > 1), #end${phaseValue[1]}("${phaseValue[0]}")#end;

        private final String id;

        ${phaseType}Phase(final String id) {
            this.id = id;
        }

        public final String getId() {
            return id;
        }

        public static ${phaseType}Phase getPhaseFromId(String id) {
            return Arrays.stream(${phaseType}Phase.values()).filter(phase -> phase.id.equals(id)).findFirst().orElse(null);
        }

        public final EntityModel getAsEntityModel() {
            final EntityModel entityModel = new EntityModel();
            entityModel.setValue(new StringFieldModel("id", id));
            entityModel.setValue(new StringFieldModel("type", "phase"));
            return entityModel;
        }

        public static ${phaseType}Phase getFromEntityModel(final EntityModel entityModel) {
            return ${phaseType}Phase.getPhaseFromId(entityModel.getId());
        }
    }

#end
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy