CPD Results

The following document contains the results of PMD's CPD 4.3.

Duplications

File Line
org/deegree/services/ows/capabilities/OWSCapabilitiesXMLAdapter.java 322
org/deegree/services/ows/capabilities/OWSCapabilitiesXMLAdapter.java 416
        writer.writeStartElement( OWS_PREFIX, "ServiceProvider", owsNS );

        // ows:ProviderName (type="string")
        writer.writeStartElement( owsNS, "ProviderName" );
        writer.writeCharacters( serviceProvider.getProviderName() );
        writer.writeEndElement();

        if ( serviceProvider.getProviderSite() != null && !"".equals( serviceProvider.getProviderSite().trim() ) ) {
            // ows:ProviderSite (type="ows:OnlineResourceType")
            writer.writeStartElement( owsNS, "ProviderSite" );
            writer.writeAttribute( XLN_NS, "href", serviceProvider.getProviderSite() );
            writer.writeEndElement();
        }

        // ows:ProviderSite (type="ows:ResponsiblePartySubsetType")
        ServiceContactType serviceContact = serviceProvider.getServiceContact();
        writer.writeStartElement( owsNS, "ServiceContact" );

        if ( serviceContact.getIndividualName() != null && !"".equals( serviceContact.getIndividualName().trim() ) ) {
            // ows:IndividualName (type="string")
            writeElement( writer, owsNS, "IndividualName", serviceContact.getIndividualName() );
        }

        if ( serviceContact.getPositionName() != null && !"".equals( serviceContact.getPositionName().trim() ) ) {
            // ows:PositionName (type="string")
            writeElement( writer, owsNS, "PositionName", serviceContact.getPositionName() );
        }

        // ows:ContactInfo
        if ( serviceContact.getPhone() != null || serviceContact.getFacsimile() != null
             || serviceContact.getAddress() != null || serviceContact.getElectronicMailAddress() != null
             || serviceContact.getOnlineResource() != null || serviceContact.getHoursOfService() != null
             || serviceContact.getContactInstructions() != null ) {
            writer.writeStartElement( owsNS, "ContactInfo" );

            // ows:Phone (type="ows:PhoneType")
            if ( serviceContact.getPhone() != null || serviceContact.getFacsimile() != null ) {
                writer.writeStartElement( owsNS, "Phone" );
                // ows:Voice (type="string")
                writeOptionalElement( writer, owsNS, "Voice", serviceContact.getPhone() );
                // ows:Facsimile (type="string")
                writeOptionalElement( writer, owsNS, "Facsimile", serviceContact.getFacsimile() );
                writer.writeEndElement();
            }

            // ows:Address (type="ows:AddressType")
            AddressType address = serviceContact.getAddress();
            if ( address != null ) {
                writer.writeStartElement( owsNS, "Address" );
                exportSimpleStrings( writer, address.getDeliveryPoint(), owsNS, "DeliveryPoint" );
                writeOptionalElement( writer, owsNS, "City", address.getCity() );
                writeOptionalElement( writer, owsNS, "AdministrativeArea", address.getAdministrativeArea() );
                writeOptionalElement( writer, owsNS, "PostalCode", address.getPostalCode() );
                writeOptionalElement( writer, owsNS, "Country", address.getCountry() );
                exportSimpleStrings( writer, serviceContact.getElectronicMailAddress(), owsNS, "ElectronicMailAddress" );
                writer.writeEndElement();
            }

            if ( serviceContact.getOnlineResource() != null && !"".equals( serviceContact.getOnlineResource().trim() ) ) {
                // ows:OnlineResource (type="ows:OnlineResourceType")
                writer.writeStartElement( owsNS, "OnlineResource" );
                writer.writeAttribute( XLN_NS, "href", serviceContact.getOnlineResource() );
                writer.writeEndElement();
            }

            // ows:HoursOfService (type="string")
            writeOptionalElement( writer, owsNS, "HoursOfService", serviceContact.getHoursOfService() );
            // ows:ContactInstructions (type="string")
            writeOptionalElement( writer, owsNS, "ContactInstructions", serviceContact.getContactInstructions() );

            writer.writeEndElement(); // ContactInfo
        }

        // ows:Role (type="ows:CodeType)
        writeElement( writer, owsNS, "Role", serviceContact.getRole() );

        writer.writeEndElement();

        writer.writeEndElement(); // ServiceProvider
    }

    /**
     * Exports a {@link ServiceProviderType} as an OWS 1.1.0 <code>ServiceProvider</code> element. Validated against ows
     * schema by rb at 23.02.2009.
     * 
     * @param writer
     *            writer to append the xml
     * @param serviceProvider
     *            <code>ServiceProviderType</code> to export
     * @throws XMLStreamException
     */
    public static void exportServiceProvider110( XMLStreamWriter writer, ServiceProviderType serviceProvider )
File Line
org/deegree/services/ows/capabilities/OWSCapabilitiesXMLAdapter.java 178
org/deegree/services/ows/capabilities/OWSCapabilitiesXMLAdapter.java 225
        writeElement( writer, OWS110_NS, "ServiceType", srvn, null, null, "codeSpace", "http://www.opengeospatial.org/" );
        List<Version> versions = serviceVersions;
        if ( serviceVersions == null || serviceVersions.isEmpty() ) {
            LOG.warn( "Service versions name may not be null, wrong call to exportServiceIdentification110, setting to unknown" );
            versions = new ArrayList<Version>();
            versions.add( new Version( 1, 0, 0 ) );
        }

        exportVersions( writer, versions, OWS110_NS, "ServiceTypeVersion" );

        // No support for profiles ???
        if ( serviceID.getFees() != null && !"".equals( serviceID.getFees() ) ) {
            writeElement( writer, OWS110_NS, "Fees", serviceID.getFees() );
        }

        exportSimpleStrings( writer, serviceID.getAccessConstraints(), OWS110_NS, "AccessConstraints" );
        writer.writeEndElement();// OWS110_NS, ServiceIdentification
    }

    /**
     * Exports the given {@link ServiceIdentificationType} as an OWS 1.1.0 <code>ServiceIdentification</code> element.
     * 
     * @param writer
     *            used to append the XML, must not be <code>null</code>
     * @param serviceID
     *            configuration object that provides most of the required metadata, must not be <code>null</code>
     * @param serviceName
     *            OGC-style abbreviation of the service, e.g. WFS, must not be <code>null</code>
     * @param serviceVersions
     *            supported protocol versions, must not be <code>null</code> and contain at least one entry
     * @throws XMLStreamException
     *             if writing the XML fails
     */
    public static void exportServiceIdentification110( XMLStreamWriter writer, ServiceIdentificationType serviceID,
File Line
org/deegree/services/controller/utils/OSAASRequestLogger.java 94
org/deegree/services/controller/utils/OSAASRequestLogger.java 136
        PreparedStatement stmt = null;
        try {
            ConnectionManager mgr = OGCFrontController.getServiceWorkspace().getSubsystemManager( ConnectionManager.class );
            conn = mgr.get( connid );
            stmt = conn.prepareStatement( "insert into " + table + "(wfsidintern,wfsidextern,username,starttime"
                                          + ",endtime,requestformat,rawrequest) values (?,?,?,?,?,?,?)" );
            String[] ss = address.split( "\\?" );
            stmt.setString( 1, ss[0] );
            stmt.setString( 2, ss[1] );
            stmt.setString( 3, creds.getUser() );
            stmt.setTimestamp( 4, new Timestamp( startTime ) );
            stmt.setTimestamp( 5, new Timestamp( endTime ) );
            stmt.setInt( 6, 2 );