Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGContent


 
  private void retrieveHierarchy(WGContent content, ArrayList contents, WGContentNavigator navigator, int level) throws WGAPIException {
      Status status = (Status) getStatus();
    contents.add(content);
    if (level < status.iMaxLevel) {
      WGContent childContent = navigator.getChildContent(content, 0, WGContent.SEARCHORDER_ASCENDING);
      while (childContent != null) {
        this.retrieveHierarchy(childContent, contents, navigator, level + 1);
        childContent = navigator.getNextSibling(childContent);
      }
    }
View Full Code Here


    return this.meta("content", name);
  }

  private Object getContentMetaData(String name) throws WGAPIException {

    WGContent content = this.content();
    if (content == null) {
      return this.getdocument().getMetaData(name);
    }

    Object mappingresult = this.getMappedMetaValue(name);
    if (mappingresult != null) {
      return mappingresult;
    }

    if (name.equals("created")) {
      return content.getCreated();
    }
    else if (name.equals("modified")) {
      return content.getLastModified();
    }
    else if (name.equals("title")) {
      return content.getTitle();
    }
        else if (name.equals("titlepath")) {
            return content.getStructEntry().getTitlePath();
        }
    else if (name.equals("uniquename") || name.equals("name") || name.equals("docname")) {
      return content.getUniqueName();
    }
    else if (name.equals("pageuniquename") || name.equals("pagename") || name.equals("pagedocname")) {
            return content.getStructEntry().getUniqueName();
        }
    else if (name.equals("position")) {
      return content.getStructEntry().getPosition();
    }
    else if (name.equals("key")) {
      return content.getContentKey(true).toString();
    }
    else if (name.equals("area")) {
            if (!content.isDummy()) {
                return content.getStructEntry().getArea().getName();
            }
            else {
                return "";
            }
    }
    else if (name.equals("level")) {
        WGContentNavigator nav = new WGContentNavigator(null, new WebTMLLanguageChooser(db(), this));
      return nav.getContentLevel(content);
    }
    else if (name.equals("index")) {
        WGContentNavigator nav = new WGContentNavigator(null, new WebTMLLanguageChooser(db(), this));
      return nav.getSiblingsIndex(content);
    }
        else if (name.equals("navindex")) {
            WGContentNavigator nav = new WGContentNavigator(WGContent.DISPLAYTYPE_NAVIGATOR, new WebTMLLanguageChooser(db(), this));
            return nav.getSiblingsIndex(content);
        }
    else if (name.equals("language")) {
      return content.getLanguage().getName();
    }
    else if (name.equals("languagetitle")) {
      return content.getLanguage().getTitle();
    }
    else if (name.equals("attachments")) {
      return content.getFileNames();
    }
    else if (name.equals("doctype") || name.equals("contenttype")) {
        if (!content.isDummy()) {
            return content.getStructEntry().getContentType().getName();
        }
        else {
            return null;
        }
    }
        else if (name.equals("contenttypetitle")) {
            return content.getStructEntry().getContentType().getNameForLanguage(getpreferredlanguage());
        }
        else if (name.equals("contenttypedescription")) {
            return content.getStructEntry().getContentType().getDescriptionForLanguage(getpreferredlanguage());
        }
    else if (name.equals("siblings")) {
        WGContentNavigator nav = new WGContentNavigator(null, new WebTMLLanguageChooser(db(), this));
      return new Integer(nav.getSiblingsCount(content));
    }
    else if (name.equals("workflow")) {
      //return content.getStructEntry().getContentType().getMetaData(WGContentType.META_WORKFLOW);
      return content.getStructEntry().getWorkflowName();
    }
    else if (name.equals("status")) {
      return content.getStatus();
    }
    else if (name.equals("structtitle")) {
      return content.getStructEntry().getTitle();
    }
    else if (name.equals("structkey")) {
      WGStructEntry entry = content.getStructEntry();
      if (entry != null) {
        return String.valueOf(entry.getStructKey());
      }
      else {
        return null;
      }
    }
    else if (name.equals("itemnames")) {
      return content.getItemNames();
    }
    else if (name.equals("searchscore")) {
        return new Float(content.getSearchScore());
    }
    else if (name.equals("searchexplanation")) {
      return content.getSearchExplanation();
    }
        else if (name.equals("positionpath")) {
            return content.getStructEntry().getPositionPath();
        }
        else if (name.equals("pagepublished")) {
            return content.getStructEntry().getPublished().get(content.getLanguage().getName());
        }
        else if (name.equals("email")) {
            return content.getAuthorEMail();
        }
    else {
      Object result = null;
      String upperName = name.toUpperCase();
      boolean isNoValidMeta = true;

      if (content.getMetaNames().indexOf(upperName) != -1) {
        result = content.getMetaData(upperName);
        isNoValidMeta = false;
      }

      else if (result == null) {
        WGStructEntry structEntry = content.getStructEntry();
        if (structEntry != null) {
          if (structEntry.getMetaNames().indexOf(upperName) != -1) {
            result = structEntry.getMetaData(upperName);
            isNoValidMeta = false;
          }
View Full Code Here

  }

  public boolean isselected() throws WGAPIException {
   
    boolean isSelected = false;
    WGContent pageContent = getmaincontext().content();
    if (pageContent.getDatabase() != this.document.getDatabase()) {
      return false;
    }

    WGContentNavigator navigator = new WGContentNavigator(this.role, new WebTMLLanguageChooser(db(), this));
    navigator.setOnlyPublished(!isbrowserinterface());
    while (pageContent != null) {
      if (pageContent.getStructKey().equals(this.content().getStructKey())) {
        isSelected = true;
        break;
      }

      if (pageContent.hasCompleteRelationships() && !pageContent.getStructEntry().isRoot()) {
        pageContent = navigator.getParentContent(pageContent);
      }
      else {
        pageContent = null;
      }
View Full Code Here

      // so we just create dummy content on the source context language
      if (lang == null) {
          lang = dbTarget.getLanguage(content().getLanguage().getName());
      }
     
        WGContent dummyContent = dbTarget.getDummyContent(lang.getName());
        if (dummyContent != null) {
            return getTMLContextForDocument(dummyContent);
        }
        else {
            return null;
View Full Code Here

                    // check if locked structentry is a descendant of given entry
                    if (lockedStructEntry.isDescendantOf(entry)) {
                        return true;
                    }
                } else if (lock.getLockable() instanceof WGContent) {
                    WGContent lockedContent = (WGContent) lock.getLockable();
                    // check if lockedContent is a content of a descendant structentry or equals given entry
                    if (lockedContent.getStructEntry().isDescendantOf(entry) || lockedContent.getStructEntry().equals(entry)) {
                        return true;
                    }
                }
            }
        }
View Full Code Here

                    WGStructEntry lockedStructEntry = (WGStructEntry) lock.getLockable();
                    if (lockedStructEntry.getArea().equals(area)) {
                        return true;
                    }
                } else if (lock.getLockable() instanceof WGContent) {
                    WGContent lockedContent = (WGContent) lock.getLockable();
                    // check if structentry of lockedContent belongs to given area
                    if (lockedContent.getStructEntry().getArea().equals(area)) {
                        return true;
                    }
                }
            }
        }
