Beispiel #1
0
 /**
  * Find app instances by container and name.
  *
  * @param container the container
  * @param applicationName the application name
  * @param results the results
  */
 private static void findAppInstancesByContainerAndName(
     Container container, String applicationName, List<String> results) {
   ArrayList<ModelObject> chidren = container.getChildren();
   if (chidren == null) return;
   for (ModelObject object : chidren) {
     if (object instanceof Application) {
       Application<?> application = Application.class.cast(object);
       if (application.getId().contains(applicationName)) {
         results.add(application.getId());
       }
     } else if (object instanceof Container) {
       Container child = Container.class.cast(object);
       findAppInstancesByContainerAndName(child, applicationName, results);
     }
   }
 }
Beispiel #2
0
 /**
  * Find app instances by id.
  *
  * @param container the container
  * @param applicationId the application id
  * @return the application
  */
 public static Application<?> findAppInstancesById(Container container, String applicationId) {
   ArrayList<ModelObject> chidren = container.getChildren();
   if (chidren == null) return null;
   for (ModelObject object : chidren) {
     if (object instanceof Application) {
       Application<?> app = Application.class.cast(object);
       if (app.getId().equals(applicationId)) {
         application = app;
       }
     } else if (object instanceof Container) {
       Container child = Container.class.cast(object);
       findAppInstancesById(child, applicationId);
     }
   }
   return application;
 }
Beispiel #3
0
 /**
  * Removed app instances in container by names.
  *
  * @param container the container
  * @param removingApplicationIds the removing application ids
  */
 private static void removedAppInstancesInContainerByNames(
     Container container, List<String> removingApplicationIds) {
   ArrayList<ModelObject> childrenTmp = new ArrayList<ModelObject>();
   ArrayList<ModelObject> chidren = container.getChildren();
   if (chidren == null) return;
   for (ModelObject object : chidren) {
     if (object instanceof Application) {
       Application<?> application = Application.class.cast(object);
       if (!removingApplicationIds.contains(application.getId())) {
         childrenTmp.add(object);
       }
     } else if (object instanceof Container) {
       Container child = Container.class.cast(object);
       removedAppInstancesInContainerByNames(child, removingApplicationIds);
       childrenTmp.add(child);
     }
   }
 }