1 /* =============================================================================== 2 * 3 * Part of the InfoGlue Content Management Platform (www.infoglue.org) 4 * 5 * =============================================================================== 6 * 7 * Copyright (C) 8 * 9 * This program is free software; you can redistribute it and/or modify it under 10 * the terms of the GNU General Public License version 2, as published by the 11 * Free Software Foundation. See the file LICENSE.html for more information. 12 * 13 * This program is distributed in the hope that it will be useful, but WITHOUT 14 * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License along with 18 * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple 19 * Place, Suite 330 / Boston, MA 02111-1307 / USA. 20 * 21 * =============================================================================== 22 */ 23 package org.infoglue.deliver.portal.om; 24 25 import java.util.ArrayList; 26 import java.util.Iterator; 27 28 import org.apache.commons.logging.Log; 29 import org.apache.commons.logging.LogFactory; 30 import org.apache.pluto.om.common.ObjectID; 31 import org.apache.pluto.om.entity.PortletApplicationEntity; 32 33 /** 34 * @author jand 35 * 36 */ 37 public class PortletApplicationEntityListImpl implements 38 org.apache.pluto.om.entity.PortletApplicationEntityList { 39 private static final Log LOG = LogFactory.getLog(PortletApplicationEntityListImpl.class); 40 41 private ArrayList applications; 42 43 public PortletApplicationEntityListImpl() { 44 this.applications = new ArrayList(); 45 } 46 47 public PortletApplicationEntityListImpl(ArrayList applications) { 48 this.applications = applications; 49 } 50 51 /* 52 * (non-Javadoc) 53 * 54 * @see org.apache.pluto.om.entity.PortletApplicationEntityList#iterator() 55 */ 56 public Iterator iterator() { 57 return applications.iterator(); 58 } 59 60 /* 61 * (non-Javadoc) 62 * 63 * @see org.apache.pluto.om.entity.PortletApplicationEntityList#get(org.apache.pluto.om.common.ObjectID) 64 */ 65 public PortletApplicationEntity get(ObjectID id) { 66 for (Iterator it = applications.iterator(); it.hasNext();) { 67 PortletApplicationEntity pae = (PortletApplicationEntity) it.next(); 68 if (pae.getId().equals(id)) { 69 return pae; 70 } 71 } 72 return null; 73 } 74 75 public void add(PortletApplicationEntity e) { 76 PortletApplicationEntity old = get(e.getId()); 77 if (old != null) { 78 applications.remove(old); 79 } 80 applications.add(e); 81 } 82 83 public String toString() { 84 return "PortletApplicationEntityListImpl[ applications:" + applications + "]"; 85 } 86 }