/** Returns the list of system-applications that are referenced from the given server. * A server references an application, if the server has an element named * <application-ref> in it that points to given application. The given server * is a <server> element inside domain. * * @param sn the string denoting name of the server * @return List of system-applications for that server, an empty list in case there is none */ public List<Application> getSystemApplicationsReferencedFrom(String sn) { if (domain == null || sn == null) throw new IllegalArgumentException("Null argument"); List<Application> allApps = getAllDefinedSystemApplications(); if (allApps.isEmpty()) { return allApps; //if there are no sys-apps, none can reference one :) } //allApps now contains ALL the system applications Server s = getServerNamed(sn); List<Application> referencedApps = new ArrayList<Application>(); List<ApplicationRef> appsReferenced = s.getApplicationRef(); for (ApplicationRef ref : appsReferenced) { for (Application app : allApps) { if (ref.getRef().equals(app.getName())) { referencedApps.add(app); } } } return referencedApps; }
/** Returns the list of system-applications that are referenced from the given server. * A server references an application, if the server has an element named * <application-ref> in it that points to given application. The given server * is a <server> element inside domain. * * @param sn the string denoting name of the server * @return List of system-applications for that server, an empty list in case there is none */ public static List<Application> getSystemApplicationsReferencedFrom(String sn) { if (domain == null || sn == null) throw new IllegalArgumentException("Null argument"); List<Application> allApps = getAllDefinedSystemApplications(); if (allApps.isEmpty()) { return allApps; //if there are no sys-apps, none can reference one :) } //allApps now contains ALL the system applications Server s = getServerNamed(sn); List<Application> referencedApps = new ArrayList<Application>(); List<ApplicationRef> appsReferenced = s.getApplicationRef(); for (ApplicationRef ref : appsReferenced) { for (Application app : allApps) { if (ref.getRef().equals(app.getName())) { referencedApps.add(app); } } } return referencedApps; }