/** * Returns the given {@code code} corresponding string value. This method should be executed from * client-side. If executed from server-side, it returns the enum constant name. * * @param code The {@code ImportStatusCode} code. * @return the given {@code code} corresponding string value, or {@code null}. */ public static String getStringValue(final ImportStatusCode code) { if (code == null) { return null; } if (!GWT.isClient()) { return code.name(); } switch (code) { case ORGUNIT_FOUND_CODE: return I18N.CONSTANTS.importOrgUnitFound(); case ORGUNIT_NOT_FOUND_CODE: return I18N.CONSTANTS.importOrgUnitNotFound(); case PROJECT_FOUND_CODE: return I18N.CONSTANTS.importProjectFound(); case PROJECT_LOCKED_CODE: return I18N.CONSTANTS.importProjectCoreLocked(); case PROJECT_NOT_FOUND_CODE: return I18N.CONSTANTS.importProjectNotFound(); case SEVERAL_ORGUNITS_FOUND_CODE: return I18N.CONSTANTS.importSeveralOrgUnitsFound(); case SEVERAL_PROJECTS_FOUND_CODE: return I18N.CONSTANTS.importSeveralProjectsFound(); default: return code.name(); } }