Search in sources :

Example 1 with ModifyProjectIconParams

use of com.enonic.xp.project.ModifyProjectIconParams in project xp by enonic.

the class ProjectServiceImpl method doModifyIcon.

private void doModifyIcon(final ModifyProjectIconParams params) {
    final UpdateRepositoryParams updateParams = UpdateRepositoryParams.create().repositoryId(params.getName().getRepoId()).editor(editableRepository -> {
        if (params.getIcon() != null) {
            try {
                editableRepository.binaryAttachments.add(createProjectIcon(params.getIcon(), params.getScaleWidth()));
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }
        final PropertySet projectData = editableRepository.data.getSet(ProjectConstants.PROJECT_DATA_SET_NAME);
        setIconData(projectData, params.getIcon());
    }).build();
    repositoryService.updateRepository(updateParams);
}
Also used : ArchiveInitializer(com.enonic.xp.core.impl.project.init.ArchiveInitializer) DeleteRepositoryParams(com.enonic.xp.repository.DeleteRepositoryParams) RepositoryService(com.enonic.xp.repository.RepositoryService) LoggerFactory(org.slf4j.LoggerFactory) AttachmentSerializer(com.enonic.xp.attachment.AttachmentSerializer) ImageHelper(com.enonic.xp.image.ImageHelper) IndexService(com.enonic.xp.index.IndexService) BigDecimal(java.math.BigDecimal) RepositoryId(com.enonic.xp.repository.RepositoryId) ContextAccessor(com.enonic.xp.context.ContextAccessor) NodeService(com.enonic.xp.node.NodeService) CreateAttachment(com.enonic.xp.attachment.CreateAttachment) ImageIO(javax.imageio.ImageIO) ContextBuilder(com.enonic.xp.context.ContextBuilder) EnumSet(java.util.EnumSet) SecurityService(com.enonic.xp.security.SecurityService) RoundingMode(java.math.RoundingMode) BinaryReference(com.enonic.xp.util.BinaryReference) ProjectService(com.enonic.xp.project.ProjectService) Projects(com.enonic.xp.project.Projects) BufferedImage(java.awt.image.BufferedImage) BinaryAttachment(com.enonic.xp.node.BinaryAttachment) Project(com.enonic.xp.project.Project) Collectors(java.util.stream.Collectors) CreateProjectParams(com.enonic.xp.project.CreateProjectParams) UpdateRepositoryParams(com.enonic.xp.repository.UpdateRepositoryParams) UncheckedIOException(java.io.UncheckedIOException) List(java.util.List) ProjectNotFoundException(com.enonic.xp.project.ProjectNotFoundException) Optional(java.util.Optional) RoleKeys(com.enonic.xp.security.RoleKeys) Context(com.enonic.xp.context.Context) Queue(java.util.Queue) Repository(com.enonic.xp.repository.Repository) EventPublisher(com.enonic.xp.event.EventPublisher) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Callable(java.util.concurrent.Callable) Attachment(com.enonic.xp.attachment.Attachment) ProjectConstants(com.enonic.xp.project.ProjectConstants) ProjectGraphEntry(com.enonic.xp.project.ProjectGraphEntry) ArrayList(java.util.ArrayList) IssueInitializer(com.enonic.xp.core.impl.project.init.IssueInitializer) ProjectRole(com.enonic.xp.project.ProjectRole) CreateAttachments(com.enonic.xp.attachment.CreateAttachments) ProjectName(com.enonic.xp.project.ProjectName) ContentInitializer(com.enonic.xp.core.impl.project.init.ContentInitializer) ModifyProjectIconParams(com.enonic.xp.project.ModifyProjectIconParams) ByteSource(com.google.common.io.ByteSource) PropertyTree(com.enonic.xp.data.PropertyTree) Logger(org.slf4j.Logger) ProjectGraph(com.enonic.xp.project.ProjectGraph) ProjectPermissions(com.enonic.xp.project.ProjectPermissions) PropertySet(com.enonic.xp.data.PropertySet) IOException(java.io.IOException) AuthenticationInfo(com.enonic.xp.security.auth.AuthenticationInfo) ArrayDeque(java.util.ArrayDeque) Collections(java.util.Collections) ModifyProjectParams(com.enonic.xp.project.ModifyProjectParams) InputStream(java.io.InputStream) UpdateRepositoryParams(com.enonic.xp.repository.UpdateRepositoryParams) PropertySet(com.enonic.xp.data.PropertySet) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException)

Aggregations

Attachment (com.enonic.xp.attachment.Attachment)1 AttachmentSerializer (com.enonic.xp.attachment.AttachmentSerializer)1 CreateAttachment (com.enonic.xp.attachment.CreateAttachment)1 CreateAttachments (com.enonic.xp.attachment.CreateAttachments)1 Context (com.enonic.xp.context.Context)1 ContextAccessor (com.enonic.xp.context.ContextAccessor)1 ContextBuilder (com.enonic.xp.context.ContextBuilder)1 ArchiveInitializer (com.enonic.xp.core.impl.project.init.ArchiveInitializer)1 ContentInitializer (com.enonic.xp.core.impl.project.init.ContentInitializer)1 IssueInitializer (com.enonic.xp.core.impl.project.init.IssueInitializer)1 PropertySet (com.enonic.xp.data.PropertySet)1 PropertyTree (com.enonic.xp.data.PropertyTree)1 EventPublisher (com.enonic.xp.event.EventPublisher)1 ImageHelper (com.enonic.xp.image.ImageHelper)1 IndexService (com.enonic.xp.index.IndexService)1 BinaryAttachment (com.enonic.xp.node.BinaryAttachment)1 NodeService (com.enonic.xp.node.NodeService)1 CreateProjectParams (com.enonic.xp.project.CreateProjectParams)1 ModifyProjectIconParams (com.enonic.xp.project.ModifyProjectIconParams)1 ModifyProjectParams (com.enonic.xp.project.ModifyProjectParams)1