The question is - how do you determine which environment it is.. Sender is not sending "SAPDEV", "SAPTEST" etc which means there is no input to the fixed values...
Again you might have to use
String systemID = (String) System.getProperty("SAPSYSTEMNAME");
return systemID;