예제 #1
0
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (!(obj instanceof SettingsInfo)) {
      return false;
    }
    final SettingsInfo other = (SettingsInfo) obj;
    if (charset == null) {
      if (other.getCharset() != null) return false;
    } else if (!charset.equals(other.getCharset())) return false;
    if (contact == null) {
      if (other.getContact() != null) return false;
    } else if (!contact.equals(other.getContact())) return false;
    if (id == null) {
      if (other.getId() != null) return false;
    } else if (!id.equals(other.getId())) return false;
    if (numDecimals != other.getNumDecimals()) return false;
    if (onlineResource == null) {
      if (other.getOnlineResource() != null) return false;
    } else if (!onlineResource.equals(other.getOnlineResource())) return false;
    if (proxyBaseUrl == null) {
      if (other.getProxyBaseUrl() != null) return false;
    } else if (!proxyBaseUrl.equals(other.getProxyBaseUrl())) return false;
    if (schemaBaseUrl == null) {
      if (other.getSchemaBaseUrl() != null) return false;
    } else if (!schemaBaseUrl.equals(other.getSchemaBaseUrl())) return false;
    if (title == null) {
      if (other.getTitle() != null) return false;
    } else if (!title.equals(other.getTitle())) return false;
    if (verbose != other.isVerbose()) return false;
    if (verboseExceptions != other.isVerboseExceptions()) return false;

    return true;
  }
예제 #2
0
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((charset == null) ? 0 : charset.hashCode());
   result = prime * result + ((clientProperties == null) ? 0 : clientProperties.hashCode());
   result = prime * result + ((contact == null) ? 0 : contact.hashCode());
   result = prime * result + ((id == null) ? 0 : id.hashCode());
   result = prime * result + ((metadata == null) ? 0 : metadata.hashCode());
   result = prime * result + numDecimals;
   result = prime * result + ((onlineResource == null) ? 0 : onlineResource.hashCode());
   result = prime * result + ((proxyBaseUrl == null) ? 0 : proxyBaseUrl.hashCode());
   result = prime * result + ((schemaBaseUrl == null) ? 0 : schemaBaseUrl.hashCode());
   result = prime * result + ((title == null) ? 0 : title.hashCode());
   result = prime * result + (verbose ? 1231 : 1237);
   result = prime * result + (verboseExceptions ? 1231 : 1237);
   return result;
 }
    /**
     * Encodes contact information in the WMS capabilities document
     *
     * @param geoServer
     */
    public void handleContactInfo(ContactInfo contact) {
      start("ContactInformation");

      start("ContactPersonPrimary");
      element("ContactPerson", contact.getContactPerson());
      element("ContactOrganization", contact.getContactOrganization());
      end("ContactPersonPrimary");

      element("ContactPosition", contact.getContactPosition());

      start("ContactAddress");
      element("AddressType", contact.getAddressType());
      element("Address", contact.getAddress());
      element("City", contact.getAddressCity());
      element("StateOrProvince", contact.getAddressState());
      element("PostCode", contact.getAddressPostalCode());
      element("Country", contact.getAddressCountry());
      end("ContactAddress");

      element("ContactVoiceTelephone", contact.getContactVoice());
      element("ContactFacsimileTelephone", contact.getContactFacsimile());
      element("ContactElectronicMailAddress", contact.getContactEmail());

      end("ContactInformation");
    }
