summaryrefslogtreecommitdiffstats
path: root/dcaedt_catalog/asdc/src/main/java/org/onap/sdc/dcae/enums/AssetType.java
blob: 647349f4e1e4307abd9f59a830782cf8b1a2c7ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package org.onap.sdc.dcae.enums;

public enum AssetType {

	RESOURCE(SdcContextPath.RESOURCES),
	SERVICE(SdcContextPath.SERVICES),
	VFCMT(SdcContextPath.RESOURCES),
	VF(SdcContextPath.RESOURCES);

	private String sdcContextPath;

	AssetType(SdcContextPath sdcContextPath) {
		this.sdcContextPath = sdcContextPath.name().toLowerCase();
	}

	public String getSdcContextPath() {
		return sdcContextPath;
	}

	// passing an invalid type will result in an IllegalArgumentException, which is fine as the 'type' value is an SDC enum value passed from SDC pluggable UI
	public static AssetType getAssetTypeByName(String type) {
		return AssetType.valueOf(type.toUpperCase());
	}

	public static String getSdcContextPath(String type) {
		return getAssetTypeByName(type).getSdcContextPath();
	}

	private enum SdcContextPath {
		RESOURCES, SERVICES
	}
}