Class MacroResource
java.lang.Object
com.atlassian.confluence.tinymceplugin.rest.MacroResource
-
Constructor Summary
ConstructorsConstructorDescriptionMacroResource
(XhtmlContent xhtmlContent, EditorFormatService editorFormatService, ContentEntityManager contentEntityManager, HtmlToXmlConverter htmlToXmlConverter, HttpContext httpContext, MacroManager macroManager, com.atlassian.sal.api.message.I18nResolver i18nResolver, com.atlassian.sal.api.transaction.TransactionTemplate transactionTemplate, PermissionManager permissionManager, SpacePermissionManager spacePermissionManager, MacroParameterTypeParser macroParameterTypeParser, XmlEventReaderFactory xmlEventReaderFactory, FragmentTransformer defaultFragmentTransformer, StorageMacroBodyParser storageMacroBodyParser, MacroMetadataManager macroMetadataManager, StorageFormatCleaner storageFormatCleaner, VelocityHelperService velocityHelperService, ContentMacroService contentMacroService, com.atlassian.applinks.host.spi.InternalHostApplication internalHostApplication) -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.Response
generateDefinition
(UnmarshalMacroRequest unmarshalMacroRequest) javax.ws.rs.core.Response
generatePlaceHolder
(MacroRenderRequest renderRequest) javax.ws.rs.core.Response
generatePlaceHolderForStoredMacro
(MacroRenderByIdRequest renderByIdRequest) Retrieves the stored macro in the editor format.javax.ws.rs.core.Response
generatePreview
(PreviewMacroRequest previewMacroRequest)
-
Constructor Details
-
MacroResource
@Inject public MacroResource(XhtmlContent xhtmlContent, EditorFormatService editorFormatService, @Named("contentEntityManager") ContentEntityManager contentEntityManager, @Named("htmlToXmlConverter") HtmlToXmlConverter htmlToXmlConverter, @Named("httpContext") HttpContext httpContext, @Named("xhtmlMacroManager") MacroManager macroManager, com.atlassian.sal.api.message.I18nResolver i18nResolver, com.atlassian.sal.api.transaction.TransactionTemplate transactionTemplate, PermissionManager permissionManager, @Named("spacePermissionManager") SpacePermissionManager spacePermissionManager, MacroParameterTypeParser macroParameterTypeParser, XmlEventReaderFactory xmlEventReaderFactory, FragmentTransformer defaultFragmentTransformer, StorageMacroBodyParser storageMacroBodyParser, MacroMetadataManager macroMetadataManager, StorageFormatCleaner storageFormatCleaner, VelocityHelperService velocityHelperService, ContentMacroService contentMacroService, com.atlassian.applinks.host.spi.InternalHostApplication internalHostApplication)
-
-
Method Details
-
generatePlaceHolder
@POST @Path("/placeholder") @Consumes("application/json") @Produces("text/plain") public javax.ws.rs.core.Response generatePlaceHolder(MacroRenderRequest renderRequest) -
generatePlaceHolderForStoredMacro
@POST @Path("/placeholder/storedmacro") @Consumes("application/json") @Produces("text/plain") public javax.ws.rs.core.Response generatePlaceHolderForStoredMacro(MacroRenderByIdRequest renderByIdRequest) Retrieves the stored macro in the editor format.This method allows users to access stored macros in the editor format. This can be used when copying a macro from view mode into editor mode.
The placeholder API was not reused because of the following reasons: The input required for both APIs is completely different, making it necessary to create a separate method. One API is designed for obtaining an empty placeholder, while the other is specifically for retrieving a saved macro. The existing API is already being utilized in multiple places on the front end, complicating any updates to the interface. Handling the validation logic for the different inputs would also be complex, further justifying the need for a new API.
- Parameters:
renderByIdRequest
- theMacroRenderByIdRequest
object containing the macroId, contentId, versionId, and hostId for the macro retrieval- Returns:
- a
Response
object representing a macro in the string format - Throws:
IllegalArgumentException
- if either macroId, versionId, or hostId is null
-
generateDefinition
@POST @Path("/definition") @Consumes("application/json") @Produces("application/json") public javax.ws.rs.core.Response generateDefinition(UnmarshalMacroRequest unmarshalMacroRequest) -
generatePreview
@POST @Path("/preview") @Consumes("application/json") @Produces("text/plain") public javax.ws.rs.core.Response generatePreview(PreviewMacroRequest previewMacroRequest)
-