View Full Code Here

                }
            }
           
            // Is there some root content in the default language? If so, we are satisfied.
            if (defaultLanguage != null) {
                WGContent content = db.getFirstReleasedContent(defaultLanguage.getName(), true);
                if (content != null) {
                    return;
                }
            }
           
            // No root content in default language? This may still be ok if there is no content at all. We try this with all languages.
            WGContent content = null;
            for (WGLanguage lang : db.getLanguages().values()) {
                content = db.getFirstReleasedContent(lang.getName(), true);
                if (content != null) {
                    break;
                }
View Full Code Here

        // Delete contents
        Iterator contents = entry.getAllContent(true).iterator();
        while (contents.hasNext()) {
           
            WGContent content = (WGContent) contents.next();
            _log.info("Deleting old content '" + content.getContentKey().toString() + "'");
            if (!content.remove()) {
                _log.error("Cannot delete content. See application log for error details");
                throw new WGBackendException("Canceled import because of failed deletion: " + content.getDocumentKey());
            }


            incTargetDocCounter();
        }
View Full Code Here

        incSourceDocCounter();
        incTargetDocCounter();

        // Clone contents of entry
        Iterator contents = rootEntry.getAllContent(true).iterator();
        WGContent content;
        WGContent contentClone;
        while (contents.hasNext()) {
            content = (WGContent) contents.next();
            validate(content);
            _log.info("Cloning content '" + content.getContentKey() + "'");
            try {
                contentClone = (WGContent) createDumpClone(content, entryClone);
            }
            catch (WGAPIException e1) {
                handleException("Error cloning content", e1, content);
                return;
            }
            if (contentClone == null) {
                handleSaveError("Unable to clone content.", content);
                continue;
            }
           
            contentClone.dropCore();
            content.dropCore();

            incSourceDocCounter();
            incTargetDocCounter();

            oldToNewContentKeys.put(content.getContentKey(true).toString(), contentClone.getContentKey().toString());
            if (contentClone.getStatus().equals(WGContent.STATUS_RELEASE)) {
                oldToNewContentKeys.put(content.getContentKey(false).toString(), contentClone.getContentKey(false).toString());
                oldToNewContentKeys.put(content.getStructKey() + "." + content.getLanguage().getName() + ".p", contentClone.getContentKey(false).toString());
            }

            contentClones.add(contentClone);

            entryClone.dropCore();
View Full Code Here

                        // Relation field
                        if (relType != null && doc instanceof WGContent) {
                       
                            int relTypeInt = relType.equalsIgnoreCase("protected") ? WGContent.RELATIONTYPE_PROTECTED : WGContent.RELATIONTYPE_NORMAL;
                           
                            WGContent content = (WGContent) doc;
                          List<String> relationStrings = (List<String>) fieldlist(fieldName);
                         
                          // Relation field is filled
                          if (relationStrings.size() > 0 && !relationStrings.get(0).equals(RELATION_NULLPLACE_HOLDER)) {
                              if (fieldReg.isMultiple()) {
                                  content.clearRelationGroup(fieldName);
                                  for (String relStr : relationStrings) {
                                      TMLContext relationContext = gettargetcontext().context("docid:"+ relStr, false);
                                        if (relationContext != null) {
                                            content.addRelationToGroup(fieldName, relationContext.content(), relTypeInt);
                                        }  
                                  }
                              }
                              else {
                                  TMLContext relationContext = gettargetcontext().context("docid:"+ relationStrings.get(0), false);
                                  if (relationContext != null) {
                                    content.setRelation(fieldName, relationContext.content(), relTypeInt);
                                  }
                              }
                          }
                         
                          // Relation field is empty
                          else {
                              if (fieldReg.isMultiple()) {
                                  content.clearRelationGroup(fieldName);
                              }
                              else {
                                  content.removeRelation(fieldName);
                            }
                            }  
                        }
                       
                        // Plain item field
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGContent

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.