001 package railo.runtime.tag; 002 003 import railo.runtime.op.Caster; 004 import railo.runtime.op.Duplicator; 005 import railo.runtime.type.Collection; 006 import railo.runtime.type.KeyImpl; 007 import railo.runtime.type.Struct; 008 import railo.runtime.type.util.StructUtil; 009 010 public class FeedProperties { 011 private static final Collection.Key ITEM = KeyImpl.intern("ITEM"); 012 private static final Collection.Key ITEMS = KeyImpl.intern("ITEMS"); 013 private static final Collection.Key ENTRY = KeyImpl.intern("ENTRY"); 014 private static final Collection.Key RDF = KeyImpl.intern("RDF"); 015 private static final Collection.Key RSS = KeyImpl.intern("RSS"); 016 private static final Collection.Key CHANNEL = KeyImpl.intern("channel"); 017 018 019 public static Struct toProperties(Struct data) { 020 data=(Struct) Duplicator.duplicate(data,true); 021 022 023 024 Struct rdf = Caster.toStruct(data.removeEL(RDF),null,false); 025 if(rdf==null)rdf = Caster.toStruct(data.removeEL(RSS),null,false); 026 if(rdf!=null){ 027 rdf.removeEL(ITEM); 028 Struct channel = Caster.toStruct(rdf.get(CHANNEL,null),null,false); 029 if(channel!=null){ 030 channel.removeEL(ITEMS); 031 StructUtil.copy(channel, data, true); 032 033 } 034 } 035 036 037 data.removeEL(ITEM); 038 data.removeEL(ENTRY); 039 040 return data; 041 } 042 }