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