Skip to main content
summaryrefslogtreecommitdiffstats
blob: a8babd558b1fe9978a6bed35f0fa38f8e1e1a508 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*******************************************************************************
 * Copyright (c) 2001, 2004 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
 *******************************************************************************/

package org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective;

import org.eclipse.wst.ws.internal.explorer.platform.perspective.*;
import org.eclipse.wst.ws.internal.explorer.platform.uddi.actions.*;
import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*;
import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*;

import java.util.*;

public class RegPublishTool extends FormTool implements MultipleFormToolPropertiesInterface
{
  ToolManager invisibleToolManager_;
  private RegFindTool regFindTool_;
  public RegPublishTool(ToolManager toolManager,String alt)
  {
    super(toolManager,"uddi/images/publish_enabled.gif","uddi/images/publish_highlighted.gif",alt);
    invisibleToolManager_ = new ToolManager(toolManager.getNode());
    regFindTool_ = new RegFindTool(invisibleToolManager_,"");
  }

  protected final void initDefaultProperties()
  {
    UDDIPerspective uddiPerspective = toolManager_.getNode().getNodeManager().getController().getUDDIPerspective();

    setProperty(UDDIActionInputs.SUBQUERY_KEY,"");

    setProperty(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_BUSINESSES));
    String simpleStyleString = String.valueOf(UDDIActionInputs.QUERY_STYLE_SIMPLE);
    setProperty(UDDIActionInputs.QUERY_STYLE_BUSINESSES,simpleStyleString);
    setProperty(UDDIActionInputs.QUERY_STYLE_SERVICES,simpleStyleString);
    setProperty(UDDIActionInputs.QUERY_STYLE_SERVICE_INTERFACES,simpleStyleString);

    // RegPublishBusinessSimpleAction inputs
    setProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_NAME,"");
    setProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_DESCRIPTION,"");

    // RegPublishServiceSimpleAction inputs
    setProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_WSDL_URL,"");
    setProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_NAME,"");
    setProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_DESCRIPTION,"");

    // RegPublishServiceAdvancedAction inputs
    setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL,"");

    // RegPublishServiceInterfaceSimpleAction inputs
    setProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_WSDL_URL,"");
    setProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_NAME,"");
    setProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_DESCRIPTION,"");

    // RegPublishServiceInterfaceAdvancedAction inputs
    setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL,"");
    setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME,"");
  }

  public final void addAuthenticationProperties(RegistryElement regElement)
  {
    String publishURL = regElement.getPublishURL();
    String userId = regElement.getUserId();
    String password = regElement.getCred();

    if (publishURL == null)
      publishURL = "";
    if (userId == null)
      userId = "";
    if (password == null)
      password = "";

    setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL);
    setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId);
    setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password);
    regFindTool_.addAuthenticationProperties(regElement);
  }

  public final FormToolPropertiesInterface getFormToolProperties(Object subQueryKeyObject)
  {
    // Empty/Non-existent subquerykey implies publish form. All else implies query form.
    String subQueryKey = (String)subQueryKeyObject;
    if (subQueryKey == null || subQueryKey.length() < 1)
      return this;
    else
      return regFindTool_.getFormToolProperties(subQueryKeyObject);
  }

  public String getSelectToolActionHref(boolean forHistory)
  {
    Node node = toolManager_.getNode();
    String subQueryKey = (String)getProperty(UDDIActionInputs.SUBQUERY_KEY);
    return SelectFindToolAction.getActionLink(node.getNodeId(),toolId_,node.getViewId(),node.getViewToolId(),subQueryKey,forHistory);
  }

  public String getFormLink()
  {
    Object subQueryKeyObject = getProperty(UDDIActionInputs.SUBQUERY_KEY);
    String subQueryKey = null;
    if (subQueryKeyObject != null)
    {
      Hashtable subQueriesProperties = (Hashtable)getProperty(UDDIActionInputs.SUBQUERIES_PROPERTIES);
      FormToolPropertiesInterface subQueryProperties = getFormToolProperties(subQueryKeyObject);
      Object subQueryGetObject = subQueryProperties.getProperty(UDDIActionInputs.SUBQUERY_GET);
      if (subQueryGetObject != null)
      {
        boolean isSubQueryGet = ((Boolean)subQueryGetObject).booleanValue();
        if (isSubQueryGet)
          return "uddi/forms/GetForm.jsp";
      }
      subQueryKey = (String)subQueryKeyObject;
    }
      
    if (subQueryKey == null || subQueryKey.length() < 1)
      return "uddi/forms/RegPublishForm.jsp";
    else
      return regFindTool_.getFormLink();
  }
}

Back to the top