/*
   * (non-Javadoc)
   *
   * @see
   * cc.kune.core.server.content.CreationService#createContent(java.lang.String,
   * java.lang.String, cc.kune.domain.User, cc.kune.domain.Container,
   * java.lang.String)
   */
  @Override
  public Content createContent(
      final String title,
      final String body,
      final User user,
      final Container container,
      final String typeId,
      final WaveRef waveRef,
      final boolean publishExistingWave) {
    final ServerTool tool = tools.get(container.getToolName());
    tool.checkTypesBeforeContentCreation(container.getTypeId(), typeId);
    final URL gagdetUrl =
        tool instanceof ServerToolWithWaveGadget
            ? ((ServerToolWithWaveGadget) tool).getGadgetUrl()
            : KuneWaveService.WITHOUT_GADGET;
    final String[] otherParticipants =
        tool instanceof ServerToolWithWave
            ? ((ServerToolWithWave) tool).getNewContentAdditionalParts(container)
            : NO_MORE_PARTICIPANTS;

    final Content content =
        contentManager.createContent(
            title,
            body,
            publishExistingWave,
            waveRef,
            user,
            container,
            typeId,
            gagdetUrl,
            NO_PROPERTIES,
            otherParticipants);
    tool.onCreateContent(content, container);
    return content;
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * cc.kune.core.server.content.CreationService#copyContent(cc.kune.domain.
  * User, cc.kune.domain.Container, cc.kune.domain.Content)
  */
 @Override
 public Content copyContent(
     final User user, final Container container, final Content contentToCopy) {
   final ServerTool tool = tools.get(container.getToolName());
   final Content content = contentManager.copyContent(user, container, contentToCopy);
   tool.onCreateContent(content, container);
   return content;
 }
Exemple #3
0
 /**
  * Inits the group.
  *
  * @param user the user
  * @param group the group
  * @param toolsToEnable the tools to enable
  * @param vars the vars
  * @throws GroupShortNameInUseException the group short name in use exception
  */
 private void initGroup(
     final User user, final Group group, final List<String> toolsToEnable, final Object... vars)
     throws GroupShortNameInUseException {
   try {
     persist(group);
   } catch (final IllegalStateException e) {
     e.printStackTrace();
   } catch (final PersistenceException e) {
     if (e.getCause() instanceof ConstraintViolationException) {
       throw new GroupShortNameInUseException();
     }
     throw e;
   }
   for (final ServerTool tool : serverToolRegistry.all()) {
     if (toolsToEnable.contains(tool.getName())) {
       tool.initGroup(user, group, vars);
     }
   }
   // Init always the trash
   initTrash(group);
 }