SW360Utils { public static String getBUFromOrganisation(String organisation) { if(Strings.isNullOrEmpty(organisation)) return ""; List<String> parts = Arrays.asList(organisation.toUpperCase().split("\\s")); int maxIndex = Math.min(parts.size(), 3); return spaceJoiner.join(parts.subList(0, maxIndex)).toUpperCase(); } private  SW360Utils(); static String getCreatedOn(); static String getCreatedOnTime(); static Date getDateFromTimeString(String date); static String getDateTimeString(Date date); static String getBUFromOrganisation(String organisation); static Set<String> filterBUSet(String organisation, Set<String> strings); static void setVendorId(Release release); static Set<String> getReleaseIds(Collection<Release> in); static Set<String> getComponentIds(Collection<Component> in); static Set<String> getProjectIds(Collection<Project> in); static String getVersionedName(String name, String version); static String printName(Component component); static String printName(Release release); static String printFullname(Release release); @NotNull static String getReleaseFullname(String vendorName, String releaseName, String version); static String printName(Project project); static String printName(License license); static String printName(Vulnerability vulnerability); static String printName(User user); static Collection<ProjectLink> getLinkedProjects(Project project, boolean deep, ThriftClients thriftClients, Logger log, User user); static Collection<ProjectLink> getLinkedProjects(String id, boolean deep, ThriftClients thriftClients, Logger log, User user); static Collection<ProjectLink> getLinkedProjectsAsFlatList(Project project, boolean deep, ThriftClients thriftClients, Logger log, User user); static Collection<ProjectLink> getLinkedProjectsAsFlatList(String id, boolean deep, ThriftClients thriftClients, Logger log, User user); static Collection<ProjectLink> flattenProjectLinkTree(Collection<ProjectLink> linkedProjects); static List<ReleaseLink> getLinkedReleases(Project project, ThriftClients thriftClients, Logger log); static List<ReleaseLink> getLinkedReleaseRelations(Release release, ThriftClients thriftClients, Logger log); static Predicate<String> startsWith(final String prefix); static List<String> getLicenseNamesFromIds(Collection<String> ids, String department); static List<License> getLicenses(Collection<String> ids, String department); @NotNull static List<String> getLicenseNamesFromLicenses(List<License> licenseList); static Map<String, License> getStringLicenseMap(User user, Set<String> licenseIds); static String fieldValueAsString(Object fieldValue); static void initializeMailNotificationsPreferences(User user); static String notificationPreferenceKey(String notificationClass, String roleName); static String displayNameFor(String name, Map<String, String> nameToDisplayName); static Map<String, T> putReleaseNamesInMap(Map<String, T> map, List<Release> releases); static Map<String, T> putProjectNamesInMap(Map<String, T> map, List<Project> projects); static List<String> getReleaseNames(List<Release> releases); static EccInformation newDefaultEccInformation(); @NotNull static Set<T> unionValues(Map<?, Set<T>>map); static final String FORMAT_DATE; static final String FORMAT_DATE_TIME; static final Comparator<ReleaseLink> RELEASE_LINK_COMPARATOR; }
@Test public void testGetBUFromOrganisation() throws Exception { assertEquals("CT BE OSS", SW360Utils.getBUFromOrganisation("CT BE OSS NE")); assertEquals("CT BE", SW360Utils.getBUFromOrganisation("CT BE")); }