Architecture Overview

The whole solution is designed to maximize usage of SharePoint 2010.

Extension Methods

There is amount of useful extension methods in “BoldBrick.SharePoint.CommonControls.Extensions” namespace. Extension methods are for following classes:
  • Enum
  • SPContentTypeCollection
  • SPContentType
  • SPField
  • SPFolder
  • SPList
  • SPListItem
  • SPUserCollection
  • SPWeb
Look at those classes yourself. You can use those methods in your own solution.

Data Object

Each object (site column, content type, list, item event receiver, etc.) used in this solution has its own metadata object in “BoldBrick.OneIntranet.HR” project. These base classes are used for creating and updating of used SharePoint objects and for referencing them in the code.
During activation of the main feature of the solution, the code from “BoldBrick.OneIntranet.HR.Features.Main.MainEventReceiver“ class is fired. All data objects are created or update from this code.

Site Columns

Each site column used in this solution has its own “ListColumn” data object. Each column data object has display name in resources and internal name in project settings (configurable in web.config). Internal name stored in web.config file is for easy changing when there is another site column with the same internal name. This columns are used in content type data objects, list data objects or when there need of refer to a columns in the code.
All used default site columns are in “BoldBrick.SharePoint.CommonControls” project in “BoldBrick.SharePoint.CommonControls.DataObjects.SiteColumns” static class.
All used custom site columns are in “BoldBrick.OneIntranet.HR” project in “BoldBrick.OneIntranet.HR.DataObjects.SiteColumns” static class.

Content Types

Content type data objects are different from site column data objects. Content type data objects are not used directly, but there is class inherited from “BoldBrick.SharePoint.CommonControls.DataObjects.Base.BaseContentType” class for each custom or default content type. This class is used for creating of the object in “ContentTypes” static class to further references in code.
  • Each of those inherited class can override certain amount of methods. In this inherited class you can specify:
  • Name of the content type
  • Description of the content type
  • Content type ID
  • Group name of the content type
  • Columns of the content type (all columns in the content type)
  • Order columns of the content type (order of columns in forms)
Name, description and group of the content type can be loaded from resource file or specified directly.

Names from Resource File
To load names from resource file you have to inherit following method:
GetResourceFileName

This method has to return file name of the resource file without ".cs-cz.resx" language extension.
Next you have to override following methods:
GetNameResourceKey
GetDescriptionResourceKey
GetGroupResourceKey

Those methods return resource key of names.
See “BoldBrick.OneIntranet.HR.DataObjects.ContentTypes.CandidatesContentTypes.CandidateContentType” for detailed view of content type implementation.

Direct Names
If you want to assign direct names for name, description and group of the content type, you have to override following methods:
GetName
GetDescription
GetGroupName

Those methods return name from resources in base class.

All used default content types are accessible from “BoldBrick.SharePoint.CommonControls” project “BoldBrick.SharePoint.CommonControls.DataObjects.ContentTypes.ContentTypes” static class.
All used custom content types are accessible from “BoldBrick.OneIntranet.HR” project “BoldBrick.OneIntranet.HR.DataObjects.ContentTypes.ContentTypes” static class.

Lists

All lists are the same approach of implementation as content types. Each custom list is inherited from “BoldBrick.SharePoint.CommonControls.DataObjects.Base.BaseList“. All custom list data objects instances are accessible from “BoldBrick.OneIntranet.HR.DataObjects.Lists.Lists“ static class.
In the inherited class you can specify following:
  • Title of the list
  • Name of the list (the name is in URL of the list)
  • List template type
  • Content types of the list
  • Views of the list
  • Event receivers of the list
  • Order of the „New Item“ button for root folder and common folder
Like for content type, you can define all names in resources or direct.

List Template Type
You can override one of two following methods:
SPListTemplateType? GetListTemplateType()
string GetListTemplateName()

The first one can be used for lists based on out-of-the-box list in SharePoint. The second one can be used for lists based on custom templates.
Content types, views and event receivers are only lists of data objects which describes those objects.
See “_BoldBrick.OneIntranet.HR.DataObjects.Lists.WorkflowsListData.WorkflowsList?” class for further info about implementation of custom list.

Views

All views are the same approach of implementation as content types. Each custom view is inherited from “BoldBrick.SharePoint.CommonControls.DataObjects.Base.BaseView“. Instance of a certain view is accessible from property of parent list of this view.
In the inherited class you can specify following:
  • Title of the view
  • Page name of the view (without .aspx extension)
  • View columns of the view
Title and page name of the view can be specified direct or load from resource file.
Other properties could be set in constructor of the custom view class.
See “BoldBrick.OneIntranet.HR.DataObjects.Lists.WorkflowsListData.Views.WorkflowStepsView” class for further info about implementation of custom view.

Event Receivers

There are two options how to implement events in SharePoint lists:
  • Through feature (set events for certain list type or content type ID)
  • Set event receivers programmatically to selected instances of lists
The second option is chosen in this solution. All event receivers object are inherited from “BoldBrick.SharePoint.CommonControls.DataObjects.Base.BaseEventReceiverObject” class. Those objects could be used in “AddEventReceiver” or “RemoveEventReceiver” SPList method (extension method from “BoldBrick.SharePoint.CommonControls.Extensions.SPListEx” class).
Objects are also used in custom list data objects (“GetEventReceivers” method) for automatic adding and removing of event receivers.
In the inherited class you can specify following:
  • Type of the event (added, adding, etc.)
  • Event receiver class type (class that is inherited from “Microsoft.SharePoint.SPItemEventReceiver” class and implement event handling itself)

See “BoldBrick.OneIntranet.HR.DataObjects.Lists.WorkflowsListData.Views.WorkflowStepsView” class for further info about implementation of custom view.

Workflow

Recruitment workflow which is run on candidate folders is designed in Visual Studio 2010. It consists of two “while” loop. One loop is inside another one.

Outer Loop – Workflow Steps Loop

Outer loop is for workflow steps. Every time when workflow is on the beginning of this loop, following steps are done:
  • All non-task steps are processed until workflow found a task step
  • New task is created
  • Mail that a task has been assigned is sent if step is marked like that
  • Processing is continue to inner loop

Inner Loop – Task Loop

Inner loop is for each task. This loop is started every time when task is changed. Following steps are done during processing of this loop:
  • If task owner is changed and step is marked as sent mail to owner, an email to the new owner is sent
  • If “Hire” or “No Hire” is set, the task is marked as completed and workflow continue to the next step if any

Lists Usage

All lists are based on custom list template except “Tasks” list (Task list template) and “HR Workflow history” list (Workflow history template). Following lists are for enumerating of values. Those lists are used like loop up list:
  • Document Types
  • Employment Types
  • Languages
  • Seniority Levels
  • Sources
  • Test Types
In some other lists are special customizations.

“Positions” List

This list is meant for defining positions. You can organize positions in folders. The whole definition of this list is in “BoldBrick.OneIntranet.HR\DataObjects\Lists\PositionsListData”.

“Workflows” List

This list is meant for defining workflows. Each workflow is represented by folder. Workflow steps are represented by list items in this folder. Order of workflow steps is stored in “Order” hidden column. During creating of a workflow step list item, “Order” column is initialized to value equal to list item ID (list item is the last item in the folder after creating). The whole definition of this list is in “BoldBrick.OneIntranet.HR\DataObjects\Lists\WorkflowsListData”.

“Candidates” List

This list is meant for storing candidates. Each folder in this list is one candidate. Results of workflow steps or manual actions are stored like list items in this folder. Recruitment workflow has to be started by clicking on “Start HR Workflow” button in “Items” ribbon tab. This workflow can be run on folders (candidates) only. The whole definition of this list is in “BoldBrick.OneIntranet.HR\DataObjects\Lists\CandidatesListData”.

Last edited Jul 3, 2011 at 10:40 AM by boldbrick, version 2

Comments

No comments yet.