U4-7557 - Support folders for import/export, packaging

Created by Sebastiaan Janssen 17 Dec 2015, 08:36:33 Updated by Sebastiaan Janssen 20 Jan 2016, 14:45:28

Relates to: U4-7556

Anything that now can have folders also needs folder support in import/export (doctypes) and packages.

  • Document Types
  • Media Types
  • Data Types

2 Attachments

Download doctype2.udt

Comments

Sebastiaan Janssen 11 Jan 2016, 21:18:50

PR: https://github.com/umbraco/Umbraco-CMS/pull/1010


Shannon Deminick 12 Jan 2016, 15:16:45

WORKS!! Tested:

  • Export/import of document type at 4 levels deep = works
  • Creating a Package containing a data type 4 levels deep & a doc type 3 levels deep
  • Deleting the packaged data type and doc type from Umbraco
  • Installing the package = works

TODO: We need to test import/export & packaging of a doc type that is a child of another doc type that is inside of a folder. Need to wait to pull in : U4-7634


Shannon Deminick 12 Jan 2016, 15:17:01

Will pull in this PR in the mean time though


Shannon Deminick 13 Jan 2016, 18:30:12

We get a YSOD for importing when we import a doc type that is a child of another doc type that is contained in a folder:

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 


Line 84:         public bool AddContentType(IContentTypeComposition contentType)
Line 85:         {
Line 86:             if (contentType.ContentTypeComposition.Any(x => x.CompositionAliases().Any(ContentTypeCompositionExists)))
Line 87:                 return false;
Line 88: 

Source File: X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Core\Models\ContentTypeCompositionBase.cs    Line: 86 

Stack Trace: 


[NullReferenceException: Object reference not set to an instance of an object.]
   Umbraco.Core.Models.ContentTypeCompositionBase.AddContentType(IContentTypeComposition contentType) in X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Core\Models\ContentTypeCompositionBase.cs:86
   Umbraco.Core.Services.PackagingService.UpdateContentTypeFromXml(XElement documentType, IContentType contentType) in X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Core\Services\PackagingService.cs:587
   Umbraco.Core.Services.PackagingService.CreateContentTypeFromXml(XElement documentType) in X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Core\Services\PackagingService.cs:539
   Umbraco.Core.Services.PackagingService.ImportContentTypes(XElement element, Boolean importStructure, Int32 userId, Boolean raiseEvents) in X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Core\Services\PackagingService.cs:411
   Umbraco.Core.Services.PackagingService.ImportContentTypes(XElement element, Int32 userId, Boolean raiseEvents) in X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Core\Services\PackagingService.cs:320
   umbraco.presentation.umbraco.dialogs.importDocumentType.import_Click(Object sender, EventArgs e) in X:\Projects\Umbraco\Umbraco_7.4\src\Umbraco.Web\umbraco.presentation\umbraco\dialogs\importDocumenttype.aspx.cs:78
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11757856
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +149
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6015

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1038.0


Shannon Deminick 14 Jan 2016, 18:54:16

I've fixed a bunch of stuff up and streamlined lots of code. However, there are 2 issues:

  • Exporting a child doc type -> this does not work because in order to import it, you'd need the parent doc type installed. So it might work if you already had the parent there but not sure, so importing a child doc type doesn't work if the parent isn't there (even in older versions).
  • Installing a package that has child doc types doesn't install correctly like it did in 7.3.x. The composition part is created but it is not made to be a child - we've probably removed that logic and didn't put it back in.

I'll fix up tomorrow.


Shannon Deminick 15 Jan 2016, 10:09:05

Everything is working now (apart from exporting a child doc type, since that was never possible unless you have already imported the parent).

To test:

  • Create a couple nested folders
  • Create a parent doc type in that folder
  • Create a child doc type
  • Create a package with both of these doc types (you cannot just include the child, that would never work)
  • Delete these doc types and folders
  • Install the package
  • Verify that they are all there with the correct data


Claus Jensen 19 Jan 2016, 08:55:28

I don't really see this working at all. I have created a folder, with a folder, with a doctype. Right clicking and exporting gives me a file with no folder attribute on the document type.


Shannon Deminick 19 Jan 2016, 10:00:43

Something went very strange with merges + PRs, here's the correct PR:

https://github.com/umbraco/Umbraco-CMS/pull/1029


Priority: Normal

Type: Task

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.4.0

Sprint: Sprint 7

Story Points:

Cycle: