Examples of BundleManager


Examples of edu.uga.galileo.voci.model.BundleManager

      } else if (contentType == ContentType.COLLECTION) {
        request.setAttribute("vbo", (new CollectionManager())
            .getCollection(command, elementId, command
                .isViewCommand() ? true : false));
      } else if (contentType == ContentType.BUNDLE) {
        request.setAttribute("vbo", (new BundleManager()).getBundle(
            command, elementId, command.isViewCommand() ? true
                : false));
      } else if (contentType == ContentType.ITEM) {
        request.setAttribute("vbo", (new ItemManager()).getItem(
            command, elementId, command.isViewCommand() ? true
View Full Code Here

Examples of edu.uga.galileo.voci.model.BundleManager

      getItemWrappersForNode(command, (User) request.getSession()
          .getAttribute("user"), request);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("search"))) {
      // prep for search functions
      setSearchObject(command, new BundleManager(), request, errors);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("open"))) {
      // open nodes in the content tree
      openNodes(command, request, openNodesAttributeName, openNodes);
    } else if ((command.getModifier() != null)
View Full Code Here

Examples of edu.uga.galileo.voci.model.BundleManager

   *         <code>false</code> if all's well.
   */
  private boolean handleBundleAddRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user,
      ArrayList<Integer> openNodes, String openNodesAttributeName) {
    BundleManager bundleManager = new BundleManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Bundle bundle = null;

    boolean goToList = false;
    try {
      bundle = bundleManager.getBundle(command, -1, false);
      if ((command.getOther() != null)
          && (command.getOther().get(0).equals("to"))) {
        int parentId = Integer.parseInt(command.getOther().get(1));
        // verify that the user can edit the requested parent
        if (!workflowManager.canEdit(user, command.getProject(),
View Full Code Here

Examples of edu.uga.galileo.voci.model.BundleManager

   *            The user making the request.
   * @return <code>true</code>.
   */
  public boolean handleBundleDeleteRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user) {
    BundleManager bundleManager = new BundleManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Bundle bundle = null;

    try {
      int bundleId = Integer.parseInt(command.getOther().get(0));
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), bundleId)) {
        errors.add("You don't have permission to delete "
            + "the requested bundle.");
      } else {
        try {
          bundle = bundleManager.getBundleForUpdate(command,
              bundleId, false, request.getSession());
          bundleManager.deleteBundle(bundle, ((User) request
              .getSession().getAttribute("user")));
          request.setAttribute("successMessage", "Bundle " + bundleId
              + " successfully deleted.");
        } catch (NoSuchBundleException e) {
          errors.add("The bundle to delete either doesn't exist, "
View Full Code Here

Examples of edu.uga.galileo.voci.model.BundleManager

   *         <code>false</code> if all's well.
   */
  private boolean handleBundleUpdateRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user,
      ArrayList<Integer> openNodes, HashMap<String, String> fieldMessages) {
    BundleManager bundleManager = new BundleManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Bundle bundle = null;

    int parentId = -1;
    boolean goToList = false;
    if (request.getParameter("parentId") != null) {
      parentId = Integer.parseInt(request.getParameter("parentId"));
      // verify that the user can edit the requested parent
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), parentId)) {
        errors.add("You don't have permission to add a "
            + "bundle to the requested object.");
        goToList = true;
      } else {
        request.setAttribute("parentId", request
            .getParameter("parentId"));
      }
    }

    if (!goToList) {
      try {
        int bundleId;
        boolean isFormSubmission = false;
        if (request.getParameter("bundleId") != null) {
          // the id comes from the request if it's a form
          // submission
          bundleId = Integer.parseInt(request
              .getParameter("bundleId"));
          isFormSubmission = true;
        } else {
          // the id comes from the "other" portion of the command
          // if the user's clicked the bundle for editing
          bundleId = Integer.parseInt(command.getOther().get(0));
        }

        if (bundleId == -1) {
          // this is a new bundle
          try {
            bundle = bundleManager.getBundle(command, -1, false);
          } catch (NoSuchBundleException e) {
            Logger.error("An empty bundle couldn't be created.", e);
            errors.add("Empty bundle couldn't be constructed.");
            goToList = true;
          }
        } else {
          // this is an existing bundle
          // first make sure that the user can edit it
          if (!workflowManager.canEdit(user, command.getProject(),
              command.getCommand(), bundleId)) {
            errors.add("You don't have permission to edit "
                + "the requested bundle.");
            goToList = true;
          } else {
            try {
              bundle = bundleManager.getBundleForUpdate(command,
                  bundleId, false, request.getSession());
            } catch (NoSuchBundleException e) {
              Logger.warn("Requested bundle (" + bundleId
                  + ") couldn't be retrieved", e);
              errors.add("Requested bundle (" + bundleId
                  + ") couldn't be retrieved");
              goToList = true;
            } catch (ContentLockedException e) {
              errors.add(e.getMessage());
              goToList = true;
            }
          }
        }

        if ((isFormSubmission) && (bundle != null)) {
          String oldData = bundle.toString();

          populateVBOFromRequest(bundle, request, fieldMessages, true);

          String addToRepeatables = request
              .getParameter("addToRepeatables");
          if ((addToRepeatables == null)
              || (addToRepeatables.trim().length() == 0)) {

            if (oldData.equals(bundle.toString())) {
              errors.add("No changes detected.");
            }

            if ((errors.size() == 0) && (fieldMessages.size() == 0)) {
              try {
                if (bundle.getId() == -1) {
                  bundleManager.addBundle(user, bundle,
                      parentId);
                  request.setAttribute("successMessage",
                      "Bundle successfully added.");
                } else {
                  bundleManager.updateBundle(bundle,
                      ((User) request.getSession()
                          .getAttribute("user")),
                      oldData);
                  request
                      .setAttribute(
View Full Code Here

Examples of edu.uga.galileo.voci.model.BundleManager

   *         the content list rather than the bundle form; <code>false</code>
   *         if all's well.
   */
  public boolean handleHistoryRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user) {
    BundleManager bundleManager = new BundleManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Bundle bundle = null;

    boolean goToList = false;

    String[] vals = command.getOther().get(0).split("\\|");
    AuditLogManager alm = new AuditLogManager();
    int bundleId = -1;
    try {
      bundleId = Integer.parseInt(vals[2]);
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), bundleId)) {
        errors.add("You don't have permission to edit "
            + "the requested bundle.");
        goToList = true;
      } else {
        AuditLog record = alm.getRecord(Integer.parseInt(vals[0]),
            ContentType.valueOf(Integer.parseInt(vals[1])),
            (bundleId = Integer.parseInt(vals[2])), Timestamp
                .valueOf(vals[3]));
        String data = record.getDataExport();
        bundle = new Bundle();
        bundle.fromString(data);
      }
    } catch (NullPointerException e) {
      goToList = true;
      errors.add("Invalid history request format.");
    } catch (NumberFormatException e) {
      goToList = true;
      errors.add("Invalid history request format.");
    } catch (NoSuchAuditLogRecordException e) {
      errors.add("The history record requested couldn't be located.");
    } catch (DataTypeMismatchException e) {
      Logger.error("Data type mismatch occurred pulling "
          + command.getOther().get(0) + " from the audit log", e);
      errors.add("A system error was encountered (DataTypeMismatch). "
          + "Please contact a system administrator.");
    }

    if (!goToList) {
      if (bundle == null) {
        try {
          bundle = bundleManager.getBundle(command, bundleId, false);
        } catch (NoSuchBundleException e) {
          goToList = true;
          errors.add("No such bundle (" + bundleId + ") found.");
        }
      }
View Full Code Here

Examples of edu.uga.galileo.voci.model.BundleManager

   *         the content list rather than the bundle viewing page;
   *         <code>false</code> if all's well.
   */
  public boolean handleBundleViewRequest(HttpServletRequest request,
      Command command) {
    BundleManager bundleManager = new BundleManager();
    Bundle bundle = null;
    boolean goToList = false;
    try {
      bundle = bundleManager.getBundle(command, Integer.parseInt(command
          .getOther().get(0)), true);
    } catch (NumberFormatException e) {
      Logger
          .warn("Couldn't get requested bundle: "
              + command.getOther() == null ? "{null}" : command
View Full Code Here

Examples of org.apache.karaf.features.internal.BundleManager

        String bundle1Uri = "bundle1";
        String bundle2Uri = "bundle2";

        URI uri = createTempRepo(FEATURE_WITH_INVALID_BUNDLE, bundle1Uri, bundle2Uri);
       
        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        Bundle installedBundle1 = createDummyBundle(12345L, "bundle1", headers());
        Bundle installedBundle2 = createDummyBundle(54321L, "bundle2", headers());
        expect(bundleManager.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
        expect(bundleManager.installBundleIfNeeded(bundle1Uri, 0, null)).andReturn(new BundleInstallerResult(installedBundle1, true));
        expect(bundleManager.installBundleIfNeeded(bundle2Uri, 0, null)).andReturn(new BundleInstallerResult(installedBundle2, true));
        expect(bundleManager.installBundleIfNeeded("zfs:unknown", 0, null)).andThrow(new MalformedURLException());
        EasyMock.expectLastCall();
        ignoreRefreshes(bundleManager);

        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
View Full Code Here

Examples of org.apache.karaf.features.internal.BundleManager

        String bundle1Uri = "file:bundle1";
        String bundle2Uri = "file:bundle2";

        URI uri = createTempRepo(FEATURE_WITH_INVALID_BUNDLE, bundle1Uri, bundle2Uri);

        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        Bundle installedBundle1 = createDummyBundle(12345L, "bundle1", headers());
        Bundle installedBundle2 = createDummyBundle(54321L, "bundle2", headers());
        expect(bundleManager.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
        expect(bundleManager.installBundleIfNeeded(bundle1Uri, 0, null)).andReturn(new BundleInstallerResult(installedBundle1, true));
        expect(bundleManager.installBundleIfNeeded(bundle2Uri, 0, null)).andReturn(new BundleInstallerResult(installedBundle2, true));
        expect(bundleManager.installBundleIfNeeded("zfs:unknown", 0, null)).andThrow(new MalformedURLException());
        bundleManager.uninstall(setOf(installedBundle1));
        EasyMock.expectLastCall();
        ignoreRefreshes(bundleManager);

        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
View Full Code Here

Examples of org.apache.karaf.features.internal.BundleManager

        String bundle1Uri = "file:bundle1";
        String bundle2Uri = "file:bundle2";

        URI uri = createTempRepo(FEATURE_WITH_INVALID_BUNDLE, bundle1Uri, bundle2Uri);

        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        Bundle installedBundle1 = createDummyBundle(12345L, bundle1Uri, headers());
        Bundle installedBundle2 = createDummyBundle(54321L, bundle2Uri, headers());
        expect(bundleManager.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
        expect(bundleManager.installBundleIfNeeded(bundle1Uri, 0, null)).andReturn(new BundleInstallerResult(installedBundle1, true));
        expect(bundleManager.installBundleIfNeeded(bundle2Uri, 0, null)).andReturn(new BundleInstallerResult(installedBundle2, true));
        expect(bundleManager.installBundleIfNeeded("zfs:unknown", 0, null)).andThrow(new MalformedURLException());
       
        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
        svc.addRepository(uri);
        try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.