예제 #4
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  public GeoServerHomePage() {
    GeoServer gs = getGeoServer();
    ContactInfo contact = gs.getGlobal().getSettings().getContact();

    // add some contact info
    add(
        new ExternalLink("contactURL", contact.getOnlineResource())
            .add(new Label("contactName", contact.getContactOrganization())));
    {
      String version = String.valueOf(new ResourceModel("version").getObject());
      String contactEmail = contact.getContactEmail();
      HashMap<String, String> params = new HashMap<String, String>();
      params.put("version", version);
      params.put("contactEmail", (contactEmail == null ? "*****@*****.**" : contactEmail));
      Label label =
          new Label(
              "footerMessage",
              new StringResourceModel("GeoServerHomePage.footer", this, new Model(params)));
      label.setEscapeModelStrings(false);
      add(label);
    }

    Authentication auth = getSession().getAuthentication();
    if (isAdmin(auth)) {
      Stopwatch sw = Stopwatch.createStarted();
      Fragment f = new Fragment("catalogLinks", "catalogLinksFragment", this);
      Catalog catalog = getCatalog();

      NumberFormat numberFormat = NumberFormat.getIntegerInstance(getLocale());
      numberFormat.setGroupingUsed(true);

      final Filter allLayers = acceptAll();
      final Filter allStores = acceptAll();
      final Filter allWorkspaces = acceptAll();

      final int layerCount = catalog.count(LayerInfo.class, allLayers);
      final int storesCount = catalog.count(StoreInfo.class, allStores);
      final int wsCount = catalog.count(WorkspaceInfo.class, allWorkspaces);

      f.add(
          new BookmarkablePageLink("layersLink", LayerPage.class)
              .add(new Label("nlayers", numberFormat.format(layerCount))));
      f.add(new BookmarkablePageLink("addLayerLink", NewLayerPage.class));

      f.add(
          new BookmarkablePageLink("storesLink", StorePage.class)
              .add(new Label("nstores", numberFormat.format(storesCount))));
      f.add(new BookmarkablePageLink("addStoreLink", NewDataPage.class));

      f.add(
          new BookmarkablePageLink("workspacesLink", WorkspacePage.class)
              .add(new Label("nworkspaces", numberFormat.format(wsCount))));
      f.add(new BookmarkablePageLink("addWorkspaceLink", WorkspaceNewPage.class));
      add(f);

      sw.stop();
    } else {
      Label placeHolder = new Label("catalogLinks");
      placeHolder.setVisible(false);
      add(placeHolder);
    }

    final IModel<List<GeoServerHomePageContentProvider>> contentProviders;
    contentProviders = getContentProviders(GeoServerHomePageContentProvider.class);
    ListView<GeoServerHomePageContentProvider> contentView =
        new ListView<GeoServerHomePageContentProvider>("contributedContent", contentProviders) {
          private static final long serialVersionUID = 1L;

          @Override
          protected void populateItem(ListItem<GeoServerHomePageContentProvider> item) {
            GeoServerHomePageContentProvider provider = item.getModelObject();
            Component extraContent = provider.getPageBodyComponent("contentList");
            if (null == extraContent) {
              Label placeHolder = new Label("contentList");
              placeHolder.setVisible(false);
              extraContent = placeHolder;
            }
            item.add(extraContent);
          }
        };
    add(contentView);

    final IModel<List<CapabilitiesHomePageLinkProvider>> capsProviders;
    capsProviders = getContentProviders(CapabilitiesHomePageLinkProvider.class);

    ListView<CapabilitiesHomePageLinkProvider> capsView =
        new ListView<CapabilitiesHomePageLinkProvider>("providedCaps", capsProviders) {
          private static final long serialVersionUID = 1L;

          @Override
          protected void populateItem(ListItem<CapabilitiesHomePageLinkProvider> item) {
            CapabilitiesHomePageLinkProvider provider = item.getModelObject();
            Component capsList = provider.getCapabilitiesComponent("capsList");
            item.add(capsList);
          }
        };
    add(capsView);
  }
예제 #5
0
    /**
     * Handles contacts.
     *
     * @param config the service.
     */
    private void handleContact() {
      final GeoServer gs = wcs.getGeoServer();
      String tmp = "";

      SettingsInfo settings = gs.getSettings();
      ContactInfo contact = settings.getContact();

      if (((contact != null) && (contact.getContactPerson() != ""))
          || ((contact.getContactOrganization() != null)
              && (contact.getContactOrganization() != ""))) {
        start("wcs:responsibleParty");

        tmp = contact.getContactPerson();
        if ((tmp != null) && (tmp != "")) {
          element("wcs:individualName", tmp);
        } else {
          // not optional
          element("wcs:individualName", "");
        }

        tmp = contact.getContactOrganization();
        if ((tmp != null) && (tmp != "")) {
          element("wcs:organisationName", tmp);
        }

        tmp = contact.getContactPosition();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:positionName", tmp);
        }

        start("wcs:contactInfo");

        start("wcs:phone");
        tmp = contact.getContactVoice();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:voice", tmp);
        }

        tmp = contact.getContactFacsimile();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:facsimile", tmp);
        }

        end("wcs:phone");

        start("wcs:address");
        tmp = contact.getAddressType();

        if ((tmp != null) && (tmp != "")) {
          String addr = "";
          addr = contact.getAddress();

          if ((addr != null) && (addr != "")) {
            element("wcs:deliveryPoint", tmp + " " + addr);
          }
        } else {
          tmp = contact.getAddress();

          if ((tmp != null) && (tmp != "")) {
            element("wcs:deliveryPoint", tmp);
          }
        }

        tmp = contact.getAddressCity();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:city", tmp);
        }

        tmp = contact.getAddressState();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:administrativeArea", tmp);
        }

        tmp = contact.getAddressPostalCode();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:postalCode", tmp);
        }

        tmp = contact.getAddressCountry();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:country", tmp);
        }

        tmp = contact.getContactEmail();

        if ((tmp != null) && (tmp != "")) {
          element("wcs:electronicMailAddress", tmp);
        }

        end("wcs:address");

        tmp = contact.getOnlineResource();

        if ((tmp != null) && (tmp != "")) {
          AttributesImpl attributes = new AttributesImpl();
          attributes.addAttribute("", "xlink:href", "xlink:href", "", tmp);
          start("wcs:onlineResource", attributes);
          end("wcs:onlineResource");
        }

        end("wcs:contactInfo");

        end("wcs:responsibleParty");
      }
    }