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

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


    assertEquals(nc1.getTemplate(), nc2.getTemplate());
    assertEquals(nc1.getFooter(), nc2.getFooter());
  }
 
  private String addContentStatusChangedEvent(String contentId, String status) throws ApsSystemException {
    Content content = this._contentManager.loadContent(contentId, false);
    String currentStatus = content.getStatus();
    content.setStatus(status);
    this._contentManager.saveContent(content);
    return currentStatus;
  }
View Full Code Here


*/
public class ContentVersionsAction extends BaseAction implements IContentVersionsAction {
 
  @Override
  public List<Long> getContentVersions() {
    Content currentContent = (Content) this.getRequest().getSession()
        .getAttribute(ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + this.getContentOnSessionMarker());
    if (null == currentContent) {
      throw new RuntimeException("Contenuto corrente nullo");
    }
    List<Long> versions = null;
    try {
      versions = this.getVersioningManager().getVersions(currentContent.getId());
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getContentVersions");
      throw new RuntimeException("Errore in estrazione lista versioni per contenuto " + currentContent.getId(), t);
    }
    return versions;
  }
View Full Code Here

 
  public void testPreviousStep() throws Throwable {
    this._notifierHelper.deleteContentEvents();
    this._helper.setWorkflowConfig();
    String contentId = "ART179";
    Content content = this._contentManager.loadContent(contentId, false);
    assertEquals(Content.STATUS_DRAFT, content.getStatus());
    try {
      Content modifiedContent = this._contentManager.loadContent(contentId, false);
      modifiedContent.setStatus(Content.STATUS_READY);
      this._contentManager.saveContent(modifiedContent);
     
      Map<String, String> params = new HashMap<String, String>();
      params.put("descr", content.getDescr());
      params.put("mainGroup", content.getMainGroup());
      params.put("Text:it_Titolo", "titolo");
      String result = this.executePreviousStep("admin", contentId, params);
      assertEquals(Action.SUCCESS, result);
      modifiedContent = this._contentManager.loadContent(contentId, false);
      assertEquals("step3", modifiedContent.getStatus());
     
      result = this.executePreviousStep("admin", contentId, params);
      assertEquals(Action.SUCCESS, result);
      modifiedContent = this._contentManager.loadContent(contentId, false);
      assertEquals("step2", modifiedContent.getStatus());
     
      result = this.executePreviousStep("admin", contentId, params);
      assertEquals(Action.SUCCESS, result);
      modifiedContent = this._contentManager.loadContent(contentId, false);
      assertEquals("step1", modifiedContent.getStatus());
     
      result = this.executePreviousStep("admin", contentId, params);
      assertEquals(Action.SUCCESS, result);
      modifiedContent = this._contentManager.loadContent(contentId, false);
      assertEquals(Content.STATUS_DRAFT, modifiedContent.getStatus());
     
      result = this.executePreviousStep("admin", contentId, params);
      assertEquals(Action.INPUT, result);
    } catch(Throwable t) {
      throw t;
View Full Code Here

 
  public void testNextStep() throws Throwable {
    this._notifierHelper.deleteContentEvents();
    this._helper.setWorkflowConfig();
    String contentId = "ART179";
    Content content = this._contentManager.loadContent(contentId, false);
    assertEquals(Content.STATUS_DRAFT, content.getStatus());
    try {
      Map<String, String> params = new HashMap<String, String>();
      params.put("descr", content.getDescr());
      params.put("mainGroup", content.getMainGroup());
      params.put("Text:it_Titolo", "titolo");
      String result = this.executeNextStep("admin", contentId, params);
      assertEquals(Action.SUCCESS, result);
      Content modifiedContent = this._contentManager.loadContent(contentId, false);
      assertEquals("step1", modifiedContent.getStatus());
     
      result = this.executeNextStep("admin", contentId, params);
      assertEquals(Action.SUCCESS, result);
      modifiedContent = this._contentManager.loadContent(contentId, false);
      assertEquals("step2", modifiedContent.getStatus());
     
      result = this.executeNextStep("admin", contentId, params);
      assertEquals(Action.SUCCESS, result);
      modifiedContent = this._contentManager.loadContent(contentId, false);
      assertEquals("step3", modifiedContent.getStatus());
     
      result = this.executeNextStep("admin", contentId, params);
      assertEquals(Action.SUCCESS, result);
      modifiedContent = this._contentManager.loadContent(contentId, false);
      assertEquals(Content.STATUS_READY, modifiedContent.getStatus());
     
      result = this.executeNextStep("admin", contentId, params);
      assertEquals(Action.INPUT, result);
    } catch(Throwable t) {
      throw t;
View Full Code Here

  private SyndEntry createEntry(ContentRecordVO contentVO, String langCode, String feedLink, HttpServletRequest req, HttpServletResponse resp) throws ApsSystemException {
    SyndEntry entry = new SyndEntryImpl();
    RssContentMapping mapping = this.getContentMapping().get(contentVO.getTypeCode());
    try {
      Content content = (Content) this.getContentManager().loadContent(contentVO.getId(), true);
      ITextAttribute titleAttr = (ITextAttribute) content.getAttribute(mapping.getTitleAttributeName());
      String title = (titleAttr.getTextForLang(langCode));
      if (null == title || title.trim().length() == 0) {
        title = titleAttr.getText();
      }
      entry.setTitle(title);
      String link = this.createLink(content, feedLink);
      entry.setLink(link);
      entry.setPublishedDate(contentVO.getModify());
      ITextAttribute descrAttr = (ITextAttribute) content.getAttribute(mapping.getDescriptionAttributeName());
      if (null != descrAttr) {
        SyndContent description = new SyndContentImpl();
        description.setType(JpRssSystemConstants.SYNDCONTENT_TYPE_TEXTHTML);
        String inLang = descrAttr.getTextForLang(langCode);
        //TODO Ottimizzare!
View Full Code Here

    UserDetails currentUser = (UserDetails) this.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    return currentUser;
  }
 
  private String executePreviousStep(String currentUserName, String contentId, Map<String, String> params) throws Throwable {
    Content content = this._contentManager.loadContent(contentId, false);
    String contentOnSessionMarker = AbstractContentAction.buildContentOnSessionMarker(content, ApsAdminSystemConstants.EDIT);
    String contentOnSessionParam = ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + contentOnSessionMarker;
    this.getRequest().getSession().setAttribute(contentOnSessionParam, content);
    this.setUserOnSession(currentUserName);
    this.initContentAction("/do/jacms/Content", "previousStep", contentOnSessionMarker);
View Full Code Here

    String result = this.executeAction();
    return result;
  }
 
  private String executeNextStep(String currentUserName, String contentId, Map<String, String> params) throws Throwable {
    Content content = this._contentManager.loadContent(contentId, false);
    String contentOnSessionMarker = AbstractContentAction.buildContentOnSessionMarker(content, ApsAdminSystemConstants.EDIT);
    String contentOnSessionParam = ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + contentOnSessionMarker;
    this.getRequest().getSession().setAttribute(contentOnSessionParam, content);
    this.setUserOnSession(currentUserName);
    this.initContentAction("/do/jacms/Content", "nextStep", contentOnSessionMarker);
View Full Code Here

  @Override
  public String delete() {
    Logger log = ApsSystemUtils.getLogger();
    try {
      String contentId = this.getContentId();
      Content contentToSuspend = this.getContentManager().loadContent(contentId, false);
      if (null == contentToSuspend) {
        log.info("fastContentEdit: contenuto da eliminare nullo");
        return FAILURE;
      }
      if (!this.isUserAllowed(contentToSuspend)) {
        log.info("fastContentEdit: utente non abilitato all'eliminazione del contenuto " + contentId);
        return "userNotAllowed";
      }
      Map references = this.getContentActionHelper().getReferencingObjects(contentToSuspend, this.getRequest());
      if (references.size()>0) {
        this.addActionError(this.getText("Errors.fastContentEdit.referencedContent"));
        log.info("fastContentEdit: il contenuto da eliminare " + contentId + " presenta delle referenze");
        return "userNotAllowed";
      }
      Content content = this.getContentManager().loadContent(contentId, true);
      this.getContentManager().removeOnLineContent(content);
      this.getContentManager().deleteContent(content);
      this.waitNotifyingThread();
      this.getResponse().sendRedirect(this.getDestForwardPath());
    } catch (Throwable t) {
View Full Code Here

      Iterator<SyndEntryImpl> entriesIt = entries.iterator();
      String linkAttributeName = aggregatorConfig.getLinkAttributeName();// this.getLinkAttributeName(typeCode);
      while (entriesIt.hasNext()) {
        SyndEntryImpl feedItem = entriesIt.next();
        String link = feedItem.getLink();
        Content content = this.getExistingContent(link, linkAttributeName, item.getContentType());
        if (null == content) {
          String typeCode = aggregatorConfig.getContentType();
          content = this.getContentManager().createContentType(typeCode);
        }
        this.getContentBuilder().populateContentFromMapping(content, feedItem, item, this.getMappingMap().get(aggregatorConfig.getContentType()));
View Full Code Here

    }
    return inFeed;
  }
 
  private Content getExistingContent(String link, String linkAttributeName, String contentType) throws ApsSystemException {
    Content content = null;
    try {
      EntitySearchFilter linkFilter = new EntitySearchFilter(linkAttributeName, true, link, false);
      linkFilter.setLangCode(this.getDefaultLangCode());
      EntitySearchFilter typeCodeFilter = new EntitySearchFilter(IContentManager.ENTITY_TYPE_CODE_FILTER_KEY, false, contentType, false);
      EntitySearchFilter[] filters = new EntitySearchFilter[]{linkFilter, typeCodeFilter};
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.