congrats Icon
New! Announcing our next generation AI code completions
Read here
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

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • addToBackStack (FragmentTransaction)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • JPanel (javax.swing)
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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