Exemple #1
0
 public TagQueries(ITagRepository repository, IUserPermissionContext permissionContext,
                   IEntryLinkFactory entryLinkFactory, IEntryImagePersisterOld imagePersister)
     : base(repository, permissionContext)
 {
     this.entryLinkFactory = entryLinkFactory;
     this.imagePersister   = imagePersister;
 }
Exemple #2
0
 public SongListQueries(ISongListRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEntryImagePersisterOld imagePersister)
 {
     this.repository        = repository;
     this.permissionContext = permissionContext;
     this.entryLinkFactory  = entryLinkFactory;
     this.imagePersister    = imagePersister;
 }
Exemple #3
0
 public EntryQueries(IAlbumRepository repository, IUserPermissionContext permissionContext, IEntryThumbPersister entryThumbPersister,
                     IEntryImagePersisterOld entryImagePersisterOld)
     : base(repository, permissionContext)
 {
     this.entryThumbPersister    = entryThumbPersister;
     this.entryImagePersisterOld = entryImagePersisterOld;
 }
        public TagForApiContract(Tag tag,
                                 IEntryImagePersisterOld thumbPersister,
                                 ContentLanguagePreference languagePreference,
                                 TagOptionalFields optionalFields)
        {
            ParamIs.NotNull(() => tag);

            CategoryName        = tag.CategoryName;
            CreateDate          = tag.CreateDate;
            DefaultNameLanguage = tag.TranslatedName.DefaultLanguage;
            Id         = tag.Id;
            Name       = tag.TranslatedName[languagePreference];
            Status     = tag.Status;
            Targets    = (int)tag.Targets;
            UrlSlug    = tag.UrlSlug;
            UsageCount = tag.UsageCount;
            Version    = tag.Version;

            var includeAdditionalNames = optionalFields.HasFlag(TagOptionalFields.AdditionalNames);

            if (includeAdditionalNames)
            {
                AdditionalNames = tag.Names.GetAdditionalNamesStringForLanguage(languagePreference);
            }

            if (optionalFields.HasFlag(TagOptionalFields.Description))
            {
                Description = tag.Description[languagePreference];
            }

            if (optionalFields.HasFlag(TagOptionalFields.MainPicture) && tag.Thumb != null && thumbPersister != null)
            {
                MainPicture = new EntryThumbForApiContract(tag.Thumb, thumbPersister);
            }

            if (optionalFields.HasFlag(TagOptionalFields.Names))
            {
                Names = tag.Names.Select(n => new LocalizedStringWithIdContract(n)).ToArray();
            }

            if (optionalFields.HasFlag(TagOptionalFields.Parent) && tag.Parent != null)
            {
                Parent = new TagBaseContract(tag.Parent, languagePreference, includeAdditionalNames);
            }

            if (optionalFields.HasFlag(TagOptionalFields.RelatedTags))
            {
                RelatedTags = tag.RelatedTags.Select(t => new TagBaseContract(t.LinkedTag, languagePreference, includeAdditionalNames)).ToArray();
            }

            if (optionalFields.HasFlag(TagOptionalFields.TranslatedDescription))
            {
                TranslatedDescription = new EnglishTranslatedStringContract(tag.Description);
            }

            if (optionalFields.HasFlag(TagOptionalFields.WebLinks))
            {
                WebLinks = tag.WebLinks.Links.Select(w => new WebLinkForApiContract(w)).ToArray();
            }
        }
Exemple #5
0
 public SongListQueries(ISongListRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory,
                        IEntryImagePersisterOld imagePersister, IUserIconFactory userIconFactory)
     : base(repository, permissionContext)
 {
     this.entryLinkFactory = entryLinkFactory;
     this.imagePersister   = imagePersister;
     this.userIconFactory  = userIconFactory;
 }
Exemple #6
0
 public EntryForApiContract(Tag tag, IEntryImagePersisterOld thumbPersister, bool ssl,
                            EntryOptionalFields includedFields)
     : this(tag, ContentLanguagePreference.Default)
 {
     if (includedFields.HasFlag(EntryOptionalFields.MainPicture) && tag.Thumb != null)
     {
         MainPicture = new EntryThumbForApiContract(tag.Thumb, thumbPersister, ssl);
     }
 }
Exemple #7
0
 public TagController(TagQueries queries, IEntryLinkFactory entryLinkFactory, IEnumTranslations enumTranslations, MarkdownParser markdownParser,
                      IEntryImagePersisterOld entryThumbPersister)
 {
     this.queries             = queries;
     this.entryLinkFactory    = entryLinkFactory;
     this.enumTranslations    = enumTranslations;
     this.markdownParser      = markdownParser;
     this.entryThumbPersister = entryThumbPersister;
 }
Exemple #8
0
 public TagQueries(ITagRepository repository, IUserPermissionContext permissionContext,
                   IEntryLinkFactory entryLinkFactory, IEntryImagePersisterOld imagePersister, IUserIconFactory userIconFactory,
                   IEnumTranslations enumTranslations)
     : base(repository, permissionContext)
 {
     this.entryLinkFactory = entryLinkFactory;
     this.imagePersister   = imagePersister;
     this.userIconFactory  = userIconFactory;
     this.enumTranslations = enumTranslations;
 }
