private void clearApplicationCategoryViewerCache(IWContext iwc) {
   IWCacheManager2 cacheManager = IWCacheManager2.getInstance(iwc.getIWMainApplication());
   Map<Serializable, ?> cache = cacheManager.getCache(ApplicationCategoryViewer.CACHE_KEY);
   if (cache != null) {
     cache.clear();
   }
   BuilderLogic.getInstance().clearAllCaches();
   IWCacheManager.getInstance(iwc.getIWMainApplication()).clearAllCaches();
 }
コード例 #2
0
 @Override
 public void main(IWContext iwc) {
   empty();
   if (this.chooserButtonImage == null) {
     IWBundle iwb = iwc.getIWMainApplication().getBundle(CoreConstants.IW_USER_BUNDLE_IDENTIFIER);
     setChooseButtonImage(iwb.getImage("magnifyingglass.gif", "Choose"));
   }
 }
コード例 #3
0
  public Collection<SearchResult> getArticleSearchResults(
      String folder, List<String> categories, IWContext iwc) {
    if (folder == null) {
      return null;
    }
    if (iwc == null) {
      iwc = IWContext.getInstance();
      if (iwc == null) {
        return null;
      }
    }

    IWTimestamp oldest = null;

    if (this.numberOfDaysDisplayed > 0) {
      oldest = IWTimestamp.RightNow();
      oldest.addDays(-this.numberOfDaysDisplayed);
    }

    IWSlideSession session = null;
    try {
      session = (IWSlideSession) IBOLookup.getSessionInstance(iwc, IWSlideSession.class);
    } catch (IBOLookupException e) {
      e.printStackTrace();
      return null;
    }
    String webDavUri = null;
    try {
      webDavUri = session.getWebdavServerURI();
    } catch (RemoteException e) {
      e.printStackTrace();
    }
    if (webDavUri != null) {
      if (folder.startsWith(webDavUri)) {
        folder = folder.substring(webDavUri.length());
      }
      if (folder.startsWith(CoreConstants.SLASH)) {
        folder = folder.substring(1);
      }
    }
    SearchRequest articleSearch = null;
    try {
      articleSearch = getSearchRequest(folder, iwc.getCurrentLocale(), oldest, categories);
    } catch (SearchException e) {
      e.printStackTrace();
      return null;
    }
    ContentSearch searchBusiness = new ContentSearch(iwc.getIWMainApplication());
    searchBusiness.setToUseRootAccessForSearch(true);
    searchBusiness.setToUseDescendingOrder(true);
    Search search = searchBusiness.createSearch(articleSearch);
    return search.getSearchResults();
  }
コード例 #4
0
  protected void init(IWContext iwc) {
    this.form = new Form();
    this.form.maintainParameter(SchoolUserChooser.PARAMETER_SCHOOL_ID);

    this.searchString = iwc.getParameter(this.PARAMETER_SEARCH);
    this.iwrb =
        iwc.getIWMainApplication()
            .getBundle(BuilderConstants.STANDARD_IW_BUNDLE_IDENTIFIER)
            .getResourceBundle(iwc);
    this.showAll = iwc.isParameterSet(this.PARAMETER_VIEW_ALL);
    if (iwc.isParameterSet(this.PARAMETER_CURRENT_PAGE)) {
      this.currentPage = Integer.parseInt(iwc.getParameter(this.PARAMETER_CURRENT_PAGE));
    }
    try {
      SchoolUserBusiness biz = getSchoolUserBusiness(iwc);
      int[] userTypes = {
        SchoolUserBusinessBean.USER_TYPE_HEADMASTER,
        SchoolUserBusinessBean.USER_TYPE_ASSISTANT_HEADMASTER,
        SchoolUserBusinessBean.USER_TYPE_IB_COORDINATOR,
        SchoolUserBusinessBean.USER_TYPE_STUDY_AND_WORK_COUNCEL,
        SchoolUserBusinessBean.USER_TYPE_TEACHER,
        SchoolUserBusinessBean.USER_TYPE_WEB_ADMIN,
        SchoolUserBusinessBean.USER_TYPE_SCHOOL_MASTER,
        SchoolUserBusinessBean.USER_TYPE_CONTACT_PERSON,
        SchoolUserBusinessBean.USER_TYPE_EXPEDITION,
        SchoolUserBusinessBean.USER_TYPE_PROJECT_MANAGER
      };

      School prov = getProvider(iwc);

      if (prov == null) {
        SchoolUserHome userHome;
        userHome = (SchoolUserHome) IDOLookup.getHome(SchoolUser.class);
        Collection schoolUsers = userHome.findByTypes(userTypes);

        this.users = new Vector();
        Iterator iter = schoolUsers.iterator();
        while (iter.hasNext()) {
          SchoolUser sUser = (SchoolUser) iter.next();
          this.users.add(sUser.getUser());
        }
      } else {
        this.users = biz.getUsers(prov, userTypes);
      }
    } catch (FinderException ex) {
      ex.printStackTrace();
    } catch (RemoteException ex) {
      ex.printStackTrace();
    }
  }
