C# Class Sitecore.Sharedsource.Tasks.NewsMover

显示文件 Open project: Sitecore/NewsMover

Public Methods

Method Description
AddTemplateConfiguration ( XmlNode configNode ) : void

Adds a configured template to be organized

NewsMover ( ) : System
OnItemSaved ( object sender, EventArgs args ) : void

Called when [item saved].

Protected Methods

Method Description
EnsureAndGetDate ( System.Item item, string dateFieldName ) : System.DateTime

Initializes the date field to the current date if there is no value.

GetItem ( EventArgs args ) : System.Item

Gets the item from the event args.

GetOrCreateChild ( System.Item parent, TemplateItem template, string childName, SortOrder subItemSorting ) : System.Item

Gets the or create child.

GetRoot ( System.Item item, TemplateConfiguration config ) : System.Item

Gets the root of where we start organization. i.e. the parent of the 'year' node

LoadLegacySettings ( ) : void

Loads the legacy settings.

OrganizeItem ( System.Item item, TemplateConfiguration config, System.DateTime articleDate ) : void

Organizes the item in the configurd year, [month], [day] structure. It will also remove any empty folders

Private Methods

Method Description
IsItemYearMonthOrDay ( System.Item item, TemplateConfiguration config ) : bool

Determines whether the item is a year, month or day item.

Method Details

AddTemplateConfiguration() public method

Adds a configured template to be organized
public AddTemplateConfiguration ( XmlNode configNode ) : void
configNode System.Xml.XmlNode The XML configuration node.
return void

EnsureAndGetDate() protected method

Initializes the date field to the current date if there is no value.
protected EnsureAndGetDate ( System.Item item, string dateFieldName ) : System.DateTime
item System.Item The article.
dateFieldName string Name of the date field.
return System.DateTime

GetItem() protected method

Gets the item from the event args.
protected GetItem ( EventArgs args ) : System.Item
args System.EventArgs The instance containing the event data.
return System.Item

GetOrCreateChild() protected method

Gets the or create child.
protected GetOrCreateChild ( System.Item parent, TemplateItem template, string childName, SortOrder subItemSorting ) : System.Item
parent System.Item The parent.
template TemplateItem The template.
childName string Name of the child.
subItemSorting SortOrder
return System.Item

GetRoot() protected method

Gets the root of where we start organization. i.e. the parent of the 'year' node
protected GetRoot ( System.Item item, TemplateConfiguration config ) : System.Item
item System.Item The item.
config TemplateConfiguration The config.
return System.Item

LoadLegacySettings() protected method

Loads the legacy settings.
protected LoadLegacySettings ( ) : void
return void

NewsMover() public method

public NewsMover ( ) : System
return System

OnItemSaved() public method

Called when [item saved].
public OnItemSaved ( object sender, EventArgs args ) : void
sender object The sender.
args System.EventArgs The instance containing the event data.
return void

OrganizeItem() protected method

Organizes the item in the configurd year, [month], [day] structure. It will also remove any empty folders
protected OrganizeItem ( System.Item item, TemplateConfiguration config, System.DateTime articleDate ) : void
item System.Item The item.
config TemplateConfiguration The config.
articleDate System.DateTime The article date.
return void