text:
using System;
using System.IO;
using System.Xml;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Extensions.MediaRss;

namespace Google.GData.YouTube
{
    ///
    /// short table to hold the namespace and the prefix
    ///
    public class YouTubeNameTable
    {
        /// static string to specify the YouTube namespace supported
        public const string NSYouTube = "http://gdata.youtube.com/schemas/2007";

        /// static string to specify the Google YouTube prefix used
        public const string ytPrefix = "yt";

        /// static string for the ratings relationship
        public const string RatingsRelationship = NSYouTube + "#video.ratings";

        /// static string for the in reply to  relationship
        public const string ReplyToRelationship = NSYouTube + "#in-reply-to";

        /// string for the video kind category
        public const string KIND_VIDEO = NSYouTube + "#video";

        /// string for the complaint kind category
        public const string KIND_COMPLAINT = NSYouTube + "#complaint";

        /// string for the comment kind category
        public const string KIND_COMMENT = NSYouTube + "#comment";

        /// string for the playlistLink kind category
        public const string KIND_PLAYLIST_LINK = NSYouTube + "#playlistLink";

        /// string for the subscription kind category
        public const string KIND_SUBSCRIPTION = NSYouTube + "#subscription";

        /// string for the friend kind category
        public const string KIND_FRIEND = NSYouTube + "#friend";

        /// string for the rating kind category
        public const string KIND_RATING = NSYouTube + "#rating";

        /// string for the userProfile kind category
        public const string KIND_USER_PROFILE = NSYouTube + "#userProfile";

        /// string for the playlist kind category
        public const string KIND_PLAYLIST = NSYouTube + "#playlist";

        /// string for the videoMessage kind category
        public const string KIND_VIDEO_MESSAGE = NSYouTube + "#videoMessage";

        ///
        /// The schema used for friends entries
        ///
        public const string FriendsCategorySchema = NSYouTube + "/contact.cat";

        ///
        /// The schema used for subscription entries
        ///
        public const string SubscriptionCategorySchema = NSYouTube + "/subscriptiontypes.cat";

        ///
        /// The schema used for complaint entries
        ///
        public const string ComplaintCategorySchema = NSYouTube + "/complaint-reasons.cat";

        ///
        /// The schema used for user events  entries
        ///
        public const string EventsCategorySchema = NSYouTube + "/userevents.cat";

        ///
        /// string for the user rated category term
        ///
        public const string VideoRatedCategory = "video_rated";

        ///
        /// string for the user shared category term
        ///
        public const string VideoSharedCategory = "video_shared";

        ///
        /// string for the user uploaded category term
        ///
        public const string VideoUploadedCategory = "video_uploaded";

        ///
        /// string for the user favorited category term
        ///
        public const string VideoFavoritedCategory = "video_favorited";

        ///
        /// string for the user commented category term
        ///
        public const string VideoCommentedCategory = "video_commented";

        ///
        /// string for the user friend added category term
        ///
        public const string FriendAddedCategory = "friend_added";

        ///
        /// string for the user subscriptoin added category term
        ///
        public const string UserSubscriptionAddedCategory = "user_subscription_added";

        ///
        /// age element string
        ///
        public const string Age = "age";

        ///
        /// books element string
        ///
        public const string Books = "books";

        ///
        /// The schema used for categories
        ///
        public const string CategorySchema = NSYouTube + "/categories.cat";

        ///
        /// Company element string
        ///
        public const string Company = "company";

        ///
        /// content element string
        ///
        public const string Content = "content";

        ///
        /// Description element string
        ///
        public const string Description = "description";

        ///
        /// The schema used for developer tags
        ///
        public const string DeveloperTagSchema = NSYouTube + "/developertags.cat";

        ///
        /// Duration element string
        ///
        public const string Duration = "duration";

        ///
        /// Episode element string
        ///
        public const string Episode = "episode";

        ///
        /// FirstName element string
        ///
        public const string FirstName = "firstName";

        ///
        /// Gender element string
        ///
        public const string Gender = "gender";

        ///
        /// Hobbies element string
        ///
        public const string Hobbies = "hobbies";

        ///
        /// HomeTown element string
        ///
        public const string HomeTown = "hometown";

        ///
        /// The schema used for keywords
        ///
        public const string KeywordSchema = NSYouTube + "/keywords.cat";

        ///
        /// LastName element string
        ///
        public const string LastName = "lastName";

        ///
        /// Location element string
        ///
        public const string Location = "location";

        ///
        /// Movies element string
        ///
        public const string Movies = "movies";

        ///
        /// Music element string
        ///
        public const string Music = "music";

        ///
        /// NoEmbed element string
        ///
        public const string NoEmbed = "noembed";

        ///
        /// Occupation element string
        ///
        public const string Occupation = "occupation";

        ///
        /// Position element string
        ///
        public const string Position = "position";

        ///
        /// Private element string
        ///
        public const string Private = "private";

        ///
        /// QueryString element string
        ///
        public const string QueryString = "queryString";

        ///
        /// Racy element string
        ///
        public const string Racy = "racy";

        ///
        /// Recorded element string
        ///
        public const string Recorded = "recorded";

        ///
        /// The related videos URI in the link collection
        ///
        public const string RelatedVideo = NSYouTube + "#video.related";

        ///
        /// Relationship element string
        ///
        public const string Relationship = "relationship";

        ///
        /// The video response URI in the link collection
        ///
        public const string ResponseVideo = NSYouTube + "#video.responses";

        ///
        /// The video complaint URI in the link collection
        ///
        public const string Complaint = NSYouTube + "#video.complaints";

        ///
        /// School element string
        ///
        public const string School = "school";

        ///
        /// State element string
        ///
        public const string State = "state";

        ///
        /// Statistics element string
        ///
        public const string Statistics = "statistics";

        ///
        /// Status element string
        ///
        public const string Status = "status";

        ///
        /// UserName element string
        ///
        public const string UserName = "username";

        ///
        /// counthint element string for playlist feeds
        ///
        public const string CountHint = "countHint";

        ///
        /// videoid element string for playlist feeds
        ///
        public const string VideoID = "videoid";

        ///
        /// uploaded element string for playlist feeds
        ///
        public const string Uploaded = "uploaded";

        ///
        /// yt:rating element string
        ///
        public const string YtRating = "rating";

        ///
        /// yt:accessControl element string
        ///
        public const string AccessControl = "accessControl";

        ///
        /// title for a playlist
        ///
        public const string PlaylistTitle = "playlistTitle";

        ///
        /// id for a playlist
        ///
        public const string PlaylistId = "playlistId";
    }

    ///
    /// this Category entry will be returned for the list of official YouTubeCategories,
    /// using the <seealso cref="YouTubeQuery.GetYouTubeCategories"/> method
    ///
    public class YouTubeCategory : AtomCategory
    {
        ///
        /// Indicates that new videos may be assigned to that category. New videos
        /// cannot be assigned to categories that are not marked as assignable
        ///
        ///
        public bool Assignable
        {
            get { return (FindExtension("assignable", YouTubeNameTable.NSYouTube) != null); }
        }

        ///
        /// The presence of the <yt:browsable> tag indicates that the corresponding
        /// category is browsable on YouTube in one or more countries. The tag's regions
        /// attribute contains a space-delimited list of two-letter regionIDs that
        /// identifies the particular countries where the category is browsable.
        ///
        public string Browsable
        {
            get
            {
                XmlExtension x = FindExtension("browsable", YouTubeNameTable.NSYouTube) as XmlExtension;
                if (x != null && x.Node != null)
                {
                    return x.Node.Attributes["regions"].Value;
                }
                return null;
            }
        }

        ///
        /// Categories that are neither assignable or browsable are deprecated and are identified as such
        ///
        public bool Deprecated
        {
            get { return (FindExtension("deprecated", YouTubeNameTable.NSYouTube) != null); }
        }
    }

    ///
    /// YouTube specific MediaGroup element. It adds Duration and Private
    /// subelements as well as using a different version of MediaCredit
    ///
    /// <returns></returns>
    public class MediaGroup : Extensions.MediaRss.MediaGroup
    {
        private ExtensionCollection<MediaContent> contents;

        public MediaGroup()
        {
            ExtensionFactories.Add(new Duration());
            ExtensionFactories.Add(new Private());
            ExtensionFactories.Add(new VideoId());

            // replace the media group default media credit with a new one.
            MediaCredit c = new MediaCredit();
            ReplaceFactory(c.XmlName, c.XmlNameSpace, c);
            // replace the media group default media content with a new one.
            MediaContent m = new MediaContent();
            ReplaceFactory(m.XmlName, m.XmlNameSpace, m);
        }