コード例 #5
0
  // œr private ’ protected
  protected void init(IWContext iwc) {
    this.form = new Form();
    this.searchString = iwc.getParameter(this.PARAMETER_SEARCH);
    this.iwrb =
        iwc.getIWMainApplication()
            .getBundle(BuilderConstants.STANDARD_IW_BUNDLE_IDENTIFIER)
            .getResourceBundle(iwc);
    this.showAll = iwc.isParameterSet(this.PARAMETER_VIEW_ALL);

    if (iwc.isParameterSet(this.PARAMETER_CURRENT_PAGE)) {
      this.currentPage = Integer.parseInt(iwc.getParameter(this.PARAMETER_CURRENT_PAGE));
    }
    // int start = currentPage * USERS_PER_PAGE;

    try {
      String useUserPks =
          (String) iwc.getSessionAttribute(USING_AVAILABLE_USER_PKS_SESSION_PARAMETER);
      if (useUserPks != null) {
        this.usingUserPks = true;
      }
      Collection availableUserPks =
          (Collection) iwc.getSessionAttribute(AVAILABLE_USER_PKS_SESSION_PARAMETER);
      String[] userIds = null;
      if (this.usingUserPks && availableUserPks != null) {
        userIds = new String[availableUserPks.size()];
        Iterator iter = availableUserPks.iterator();
        int counter = 0;
        while (iter.hasNext()) {
          Object i = iter.next();
          userIds[counter++] = i.toString();
        }
      }
      if (this.usingUserPks && this.searchString == null) {
        this.showAll = true;
      }

      UserHome uHome = (UserHome) IDOLookup.getHome(User.class);
      if (this.showAll) {
        if (this.usingUserPks && userIds != null) {
          this.users = uHome.findUsers(userIds);
        } else {
          this.users = uHome.findAllUsersOrderedByFirstName();
        }
      } else if (this.searchString != null) {
        this.users = uHome.findUsersBySearchCondition(this.searchString, userIds, false);
      }
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }
  }
