Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending the full container path to the UI #17950

Merged

Conversation

freddyucv
Copy link

The Multi tree was saved with the default host container id and not with the container's id in the new site, so now it is send the container full path to the UI, then it is send back by the UI when a Multi tree is saved

final ContainerLoader containerLoader = new ContainerLoader();

final VelocityResourceKey velocityResourceKey = new VelocityResourceKey(fileAssetContainer, PageMode.EDIT_MODE);
final InputStream inputStream = containerLoader.writeObject(velocityResourceKey);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import com.dotcms.datagen.SiteDataGen;
import com.dotmarketing.beans.Host;
import com.dotmarketing.business.APILocator;
import com.dotmarketing.portlets.ContentletBaseTest;
import com.dotmarketing.portlets.containers.model.Container;
import com.dotmarketing.portlets.containers.model.FileAssetContainer;
import com.dotmarketing.portlets.folders.model.Folder;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import org.junit.Assert;
import org.junit.Test;

import java.util.Optional;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import com.dotmarketing.portlets.containers.model.Container;
import com.dotmarketing.portlets.containers.model.FileAssetContainer;
import com.dotmarketing.portlets.folders.model.Folder;
import com.dotmarketing.util.Constants;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import com.dotmarketing.portlets.containers.model.FileAssetContainer;
import com.dotmarketing.portlets.folders.model.Folder;
import com.dotmarketing.util.Constants;
import com.dotmarketing.util.HostUtil;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1,14 +1,49 @@
package com.dotmarketing.portlets.containers.business;

import com.dotcms.datagen.ContainerAsFileDataGen;
import com.dotcms.datagen.FolderDataGen;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import com.dotcms.datagen.SiteDataGen;
import com.dotmarketing.beans.Host;
import com.dotmarketing.business.APILocator;
import com.dotmarketing.portlets.ContentletBaseTest;
import com.dotmarketing.portlets.containers.model.Container;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import com.dotmarketing.business.APILocator;
import com.dotmarketing.exception.DotDataException;
import com.dotmarketing.exception.DotSecurityException;
import com.dotmarketing.portlets.containers.model.Container;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import java.io.InputStream;
import java.nio.charset.StandardCharsets;

import static org.junit.Assert.assertEquals;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Should: return a div with the File Comntainer's id
*/
@Test
public void aaa() throws DotDataException, DotSecurityException, IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename this test

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final ContainerLoader containerLoader = new ContainerLoader();

final VelocityResourceKey velocityResourceKey = new VelocityResourceKey(fileAssetContainer, PageMode.EDIT_MODE);
final InputStream inputStream = containerLoader.writeObject(velocityResourceKey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this InputStream should be closed in a finally statement or in a try with resources

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsilvam dsilvam merged commit 655f786 into master Feb 5, 2020
@delete-merged-branch delete-merged-branch bot deleted the issue-17749-Containers-as-files-outside-default-host branch February 5, 2020 15:04
dsilvam pushed a commit that referenced this pull request Feb 12, 2020
* Sending the full container path to the UI

* codacy refactoring

* renaming test method and close resource correctly
freddyucv pushed a commit that referenced this pull request Feb 25, 2020
dsilvam pushed a commit that referenced this pull request Feb 26, 2020
* Revert "Sending the full container path to the UI (#17950)"

This reverts commit 655f786.

* Fixing containers error

* #17749 doc

* #17749 testing

* #17749 refactoring

* #17749 refactoring

* #17749 refactoring

* #17749 doc

* #17749 refactoring

* #17749 miss spelling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants