Package com.agiletec.plugins.jacms.aps.system.services.content.model

Examples of com.agiletec.plugins.jacms.aps.system.services.content.model.Content


  }
 
  @Override
  public String createNewVoid() {
    String result = super.createNewVoid();
    Content content = this.getContent();
    IContentActionHelper helper = (IContentActionHelper) this.getContentActionHelper();
    helper.checkTypeLabels(content);
    this.disableAttributes(content);
    String mainGroup = this.getMainGroup();
    if (null != mainGroup
        && null != this.getGroupManager().getGroup(mainGroup)
        && super.isCurrentUserMemberOf(mainGroup)) {
      content.setMainGroup(mainGroup);
    }
    return result;
  }
View Full Code Here


 
  @Override
  protected String saveContent(boolean approve) {
    Logger log = ApsSystemUtils.getLogger();
    try {
      Content currentContent = this.getContent();
      if (null != currentContent) {
        if (!this.getContentActionHelper().isUserAllowed(currentContent, this.getCurrentUser())) {
          log.info("Utente non abilitato al salvataggio del contenuto " + currentContent.getId());
          return USER_NOT_ALLOWED;
        }
        currentContent.setLastEditor(this.getCurrentUser().getUsername());
        if (approve) {
          if (!Content.STATUS_READY.equals(currentContent.getStatus()) && !Content.STATUS_PUBLIC.equals(currentContent.getStatus())) {
            String[] args = { currentContent.getId() , currentContent.getDescr()};
            this.addFieldError("status", this.getText("error.content.publish.notReadyStatus", args));
            return INPUT;
          }
          this.getContentManager().insertOnLineContent(currentContent);
        } else {
          this.getContentManager().saveContent(currentContent);
        }
        String sessionParamName = ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + this.getContentOnSessionMarker();
        this.getRequest().getSession().removeAttribute(sessionParamName);
        log.info("Salvato contenuto " + currentContent.getId() +
            " - Descrizione: '" + currentContent.getDescr() + "' - Utente: " + this.getCurrentUser().getUsername());
      } else {
        log.error("Tentativo Salvataggio/approvazione contenuto NULLO - Utente: " + this.getCurrentUser().getUsername());
      }
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "saveContent");
View Full Code Here

 
  @Override
  public String previousStep() {
    Logger log = ApsSystemUtils.getLogger();
    try {
      Content currentContent = this.updateContentOnSession();
      if (null != currentContent) {
        currentContent.setLastEditor(this.getCurrentUser().getUsername());
        String previousStep = this.getPreviousStep();
        if (previousStep != null) {
          currentContent.setStatus(previousStep);
          this.getContentManager().saveContent(currentContent);
          String sessionParamName = ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + this.getContentOnSessionMarker();
          this.getRequest().getSession().removeAttribute(sessionParamName);
        } else {
          this.addActionError(this.getText("error.content.save.statusNotAllowed"));
View Full Code Here

 
  @Override
  public String nextStep() {
    Logger log = ApsSystemUtils.getLogger();
    try {
      Content currentContent = this.updateContentOnSession();
      if (null != currentContent) {
        currentContent.setLastEditor(this.getCurrentUser().getUsername());
        String nextStep = this.getNextStep();
        if (nextStep != null) {
          currentContent.setStatus(nextStep);
          this.getContentManager().saveContent(currentContent);
          String sessionParamName = ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + this.getContentOnSessionMarker();
          this.getRequest().getSession().removeAttribute(sessionParamName);
        } else {
          this.addActionError(this.getText("error.content.save.statusNotAllowed"));
View Full Code Here

    return isAllowed;
  }
 
  public String getPreviousStep() {
    if (this._previousStep == null) {
      Content content = this.getContent();
      this._previousStep = ((IContentWorkFlowActionHelper) this.getContentActionHelper()).getPreviousStep(content.getStatus(), content.getTypeCode());
    }
    return this._previousStep;
  }
View Full Code Here

    return this._previousStep;
  }
 
  public String getNextStep() {
    if (this._nextStep == null) {
      Content content = this.getContent();
      this._nextStep = ((IContentWorkFlowActionHelper) this.getContentActionHelper()).getNextStep(content.getStatus(), content.getTypeCode());
    }
    return this._nextStep;
  }
View Full Code Here

 
  @Override
  public List<SelectItem> getAvalaibleStatus() {
    List<SelectItem> items;
    try {
      Content content = this.getContent();
      items = new ArrayList<SelectItem>(1);
      String statusDescrKey = "name.contentStatus." +content.getStatus();
      SelectItem item = null;
      if (statusDescrKey.equals(this.getText(statusDescrKey))) {
        String contentType = content.getTypeCode();
        Workflow workflow = this.getWorkflowManager().getWorkflow(contentType);
        if (null != workflow && null != workflow.getStep(content.getStatus())) {
          item = new SelectItem(content.getStatus(), workflow.getStep(content.getStatus()).getDescr());
        } else {
          item = new SelectItem(content.getStatus(), content.getStatus());
        }
      } else {
        item = new SelectItem(content.getStatus(), statusDescrKey);
      }
      items.add(item);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getAvalaibleStatus");
      throw new RuntimeException("Error in getAvalaibleStatus");
View Full Code Here

      Iterator<String> iter = this.getContentIds().iterator();
      List<Content> publishedContents = new ArrayList<Content>();
      IContentManager contentManager = (IContentManager) this.getContentManager();
      while (iter.hasNext()) {
        String contentId = (String) iter.next();
        Content contentToPublish = contentManager.loadContent(contentId, false);
        String[] msgArg = new String[1];
        if (null == contentToPublish) {
          msgArg[0] = contentId;
          this.addActionError(this.getText("error.content.contentToPublishNull", msgArg));
          continue;
        }
        msgArg[0] = contentToPublish.getDescr();
        if (!Content.STATUS_READY.equals(contentToPublish.getStatus())) {
          String nextStep = this.getNextStep(contentToPublish);
          if (null != nextStep && !Content.STATUS_READY.equals(nextStep)) {
            String[] args = {contentToPublish.getId(), contentToPublish.getDescr(), contentToPublish.getStatus()};
            this.addActionError(this.getText("error.content.publish.statusNotAllowed", args));
            continue;
          }
        }
        if (!this.isUserAllowed(contentToPublish)) {
          this.addActionError(this.getText("error.content.userNotAllowedToPublishContent", msgArg));
          continue;
        }
        this.getContentActionHelper().scanEntity(contentToPublish, this);
        if (this.getFieldErrors().size()>0) {
          this.addActionError(this.getText("error.content.publishingContentWithErrors", msgArg));
          continue;
        }
        contentManager.insertOnLineContent(contentToPublish);
        ApsSystemUtils.getLogger().info("Content '" + contentToPublish.getId()
            + "' published by user '" + this.getCurrentUser().getUsername() + "'");
        publishedContents.add(contentToPublish);
      }
      //RIVISITARE LOGICA DI COSTRUZIONE LABEL
      this.addConfirmMessage("message.content.publishedContents", publishedContents);
View Full Code Here

    PreparedStatement stat = null;
    try {
      conn = this.getConnection();
      conn.setAutoCommit(false);
      stat = conn.prepareStatement(SAVE_EVENT);
      Content content = (Content) event.getContent();
      stat.setInt(1, this.newId(conn));
      stat.setTimestamp(2, new Timestamp(new Date().getTime()));
      stat.setInt(3, event.getOperationCode());
      stat.setString(4, content.getId());
      stat.setString(5, content.getTypeCode());
      stat.setString(6, content.getDescr());
      stat.setString(7, content.getMainGroup());
      String groups = this.getConcatedString(content.getGroups());
      stat.setString(8, groups);
      stat.setShort(9, (short) 0); // false
      stat.executeUpdate();
      conn.commit();
    } catch (Throwable t) {
View Full Code Here

    return isAllowed;
  }
 
  @Override
  public boolean isAuthToEdit(UserDetails user, PublicContentAuthorizationInfo info) throws ApsSystemException {
    Content content = this.getContentManager().loadContent(info.getContentId(), true);
    return super.isAuthToEdit(user, content);
  }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jacms.aps.system.services.content.model.Content

Copyright © 2018 www.massapicom. 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.