        ///
        /// property accessor for the Contents Collection
        ///
        public ExtensionCollection<MediaContent> Contents
        {
            get
            {
                if (contents == null)
                {
                    contents = new ExtensionCollection<MediaContent>(this);
                }
                return contents;
            }
        }

        ///
        /// returns the media:credit element
        ///
        public new MediaCredit Credit
        {
            get
            {
                return FindExtension(MediaRssNameTable.MediaRssCredit,
                    MediaRssNameTable.NSMediaRss) as MediaCredit;
            }
            set
            {
                ReplaceExtension(MediaRssNameTable.MediaRssCredit,
                    MediaRssNameTable.NSMediaRss,
                    value);
            }
        }

        ///
        /// returns the yt:duration element
        ///
        public Duration Duration
        {
            get
            {
                return FindExtension(YouTubeNameTable.Duration,
                    YouTubeNameTable.NSYouTube) as Duration;
            }
            set
            {
                ReplaceExtension(YouTubeNameTable.Duration,
                    YouTubeNameTable.NSYouTube,
                    value);
            }
        }

        ///
        /// returns the yt:duration element
        ///
        public Private Private
        {
            get
            {
                return FindExtension(YouTubeNameTable.Private,
                    YouTubeNameTable.NSYouTube) as Private;
            }
            set
            {
                ReplaceExtension(YouTubeNameTable.Private,
                    YouTubeNameTable.NSYouTube,
                    value);
            }
        }

        ///
        /// property accessor for the VideoID, if applicable
        ///
        public VideoId VideoId
        {
            get
            {
                return FindExtension(YouTubeNameTable.VideoID,
                    YouTubeNameTable.NSYouTube) as VideoId;
            }
            set
            {
                ReplaceExtension(YouTubeNameTable.VideoID,
                    YouTubeNameTable.NSYouTube,
                    value);
            }
        }
    }

    public class MediaCredit : Extensions.MediaRss.MediaCredit
    {
        ///
        /// default constructor for media:credit
        ///
        public MediaCredit()
        {
            AttributeNamespaces.Add("type", YouTubeNameTable.NSYouTube);
            Attributes.Add("type", null);
        }

        ///
        /// returns the type of the credit element
        ///
        /// <returns></returns>
        public string Type
        {
            get { return Attributes["type"] as string; }
            set { Attributes["type"] = value; }
        }
    }

    public class MediaContent : Extensions.MediaRss.MediaContent
    {
        ///
        /// default constructor for media:credit
        ///
        public MediaContent()
        {
            AttributeNamespaces.Add("format", YouTubeNameTable.NSYouTube);
            Attributes.Add("format", null);
        }

        ///
        /// returns the type of the credit element
        ///
        /// <returns></returns>
        public string Format
        {
            get { return Attributes["format"] as string; }
            set { Attributes["format"] = value; }
        }
    }

    ///
    /// The yt:accessControl element indicates whether users are allowed to rate a video,
    /// rate comments about the video, add a video response to the video or embed the
    /// video on third-party websites.
    ///
    public class YtAccessControl : SimpleElement
    {
        /// the action xml attribute
        private const string actionAttribute = "action";

        /// the permission xml attribute
        private const string permissionAttribute = "permission";

        /// the rate action
        public const string RateAction = "rate";

        /// the comment action
        public const string CommentAction = "comment";

        /// the commentVote action
        public const string CommentVoteAction = "commentVote";

        /// the videoRespond action
        public const string VideoRespondAction = "videoRespond";

        /// the list action
        public const string ListAction = "list";

        /// the embed action
        public const string EmbedAction = "embed";

        /// the syndicate action
        public const string SyndicateAction = "syndicate";

        /// the allowed permission
        public const string AllowedPermission = "allowed";

        /// the denied permission
        public const string DeniedPermission = "denied";

        /// the moderated permission
        public const string ModeratedPermission = "moderated";

        ///
        /// default constructor for yt:accessControl.
        ///
        public YtAccessControl()
            : base(YouTubeNameTable.AccessControl,
                YouTubeNameTable.ytPrefix,
                YouTubeNameTable.NSYouTube)
        {
            Attributes.Add(actionAttribute, null);
            Attributes.Add(permissionAttribute, null);
        }

        ///
        /// alternative constructor for yt:accessControl that allows
        /// to specify initial values.
        ///
        public YtAccessControl(string action, string permission)
            : base(YouTubeNameTable.AccessControl,
                YouTubeNameTable.ytPrefix,
                YouTubeNameTable.NSYouTube)
        {
            Attributes.Add(actionAttribute, action);
            Attributes.Add(permissionAttribute, permission);
        }

        ///
        /// convenience accessor for action.
        ///
        /// <returns></returns>
        public string Action
        {
            get { return Attributes[actionAttribute] as string; }
            set { Attributes[actionAttribute] = value; }
        }

        ///
        /// convenience accessor for permission.
        ///
        /// <returns></returns>
        public string Permission
        {
            get { return Attributes[permissionAttribute] as string; }
            set { Attributes[permissionAttribute] = value; }
        }
    }

