Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3daff3bfd0a1b76a052681bdab29813947d6eb76 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 * yyyymmdd bug      Email and other contact information
 * 20060404 134913  sengpl@ca.ibm.com - Seng Phung-Lu 
 * -------- -------- -----------------------------------------------------------
 */
package org.eclipse.jst.ws.internal.consumption.ui.common;

import java.util.List;
import java.util.Vector;

import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem;


public class HandlerServiceRefHelper {

  /**
   * Helper method for getting the HandlerServiceRefHolder given the name
   * @param hsrh
   * @param descName
   * @return
   */
  public static HandlerServiceRefHolder getForServiceRefName(HandlerServiceRefHolder[] hsrh, String descName){
    for (int i=0;i<hsrh.length;i++){
      String name = hsrh[i].getServiceRefName();
      if (name!=null && name.equals(descName)){
        return hsrh[i];
      }
    }
    return  null;
  }
  
  /**
   * Gets all the handler Class names associated with each service ref
   * @param hsrh
   * @return
   */
  public static String[] getAllHandlerClassNames(HandlerServiceRefHolder[] hsrh){
    Vector v = new Vector();
    for (int i=0;i<hsrh.length;i++){
      List list = hsrh[i].getHandlerList();
      if (list!=null && !list.isEmpty()){
        for (int j=0;j<list.size();j++){
          HandlerTableItem hti = (HandlerTableItem)list.get(j);
          v.add(hti.getHandlerClassName());
        }
      }
    }
    return (String[])v.toArray(new String[0]);
  }
  
  /**
   * Get all the service Ref names
   * @param hsrh
   * @return
   */
  public static String[] getAllServiceRefNames(HandlerServiceRefHolder[] hsrh){
    String[] names = new String[hsrh.length];
    for(int i=0;i<hsrh.length;i++){
      names[i]=hsrh[i].getServiceRefName();
    }
    return names;
  }
  
}

Back to the top