Tabnine Logo
CmsFile.getStructureId
Code IndexAdd Tabnine to your IDE (free)

How to use
getStructureId
method
in
org.opencms.file.CmsFile

Best Java code snippets using org.opencms.file.CmsFile.getStructureId (Showing top 20 results out of 315)

origin: org.opencms/opencms-core

/**
 * Creates a new container page element bean.<p>
 *
 * @param file the element's file
 * @param formatterId the formatter's structure id, could be <code>null</code>
 * @param individualSettings the element settings as a map of name/value pairs
 * @param inMemoryOnly the in memory flag
 * @param editorHash the editor hash to use
 * @param createNew <code>true</code> if a new element should be created replacing the given one on first edit of a container-page
 **/
public CmsContainerElementBean(
  CmsFile file,
  CmsUUID formatterId,
  Map<String, String> individualSettings,
  boolean inMemoryOnly,
  String editorHash,
  boolean createNew) {
  this(file.getStructureId(), formatterId, individualSettings, createNew);
  m_inMemoryOnly = inMemoryOnly;
  m_editorHash = editorHash;
  m_resource = file;
}
origin: org.opencms/opencms-core

/**
 * @see java.lang.Object#hashCode()
 */
@Override
public int hashCode() {
  if (m_contentValue == null) {
    return 0;
  }
  if (m_hashCode == 0) {
    StringBuffer result = new StringBuffer(64);
    result.append(m_contentValue.getDocument().getFile().getStructureId().toString());
    result.append('/');
    result.append(m_contentValue.getLocale());
    result.append('/');
    result.append(m_contentValue.getPath());
    m_hashCode = result.toString().hashCode();
  }
  return m_hashCode;
}
origin: org.opencms/opencms-solr

/**
 * @see java.lang.Object#hashCode()
 */
@Override
public int hashCode() {
  if (m_contentValue == null) {
    return 0;
  }
  if (m_hashCode == 0) {
    StringBuffer result = new StringBuffer(64);
    result.append(m_contentValue.getDocument().getFile().getStructureId().toString());
    result.append('/');
    result.append(m_contentValue.getLocale());
    result.append('/');
    result.append(m_contentValue.getPath());
    m_hashCode = result.toString().hashCode();
  }
  return m_hashCode;
}
origin: org.opencms/opencms-core

/**
 * Returns the structure ID of the current resource, that is the ID of
 * the resource obtained by {@link #getFile()}.<p>
 *
 * Usage example on a JSP with the JSTL:<pre>
 * &lt;cms:contentload ... &gt;
 *     &lt;cms:contentaccess var="content" /&gt;
 *     Site path of the resource: "${content.id}";
 * &lt;/cms:contentload&gt;</pre>
 *
 * @return the structure ID of the current resource
 *
 * @see CmsResource#getStructureId()
 */
public CmsUUID getId() {
  return getRawContent().getFile().getStructureId();
}
origin: org.opencms/opencms-core

/**
 * Returns the XML content document.<p>
 *
 * @param file the resource file
 * @param fromCache <code>true</code> to use the cached document
 *
 * @return the content document
 *
 * @throws CmsXmlException if reading the XML fails
 */
private CmsXmlContent getContentDocument(CmsFile file, boolean fromCache) throws CmsXmlException {
  CmsXmlContent content = null;
  if (fromCache) {
    content = getSessionCache().getCacheXmlContent(file.getStructureId());
  }
  if (content == null) {
    content = CmsXmlContentFactory.unmarshal(getCmsObject(), file);
    getSessionCache().setCacheXmlContent(file.getStructureId(), content);
  }
  return content;
}
origin: org.opencms/opencms-core

/**
 * Returns the RDF annotations required for in line editing.<p>
 *
 * @param document the parent XML document
 * @param contentLocale the content locale
 * @param elementPath the element xpath to get the RDF annotation for
 *
 * @return the RDFA
 */
public static String getRdfaAttributes(I_CmsXmlDocument document, Locale contentLocale, String elementPath) {
  I_CmsXmlSchemaType schemaType = document.getContentDefinition().getSchemaType(elementPath);
  if (schemaType != null) {
    String path = "";
    if (elementPath.contains("/")) {
      path += "/" + removePathIndexes(elementPath.substring(0, elementPath.lastIndexOf("/")) + ":");
    }
    path += getTypeUri(schemaType.getContentDefinition()) + "/" + elementPath;
    return String.format(
      RDFA_ATTRIBUTES,
      CmsContentDefinition.uuidToEntityId(document.getFile().getStructureId(), contentLocale.toString()),
      path);
  } else {
    return "";
  }
}
origin: org.opencms/opencms-core

  /**
   * @see org.apache.commons.collections.Transformer#transform(java.lang.Object)
   */
  public Object transform(Object input) {
    String result;
    if (CmsJspContentAccessValueWrapper.isDirectEditEnabled(getCmsObject())) {
      result = createImageDndAttr(
        getRawContent().getFile().getStructureId(),
        String.valueOf(input),
        String.valueOf(getLocale()));
    } else {
      result = "";
    }
    return result;
  }
}
origin: org.opencms/opencms-core

