Exemple #1
0
  /**
   * check if an artefact might be moved to this new parent node artefact might be moved to pages or
   * structureElements, but not on maps
   *
   * @param artefactId
   * @param structureId
   * @return
   */
  private boolean checkNewArtefactTarget(final String artefactId, final String structureId) {
    // artefact cannot be moved directly under root
    if (ROOT_NODE_IDENTIFIER.equals(structureId)) {
      return false;
    }

    PortfolioStructure newParStruct;
    AbstractArtefact artefact;
    try {
      artefact = ePFMgr.loadArtefactByKey(new Long(artefactId));
      newParStruct = ePFMgr.loadPortfolioStructureByKey(new Long(structureId));
    } catch (final Exception e) {
      log.warn("could not check for valid artefact target", e);
      return false;
    }
    final boolean sameTarget = ePFMgr.isArtefactInStructure(artefact, newParStruct);
    if (sameTarget) {
      return false;
    }
    if (newParStruct instanceof EPAbstractMap) {
      return false;
    }
    return true;
  }