Subversion Repositories SmartDukaan

Rev

Rev 45 | Rev 211 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * 
 */
package in.shop2020.metamodel.core;

import java.util.ArrayList;
import java.util.List;

import in.shop2020.metamodel.util.MetaModelComponent;

/**
 * Represents un-structured data about Slide, Feature and Bullet. It is used
 * judiciously by content developers to store multi-media content in support
 * component they are attached to.
 * 
 * @author naveen
 *
 */
public class FreeformContent extends MetaModelComponent {
        
        /**
         * 
         */
        private static final long serialVersionUID = 1L;
        
        // Un-structured text only
        private List<String> freeformTexts;

        private List<String> imageURLs;

        private List<String> youtubeURLs;

    /**
     * 
     */
    public FreeformContent() {
    }

    /**
     * 
     * @param freeformText
     */
    public FreeformContent(String freeformText) {
        this.addFreeformText(freeformText);
    }

        /**
         * @param freeformTexts the freeformTexts to set
         */
        public void setFreeformTexts(List<String> freeformTexts) {
                this.freeformTexts = freeformTexts;
        }
        
        /**
         * 
         * @param fft
         */
        public void addFreeformText(String fft) {
                if(this.freeformTexts == null) {
                        this.freeformTexts = new ArrayList<String>();
                }
                
                this.freeformTexts.add(fft);
        }
        
        /**
         * @return the freeformTexts
         */
        public List<String> getFreeformTexts() {
                return freeformTexts;
        }

        
        /**
         * Return first free-form text
         * 
         * @return the freeformTexts
         */
        public String getFreeformText() {
                if(this.freeformTexts != null && this.freeformTexts.size() > 0) {
                        return this.freeformTexts.get(0);
                }
                
                return null;
        }
        
        /**
         * @param imageURLs the imageURLs to set
         */
        public void setImageURLs(List<String> imageURLs) {
                this.imageURLs = imageURLs;
        }

        /**
         * Convenience method to add new image URL
         * 
         * @param imgURL
         */
        public void addImageURL(String imgURL) {
                if(this.imageURLs == null) {
                        this.imageURLs = new ArrayList<String>();
                }
                
                this.imageURLs.add(imgURL);
        }
        
        /**
         * @return the imageURLs
         */
        public List<String> getImageURLs() {
                return imageURLs;
        }

        /**
         * @param youtubeURLs the youtubeURLs to set
         */
        public void setYoutubeURLs(List<String> youtubeURLs) {
                this.youtubeURLs = youtubeURLs;
        }

        public void addYoutubeURL(String ytURL) {
                if(this.youtubeURLs == null) {
                        this.youtubeURLs = new ArrayList<String>();
                }
                
                this.youtubeURLs.add(ytURL);
        }
        
        /**
         * @return the youtubeURLs
         */
        public List<String> getYoutubeURLs() {
                return youtubeURLs;
        }

        /* (non-Javadoc)
         * @see java.lang.Object#toString()
         */
        @Override
        public String toString() {
                return "FreeformContent [freeformTexts=" + freeformTexts
                                + ", imageURLs=" + imageURLs + ", youtubeURLs=" + youtubeURLs
                                + "]";
        }

}