/**
 * Returns the entity id to the given content value.<p>
 *
 * @param contentValue the content value
 *
 * @return the entity id
 */
public static String getEntityId(I_CmsXmlContentValue contentValue) {
  String result = CmsContentDefinition.uuidToEntityId(
    contentValue.getDocument().getFile().getStructureId(),
    contentValue.getLocale().toString());
  String valuePath = contentValue.getPath();
  if (valuePath.contains("/")) {
    result += "/" + valuePath.substring(0, valuePath.lastIndexOf("/"));
  }
  if (contentValue.isChoiceOption()) {
    result += "/"
      + CmsType.CHOICE_ATTRIBUTE_NAME
      + "_"
      + contentValue.getName()
      + "["
      + contentValue.getXmlIndex()
      + "]";
  }
  return result;
}
origin: org.opencms/opencms-core

/**
 * @see org.opencms.file.wrapper.A_CmsResourceWrapper#writeFile(org.opencms.file.CmsObject, org.opencms.file.CmsFile)
 */
@Override
public CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException {
  CmsResource res = getResource(cms, resource.getStructureId());
  if (res != null) {
    CmsResourceWrapperUtils.writePropertyFile(
      cms,
      cms.getRequestContext().removeSiteRoot(res.getRootPath()),
      resource.getContents());
    return resource;
  }
  return null;
}
origin: org.opencms/opencms-core

CmsFile file = m_cms.readFile(resource);
rewriteContent(file, relations);
m_rewrittenContent.add(file.getStructureId());
origin: org.opencms/opencms-solr

/**
 * @see org.opencms.file.wrapper.A_CmsResourceWrapper#writeFile(org.opencms.file.CmsObject, org.opencms.file.CmsFile)
 */
@Override
public CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException {
  CmsResource res = cms.readResource(resource.getStructureId());
  //        CmsResource res = getResource(
  //            cms,
  //            cms.getRequestContext().removeSiteRoot(resource.getRootPath()),
  //            CmsResourceFilter.ALL);
  if (res != null) {
    CmsResourceWrapperUtils.writePropertyFile(
      cms,
      cms.getRequestContext().removeSiteRoot(res.getRootPath()),
      resource.getContents());
    return resource;
  }
  return null;
}
origin: org.opencms/opencms-solr

public CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException {
  CmsResource xmlPage = cms.readResource(resource.getStructureId());
origin: org.opencms/opencms-core

/**
 * Returns the RDF annotations required for in line editing.<p>
 *
 * @param parentValue the parent XML content value
 * @param childNames the child attribute names separated by '|'
 *
 * @return the RDFA
 */
public static String getRdfaAttributes(I_CmsXmlContentValue parentValue, String childNames) {
  String id = CmsContentDefinition.uuidToEntityId(
    parentValue.getDocument().getFile().getStructureId(),
    parentValue.getLocale().toString()) + "/" + parentValue.getPath();
  String path = "";
  String[] children = childNames.split("\\|");
  for (int i = 0; i < children.length; i++) {
    I_CmsXmlSchemaType schemaType = parentValue.getContentDefinition().getSchemaType(
      parentValue.getName() + "/" + children[i]);
    if (schemaType != null) {
      if (i > 0) {
        path += " ";
      }
      String typePath = parentValue.getPath();
      path += "/" + removePathIndexes(typePath) + ":";
      path += getTypeUri(schemaType.getContentDefinition()) + "/" + children[i];
    }
  }
  return String.format(RDFA_ATTRIBUTES, id, path);
}
origin: org.opencms/opencms-core

/**
 * Returns the annotation that enables image drag and drop for this content value.<p>
 *
 * Use to insert the annotation attributes into a HTML tag.<p>
 *
 * Only makes sense in case this node actually contains the path to an image.<p>
 *
 * Example using EL: &lt;span ${value.Image.imageDndAttr}&gt; ... &lt;/span&gt; will result in
 * &lt;span data-imagednd="..."&gt; ... &lt;/span&gt;<p>
 *
 * @return the annotation that enables image drag and drop for this content value
 */
public String getImageDndAttr() {
  String result = "";
  CmsObject cms = obtainCmsObject();
  if ((cms != null)
    && (m_contentValue != null)
    && isDirectEditEnabled(cms)
    && (m_contentValue.getDocument().getFile() != null)) {
    result = CmsJspContentAccessBean.createImageDndAttr(
      m_contentValue.getDocument().getFile().getStructureId(),
      m_contentValue.getPath(),
      String.valueOf(m_contentValue.getLocale()));
  }
  return result;
}
origin: org.opencms/opencms-core

public CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException {
  CmsResource xmlPage = cms.readResource(resource.getStructureId());
origin: org.opencms/opencms-core

/**
 * Stores the given group container in the cache.<p>
 *
 * @param cms the cms context
 * @param xmlGroupContainer the group container to cache
 * @param keepEncoding if the encoding was kept while unmarshalling
 */
private static void setCache(CmsObject cms, CmsXmlGroupContainer xmlGroupContainer, boolean keepEncoding) {
  if (xmlGroupContainer.getFile() instanceof I_CmsHistoryResource) {
    return;
  }
  boolean online = cms.getRequestContext().getCurrentProject().isOnlineProject();
  getCache().setCacheGroupContainer(
    getCache().getCacheKey(xmlGroupContainer.getFile().getStructureId(), keepEncoding),
    xmlGroupContainer,
    online);
}
origin: org.opencms/opencms-core

  /**
   * Stores the given container page in the cache.<p>
   *
   * @param cms the cms context
   * @param xmlCntPage the container page to cache
   * @param keepEncoding if the encoding was kept while unmarshalling
   */
  private static void setCache(CmsObject cms, CmsXmlContainerPage xmlCntPage, boolean keepEncoding) {

    if (xmlCntPage.getFile() instanceof I_CmsHistoryResource) {
      return;
    }
    boolean online = cms.getRequestContext().getCurrentProject().isOnlineProject();
    getCache().setCacheContainerPage(
      getCache().getCacheKey(xmlCntPage.getFile().getStructureId(), keepEncoding),
      xmlCntPage,
      online);
  }
}
origin: org.opencms/opencms-solr

/**
 * Returns the virtual resource as a file.<p>
 * 
 * @return the virtual resource as a file
 */
public CmsFile getFile() {
  if (m_base instanceof CmsFile) {
    CmsFile file = (CmsFile)m_base;
    return new CmsFile(
      file.getStructureId(),
      file.getResourceId(),
      m_rootPath,
      m_typeId,
      file.getFlags(),
      file.getProjectLastModified(),
      file.getState(),
      file.getDateCreated(),
      file.getUserCreated(),
      file.getDateLastModified(),
      file.getUserLastModified(),
      file.getDateReleased(),
      file.getDateExpired(),
      file.getSiblingCount(),
      file.getLength(),
      file.getDateContent(),
      file.getVersion(),
      file.getContents());
  }
  return new CmsFile(getResource());
}
origin: org.opencms/opencms-core

getStructureId(),
getResourceId(),
getRootPath(),
origin: org.opencms/opencms-core

/**
 * Returns the virtual resource as a file.<p>
 *
 * @return the virtual resource as a file
 */
public CmsFile getFile() {
  if (m_base instanceof CmsFile) {
    CmsFile file = (CmsFile)m_base;
    return new CmsFile(
      file.getStructureId(),
      file.getResourceId(),
      m_rootPath,
      m_typeId,
      file.getFlags(),
      file.getProjectLastModified(),
      file.getState(),
      file.getDateCreated(),
      file.getUserCreated(),
      file.getDateLastModified(),
      file.getUserLastModified(),
      file.getDateReleased(),
      file.getDateExpired(),
      file.getSiblingCount(),
      file.getLength(),
      file.getDateContent(),
      file.getVersion(),
      file.getContents());
  }
  return new CmsFile(getResource());
}
org.opencms.fileCmsFilegetStructureId

Popular methods of CmsFile

  • getContents
    Returns the content of this file.
  • setContents
    Sets the contents of this file. This will also set the date content, but only if the content is alre
  • getName
  • getRootPath
  • getTypeId
  • setDateLastModified
  • <init>
  • clone
    Returns a clone of this Objects instance.
  • getDateCreated
  • getDateLastModified
  • getFlags
  • getLength
  • getFlags,
  • getLength,
  • getProjectLastModified,
  • getResourceId,
  • getState,
  • isFile,
  • isTouched,
  • setDateExpired,
  • setDateReleased

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • addToBackStack (FragmentTransaction)
  • compareTo (BigDecimal)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JLabel (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now