    ///
    /// id schema extension describing an ID.
    ///
    public class Age : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Age()
            : base(YouTubeNameTable.Age, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// default constructor with an initial value as a string
        ///
        public Age(string initValue)
            : base(YouTubeNameTable.Age, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Books schema extension describing a YouTube Books
    ///
    public class Books : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Books()
            : base(YouTubeNameTable.Books, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor with an init value
        ///
        /// <param name="initValue"></param>
        public Books(string initValue)
            : base(YouTubeNameTable.Books, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Company schema extension describing a YouTube Company
    ///
    public class Company : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Company()
            : base(YouTubeNameTable.Company, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Company(string initValue)
            : base(YouTubeNameTable.Company, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// content schema extension describing a YouTube complaint
    ///
    public class Content : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Content()
            : base(YouTubeNameTable.Content, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Content(string initValue)
            : base(YouTubeNameTable.Content, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Description schema extension describing a YouTube Description
    ///
    public class Description : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Description()
            : base(YouTubeNameTable.Description, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Description(string initValue)
            : base(YouTubeNameTable.Description, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Duration schema extension describing a YouTube Duration
    ///
    public class Duration : SimpleElement
    {
        /// the seconds xml attribute
        public const string AttributeSeconds = "seconds";

        ///
        /// default constructor
        ///
        public Duration()
            : base(YouTubeNameTable.Duration, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
            Attributes.Add(AttributeSeconds, null);
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Duration(string initValue)
            : base(YouTubeNameTable.Duration, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
            Attributes.Add(AttributeSeconds, null);
        }

        /// returns you the seconds attribute
        /// <returns> </returns>
        public string Seconds
        {
            get { return Attributes[AttributeSeconds] as string; }
            set { Attributes[AttributeSeconds] = value; }
        }
    }

    ///
    /// The yt:episode element contains the episode number for the video.
    ///
    public class Episode : SimpleElement
    {
        /// the number xml attribute
        private const string AttributeNumber = "number";

        ///
        /// default constructor for yt:episode.
        ///
        public Episode()
            : base(YouTubeNameTable.Episode,
                YouTubeNameTable.ytPrefix,
                YouTubeNameTable.NSYouTube)
        {
            Attributes.Add(AttributeNumber, null);
        }

        ///
        /// default constructor for yt:rating.
        ///
        public Episode(string value)
            : base(YouTubeNameTable.Episode,
                YouTubeNameTable.ytPrefix,
                YouTubeNameTable.NSYouTube)
        {
            Attributes.Add(AttributeNumber, null);
        }

        ///
        /// convenience accessor for Episode Number.
        ///
        /// <returns></returns>
        public int? Number
        {
            get
            {
                int parsed;
                if (int.TryParse(Attributes[AttributeNumber] as string, out parsed))
                {
                    return parsed;
                }
                return null;
            }
            set { Attributes[AttributeNumber] = value; }
        }
    }

    ///
    /// FirstName schema extension describing a YouTube FirstName
    ///
    public class FirstName : SimpleElement
    {
        ///
        /// default constructor
        ///
        public FirstName()
            : base(YouTubeNameTable.FirstName, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public FirstName(string initValue)
            : base(YouTubeNameTable.FirstName, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Gender schema extension describing a YouTube Gender
    ///
    public class Gender : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Gender()
            : base(YouTubeNameTable.Gender, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Gender(string initValue)
            : base(YouTubeNameTable.Gender, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Hobbies schema extension describing a YouTube Hobbies
    ///
    public class Hobbies : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Hobbies()
            : base(YouTubeNameTable.Hobbies, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Hobbies(string initValue)
            : base(YouTubeNameTable.Hobbies, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// HomeTown schema extension describing a YouTube HomeTown
    ///
    public class HomeTown : SimpleElement
    {
        ///
        /// default constructor
        ///
        public HomeTown()
            : base(YouTubeNameTable.HomeTown, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public HomeTown(string initValue)
            : base(YouTubeNameTable.HomeTown, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// LastName schema extension describing a YouTube LastName
    ///
    public class LastName : SimpleElement
    {
        ///
        /// default constructor
        ///
        public LastName()
            : base(YouTubeNameTable.LastName, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public LastName(string initValue)
            : base(YouTubeNameTable.LastName, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Location schema extension describing a YouTube Location
    ///
    public class Location : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Location()
            : base(YouTubeNameTable.Location, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Location(string initValue)
            : base(YouTubeNameTable.Location, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Movies schema extension describing a YouTube Movies
    ///
    public class Movies : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Movies()
            : base(YouTubeNameTable.Movies, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Movies(string initValue)
            : base(YouTubeNameTable.Movies, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Music schema extension describing a YouTube Music
    ///
    public class Music : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Music()
            : base(YouTubeNameTable.Music, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Music(string initValue)
            : base(YouTubeNameTable.Music, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// NoEmbed schema extension describing a YouTube NoEmbed
    ///
    public class NoEmbed : SimpleElement
    {
        ///
        /// default constructor
        ///
        public NoEmbed()
            : base(YouTubeNameTable.NoEmbed, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public NoEmbed(string initValue)
            : base(YouTubeNameTable.NoEmbed, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Occupation schema extension describing a YouTube Occupation
    ///
    public class Occupation : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Occupation()
            : base(YouTubeNameTable.Occupation, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Occupation(string initValue)
            : base(YouTubeNameTable.Occupation, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Position schema extension describing a YouTube Position
    ///
    public class Position : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Position()
            : base(YouTubeNameTable.Position, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Position(string initValue)
            : base(YouTubeNameTable.Position, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Private schema extension describing a YouTube Private
    ///
    public class Private : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Private()
            : base(YouTubeNameTable.Private, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Private(string initValue)
            : base(YouTubeNameTable.Private, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// QueryString schema extension describing a YouTube QueryString
    ///
    public class QueryString : SimpleElement
    {
        ///
        /// default constructor
        ///
        public QueryString()
            : base(YouTubeNameTable.QueryString, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public QueryString(string initValue)
            : base(YouTubeNameTable.QueryString, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Racy schema extension describing a YouTube Racy
    ///
    [Obsolete("replaced media:rating")]
    public class Racy : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Racy()
            : base(YouTubeNameTable.Racy, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Racy(string initValue)
            : base(YouTubeNameTable.Racy, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Recorded schema extension describing a YouTube Recorded
    ///
    public class Recorded : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Recorded()
            : base(YouTubeNameTable.Recorded, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Recorded(string initValue)
            : base(YouTubeNameTable.Recorded, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Relationship schema extension describing a YouTube Relationship
    ///
    public class Relationship : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Relationship()
            : base(YouTubeNameTable.Relationship, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Relationship(string initValue)
            : base(YouTubeNameTable.Relationship, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Identifies the school that the user attended according to the information
    /// in the user's public YouTube profile.
    ///
    public class School : SimpleElement
    {
        ///
        /// default constructor
        ///
        public School()
            : base(YouTubeNameTable.School, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public School(string initValue)
            : base(YouTubeNameTable.School, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// State schema extension describing a YouTube State, child of app:control
    /// The state tag contains information that describes the status of a video.
    /// For videos that failed to upload or were rejected after the upload
    /// process, the reasonCode attribute and the tag value provide
    /// insight into the reason for the upload problem.
    ///
    public class State : SimpleElement
    {
        /// the name xml attribute
        public const string AttributeName = "name";

        /// the reasonCode xml attribute
        public const string AttributeReason = "reasonCode";

        /// the help xml attribute
        public const string AttributeHelp = "helpUrl";

        ///
        /// default constructor
        ///
        public State()
            : base(YouTubeNameTable.State, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
            Attributes.Add(AttributeName, null);
            Attributes.Add(AttributeReason, null);
            Attributes.Add(AttributeHelp, null);
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public State(string initValue)
            : base(YouTubeNameTable.State, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
            Attributes.Add(AttributeName, null);
            Attributes.Add(AttributeReason, null);
            Attributes.Add(AttributeHelp, null);
        }

        /// The name attribute identifies the status of an unpublished video.
        /// Valid values for this tag are processing, deleted, rejected and failed.
        /// <returns> </returns>
        public string Name
        {
            get { return Attributes[AttributeName] as string; }
            set { Attributes[AttributeName] = value; }
        }

        /// The reasonCode attribute provides information about why a video failed
        /// to upload or was rejected after the uploading process. The yt:state tag will not
        /// include a reasonCode attribute if the value of the name
        /// attribute is processing.
        /// <returns> </returns>
        public string Reason
        {
            get { return Attributes[AttributeReason] as string; }
            set { Attributes[AttributeReason] = value; }
        }

        /// The helpUrl parameter contains a link to a YouTube Help
        /// Center page that may help the developer or the video owner to
        /// diagnose the reason that an upload failed or was rejected..
        /// <returns> </returns>
        public string Help
        {
            get { return Attributes[AttributeHelp] as string; }
            set { Attributes[AttributeHelp] = value; }
        }
    }

    ///
    /// The statistics tag provides statistics about a video or a user.
    /// The statistics tag is not provided in a video entry if the value
    /// of the viewCount attribute is 0.
    ///
    public class Statistics : SimpleElement
    {
        /// the viewCount xml attribute
        public const string AttributeViewCount = "viewCount";

        /// the videoWatchCount xml attribute
        public const string AttributeWatchCount = "videoWatchCount";

        /// the subscriberCount xml attribute
        public const string AttributeSubscriberCount = "subscriberCount";

        /// the lastWebAccess xml attribute
        public const string AttributeLastWebAccess = "lastWebAccess";

        /// the favoriteCount xml attribute
        public const string AttributeFavoriteCount = "favoriteCount";

        ///
        /// default constructor
        ///
        public Statistics()
            : base(YouTubeNameTable.Statistics, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
            Attributes.Add(AttributeViewCount, null);
            Attributes.Add(AttributeWatchCount, null);
            Attributes.Add(AttributeSubscriberCount, null);
            Attributes.Add(AttributeLastWebAccess, null);
            Attributes.Add(AttributeFavoriteCount, null);
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Statistics(string initValue)
            : base(YouTubeNameTable.Statistics, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
            Attributes.Add(AttributeViewCount, null);
            Attributes.Add(AttributeWatchCount, null);
            Attributes.Add(AttributeSubscriberCount, null);
            Attributes.Add(AttributeLastWebAccess, null);
            Attributes.Add(AttributeFavoriteCount, null);
        }

        /// convenience accessor for the ViewCount
        /// <returns> </returns>
        public string ViewCount
        {
            get { return Attributes[AttributeViewCount] as string; }
            set { Attributes[AttributeViewCount] = value; }
        }

        /// convenience accessor for the Watched Count
        /// <returns> </returns>
        public string WatchCount
        {
            get { return Attributes[AttributeWatchCount] as string; }
            set { Attributes[AttributeWatchCount] = value; }
        }

        /// convenience accessor for the SubscriberCount
        /// <returns> </returns>
        public string SubscriberCount
        {
            get { return Attributes[AttributeSubscriberCount] as string; }
            set { Attributes[AttributeSubscriberCount] = value; }
        }

        /// convenience accessor for the LastWebAccess
        /// <returns> </returns>
        public string LastWebAccess
        {
            get { return Attributes[AttributeLastWebAccess] as string; }
            set { Attributes[AttributeLastWebAccess] = value; }
        }

        /// convenience accessor for the Favorite
        /// <returns> </returns>
        public string FavoriteCount
        {
            get { return Attributes[AttributeFavoriteCount] as string; }
            set { Attributes[AttributeFavoriteCount] = value; }
        }
    }

    ///
    /// The countHint element specifies the number of entries in a playlist feed.
    /// The countHint tag appears in the entries in a playlists feed, where each entry contains
    /// information about a single playlist
    ///
    public class CountHint : SimpleElement
    {
        ///
        /// default constructor
        ///
        public CountHint()
            : base(YouTubeNameTable.CountHint, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public CountHint(string initValue)
            : base(YouTubeNameTable.CountHint, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Status schema extension describing a YouTube Status
    ///
    public class Status : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Status()
            : base(YouTubeNameTable.Status, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public Status(string initValue)
            : base(YouTubeNameTable.Status, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// UserName schema extension describing a YouTube UserName
    ///
    public class UserName : SimpleElement
    {
        ///
        /// default constructor
        ///
        public UserName()
            : base(YouTubeNameTable.UserName, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor taking the initial value
        ///
        /// <param name="initValue"></param>
        public UserName(string initValue)
            : base(YouTubeNameTable.UserName, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// Uploaded schema extension describing a YouTube uploaded date
    ///
    public class Uploaded : SimpleElement
    {
        ///
        /// default constructor
        ///
        public Uploaded()
            : base(YouTubeNameTable.Uploaded, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor with an init value
        ///
        /// <param name="initValue"></param>
        public Uploaded(string initValue)
            : base(YouTubeNameTable.Uploaded, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// VideoId schema extension describing a YouTube video identifier
    ///
    public class VideoId : SimpleElement
    {
        ///
        /// default constructor
        ///
        public VideoId()
            : base(YouTubeNameTable.VideoID, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor with an init value
        ///
        /// <param name="initValue"></param>
        public VideoId(string initValue)
            : base(YouTubeNameTable.VideoID, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// PlaylistId schema extension describing a YouTube playlist identifier
    ///
    public class PlaylistId : SimpleElement
    {
        ///
        /// default constructor
        ///
        public PlaylistId()
            : base(YouTubeNameTable.PlaylistId, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor with an init value
        ///
        /// <param name="initValue"></param>
        public PlaylistId(string initValue)
            : base(YouTubeNameTable.PlaylistId, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// PlaylistTitle schema extension describing a YouTube playlist title
    ///
    public class PlaylistTitle : SimpleElement
    {
        ///
        /// default constructor
        ///
        public PlaylistTitle()
            : base(YouTubeNameTable.PlaylistTitle, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube)
        {
        }

        ///
        /// constructor with an init value
        ///
        /// <param name="initValue"></param>
        public PlaylistTitle(string initValue)
            : base(YouTubeNameTable.PlaylistTitle, YouTubeNameTable.ytPrefix, YouTubeNameTable.NSYouTube, initValue)
        {
        }
    }

    ///
    /// The yt:rating element contains information about the number of users who gave
    /// the video a positive or negative rating as well as the totale number of ratings
    /// that the video received.
    ///
    public class YtRating : SimpleElement
    {
        /// the numLikes xml attribute
        private const string numLikesAttribute = "numLikes";

        /// the numDislikes xml attribute
        private const string numDislikesAttribute = "numDislikes";

        /// the value xml attribute
        private const string valueAttribute = "value";

        /// the like video rating
        public const string Like = "like";

        /// the dislike video rating
        public const string Dislike = "dislike";

        ///
        /// default constructor for yt:rating.
        ///
        public YtRating()
            : base(YouTubeNameTable.YtRating,
                YouTubeNameTable.ytPrefix,
                YouTubeNameTable.NSYouTube)
        {
            Attributes.Add(numLikesAttribute, null);
            Attributes.Add(numDislikesAttribute, null);
            Attributes.Add(valueAttribute, null);
        }

        ///
        /// default constructor for yt:rating.
        ///
        public YtRating(string value)
            : base(YouTubeNameTable.YtRating,
                YouTubeNameTable.ytPrefix,
                YouTubeNameTable.NSYouTube)
        {
            Attributes.Add(numLikesAttribute, null);
            Attributes.Add(numDislikesAttribute, null);
            Attributes.Add(valueAttribute, value);
        }

        ///
        /// convenience accessor for Likes Count.
        ///
        /// <returns></returns>
        public string NumLikes
        {
            get { return Attributes[numLikesAttribute] as string; }
            set { Attributes[numLikesAttribute] = value; }
        }

        ///
        /// convenience accessor for Dislikes Count.
        ///
        /// <returns></returns>
        public string NumDislikes
        {
            get { return Attributes[numDislikesAttribute] as string; }
            set { Attributes[numDislikesAttribute] = value; }
        }

        ///
        /// The positive ("like") or negative ("dislike") rating for the video.
        ///
        /// <returns></returns>
        public string RatingValue
        {
            get { return Attributes[valueAttribute] as string; }
            set { Attributes[valueAttribute] = value; }
        }
    }

    ///
    /// Simple class to hold the response of a browser-based upload request
    ///
    public class FormUploadToken
    {
        ///
        /// The token which much be included in the browser form.
        ///
        private string token;

        ///
        /// The URL that the browser must POST to
        ///
        private string url;

        ///
        /// Simple constructor that initializes private members
        ///
        /// <param name="url">The URL that the browser must POST to</param>
        /// <param name="token">The token which much be included in the browser form.</param>
        public FormUploadToken(string url, string token)
        {
            this.url = url;
            this.token = token;
        }

        ///
        /// Constructor that initializes the object from a server response
        ///
        /// <param name="stream">Stream containing a server response</param>
        public FormUploadToken(Stream stream)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(stream);

            url = doc.GetElementsByTagName("url")[0].InnerText;
            token = doc.GetElementsByTagName("token")[0].InnerText;
        }

        ///
        /// Property to access the URL the browser must POST to
        ///
        public string Url
        {
            get { return url; }
            set { url = value; }
        }

        ///
        /// Property to access the token the browser must include in the form POST
        ///
        public string Token
        {
            get { return token; }
            set { token = value; }
        }
    }
}


text:
<?php

namespace Numa\DOAAdminBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\XmlRoot;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation as JMS;

use Doctrine\ORM\Mapping as ORM;

/**
 * Catalogrecords
 * @JMS\XmlRoot("dealer")
 * @JMS\ExclusionPolicy("ALL")
 *
 *
 */
class Catalogrecords implements UserInterface
{

    /**
     * @var integer
     * @Expose
     * @Groups({"site"})
     */
    protected $id;

    /**
     * @var string
     * @JMS\Expose
     * @JMS\SerializedName("name")
     * @Groups({"site"})
     */
    private $name;

    /**
     * @var string
     * @Expose
     * $Type("string")
     * @Groups({"site"})
     */
    private $url;

    public static $maping = array(
        'DealerID' => 'DealerId',
        'DealerName' => 'Name',
        'Address1' => 'Address',
        'Address2' => 'Address2',
        'City' => 'City',
        'State' => 'State',
        'Zip' => 'Zip',
        'Phone' => 'Phone',
        'Fax' => 'Fax',
        'Email' => 'Email',
        'DealerContact' => 'Contact',
        'DealerWebsite' => 'Url',
        'ShowRoomHours' => 'ShowRoomHours',
        'ServiceHours' => 'ServiceHours',
        'PartsHours' => 'PartsHours',
        'AdminHours' => 'AdminHours'
    );

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    public function setId($id){
        $this->id=$id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Catalogrecords
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set url
     *
     * @param string $url
     * @return Catalogrecords
     */
    public function setUrl($url)
    {
        $this->url = $url;

        return $this;
    }

    /**
     * Get url
     *
     * @return string
     */
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        // Add your code here
    }

    /**
     * @ORM\PreUpdate
     */
    public function setUpdatedAtValue()
    {
        // Add your code here
    }

    /**
     * @ORM\PreRemove
     */
    public function doBeforeRemoved()
    {

    }

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $description;

    /**
     * Set description
     *
     * @param string $description
     * @return Catalogrecords
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $address;

    /**
     * @var string
     * @Groups({"site"})
     * @Expose
     */
    private $phone;

    /**
     * @var string
     * @Groups({"site"})
     */
    private $location;

    /**
     * @var string
     * @Groups({"site"})
     */
    private $email;

    /**
     * @var string
     * @Groups({"site"})
     */
    private $full;

    /**
     * Set address
     *
     * @param string $address
     * @return Catalogrecords
     */
    public function setAddress($address)
    {
        $this->address = $address;

        return $this;
    }

    /**
     * Get address
     *
     * @return string
     */
    public function getAddress()
    {
        return $this->address;
    }

    /**
     * Set phone
     *
     * @param string $phone
     * @return Catalogrecords
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;

        return $this;
    }

    /**
     * Get phone
     *
     * @return string
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * Set location
     *
     * @param string $location
     * @return Catalogrecords
     */
    public function setLocation($location)
    {
        $this->location = $location;

        return $this;
    }

    /**
     * Get location
     *
     * @return string
     */
    public function getLocation()
    {
        return $this->location;
    }

    /**
     * Set email
     *
     * @param string $email
     * @return Catalogrecords
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Set full
     *
     * @param string $full
     * @return Catalogrecords
     */
    public function setFull($full)
    {
        $this->full = $full;

        return $this;
    }

    /**
     * Get full
     *
     * @return string
     */
    public function getFull()
    {
        return $this->full;
    }

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $fax;

    /**
     * Set fax
     *
     * @param string $fax
     * @return Catalogrecords
     */
    public function setFax($fax)
    {
        $this->fax = $fax;

        return $this;
    }

    /**
     * Get fax
     *
     * @return string
     */
    public function getFax()
    {
        return $this->fax;
    }

    public function __toString()
    {
        return $this->getName();
    }

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $logo;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $logo_url;

    /**
     * Set logo
     *
     * @param string $logo
     * @return Catalogrecords
     */
    public function setLogo($logo)
    {
        $this->logo = $logo;

        return $this;
    }

    /**
     * Get logo
     *
     * @return string
     */
    public function getLogo()
    {
        return $this->logo;
    }

    /**
     * Set logo_url
     *
     * @param string $logoUrl
     * @return Catalogrecords
     */
    public function setLogoUrl($logoUrl)
    {

        $this->logo_url = $logoUrl;

        return $this;
    }

    /**
     * Get logo_url
     *
     * @return string
     */
    public function getLogoUrl()
    {
        if (!empty($this->getLogo())) {
            $this->logo_url = $this->getLogo();
        }
        return $this->logo_url;
    }

    /**
     * @var string
     */
    private $password;

    /**
     * Set password
     *
     * @param string $password
     * @return Catalogrecords
     */
    public function setPassword($password)
    {
        if (!empty($password)) {
            $this->password = $password;
        }

        return $this;
    }

    /**
     * Get password
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    public function getRoles()
    {
        if (strtolower($this->getDmsStatus()) == 'activated') {
            return array('ROLE_DMS_USER', 'ROLE_BUSINES');
        } else {
            return array('ROLE_NODMS_USER', 'ROLE_BUSINES');
        }
        if ($this->getAdmindealer()) {
            return array('ROLE_DEALER_ADMIN', 'ROLE_BUSINES');
        }

        return array('ROLE_BUSINES');
    }

    public function getSalt()
    {
        return null;
    }

    public function eraseCredentials()
    {

    }

    public function equals(User $user)
    {
        return $user->getUsername() == $this->getUsername();
    }

    /**
     * Get username
     * @Groups({"site"})
     * @return string
     */
    private $username;

    public function getUsername()
    {
        return $this->username;
    }

    public function setUserame($username)
    {
        $this->username = $username;
    }

    /**
     * @var integer
     * @Groups({"site"})
     */
    private $dealer_id;

    /**
     * @var string
     * @Groups({"site"})
     */
    private $address2;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $city;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $zip;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $state;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $ShowRoomHours;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $ServiceHours;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $PartsHours;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $AdminHours;

    /**
     * Set dealer_id
     *
     * @param integer $dealerId
     * @return Catalogrecords
     */
    public function setDealerId($dealerId)
    {
        $this->dealer_id = $dealerId;

        return $this;
    }

    /**
     * Get dealer_id
     *
     * @return integer
     */
    public function getDealerId()
    {
        return $this->dealer_id;
    }

    /**
     * Set address2
     *
     * @param string $address2
     * @return Catalogrecords
     */
    public function setAddress2($address2)
    {
        $this->address2 = $address2;

        return $this;
    }

    /**
     * Get address2
     *
     * @return string
     */
    public function getAddress2()
    {
        return $this->address2;
    }

    /**
     * Set city
     *
     * @param string $city
     * @return Catalogrecords
     */
    public function setCity($city)
    {
        $this->city = $city;

        return $this;
    }

    /**
     * Get city
     *
     * @return string
     */
    public function getCity()
    {
        return $this->city;
    }

    /**
     * Set zip
     *
     * @param string $zip
     * @return Catalogrecords
     */
    public function setZip($zip)
    {
        $this->zip = $zip;

        return $this;
    }

    /**
     * Get zip
     *
     * @return string
     */
    public function getZip()
    {
        return $this->zip;
    }

    /**
     * Set state
     *
     * @param string $state
     * @return Catalogrecords
     */
    public function setState($state)
    {
        $this->state = $state;

        return $this;
    }

    /**
     * Get state
     *
     * @return string
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * Set ShowRoomHours
     *
     * @param string $showRoomHours
     * @return Catalogrecords
     */
    public function setShowRoomHours($showRoomHours)
    {
        $this->ShowRoomHours = $showRoomHours;

        return $this;
    }

    /**
     * Get ShowRoomHours
     *
     * @return string
     */
    public function getShowRoomHours()
    {
        return $this->ShowRoomHours;
    }

    /**
     * Set ServiceHours
     *
     * @param string $serviceHours
     * @return Catalogrecords
     */
    public function setServiceHours($serviceHours)
    {
        $this->ServiceHours = $serviceHours;

        return $this;
    }

    /**
     * Get ServiceHours
     *
     * @return string
     */
    public function getServiceHours()
    {
        return $this->ServiceHours;
    }

    /**
     * Set PartsHours
     *
     * @param string $partsHours
     * @return Catalogrecords
     */
    public function setPartsHours($partsHours)
    {
        $this->PartsHours = $partsHours;

        return $this;
    }

    /**
     * Get PartsHours
     *
     * @return string
     */
    public function getPartsHours()
    {
        return $this->PartsHours;
    }

    /**
     * Set AdminHours
     *
     * @param string $adminHours
     * @return Catalogrecords
     */
    public function setAdminHours($adminHours)
    {
        $this->AdminHours = $adminHours;

        return $this;
    }

    /**
     * Get AdminHours
     *
     * @return string
     */
    public function getAdminHours()
    {
        return $this->AdminHours;
    }

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $contact;

    /**
     * Set contact
     *
     * @param string $contact
     * @return Catalogrecords
     */
    public function setContact($contact)
    {
        $this->contact = $contact;

        return $this;
    }

    /**
     * Get contact
     *
     * @return string
     */
    public function getContact()
    {
        return $this->contact;
    }

    public function getAbsolutePath()
    {
        return null === $this->logo ? null : $this->getUploadRootDir() . '/' . $this->logo;
    }

    public function getLogoImage()
    {
        return null === $this->logo ? null : '/' . $this->getUploadDir() . '/' . $this->logo;
    }

    protected function getUploadRootDir()
    {
        // the absolute directory path where uploaded
        // documents should be saved
        return __DIR__ . '/../../../../web/' . $this->getUploadDir();
    }

    protected function getUploadDir()
    {
        // get rid of the __DIR__ so it doesn't screw up
        // when displaying uploaded doc/image in the view.
        return 'upload/dealers/' . $this->getId();
    }

    public $file_import_source;

    /**
     * Sets file.
     *
     * @param UploadedFile $file
     */
    public function setFileImportSource(\Symfony\Component\HttpFoundation\File\UploadedFile $file_import_source = null)
    {
        $this->file_import_source = $file_import_source;
    }

    /**
     * Get file.
     *
     * @return UploadedFile
     */
    public function getFileImportSource()
    {
        return $this->file_import_source;
    }

    public function upload()
    {
        // the file property can be empty if the field is not required

        if (null === $this->getFileImportSource()) {
            return;
        }

        // use the original file name here but you should
        // sanitize it at least to avoid any security issues
        // move takes the target directory and then the
        // target filename to move to
        $this->getFileImportSource()->move(
            $this->getUploadRootDir(), $this->getFileImportSource()->getClientOriginalName()
        );

        // set the path property to the filename where you've saved the file
        $this->logo = $this->getUploadDir() . "/" . $this->getFileImportSource()->getClientOriginalName();
        $this->logo_url = $this->logo;
//        dump($this->logo);die();
        // clean up the file property as you won't need it anymore
        $this->file_import_source = null;
    }

    /**
     * Set username
     *
     * @param string $username
     * @return Catalogrecords
     */
    public function setUsername($username)
    {
        $this->username = $username;

        return $this;
    }

    /**
     * @var integer
     */
    private $category_id;

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $DealerCategories;

    /**
     * @var \Numa\DOAAdminBundle\Entity\Catalogcategory
     */
    private $Catalogcategory;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->DealerCategories = new \Doctrine\Common\Collections\ArrayCollection();
        $this->Coupon = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Set categoryId
     *
     * @param integer $categoryId
     *
     * @return Catalogrecords
     */
    public function setCategoryId($categoryId)
    {
        $this->category_id = $categoryId;

        return $this;
    }

    /**
     * Get categoryId
     *
     * @return integer
     */
    public function getCategoryId()
    {
        return $this->category_id;
    }

    /**
     * Add dealerCategory
     *
     * @param \Numa\DOAAdminBundle\Entity\DealerCategories $dealerCategory
     *
     * @return Catalogrecords
     */
    public function addDealerCategory(\Numa\DOAAdminBundle\Entity\DealerCategories $dealerCategory)
    {
        $this->DealerCategories[] = $dealerCategory;

        return $this;
    }

    /**
     * Remove dealerCategory
     *
     * @param \Numa\DOAAdminBundle\Entity\DealerCategories $dealerCategory
     */
    public function removeDealerCategory(\Numa\DOAAdminBundle\Entity\DealerCategories $dealerCategory)
    {
        $this->DealerCategories->removeElement($dealerCategory);
    }

    /**
     * Get dealerCategories
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getDealerCategories()
    {
        return $this->DealerCategories;
    }

    /**
     * Set catalogcategory
     *
     * @param \Numa\DOAAdminBundle\Entity\Catalogcategory $catalogcategory
     *
     * @return Catalogrecords
     */
    public function setCatalogcategory(\Numa\DOAAdminBundle\Entity\Catalogcategory $catalogcategory = null)
    {
        $this->Catalogcategory = $catalogcategory;

        return $this;
    }

    /**
     * Get catalogcategory
     *
     * @return \Numa\DOAAdminBundle\Entity\Catalogcategory
     */
    public function getCatalogcategory()
    {
        return $this->Catalogcategory;
    }

    // Important
    public function getDcategory()
    {
        $dcategories = new ArrayCollection();
        if (!empty($this->getDealerCategories()) && !$this->getDealerCategories()->isEmpty()) {
            foreach ($this->getDealerCategories() as $dc) {
                if ($dc instanceof DealerCategories) {
                    $dcategories[] = $dc->getDcategory();
                }
            }
        }
        return $dcategories;
    }

    // Important
    public function setDcategory($dcategories)
    {
        foreach ($dcategories as $dcategory) {
            $dc = new DealerCategories();

            $dc->setCatalogrecords($this);
            $dc->setDcategory($dcategory);

            $this->addDealerCategory($dc);
        }

    }

    public function getDcategoryNames()
    {
        $res = array();
        if (!empty($this->getDealerCategories()) && !$this->getDealerCategories()->isEmpty()) {

            foreach ($this->getDealerCategories() as $dc) {
                if ($dc instanceof DealerCategories) {
                    $res[] = $dc->getDcategory()->getName() . " ";
                }
            }
        }
        return implode(',', $res);
    }

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $Coupon;

    /**
     * Add coupon
     *
     * @param \Numa\DOAAdminBundle\Entity\Coupon $coupon
     *
     * @return Catalogrecords
     */
    public function addCoupon(\Numa\DOAAdminBundle\Entity\Coupon $coupon)
    {
        $this->Coupon[] = $coupon;

        return $this;
    }

    /**
     * Remove coupon
     *
     * @param \Numa\DOAAdminBundle\Entity\Coupon $coupon
     */
    public function removeCoupon(\Numa\DOAAdminBundle\Entity\Coupon $coupon)
    {
        $this->Coupon->removeElement($coupon);
    }

    /**
     * Get coupon
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCoupon()
    {
        return $this->Coupon;
    }

    public function hasCoupons()
    {
        foreach ($this->getCoupon() as $coupon) {
            if (!$coupon->isEmpty()) {
                return true;
            }
        }
        return false;
    }

    /**
     * @var bool
     */
    private $Admindealer;

    /**
     * Set admindealer
     *
     * @param bool $admindealer
     *
     * @return Catalogrecords
     */
    public function setAdmindealer($admindealer)
    {
        $this->Admindealer = $admindealer;

        return $this;
    }

    /**
     * Get admindealer
     *
     * @return bool
     */
    public function getAdmindealer()
    {
        return $this->Admindealer;
    }

    /**
     * @var string
     */
    private $dms_status;

    /**
     * Set dms_status
     *
     * @param string $dmsStatus
     * @return Catalogrecords
     */
    public function setDmsStatus($dmsStatus)
    {
        $this->dms_status = $dmsStatus;

        return $this;
    }

    /**
     * Get dms_status
     *
     * @return string
     */
    public function getDmsStatus()
    {
        return $this->dms_status;
    }

    /**
     * @var string
     * @Expose
     */
    private $gst;

    /**
     * Set gst
     *
     * @param string $gst
     *
     * @return Catalogrecords
     */
    public function setGst($gst)
    {
        $this->gst = $gst;

        return $this;
    }

    /**
     * Get gst
     *
     * @return string
     */
    public function getGst()
    {
        return $this->gst;
    }

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $HomeTab;

    /**
     * Add homeTab
     *
     * @param \Numa\DOAAdminBundle\Entity\HomeTab $homeTab
     *
     * @return Catalogrecords
     */
    public function addHomeTab(\Numa\DOAAdminBundle\Entity\HomeTab $homeTab)
    {
        $this->HomeTab[] = $homeTab;

        return $this;
    }

    /**
     * Remove homeTab
     *
     * @param \Numa\DOAAdminBundle\Entity\HomeTab $homeTab
     *
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
     */
    public function removeHomeTab(\Numa\DOAAdminBundle\Entity\HomeTab $homeTab)
    {
        return $this->HomeTab->removeElement($homeTab);
    }

    /**
     * Get homeTab
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getHomeTab()
    {
        return $this->HomeTab;
    }

    public function __sleep()
    {

        // these are field names to be serialized, others will be excluded
        // but note that you have to fill other field values by your own
        return array('id',
            'category_id',
            'name',
            'description',
            'url',
            'address',
            'phone',
            'location',
            'email',
            'fax',
            'full',
            'logo',
            'logo_url',
            'password',
            'contact',
            'dealer_id',
            'address2',
            'city',
            'zip',
            'state',
            'username',
            'Admindealer',
            'dms_status',
            'gst',
        );
    }

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $site_url;

    /**
     * @var string
     * @expose
     * @Groups({"site"})
     */
    private $site_theme;

    /**
     * Set siteUrl
     *
     * @param string $siteUrl
     * @return Catalogrecords
     */
    public function setSiteUrl($siteUrl)
    {
        $this->site_url = $siteUrl;

        return $this;
    }

    /**
     * Get siteUrl
     *
     * @return string
     */
    public function getSiteUrl()
    {
        return $this->site_url;
    }

    /**
     * Get siteUrl
     *
     * @return string
     */
    public function getAbsoluteSiteUrl()
    {
        $res = $this->site_url;
        if(strpos($this->site_url,"http://")===false){
            $res= "http://".$res;
        }

        return $res;
    }

    /**
     * Set siteTheme
     *
     * @param string $siteTheme
     *
     * @return Catalogrecords
     */
    public function setSiteTheme($siteTheme)
    {
        $this->site_theme = $siteTheme;

        return $this;
    }

    /**
     * Get siteTheme
     *
     * @return string
     */
    public function getSiteTheme()
    {
        return $this->site_theme;
    }

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $country;

    /**
     * Set country
     *
     * @param string $country
     *
     * @return Catalogrecords
     */
    public function setCountry($country)
    {
        $this->country = $country;

        return $this;
    }

    /**
     * Get country
     *
     * @return string
     */
    public function getCountry()
    {
        return $this->country;
    }

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $site_facebook;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $site_youtube;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $site_google;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $site_twiter;

    /**
     * @var string
     * @Expose
     * @Groups({"site"})
     */
    private $site_instagram;

    /**
     * Set siteFacebook
     *
     * @param string $siteFacebook
     *
     * @return Catalogrecords
     */
    public function setSiteFacebook($siteFacebook)
    {
        $this->site_facebook = $siteFacebook;

        return $this;
    }

    /**
     * Get siteFacebook
     *
     * @return string
     */
    public function getSiteFacebook()
    {
        return $this->site_facebook;
    }

    /**
     * Set siteYoutube
     *
     * @param string $siteYoutube
     *
     * @return Catalogrecords
     */
    public function setSiteYoutube($siteYoutube)
    {
        $this->site_youtube = $siteYoutube;

        return $this;
    }

    /**
     * Get siteYoutube
     *
     * @return string
     */
    public function getSiteYoutube()
    {
        return $this->site_youtube;
    }

    /**
     * Set siteGoogle
     *
     * @param string $siteGoogle
     *
     * @return Catalogrecords
     */
    public function setSiteGoogle($siteGoogle)
    {
        $this->site_google = $siteGoogle;

        return $this;
    }

    /**
     * Get siteGoogle
     *
     * @return string
     */
    public function getSiteGoogle()
    {
        return $this->site_google;
    }

    /**
     * Set siteTwiter
     *
     * @param string $siteTwiter
     *
     * @return Catalogrecords
     */
    public function setSiteTwiter($siteTwiter)
    {
        $this->site_twiter = $siteTwiter;

        return $this;
    }

    /**
     * Get siteTwiter
     *
     * @return string
     */
    public function getSiteTwiter()
    {
        return $this->site_twiter;
    }

    /**
     * Set siteInstagram
     *
     * @param string $siteInstagram
     *
     * @return Catalogrecords
     */
    public function setSiteInstagram($siteInstagram)
    {
        $this->site_instagram = $siteInstagram;

        return $this;
    }

    /**
     * Get siteInstagram
     *
     * @return string
     */
    public function getSiteInstagram()
    {
        return $this->site_instagram;
    }

    /**
     * @var string
     * @Groups({"site"})
     */
    private $site_twitter;

    /**
     * Set siteTwitter
     *
     * @param string $siteTwitter
     *
     * @return Catalogrecords
     */
    public function setSiteTwitter($siteTwitter)
    {
        $this->site_twitter = $siteTwitter;

        return $this;
    }

    /**
     * Get siteTwitter
     *
     * @return string
     */
    public function getSiteTwitter()
    {
        return $this->site_twitter;
    }

    /**
     * @var \Doctrine\Common\Collections\Collection
     * @Expose
     */
    private $Component;

    /**
     * Add component
     *
     * @param \Numa\DOADMSBundle\Entity\DealerComponent $component
     *
     * @return Catalogrecords
     */
    public function addComponent(\Numa\DOADMSBundle\Entity\DealerComponent $component)
    {
        $this->Component[] = $component;

        return $this;
    }

    /**
     * Remove component
     *
     * @param \Numa\DOADMSBundle\Entity\DealerComponent $component
     */
    public function removeComponent(\Numa\DOADMSBundle\Entity\DealerComponent $component)
    {
        $this->Component->removeElement($component);
    }

    /**
     * Get component
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getComponent()
    {
        return $this->Component;
    }

    /**
     * @var string
     * @Groups({"site"})
     */
    private $terms_upload;

    /**
     * @var string
     * @Groups({"site"})
     */
    private $terms_text;

    /**
     * Set termsUpload
     *
     * @param string $termsUpload
     *
     * @return Catalogrecords
     */
    public function setTermsUpload($termsUpload)
    {
        $this->terms_upload = $termsUpload;

        return $this;
    }

    /**
     * Get termsUpload
     *
     * @return string
     */
    public function getTermsUpload()
    {
        return $this->terms_upload;
    }

    /**
     * Set termsText
     *
     * @param string $termsText
     *
     * @return Catalogrecords
     */
    public function setTermsText($termsText)
    {
        $this->terms_text = $termsText;

        return $this;
    }

    /**
     * Get termsText
     *
     * @return string
     */
    public function getTermsText()
    {
        return $this->terms_text;
    }

    /**
     * @var string
     * @Groups({"site"})
     */
    private $finance_email;

    /**
     * Set financeEmail
     *
     * @param string $financeEmail
     *
     * @return Catalogrecords
     */
    public function setFinanceEmail($financeEmail)
    {
        $this->finance_email = $financeEmail;

        return $this;
    }

    /**
     * Get financeEmail
     * @Groups({"site"})
     * @return string
     */
    public function getFinanceEmail()
    {
        return $this->finance_email;
    }

    public function isCarDealer()
    {
        return $this->dealerType(1);
    }

    public function isMotoDealer()
    {
        return $this->dealerType(5);
    }

    public function isRVsDealer()
    {
        return $this->dealerType(7);
    }

    public function isAgDealer()
    {
        return $this->dealerType(3);
    }

    public function dealerType($cid)
    {

        foreach ($this->getDcategory() as $category) {
            if ($category->getId() == $cid) {
                return true;
            }
        }
        return false;
    }

    /**
     * @var string
     * @Groups({"site"})
     */
    private $default_listing_comment;

    /**
     * Set defaultListingComment
     *
     * @param string $defaultListingComment
     *
     * @return Catalogrecords
     */
    public function setDefaultListingComment($defaultListingComment)
    {
        $this->default_listing_comment = $defaultListingComment;

        return $this;
    }

    /**
     * Get defaultListingComment
     *
     * @return string
     */
    public function getDefaultListingComment()
    {
        return $this->default_listing_comment;
    }

    /**
     * @var integer
     * @Expose
     */
    private $dealer_group_id;

    /**
     * @var \Numa\DOAAdminBundle\Entity\DealerGroup
     */
    private $DealerGroup;

    /**
     * Set dealerGroupId
     *
     * @param integer $dealerGroupId
     *
     * @return Catalogrecords
     */
    public function setDealerGroupId($dealerGroupId)
    {
        $this->dealer_group_id = $dealerGroupId;

        return $this;
    }

    /**
     * Get dealerGroupId
     *
     * @return integer
     */
    public function getDealerGroupId()
    {
        return $this->dealer_group_id;
    }

    /**
     * Set dealerGroup
     *
     * @param \Numa\DOAAdminBundle\Entity\DealerGroup $dealerGroup
     *
     * @return Catalogrecords
     */
    public function setDealerGroup(\Numa\DOADMSBundle\Entity\DealerGroup $dealerGroup = null)
    {
        $this->DealerGroup = $dealerGroup;

        return $this;
    }

    /**
     * Get dealerGroup
     *
     * @return \Numa\DOAAdminBundle\Entity\DealerGroup
     */
    public function getDealerGroup()
    {
        return $this->DealerGroup;
    }
    /**
     * @var string
     * @Groups({"site"})
     */
    private $feul_economy;

    /**
     * Set feulEconomy
     *
     * @param string $feulEconomy
     *
     * @return Catalogrecords
     */
    public function setFeulEconomy($feulEconomy)
    {
        $this->feul_economy = $feulEconomy;

        return $this;
    }

    /**
     * Get feulEconomy
     *
     * @return string
     */
    public function getFeulEconomy()
    {
        return $this->feul_economy;
    }
    /**
     * @var string
     * @Groups({"site"})
     */
    private $fuel_economy;

    /**
     * Set fuelEconomy
     *
     * @param string $fuelEconomy
     *
     * @return Catalogrecords
     */
    public function setFuelEconomy($fuelEconomy)
    {
        $this->fuel_economy = $fuelEconomy;

        return $this;
    }

    /**
     * Get fuelEconomy
     *
     * @return string
     */
    public function getFuelEconomy()
    {
        return $this->fuel_economy;
    }
    /**
     * @var string
     */
    private $feed_kijiji_url;

    /**
     * @var string
     */
    private $feed_kijiji_username;

    /**
     * @var string
     */
    private $feed_kijiji_password;

    /**
     * Set feedKijijiUrl
     *
     * @param string $feedKijijiUrl
     *
     * @return Catalogrecords
     */
    public function setFeedKijijiUrl($feedKijijiUrl)
    {
        $this->feed_kijiji_url = $feedKijijiUrl;

        return $this;
    }

    /**
     * Get feedKijijiUrl
     *
     * @return string
     */
    public function getFeedKijijiUrl()
    {
        return $this->feed_kijiji_url;
    }

    /**
     * Set feedKijijiUsername
     *
     * @param string $feedKijijiUsername
     *
     * @return Catalogrecords
     */
    public function setFeedKijijiUsername($feedKijijiUsername)
    {
        $this->feed_kijiji_username = $feedKijijiUsername;

        return $this;
    }

    /**
     * Get feedKijijiUsername
     *
     * @return string
     */
    public function getFeedKijijiUsername()
    {
        return $this->feed_kijiji_username;
    }

    /**
     * Set feedKijijiPassword
     *
     * @param string $feedKijijiPassword
     *
     * @return Catalogrecords
     */
    public function setFeedKijijiPassword($feedKijijiPassword)
    {
        $this->feed_kijiji_password = $feedKijijiPassword;

        return $this;
    }

    /**
     * Get feedKijijiPassword
     *
     * @return string
     */
    public function getFeedKijijiPassword()
    {
        return $this->feed_kijiji_password;
    }
    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $DealerSetting;

    /**
     * Add dealerSetting
     *
     * @param \Numa\DOADMSBundle\Entity\DealerSetting $dealerSetting
     *
     * @return Catalogrecords
     */
    public function addDealerSetting(\Numa\DOADMSBundle\Entity\DealerSetting $dealerSetting)
    {
        $this->DealerSetting[] = $dealerSetting;

        return $this;
    }

    /**
     * Remove dealerSetting
     *
     * @param \Numa\DOADMSBundle\Entity\DealerSetting $dealerSetting
     */
    public function removeDealerSetting(\Numa\DOADMSBundle\Entity\DealerSetting $dealerSetting)
    {
        $this->DealerSetting->removeElement($dealerSetting);
    }

    /**
     * Get dealerSetting
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getDealerSetting()
    {
        return $this->DealerSetting;
    }
    /**
     * @var string
     */
    private $setting_purechat;

    /**
     * Set settingPurechat
     *
     * @param string $settingPurechat
     *
     * @return Catalogrecords
     */
    public function setSettingPurechat($settingPurechat)
    {
        $this->setting_purechat = $settingPurechat;

        return $this;
    }

    /**
     * Get settingPurechat
     *
     * @return string
     */
    public function getSettingPurechat()
    {
        return $this->setting_purechat;
    }
    /**
     * @var string
     */
    private $setting_ga;

    /**
     * Set settingGa
     *
     * @param string $settingGa
     *
     * @return Catalogrecords
     */
    public function setSettingGa($settingGa)
    {
        $this->setting_ga = $settingGa;

        return $this;
    }

    /**
     * Get settingGa
     *
     * @return string
     */
    public function getSettingGa()
    {
        return $this->setting_ga;
    }
    /**
     * @var string
     */
    private $qb_realm_id;

    /**
     * @var string
     */
    private $qb_identifier;

    /**
     * @var string
     */
    private $qb_token_credential;

    /**
     * Set qbRealmId
     *
     * @param string $qbRealmId
     *
     * @return Catalogrecords
     */
    public function setQbRealmId($qbRealmId)
    {
        $this->qb_realm_id = $qbRealmId;

        return $this;
    }

    /**
     * Get qbRealmId
     *
     * @return string
     */
    public function getQbRealmId()
    {
        return $this->qb_realm_id;
    }

    /**
     * Set qbIdentifier
     *
     * @param string $qbIdentifier
     *
     * @return Catalogrecords
     */
    public function setQbIdentifier($qbIdentifier)
    {
        $this->qb_identifier = $qbIdentifier;

        return $this;
    }

    /**
     * Get qbIdentifier
     *
     * @return string
     */
    public function getQbIdentifier()
    {
        return $this->qb_identifier;
    }

    /**
     * Set qbTokenCredential
     *
     * @param string $qbTokenCredential
     *
     * @return Catalogrecords
     */
    public function setQbTokenCredential($qbTokenCredential)
    {
        $this->qb_token_credential = $qbTokenCredential;

        return $this;
    }

    /**
     * Get qbTokenCredential
     *
     * @return string
     */
    public function getQbTokenCredential()
    {
        return $this->qb_token_credential;
    }
    /**
     * @var string
     */
    private $qb_server;

    /**
     * Set qbServer
     *
     * @param string $qbServer
     *
     * @return Catalogrecords
     */
    public function setQbServer($qbServer)
    {
        $this->qb_server = $qbServer;

        return $this;
    }

    /**
     * Get qbServer
     *
     * @return string
     */
    public function getQbServer()
    {
        return $this->qb_server;
    }
    /**
     * @var string
     */
    private $qb_temp_token;

    /**
     * Set qbTempToken
     *
     * @param string $qbTempToken
     *
     * @return Catalogrecords
     */
    public function setQbTempToken($qbTempToken)
    {
        $this->qb_temp_token = $qbTempToken;

        return $this;
    }

    /**
     * Get qbTempToken
     *
     * @return string
     */
    public function getQbTempToken()
    {
        return $this->qb_temp_token;
    }
    /**
     * @var string
     */
    private $setting_ga_view;

    /**
     * Set settingGaView
     *
     * @param string $settingGaView
     *
     * @return Catalogrecords
     */
    public function setSettingGaView($settingGaView)
    {
        $this->setting_ga_view = $settingGaView;

        return $this;
    }

    /**
     * Get settingGaView
     *
     * @return string
     */
    public function getSettingGaView()
    {
        return $this->setting_ga_view;
    }
    /**
     * @var string
     * @Groups({"site"})
     */
    private $site_googlemap;

    /**
     * Set siteGooglemap
     *
     * @param string $siteGooglemap
     *
     * @return Catalogrecords
     */
    public function setSiteGooglemap($siteGooglemap)
    {
        $this->site_googlemap = $siteGooglemap;

        return $this;
    }

    /**
     * Get siteGooglemap
     *
     * @return string
     */
    public function getSiteGooglemap()
    {
        return $this->site_googlemap;
    }
    /**
     * @var boolean
     */
    private $feed_kijiji_manual;

    /**
     * Set feedKijijiManual
     *
     * @param boolean $feedKijijiManual
     *
     * @return Catalogrecords
     */
    public function setFeedKijijiManual($feedKijijiManual)
    {
        $this->feed_kijiji_manual = $feedKijijiManual;

        return $this;
    }

    /**
     * Get feedKijijiManual
     *
     * @return boolean
     */
    public function getFeedKijijiManual()
    {
        return $this->feed_kijiji_manual;
    }
    /**
     * @var string
     * @Groups({"site"})
     */
    private $site_google_tag;

    /**
     * Set siteGoogleTag
     *
     * @param string $siteGoogleTag
     *
     * @return Catalogrecords
     */
    public function setSiteGoogleTag($siteGoogleTag)
    {
        $this->site_google_tag = $siteGoogleTag;

        return $this;
    }

    /**
     * Get siteGoogleTag
     *
     * @return string
     */
    public function getSiteGoogleTag()
    {
        return $this->site_google_tag;
    }
    /**
     * @var string
     */
    private $dealer_number;

    /**
     * Set dealerNumber
     *
     * @param string $dealerNumber
     *
     * @return Catalogrecords
     */
    public function setDealerNumber($dealerNumber)
    {
        $this->dealer_number = $dealerNumber;

        return $this;
    }

    /**
     * Get dealerNumber
     *
     * @return string
     */
    public function getDealerNumber()
    {
        return $this->dealer_number;
    }
    /**
     * @var string
     * @Groups({"site"})
     */
    private $site_facebook_pixel_id;

    /**
     * Set siteFacebookPixelId
     *
     * @param string $siteFacebookPixelId
     *
     * @return Catalogrecords
     */
    public function setSiteFacebookPixelId($siteFacebookPixelId)
    {
        $this->site_facebook_pixel_id = $siteFacebookPixelId;

        return $this;
    }

    /**
     * Get siteFacebookPixelId
     *
     * @return string
     */
    public function getSiteFacebookPixelId()
    {
        return $this->site_facebook_pixel_id;
    }
    /**
     * @var string
     * @Groups({"site"})
     */
    private $legal_trade_name;

    /**
     * Set legalTradeName
     *
     * @param string $legalTradeName
     *
     * @return Catalogrecords
     */
    public function setLegalTradeName($legalTradeName)
    {
        $this->legal_trade_name = $legalTradeName;

        return $this;
    }

    /**
     * Get legalTradeName
     *
     * @return string
     */
    public function getLegalTradeName()
    {
        return $this->legal_trade_name;
    }
    /**
     * @var string
     * @Groups({"site"})
     */
    private $biweekly_url;

    /**
     * Set biweeklyUrl
     *
     * @param string $biweeklyUrl
     *
     * @return Catalogrecords
     */
    public function setBiweeklyUrl($biweeklyUrl)
    {
        $this->biweekly_url = $biweeklyUrl;

        return $this;
    }

    /**
     * Get biweeklyUrl
     *
     * @return string
     */
    public function getBiweeklyUrl()
    {
        return $this->biweekly_url;
    }
}

redpajama_set_name: RedPajamaGithub


text:
import logging

from flask import current_app

from crawler import jenkins
from crawler import launchpad
from crawler import util
from jenkins_reporting import db

log = logging.getLogger(__name__)

def scan_failed_builds(jenkins_url, job_name):
    failed = jenkins.get_builds(jenkins_url,
                                job_name,
                                stopline=util.days_ago_timestamp(7))

    for build in failed:
        build['bugs'] = map(launchpad.get_bug, build['bugs'])

    return failed

def crawl_job(jenkins_url, job_name):
    res = scan_failed_builds(jenkins_url, job_name)
    db.insert_staging_builds(job_name, res)

def crawl_ci(ci):
    jenkins_url = ci["JENKINS"]
    staging_jobs = ci["STAGING_JOBS"]

    for job in staging_jobs:
        log.info("Starting to crawl job #{0}".format(job))
        crawl_job(jenkins_url, job)
        log.info("Done crawling job #{0}".format(job))

def crawl():
    crawl_ci(current_app.config["MASTER_CI"])
    crawl_ci(current_app.config["STABLE_CI"])