Snippets

OICP 2.1 Push EVSE Data | Java

You are viewing an old version of this snippet. View the current version.
Revised by Gregor Schermuly 1e701a4
EVSEDataRecord EVSE1 = EVSEDataRecord.

    Create                 (EVSE_Id.Parse("DE*GEF*E123456789*1")).
    setChargingStationId   (ChargingStation_Id.Parse("DE*GEF*S123456789")).
    addChargingStationName (name -> name.add(Languages.de, "Testbox 1").
                                         add(Languages.en, "Testbox One")).

    setAddress             (new Address(Country.Germany,
                                        "07749", "Jena",
                                        "Biberweg", "18")).

    setGeoCoordinates      (Latitude. Parse(49.731102),
                            Longitude.Parse(10.142530)).

    setPlugs               (PlugTypes.TypeFSchuko,
                            PlugTypes.Type2Outlet).

    setAuthenticationModes (AuthenticationModes.NFC_RFID_Classic,
                            AuthenticationModes.NFC_RFID_DESFire,
                            AuthenticationModes.REMOTE).

    setPaymentOptions      (PaymentOptions.Contract,
                            PaymentOptions.Direct).

    setAccessibility       (AccessibilityTypes.Paying_publicly_accessible).
    setHotlinePhoneNumber  ("+4955512345678").
    addAdditionalInfo      (info -> info.add(Languages.de, "This is a Testbox!")).
    setIsOpen24Hours       ().

    build();


CompletableFuture req = new CPOClient("api.playground.hubject.com").

    PushEVSEData(EVSEOperator_Id.Parse("DE*GEF"),
                 ActionType.insert,
                 EVSE1).

    Run(ack -> {

        if (ack.hasResult())
            System.out.println("success!");

        else {
            System.out.println(ack.getStatusCode().getCode());
            System.out.println(ack.getStatusCode().getDescription());
            System.out.println(ack.getStatusCode().getAdditionalInfo());
        }

    });

// Wait for the future to complete...
req.get();
/**
 * Creates a new PushEVSEData request.
 *
 * @param EVSEDataRecords a stream of EVSEDataRecords.
 * @param EVSEOperatorId the unique identification of the EVSE operator for this request.
 * @param EVSEOperatorName the unique name of the EVSE operator for this request.
 * @param Action the server side data management operation for this request.
 * @return a new PushEVSEData request builder object.
 */
public PushEVSEDataRequest PushEVSEData(final Stream<EVSEDataRecord>  EVSEDataRecords
                                        final EVSEOperator_Id         EVSEOperatorId,
                                        final String                  EVSEOperatorName,
                                        final ActionType              Action)
{ ... }


/**
 * Creates a new PushEVSEData request.
 *
 * @param EVSEOperatorId the unique identification of the EVSE operator for this request.
 * @param EVSEOperatorName the unique name of the EVSE operator for this request.
 * @param Action the server side data management operation for this request.
 * @param EVSEDataRecords an array of EVSEDataRecords.
 * @return a new PushEVSEData request builder object.
 */
public PushEVSEDataRequest PushEVSEData(final EVSEOperator_Id    EVSEOperatorId,
                                        final String             EVSEOperatorName,
                                        final ActionType         Action,
                                        final EVSEDataRecord...  EVSEDataRecords)
{ ... }
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.