Exemple #9
0
 public ExtController(IEntryUrlParser entryUrlParser, IEntryImagePersisterOld entryThumbPersister,
                      AlbumService albumService, ArtistService artistService, SongQueries songService, TagQueries tagQueries)
 {
     this.entryUrlParser      = entryUrlParser;
     this.entryThumbPersister = entryThumbPersister;
     this.albumService        = albumService;
     this.artistService       = artistService;
     this.songService         = songService;
     this.tagQueries          = tagQueries;
 }
Exemple #10
0
 public TagQueries(ITagRepository repository, IUserPermissionContext permissionContext,
                   IEntryLinkFactory entryLinkFactory, IEntryImagePersisterOld imagePersister, IAggregatedEntryImageUrlFactory thumbStore, IUserIconFactory userIconFactory,
                   IEnumTranslations enumTranslations, ObjectCache cache)
     : base(repository, permissionContext)
 {
     this.entryLinkFactory = entryLinkFactory;
     this.imagePersister   = imagePersister;
     this.thumbStore       = thumbStore;
     this.userIconFactory  = userIconFactory;
     this.enumTranslations = enumTranslations;
     this.cache            = cache;
 }
        public EntryForApiContract(SongList songList, IEntryImagePersisterOld thumbPersister, bool ssl,
                                   EntryOptionalFields includedFields)
            : this(songList, ContentLanguagePreference.Default, includedFields)
        {
            ActivityDate             = songList.EventDate;
            CreateDate               = songList.CreateDate;
            SongListFeaturedCategory = songList.FeaturedCategory;

            if (includedFields.HasFlag(EntryOptionalFields.MainPicture) && songList.Thumb != null)
            {
                MainPicture = new EntryThumbForApiContract(songList.Thumb, thumbPersister, ssl, SongList.ImageSizes);
            }
        }
		public TagForApiContract(Tag tag, 
			IEntryImagePersisterOld thumbPersister,
			bool ssl,			
			TagOptionalFields optionalFields) {
			
			CategoryName = tag.CategoryName;
			Id = tag.Id;
			Name = tag.Name;

			if (optionalFields.HasFlag(TagOptionalFields.Description)) {
				Description = tag.Description;
			}

			if (optionalFields.HasFlag(TagOptionalFields.MainPicture) && tag.Thumb != null) {
				MainPicture = new EntryThumbForApiContract(tag.Thumb, thumbPersister, ssl);
			}

		}
Exemple #13
0
        public TagForApiContract(Tag tag,
                                 IEntryImagePersisterOld thumbPersister,
                                 bool ssl,
                                 TagOptionalFields optionalFields)
        {
            CategoryName = tag.CategoryName;
            Id           = tag.Id;
            Name         = tag.Name;

            if (optionalFields.HasFlag(TagOptionalFields.Description))
            {
                Description = tag.Description;
            }

            if (optionalFields.HasFlag(TagOptionalFields.MainPicture) && tag.Thumb != null)
            {
                MainPicture = new EntryThumbForApiContract(tag.Thumb, thumbPersister, ssl);
            }
        }
Exemple #14
0
        public TagForApiContract(Tag tag,
                                 IEntryImagePersisterOld thumbPersister,
                                 bool ssl,
                                 TagOptionalFields optionalFields)
        {
            AlisedToName = tag.AliasedTo != null ? tag.AliasedTo.Name : null;
            CategoryName = tag.CategoryName;
            Id           = tag.Id;
            Name         = tag.Name;
            ParentName   = tag.Parent != null ? tag.Parent.Name : null;
            Status       = tag.Status;

            if (optionalFields.HasFlag(TagOptionalFields.Description))
            {
                Description = tag.Description;
            }

            if (optionalFields.HasFlag(TagOptionalFields.MainPicture) && tag.Thumb != null)
            {
                MainPicture = new EntryThumbForApiContract(tag.Thumb, thumbPersister, ssl);
            }
        }
        public static EntryForApiContract Create(IEntryWithNames entry, ContentLanguagePreference languagePreference,
                                                 IEntryThumbPersister thumbPersister, IEntryImagePersisterOld imagePersisterOld, bool ssl,
                                                 EntryOptionalFields includedFields)
        {
            ParamIs.NotNull(() => entry);

            switch (entry.EntryType)
            {
            case EntryType.Album:
                return(new EntryForApiContract((Album)entry, languagePreference, thumbPersister, ssl, includedFields));

            case EntryType.Artist:
                return(new EntryForApiContract((Artist)entry, languagePreference, thumbPersister, ssl, includedFields));

            case EntryType.DiscussionTopic:
                return(new EntryForApiContract((DiscussionTopic)entry, languagePreference));

            case EntryType.ReleaseEvent:
                return(new EntryForApiContract((ReleaseEvent)entry, thumbPersister, ssl, includedFields));

            case EntryType.Song:
                return(new EntryForApiContract((Song)entry, languagePreference, includedFields));

            case EntryType.SongList:
                return(new EntryForApiContract((SongList)entry, imagePersisterOld, ssl, includedFields));

            case EntryType.Tag:
                return(new EntryForApiContract((Tag)entry, languagePreference, imagePersisterOld, ssl, includedFields));
            }

            return(new EntryForApiContract(entry, languagePreference, includedFields));
        }