コード例 #6
0
  private void init(IWContext iwc) {
    this.bundle = getBundle(iwc);
    this.iwrb = this.bundle.getResourceBundle(iwc);
    this.iwc = iwc;
    setAutoCreate(false);
    if (iwc.isParameterSet(this.prmClrCache)) {
      clearCache(iwc);
    }
    this._currentLocale = iwc.getCurrentLocale();
    this._currentLocaleId = ICLocaleBusiness.getLocaleId(this._currentLocale);
    this._hasEditPermission = this.hasEditPermission();
    if (iwc.isInPreviewMode()) {
      this._hasEditPermission = false;
    }
    IWBundle coreBundle = iwc.getIWMainApplication().getCoreBundle();
    this.iCreate = coreBundle.getImage("shared/create.gif");
    this.iDelete = coreBundle.getImage("shared/delete.gif");
    this.iEdit = coreBundle.getImage("shared/edit.gif");
    this.iDetach = coreBundle.getImage("shared/detach.gif");
    try {
      this.layout = (AbstractProductCatalogLayout) this._layoutClass.newInstance();
    } catch (IllegalAccessException iae) {
      iae.printStackTrace(System.err);
    } catch (InstantiationException ie) {
      ie.printStackTrace(System.err);
    }
    try {
      String sCurrentPage = iwc.getParameter(ProductCatalog._VIEW_PAGE);
      String sOrderBy = iwc.getParameter(ProductCatalog._ORDER_BY);
      if (sCurrentPage != null) {
        this.currentPage = Integer.parseInt(sCurrentPage);
      }
      if (sOrderBy != null) {
        this.orderBy = Integer.parseInt(sOrderBy);
      }
    } catch (NumberFormatException n) {
    }

    this.expandedCategories = new Vector();
    String selCat = iwc.getParameter(CATEGORY_ID);

    if (selCat != null) {
      this._selectedCategoryID = Integer.parseInt(selCat);
      addCategoryAsExpanded(selCat);
    }
  }
  public void init(HttpServletRequest req, IWContext iwc) {

    this.locale = iwc.getApplicationSettings().getApplicationLocale();
    this.iwrb =
        iwc.getIWMainApplication()
            .getBundle(CommuneBlock.IW_BUNDLE_IDENTIFIER)
            .getResourceBundle(this.locale);

    this.schoolID = Integer.parseInt(req.getParameter(PARAMETER_SCHOOL_ID));
    this.seasonID = Integer.parseInt(req.getParameter(PARAMETER_SCHOOL_SEASON_ID));

    try {
      this.buffer = writeXls(iwc);
      setAsDownload(iwc, "rejected_students_list.xls", this.buffer.length());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #8
0
  @Override
  public void handleRSSRequest(RSSRequest rssRequest) throws IOException {
    String extraURI = rssRequest.getExtraUri();
    if (extraURI == null) extraURI = "";
    if ((!extraURI.endsWith("/")) && (extraURI.length() != 0)) extraURI = extraURI.concat("/");

    try {
      IWContext iwc = getIWContext(rssRequest);
      this.dispatch(
          iwc.getIWMainApplication().getApplicationContextURI()
              + "content"
              + getFeedFile(extraURI, rssRequest),
          rssRequest);
    } catch (ServletException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
コード例 #9
0
 public void clearCache(IWContext iwc) {
   iwc.getIWMainApplication()
       .getIWCacheManager()
       .invalidateCache(getCacheState(iwc, super.getCachePrefixString(iwc)));
 }
  private void drawForm(IWContext iwc) {
    Form form = new Form();
    Table T = new Table();
    T.setCellpadding(2);
    T.setCellspacing(2);
    T.setBorder(0);
    form.add(T);

    Table table = new Table();
    //		table.setWidth(getWidth());
    table.setCellpadding(2);
    table.setCellspacing(2);
    table.setBorder(0);
    T.add(table, 1, 1);
    T.setWidth(2, 1, "20");

    T.setVerticalAlignment(1, 1, Table.VERTICAL_ALIGN_BOTTOM);
    T.setVerticalAlignment(3, 1, Table.VERTICAL_ALIGN_BOTTOM);

    int row = 1;

    String personalID =
        PersonalIDFormatter.format(
            user.getPersonalID(), iwc.getIWMainApplication().getSettings().getApplicationLocale());

    table.add(new Break(2), 1, row);
    table.add(getSmallHeader(localize(KEY_PID, DEFAULT_PID)), 1, row);

    if (user.getPersonalID() != null) {
      table.add(getSmallText(personalID), 2, row);
      table.setVerticalAlignment(1, row, Table.VERTICAL_ALIGN_BOTTOM);
      table.setVerticalAlignment(2, row, Table.VERTICAL_ALIGN_BOTTOM);
    }
    row++;
    table.add(getSmallHeader(localize(KEY_LOGIN, DEFAULT_LOGIN)), 1, row);
    LoginTable loginTable =
        LoginDBHandler.getUserLogin(((Integer) user.getPrimaryKey()).intValue());
    if (loginTable != null) {
      table.add(new HiddenInput(PARAMETER_OLD_LOGIN, loginTable.getUserLogin()), 2, row);
      table.add(getSmallText(loginTable.getUserLogin()), 2, row);
      table.setVerticalAlignment(1, row, Table.VERTICAL_ALIGN_BOTTOM);
      table.setVerticalAlignment(2, row, Table.VERTICAL_ALIGN_BOTTOM);
    }

    String valueCurrentPassword =
        iwc.getParameter(PARAMETER_CURRENT_PASSWORD) != null
            ? iwc.getParameter(PARAMETER_CURRENT_PASSWORD)
            : "";
    String valueNewPassword =
        iwc.getParameter(PARAMETER_NEW_PASSWORD) != null
            ? iwc.getParameter(PARAMETER_NEW_PASSWORD)
            : "";
    String valueNewPasswordRepeated =
        iwc.getParameter(PARAMETER_NEW_PASSWORD_REPEATED) != null
            ? iwc.getParameter(PARAMETER_NEW_PASSWORD_REPEATED)
            : "";

    // Text tLogin = getSmallHeader(localize(KEY_LOGIN, DEFAULT_LOGIN));
    Text tCurrentPassword =
        getSmallHeader(localize(KEY_CURRENT_PASSWORD, DEFAULT_CURRENT_PASSWORD));
    Text tNewPassword = getSmallHeader(localize(KEY_NEW_PASSWORD, DEFAULT_NEW_PASSWORD));
    Text tNewPasswordRepeated =
        getSmallHeader(localize(KEY_NEW_PASSWORD_REPEATED, DEFAULT_NEW_PASSWORD_REPEATED));

    PasswordInput tiCurrentPassword =
        (PasswordInput) getStyledInterface(new PasswordInput(PARAMETER_CURRENT_PASSWORD));
    if (valueCurrentPassword != null) {
      tiCurrentPassword.setValue(valueCurrentPassword);
    }
    PasswordInput tiNewPassword =
        (PasswordInput) getStyledInterface(new PasswordInput(PARAMETER_NEW_PASSWORD));
    if (valueNewPassword != null) {
      tiNewPassword.setValue(valueNewPassword);
    }
    PasswordInput tiNewPasswordRepeated =
        (PasswordInput) getStyledInterface(new PasswordInput(PARAMETER_NEW_PASSWORD_REPEATED));
    if (valueNewPasswordRepeated != null) {
      tiNewPasswordRepeated.setValue(valueNewPasswordRepeated);
    }

    SubmitButton sbUpdate =
        (SubmitButton)
            getStyledInterface(
                new SubmitButton(
                    localize(KEY_UPDATE, DEFAULT_UPDATE), PARAMETER_FORM_SUBMIT, "true"));

    row++;
    table.setHeight(row, 12);

    if (requirePasswordVerification) {
      row++;
      table.add(tCurrentPassword, 1, row);
      table.add(tiCurrentPassword, 2, row);
    }

    row++;
    table.add(tNewPassword, 1, row);
    table.add(tiNewPassword, 2, row);

    row++;
    table.add(tNewPasswordRepeated, 1, row);
    table.add(tiNewPasswordRepeated, 2, row);

    row++;
    table.setHeight(row, 12);

    row++;
    table.mergeCells(1, row, 2, row);
    table.setAlignment(1, row, Table.HORIZONTAL_ALIGN_RIGHT);

    table.add(Text.NON_BREAKING_SPACE, 1, row);
    table.add(sbUpdate, 1, row);

    add(form);
  }
コード例 #11
0
  public PresentationObject getCatalog(
      ProductCatalog productCatalog, IWContext iwc, List productCategories)
      throws RemoteException, FinderException {
    this.localeID = iwc.getCurrentLocaleId();
    this.locale = iwc.getCurrentLocale();
    this.defaultLocale = iwc.getIWMainApplication().getSettings().getDefaultLocale();
    this.defaultLocaleID = ICLocaleBusiness.getLocaleId(this.defaultLocale);

    Table table = new Table();
    table.setWidth("100%");
    table.setCellspacing(1);
    table.setCellpadding(2);

    Collection products = productCatalog.getProducts(productCategories);
    Iterator iter = products.iterator();
    Iterator catIter = productCategories.iterator();

    int row = 1;
    int column = 1;
    int imageColumn = 1;

    Hashtable metaDataTypes = new Hashtable();

    table.add(
        productCatalog.getHeader(
            productCatalog.iwrb.getLocalizedString("product.product", "Product")),
        column++,
        row);
    List metadataKeys = new Vector();
    String[] metadata = new String[10 + column];

    while (catIter.hasNext()) {
      ICCategory element = (ICCategory) catIter.next();
      metaDataTypes.putAll(
          getCategoryService(iwc).getInheritedMetaDataTypes(element.getMetaDataTypes(), element));
    }

    if (!metaDataTypes.isEmpty()) {
      Set set = metaDataTypes.keySet();
      Iterator setIter = set.iterator();
      while (setIter.hasNext()) {
        String key = setIter.next().toString();
        if (!metadataKeys.contains(key)) {
          metadataKeys.add(key);
          metadata[column] = key;
          table.add(
              productCatalog.getHeader(productCatalog.iwrb.getLocalizedString(METADATA + key, key)),
              column++,
              row);
        }
      }
    }
    imageColumn = column;
    table.add(
        productCatalog.getHeader(
            productCatalog.iwrb.getLocalizedString("product.images", "Images")),
        column++,
        row);
    table.setRowColor(row, productCatalog.getHeaderBackgroundColor());

    Product product;
    String key;
    String meta;
    Locale localeInUse;
    int localeIDinUse;
    while (iter.hasNext()) {
      ++row;
      product = (Product) iter.next();

      if (null == product.getProductName(this.localeID, null)) {
        localeInUse = this.defaultLocale;
        localeIDinUse = this.defaultLocaleID;
      } else {
        localeInUse = this.locale;
        localeIDinUse = this.localeID;
      }

      if (productCatalog.hasEditPermission()) {
        table.add(productCatalog.getProductEditorLink(product), 1, row);
      }
      table.add(
          productCatalog.getNamePresentationObject(
              product, product.getProductName(localeIDinUse), false),
          1,
          row);
      for (int i = 0; i < metadata.length; i++) {
        key = metadata[i];
        if (key != null) {
          meta = product.getMetaData(METADATA + key + "_" + localeInUse.toString());
          if (meta != null) {
            table.add(productCatalog.getText(meta), i, row);
          }
        }
      }

      // Collection coll = getEditorBusiness(iwc).getFiles(product);
      Collection coll;
      try {
        coll = product.getICFile();
        Iterator images = coll.iterator();
        Image image;
        int counter = 0;
        while (images.hasNext()) {
          ++counter;
          try {
            image =
                new Image(
                    new Integer(((ICFile) images.next()).getPrimaryKey().toString()).intValue());
            Window window = new Window(image);

            Link link = new Link(productCatalog.getText(Integer.toString(counter)));

            if (productCatalog._iconPhoto != null) {
              link = new Link(productCatalog._iconPhoto);
            }

            link.setWindow(window);

            table.add(link, imageColumn, row);
            table.add(productCatalog.getText(Text.NON_BREAKING_SPACE), imageColumn, row);
          } catch (Exception e) {
            e.printStackTrace(System.err);
          }
        }
      } catch (IDORelationshipException e1) {
        e1.printStackTrace();
      }

      table.setRowColor(row, productCatalog.getBackgroundColor());
    }

    return table;
  }
  @Override
  public void present(IWContext iwc) throws Exception {
    this.iwrb = getResourceBundle(iwc);
    this.iwb = getBundle(iwc);

    List<ICLocale> locales = ICLocaleBusiness.listOfLocales();

    String action = iwc.getParameter(PARAMETER_ACTION);
    if (ACTION_CREATE.equals(action)) {
      getCategoryCreationForm(iwc, null, locales);
    } else if (ACTION_EDIT.equals(action)) {
      ApplicationCategory category =
          getApplicationBusiness(iwc)
              .getApplicationCategoryHome()
              .findByPrimaryKey(Integer.parseInt(iwc.getParameter("id")));
      getCategoryCreationForm(iwc, category, locales);
    } else if (ACTION_SAVE.equals(action)) {
      String id = iwc.getParameter("id");
      String name = iwc.getParameter("name");
      String desc = iwc.getParameter("desc");
      String priority = iwc.getParameter("priority");

      if (name != null && !name.trim().equals("")) {
        ApplicationCategory cat = null;
        if (id != null) {
          try {
            cat =
                getApplicationBusiness(iwc)
                    .getApplicationCategoryHome()
                    .findByPrimaryKey(new Integer(iwc.getParameter("id")));
          } catch (FinderException f) {
            f.printStackTrace();
          }
        } else {
          cat = getApplicationBusiness(iwc).getApplicationCategoryHome().create();
        }

        cat.setName(name);
        cat.setDescription(desc);
        if (priority != null && !priority.equals("")) {
          cat.setPriority(new Integer(priority));
        }
        cat.store();

        for (Iterator<ICLocale> it = locales.iterator(); it.hasNext(); ) {
          ICLocale locale = it.next();
          String locName = iwc.getParameter(locale.getName() + "_locale");

          if (locName != null && !locName.equals("")) {
            LocalizedText locText = cat.getLocalizedText(locale.getLocaleID());
            boolean newText = false;
            if (locText == null) {
              locText = getLocalizedTextHome().create();
              newText = true;
            }

            locText.setLocaleId(locale.getLocaleID());
            locText.setBody(locName);

            locText.store();

            if (newText) {
              cat.addLocalizedName(locText);
            }
          }
        }

        IWCacheManager.getInstance(iwc.getIWMainApplication())
            .invalidateCache(ApplicationCategoryViewer.CACHE_KEY);
        IWCacheManager.getInstance(iwc.getIWMainApplication())
            .invalidateCache(ApplicationFavorites.CACHE_KEY);
      }
      listExisting(iwc);
    } else if (ACTION_CATEGORY_UP.equals(action)) {
      String id = iwc.getParameter("id");

      ApplicationCategory cat = null;
      if (id != null) {
        try {
          cat =
              getApplicationBusiness(iwc)
                  .getApplicationCategoryHome()
                  .findByPrimaryKey(new Integer(id));
        } catch (FinderException f) {
          f.printStackTrace();
        }
      }
      Integer priority = cat.getPriority();
      ApplicationCategory upperCat = null;
      if (priority != null) {
        try {
          upperCat =
              getApplicationBusiness(iwc)
                  .getApplicationCategoryHome()
                  .findByPriority(priority.intValue() - 1);
          upperCat.setPriority(-1);
          upperCat.store();
        } catch (FinderException f) {
          f.printStackTrace();
        }
        cat.setPriority(priority.intValue() - 1);
      }

      cat.store();

      if (upperCat != null) {
        upperCat.setPriority(priority.intValue());
        upperCat.store();
      }

      clearApplicationCategoryViewerCache(iwc);

      listExisting(iwc);
    } else if (ACTION_CATEGORY_DOWN.equals(action)) {
      String id = iwc.getParameter("id");

      ApplicationCategory cat = null;
      if (id != null) {
        try {
          cat =
              getApplicationBusiness(iwc)
                  .getApplicationCategoryHome()
                  .findByPrimaryKey(new Integer(id));
        } catch (FinderException f) {
          f.printStackTrace();
        }
      }
      Integer priority = cat.getPriority();
      ApplicationCategory lowerCat = null;
      if (priority != null) {
        try {
          lowerCat =
              getApplicationBusiness(iwc)
                  .getApplicationCategoryHome()
                  .findByPriority(priority.intValue() + 1);
          lowerCat.setPriority(-1);
          lowerCat.store();
        } catch (FinderException f) {
          f.printStackTrace();
        }
        cat.setPriority(priority.intValue() + 1);
      }

      cat.store();

      if (lowerCat != null) {
        lowerCat.setPriority(priority.intValue());
        lowerCat.store();
      }

      clearApplicationCategoryViewerCache(iwc);

      listExisting(iwc);
    } else if (ACTION_APP_UP.equals(action)) {
      String appId = iwc.getParameter("app_id");
      String id = iwc.getParameter("id");

      Application app = null;
      ApplicationCategory category = null;
      if (appId != null) {
        try {
          app =
              getApplicationBusiness(iwc).getApplicationHome().findByPrimaryKey(new Integer(appId));
        } catch (FinderException f) {
          f.printStackTrace();
        }
      }
      Integer priority = app.getPriority();
      Application upperApp = null;
      if (priority != null) {
        try {
          category =
              getApplicationBusiness(iwc)
                  .getApplicationCategoryHome()
                  .findByPrimaryKey(new Integer(id));

          upperApp =
              getApplicationBusiness(iwc)
                  .getApplicationHome()
                  .findByCategoryAndPriority(category, priority.intValue() - 1);
          upperApp.setPriority(-1);
          upperApp.store();
        } catch (FinderException f) {
          f.printStackTrace();
        }
        app.setPriority(priority.intValue() - 1);
      }

      app.store();

      if (upperApp != null) {
        upperApp.setPriority(priority.intValue());
        upperApp.store();
      }

      clearApplicationCategoryViewerCache(iwc);

      getCategoryCreationForm(iwc, category, locales);
    } else if (ACTION_APP_DOWN.equals(action)) {
      String appId = iwc.getParameter("app_id");
      String id = iwc.getParameter("id");

      Application app = null;
      ApplicationCategory category = null;
      if (appId != null) {
        try {
          app =
              getApplicationBusiness(iwc).getApplicationHome().findByPrimaryKey(new Integer(appId));
        } catch (FinderException f) {
          f.printStackTrace();
        }
      }
      Integer priority = app.getPriority();
      Application lowerApp = null;
      if (priority != null) {
        try {
          category =
              getApplicationBusiness(iwc)
                  .getApplicationCategoryHome()
                  .findByPrimaryKey(new Integer(id));

          lowerApp =
              getApplicationBusiness(iwc)
                  .getApplicationHome()
                  .findByCategoryAndPriority(category, priority.intValue() + 1);
          lowerApp.setPriority(-1);
          lowerApp.store();
        } catch (FinderException f) {
          f.printStackTrace();
        }
        app.setPriority(priority.intValue() + 1);
      }

      app.store();

      if (lowerApp != null) {
        lowerApp.setPriority(priority.intValue());
        lowerApp.store();
      }

      clearApplicationCategoryViewerCache(iwc);

      getCategoryCreationForm(iwc, category, locales);
    } else if (ACTION_DELETE.equals(action)) {
      try {
        ApplicationCategory cat =
            getApplicationBusiness(iwc)
                .getApplicationCategoryHome()
                .findByPrimaryKey(new Integer(iwc.getParameter("id")));
        cat.remove();
      } catch (FinderException f) {
        f.printStackTrace();
      }
      listExisting(iwc);
    } else if (ACTION_LIST.equals(action)) {
      listExisting(iwc);
    } else {
      listExisting(iwc);
    }
  }