001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.rest.labels;
014
015import java.util.*;
016
017import org.apache.juneau.rest.*;
018
019/**
020 * @deprecated Use {@link org.apache.juneau.rest.helper.ChildResourceDescriptions}
021 */
022@Deprecated
023public class ChildResourceDescriptions extends LinkedList<ResourceDescription> {
024
025   private static final long serialVersionUID = 1L;
026
027   /**
028    * Constructor.
029    *
030    * @param context The servlet context that this bean describes.
031    * @param req The HTTP servlet request.
032    * @throws Exception
033    */
034   public ChildResourceDescriptions(RestContext context, RestRequest req) throws Exception {
035      this(context, req, false);
036   }
037
038   /**
039    * Constructor.
040    *
041    * @param context The servlet context that this bean describes.
042    * @param req The HTTP servlet request.
043    * @param sort
044    *    If <jk>true</jk>, list will be ordered by name alphabetically.
045    *    Default is to maintain the order as specified in the annotation.
046    * @throws Exception
047    */
048   public ChildResourceDescriptions(RestContext context, RestRequest req, boolean sort) throws Exception {
049      for (Map.Entry<String,RestContext> e : context.getChildResources().entrySet())
050         add(new ResourceDescription(e.getKey(), e.getValue().getInfoProvider().getTitle(req)));
051      if (sort)
052         Collections.sort(this);
053   }
054
055   /**
056    * Bean constructor.
057    */
058   public ChildResourceDescriptions() {
059      super();
060   }
061}