@Test public void shouldGenerateCorrectRestIds() { assertEquals("rest-eudeent", ClassName.restId("eudeEnt", null, "")); assertEquals("rest-admin-notificationrule", ClassName.restId("NotificationRule", "MOTECH Admin", "")); assertEquals("rest-openmrs-accra-patient", ClassName.restId("Patient", "OpenMRS", "accra")); assertEquals("rest-email-record", ClassName.restId("Record", "MOTECH Platform Email", null)); }
public static String restId(String entityName, String module, String namespace) { if (StringUtils.isBlank(module)) { return String.format("rest-%s", StringUtils.lowerCase(entityName)); } else if (StringUtils.isBlank(namespace)) { return String.format("rest-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(entityName)); } else { return String.format("rest-%s-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(namespace), StringUtils.lowerCase(entityName)); } }
ClassName { public static String restId(String entityName, String module, String namespace) { if (StringUtils.isBlank(module)) { return String.format("rest-%s", StringUtils.lowerCase(entityName)); } else if (StringUtils.isBlank(namespace)) { return String.format("rest-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(entityName)); } else { return String.format("rest-%s-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(namespace), StringUtils.lowerCase(entityName)); } } }
ClassName { public static String restId(String entityName, String module, String namespace) { if (StringUtils.isBlank(module)) { return String.format("rest-%s", StringUtils.lowerCase(entityName)); } else if (StringUtils.isBlank(namespace)) { return String.format("rest-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(entityName)); } else { return String.format("rest-%s-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(namespace), StringUtils.lowerCase(entityName)); } } private  ClassName(); }
ClassName { public static String restId(String entityName, String module, String namespace) { if (StringUtils.isBlank(module)) { return String.format("rest-%s", StringUtils.lowerCase(entityName)); } else if (StringUtils.isBlank(namespace)) { return String.format("rest-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(entityName)); } else { return String.format("rest-%s-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(namespace), StringUtils.lowerCase(entityName)); } } private  ClassName(); static String getSimpleName(String className); static String getPackage(String className); static String getHistoryClassName(String className); static String getTrashClassName(String className); static String getEntityClassName(String simpleName); static String getRepositoryName(String className); static String getInterfaceName(String className); static String getServiceClassName(String className); static String getServiceName(String className); static String trimTrashHistorySuffix(String name); static String getEntityTypeSuffix(String name); static boolean isTrashClassName(String className); static boolean isHistoryClassName(String className); static String restId(String entityName, String module, String namespace); static String restUrl(String entityName, String entityModule, String entityNamespace); static String restLookupUrl(String entityName, String entityModule, String entityNamespace,
                                       String lookupMethodName); static String simplifiedModuleName(String moduleName); static String getEnumPackage(String className); }
ClassName { public static String restId(String entityName, String module, String namespace) { if (StringUtils.isBlank(module)) { return String.format("rest-%s", StringUtils.lowerCase(entityName)); } else if (StringUtils.isBlank(namespace)) { return String.format("rest-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(entityName)); } else { return String.format("rest-%s-%s-%s", simplifiedModuleName(module), StringUtils.lowerCase(namespace), StringUtils.lowerCase(entityName)); } } private  ClassName(); static String getSimpleName(String className); static String getPackage(String className); static String getHistoryClassName(String className); static String getTrashClassName(String className); static String getEntityClassName(String simpleName); static String getRepositoryName(String className); static String getInterfaceName(String className); static String getServiceClassName(String className); static String getServiceName(String className); static String trimTrashHistorySuffix(String name); static String getEntityTypeSuffix(String name); static boolean isTrashClassName(String className); static boolean isHistoryClassName(String className); static String restId(String entityName, String module, String namespace); static String restUrl(String entityName, String entityModule, String entityNamespace); static String restLookupUrl(String entityName, String entityModule, String entityNamespace,
                                       String lookupMethodName); static String simplifiedModuleName(String moduleName); static String getEnumPackage(String className);  }