removed IReferenceBase from IArticle and standardized cast methods in reference base
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / reference / ReferenceBase.java
index 4cef32baa49ad6e95f33e0f3a4122f8a812fe666..8e8c5ea650f2cf210b07919ef79f36a2600a442f 100644 (file)
@@ -901,103 +901,83 @@ public class ReferenceBase<S extends IReferenceBaseCacheStrategy> extends Identi
        /* Casting methods */\r
        \r
        public IArticle castReferenceToArticle(){\r
-               ((IArticle) this).setCacheStrategy(ArticleDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Article;\r
-               \r
+               setType(ReferenceType.Article);\r
                return (IArticle) this;\r
        }\r
        \r
        public IBook castReferenceToBook(){\r
-               ((IBook) this).setCacheStrategy(BookDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Book;\r
+               setType(ReferenceType.Book);\r
                return (IBook) this;\r
        }\r
        \r
        public IBookSection castReferenceToBookSection(){\r
-               ((IBookSection) this).setCacheStrategy(BookSectionDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.BookSection;\r
-               \r
+               setType(ReferenceType.BookSection);\r
                return (IBookSection) this;\r
        }\r
        \r
        public ICdDvd castReferenceToCdDvd(){\r
-               ((ICdDvd) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.CdDvd;\r
+               setType(ReferenceType.CdDvd);\r
                return (ICdDvd) this;\r
        }\r
        \r
        public IDatabase castReferenceToDatabase(){\r
-               ((IDatabase) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Database;\r
+               setType(ReferenceType.Database);\r
                return (IDatabase) this;\r
        }\r
        \r
        public IGeneric castReferenceToGeneric(){\r
-               ((IGeneric) this).setCacheStrategy(GenericDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Generic;\r
+               setType(ReferenceType.Generic);\r
                return (IGeneric) this;\r
        }\r
        \r
        public IInProceedings castReferenceToInProceedings(){\r
-               ((IInProceedings) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.InProceedings;\r
+               setType(ReferenceType.InProceedings);\r
                return (IInProceedings) this;\r
        }\r
        \r
        public IJournal castReferenceToJournal(){\r
-               ((IJournal) this).setCacheStrategy(JournalDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Journal;\r
-               IJournal test = this;\r
-               return (IJournal) test;\r
+               setType(ReferenceType.Journal);\r
+               return (IJournal) this;\r
        }\r
        \r
-       public IMap castReferenceToMap(ReferenceBase ref){\r
-               ((IMap) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Map;\r
-               return (IMap) ref;\r
+       public IMap castReferenceToMap(){\r
+               setType(ReferenceType.Map);\r
+               return (IMap) this;\r
        }\r
        \r
-       public IPatent castReferenceToPatent(ReferenceBase ref){\r
-               ((IPatent) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Patent;\r
-               return (IPatent) ref;\r
+       public IPatent castReferenceToPatent(){\r
+               setType(ReferenceType.Patent);\r
+               return (IPatent) this;\r
        }\r
        \r
-       public IPersonalCommunication castReferenceToPersonalCommunication(ReferenceBase ref){\r
-               ((IPersonalCommunication) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.PersonalCommunication;\r
-               return (IPersonalCommunication) ref;\r
+       public IPersonalCommunication castReferenceToPersonalCommunication(){\r
+               setType(ReferenceType.PersonalCommunication);\r
+               return (IPersonalCommunication) this;\r
        }\r
        \r
-       public IPrintSeries castReferenceToPrintSeries(ReferenceBase ref){\r
-               ((IPrintSeries) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.PrintSeries;\r
-               return (IPrintSeries) ref;\r
+       public IPrintSeries castReferenceToPrintSeries(){\r
+               setType(ReferenceType.PrintSeries);\r
+               return (IPrintSeries) this;\r
        }\r
        \r
-       public IWebPage castReferenceToWebPage(ReferenceBase ref){\r
-               ((IWebPage) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.WebPage;\r
-               return (IWebPage) ref;\r
+       public IWebPage castReferenceToWebPage(){\r
+               setType(ReferenceType.WebPage);\r
+               return (IWebPage) this;\r
        }\r
        \r
-       public IProceedings castReferenceToProceedings(ReferenceBase ref){\r
-               ((IProceedings) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Proceedings;\r
-               return (IProceedings) ref;\r
+       public IProceedings castReferenceToProceedings(){\r
+               setType(ReferenceType.Proceedings);\r
+               return (IProceedings) this;\r
        }\r
        \r
-       public IReport castReferenceToReport(ReferenceBase ref){\r
-               ((IReport) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Report;\r
-               \r
-               return (IReport) ref;\r
+       public IReport castReferenceToReport(){\r
+               setType(ReferenceType.Report);\r
+               return (IReport) this;\r
        }\r
 \r
-       public IThesis castReferenceToThesis(ReferenceBase ref){\r
-               ((IThesis) this).setCacheStrategy(ReferenceBaseDefaultCacheStrategy.NewInstance());\r
-               this.type = ReferenceType.Thesis;\r
-               return (IThesis) ref;\r
+       public IThesis castReferenceToThesis(){\r
+               setType(ReferenceType.Thesis);\r
+               return (IThesis) this;\r
        }\r
 \r
        \r