Exemple #16
0
 public TagApiController(TagQueries queries, IEntryImagePersisterOld thumbPersister)
 {
     this.queries        = queries;
     this.thumbPersister = thumbPersister;
 }
Exemple #17
0
 public ServerEntryImageFactoryAggregator(IDynamicImageUrlFactory dynamicImageUrlFactory, IEntryThumbPersister thumbPersister, IEntryImagePersisterOld entryImagePersisterOld)
 {
     factories = new IEntryImageUrlFactory[] {
         thumbPersister,
         entryImagePersisterOld,
         dynamicImageUrlFactory
     };
 }
Exemple #18
0
        public static EntryForApiContract Create(IEntryWithNames entry, ContentLanguagePreference languagePreference,
                                                 IEntryThumbPersister thumbPersister, IEntryImagePersisterOld imagePersisterOld, bool ssl,
                                                 EntryOptionalFields includedFields)
        {
            ParamIs.NotNull(() => entry);

            if (entry is Album)
            {
                return(new EntryForApiContract((Album)entry, languagePreference, thumbPersister, ssl, includedFields));
            }
            else if (entry is Artist)
            {
                return(new EntryForApiContract((Artist)entry, languagePreference, thumbPersister, ssl, includedFields));
            }
            else if (entry is DiscussionTopic)
            {
                return(new EntryForApiContract((DiscussionTopic)entry, languagePreference));
            }
            else if (entry is Song)
            {
                return(new EntryForApiContract((Song)entry, languagePreference, includedFields));
            }
            else if (entry is Tag)
            {
                return(new EntryForApiContract((Tag)entry, imagePersisterOld, ssl, includedFields));
            }

            throw new ArgumentException("Unsupported entry type: " + entry, "entry");
        }
 public EntryForApiContractFactory(IEntryImagePersisterOld imagePersisterOld, IEntryThumbPersister thumbPersister)
 {
     this.imagePersisterOld = imagePersisterOld;
     this.thumbPersister    = thumbPersister;
 }
Exemple #20
0
        public EntryForApiContract(Tag tag, ContentLanguagePreference languagePreference, IEntryImagePersisterOld thumbPersister,
                                   EntryOptionalFields includedFields)
            : this(tag, languagePreference, includedFields)
        {
            CreateDate      = tag.CreateDate;
            Status          = tag.Status;
            TagCategoryName = tag.CategoryName;

            if (includedFields.HasFlag(EntryOptionalFields.MainPicture) && tag.Thumb != null)
            {
                MainPicture = new EntryThumbForApiContract(tag.Thumb, thumbPersister, Tag.ImageSizes);
            }

            if (includedFields.HasFlag(EntryOptionalFields.WebLinks))
            {
                WebLinks = tag.WebLinks.Links.Select(w => new ArchivedWebLinkContract(w)).ToArray();
            }

            UrlSlug = tag.UrlSlug;
        }
        public EntryForApiContract(Tag tag, ContentLanguagePreference languagePreference, IEntryImagePersisterOld thumbPersister, bool ssl,
                                   EntryOptionalFields includedFields)
            : this(tag, languagePreference, includedFields)
        {
            CreateDate      = tag.CreateDate;
            TagCategoryName = tag.CategoryName;

            if (includedFields.HasFlag(EntryOptionalFields.MainPicture) && tag.Thumb != null)
            {
                MainPicture = new EntryThumbForApiContract(tag.Thumb, thumbPersister, ssl, Tag.ImageSizes);
            }

            UrlSlug = tag.UrlSlug;
        }
 public TagApiController(TagQueries queries, IEntryImagePersisterOld thumbPersister)
 {
     this.queries = queries;
     this.thumbPersister = thumbPersister;
 }
		public EntryForApiContract(Tag tag, IEntryImagePersisterOld thumbPersister, bool ssl, 
			EntryOptionalFields includedFields)
			: this(tag, ContentLanguagePreference.Default) {

			if (includedFields.HasFlag(EntryOptionalFields.MainPicture) && tag.Thumb != null) {
				MainPicture = new EntryThumbForApiContract(tag.Thumb, thumbPersister, ssl);					
			}

		}
Exemple #24
0
 public SongListApiController(SongListQueries queries, IUserIconFactory userIconFactory, IEntryImagePersisterOld entryImagePersister)
 {
     this.queries             = queries;
     this.userIconFactory     = userIconFactory;
     this.entryImagePersister = entryImagePersister;
 }