congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
AttachmentManager.getAttachment
Code IndexAdd Tabnine to your IDE (free)

How to use
getAttachment
method
in
com.atlassian.confluence.pages.AttachmentManager

Best Java code snippets using com.atlassian.confluence.pages.AttachmentManager.getAttachment (Showing top 9 results out of 315)

origin: com.atlassian.confluence.extra.webdav/webdav-plugin

public Attachment getAttachment() {
  if (null == attachment)
    attachment = attachmentManager.getAttachment(getContentEntityObject(), attachmentName);
  return attachment;
}
origin: com.atlassian.confluence.extra.webdav/webdav-plugin

private boolean isPathPointingToPageAttachment(String[] resourcePathTokens) {
  if (resourcePathTokens.length >= 5
      && (StringUtils.equals(GlobalSpacesResourceImpl.DISPLAY_NAME, resourcePathTokens[1])
      || StringUtils.equals(PersonalSpacesResourceImpl.DISPLAY_NAME, resourcePathTokens[1]))) {
    String spaceKey = resourcePathTokens[2];
    Space space = spaceManager.getSpace(spaceKey);
    Page page = pageManager.getPage(spaceKey, resourcePathTokens[resourcePathTokens.length - 2]);
    return null != space
        && !hasAliasInTokens(resourcePathTokens, 3)
        && null != page
        && null != attachmentManager.getAttachment(page, resourcePathTokens[resourcePathTokens.length - 1]);
  }
  return false;
}
origin: com.atlassian.confluence.extra.webdav/webdav-plugin

  private boolean isPathPointingSpaceAttachment(String[] resourcePathTokens) {
    if (resourcePathTokens.length == 4 && !StringUtils.equals(resourcePathTokens[resourcePathTokens.length - 1], BlogPostsResourceImpl.DISPLAY_NAME)) {
      Space space = spaceManager.getSpace(resourcePathTokens[2]);
      return null != space
          && null == pageManager.getPage(space.getKey(), resourcePathTokens[3])
          && null != attachmentManager.getAttachment(space.getDescription(), resourcePathTokens[3]);
    }

    return false;
  }
}
origin: org.randombits.support/support-confluence

ConfluenceEntityObject page = findEntityForWikiLink( spaceKey, pageTitle, addPart( processed, LinkPart.ATTACHMENT_NAME ) );
if ( page instanceof ContentEntityObject ) {
  content = attachmentManager.getAttachment( (ContentEntityObject) page, attachmentName );
origin: com.atlassian.confluence.extra.webdav/webdav-plugin

public void execute() throws Exception {
  Page page = pageManager.getPage(getContainingPageId());
  if (null != page) {
    Attachment attachment = attachmentManager.getAttachment(page, getFileName());
    if (null != attachment)
      attachmentManager.removeAttachmentFromServer(attachment);
  }
}
origin: com.atlassian.confluence.extra.webdav/webdav-plugin

public static void addOrUpdateAttachment(AttachmentManager attachmentManager, ContentEntityObject ceo, String fileName, InputContext inputContext) throws IOException, CloneNotSupportedException {
  Attachment attachment = attachmentManager.getAttachment(ceo, fileName);
  Attachment previousVersionOfAttachment = null;
  File inputContentFile = null;
origin: com.atlassian.labs/confluence-mentions-plugin

private DataHandler createAvatarDataHandler(User user)
    throws MessagingException, IOException
{
  PropertySet propertySet = userAccessor.getPropertySet(user);
  if (propertySet == null)
    return createWebResourceDataHandler(ProfilePictureInfo.DEFAULT_PROFILE_PATH);
  String profilePicture = propertySet.getString(UserPreferencesKeys.PROPERTY_USER_PROFILE_PICTURE);
  if (profilePicture == null)
  {
    return createWebResourceDataHandler(ProfilePictureInfo.DEFAULT_PROFILE_PATH);
  }
  if (profilePicture.startsWith(UserAccessor.PROFILE_PICTURE_BUILTIN_PATH))
  {
    return createWebResourceDataHandler(profilePicture);
  }
  PersonalInformation personalInformation = personalInformationManager.getPersonalInformation(user);
  if (personalInformation == null)
    return createWebResourceDataHandler(ProfilePictureInfo.DEFAULT_PROFILE_PATH);
  Attachment a = attachmentManager.getAttachment(personalInformation, profilePicture);
  if (a != null)
  {
    return new DataHandler(new ProfileImageDataSource(new ByteArrayDataSource(a.getContentsAsStream(), a.getContentType())));
  }
  return null;
}
origin: com.atlassian.confluence.extra.webdav/webdav-plugin

  resourceStates.unhideAttachment(attachmentManager.getAttachment(thisPage, resourceName));
} else {
  throw new DavException(HttpServletResponse.SC_FORBIDDEN, "Attachment creation denied. File name contains invalid characters ['&', '+', '?', '|', '=']: " + resourceName);
origin: com.atlassian.confluence.extra.webdav/webdav-plugin

public void removeMember(DavResource davResource) throws DavException {
  String[] pathComponents = StringUtils.split(davResource.getResourcePath(), '/');
  String resourceName = pathComponents[pathComponents.length - 1];
  Space thisSpace = getSpace();
  User user = AuthenticatedUserThreadLocal.getUser();
  if (isResourceSpaceDescription(thisSpace, resourceName)) {
    if (permissionManager.hasPermission(user, Permission.EDIT, thisSpace))
      ((ConfluenceDavSession) getSession()).getResourceStates().hideSpaceDescription(thisSpace);
    else
      throw new DavException(HttpServletResponse.SC_FORBIDDEN, "No permission to edit " + thisSpace);
  } else {
    Page pageToRemove = pageManager.getPage(thisSpace.getKey(), resourceName);
    if (null == pageToRemove) {
      ContentEntityObject spaceDesc = getSpace().getDescription();
      Attachment attachmentToRemove = attachmentManager.getAttachment(spaceDesc, resourceName);
      if (null != attachmentToRemove) {
        attachmentManager.removeAttachmentFromServer(attachmentToRemove);
      }
    } else {
      if (permissionManager.hasPermission(
          AuthenticatedUserThreadLocal.getUser(),
          Permission.REMOVE,
          pageToRemove)) {
        pageManager.trashPage(pageToRemove);
      } else {
        throw new DavException(HttpServletResponse.SC_FORBIDDEN, "Forbidden to delete " + pageToRemove);
      }
    }
  }
}
com.atlassian.confluence.pagesAttachmentManagergetAttachment

Popular methods of AttachmentManager

  • getAttachmentData
  • getLatestVersionsOfAttachments
  • removeAttachmentFromServer
  • saveAttachment
  • moveAttachment

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • setRequestProperty (URLConnection)
  • getApplicationContext (Context)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • 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
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • CodeWhisperer alternatives
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