C# Class Sitecore.SharedSource.Commons.Utilities.CreateItemUtil

Utilities for creating Sitecore items for imports
Datei anzeigen Open project: Velir/Sitecore-Commons

Public Properties

Property Type Description
alphabetFolderNames string[]

Public Methods

Method Description
CreateAlphabetFolderStructure ( Item parentItem, TemplateItem folderTemplate ) : void

Creates an alphabet folder structure under the passed in parent. This will also inlcude 123 as a folder for handling items that start with numbers. This defaults to lowercase letters for the folder names.

CreateAlphabetFolderStructure ( Item parentItem, TemplateItem folderTemplate, bool upperCase ) : void

Creates an alphabet folder structure under the passed in parent. This will also inlcude 123 as a folder for handling items that start with numbers.

GetOrCreateItem ( ICreateItem iCreateItem, bool &itemCreated ) : ID

Gets the or create item.

This is an updated version which has the complex dependencies removed So that it can be unit tested This method can/should be used directly, but for backwards compatability we still have the overloads which call this

GetOrCreateItem ( Item parentItem, string itemName, TemplateItem template ) : Item

Checks to see if an item already exists under a parent. If it exists return the item, otherwise create and return the new item. This defaults to using the master db.

GetOrCreateItem ( Item parentItem, string itemName, TemplateItem template, Database db ) : Item

Overriden without the itemCreated parameter to allow existing code to continue working

GetOrCreateItem ( Item parentItem, string itemName, TemplateItem template, Database db, bool &itemCreated ) : Item

Checks to see if an item already exists under a parent. If it exists return the item, otherwise create and return the new item.

This has been updated to call the testable method. Remaining logic is the item name cleaning.

GetOrCreateItem ( Item parentItem, string itemName, TemplateItem template, bool &itemCreated ) : Item

Checks to see if an item already exists under a parent. If it exists return the item, otherwise create and return the new item. This defaults to using the master db. Added the override option to determine if the item was created or not. the out value of itemCreated will return true if item has been created, false if the item already exists in sitecore and was found (and returned)

ItemNameCleaner ( string itemName ) : string

Cleans the Item Name - Changes & to "And", and removes disallowed characters

Method Details

CreateAlphabetFolderStructure() public static method

Creates an alphabet folder structure under the passed in parent. This will also inlcude 123 as a folder for handling items that start with numbers. This defaults to lowercase letters for the folder names.
public static CreateAlphabetFolderStructure ( Item parentItem, TemplateItem folderTemplate ) : void
parentItem Item The parent item.
folderTemplate TemplateItem The folder template.
return void

CreateAlphabetFolderStructure() public static method

Creates an alphabet folder structure under the passed in parent. This will also inlcude 123 as a folder for handling items that start with numbers.
public static CreateAlphabetFolderStructure ( Item parentItem, TemplateItem folderTemplate, bool upperCase ) : void
parentItem Item The parent item.
folderTemplate TemplateItem The folder template.
upperCase bool if set to true make the letter folder name upper case.
return void

GetOrCreateItem() public static method

Gets the or create item.
This is an updated version which has the complex dependencies removed So that it can be unit tested This method can/should be used directly, but for backwards compatability we still have the overloads which call this
public static GetOrCreateItem ( ICreateItem iCreateItem, bool &itemCreated ) : ID
iCreateItem ICreateItem The i create item.
itemCreated bool if set to true [item created].
return ID

GetOrCreateItem() public static method

Checks to see if an item already exists under a parent. If it exists return the item, otherwise create and return the new item. This defaults to using the master db.
public static GetOrCreateItem ( Item parentItem, string itemName, TemplateItem template ) : Item
parentItem Item The parent item.
itemName string Name of the item.
template TemplateItem The template.
return Item

GetOrCreateItem() public static method

Overriden without the itemCreated parameter to allow existing code to continue working
public static GetOrCreateItem ( Item parentItem, string itemName, TemplateItem template, Database db ) : Item
parentItem Item The parent item.
itemName string Name of the item.
template TemplateItem The template.
db Database The db to use.
return Item

GetOrCreateItem() public static method

Checks to see if an item already exists under a parent. If it exists return the item, otherwise create and return the new item.
This has been updated to call the testable method. Remaining logic is the item name cleaning.
public static GetOrCreateItem ( Item parentItem, string itemName, TemplateItem template, Database db, bool &itemCreated ) : Item
parentItem Item The parent item.
itemName string Name of the item.
template TemplateItem The template.
db Database The db to use.
itemCreated bool if set to true [item created].
return Item

GetOrCreateItem() public static method

Checks to see if an item already exists under a parent. If it exists return the item, otherwise create and return the new item. This defaults to using the master db. Added the override option to determine if the item was created or not. the out value of itemCreated will return true if item has been created, false if the item already exists in sitecore and was found (and returned)
public static GetOrCreateItem ( Item parentItem, string itemName, TemplateItem template, bool &itemCreated ) : Item
parentItem Item The parent item.
itemName string Name of the item.
template TemplateItem The template.
itemCreated bool
return Item

ItemNameCleaner() public static method

Cleans the Item Name - Changes & to "And", and removes disallowed characters
public static ItemNameCleaner ( string itemName ) : string
itemName string The proposed item name
return string

Property Details

alphabetFolderNames public_oe static_oe property

public static string[] alphabetFolderNames
return string[]