This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.apz.salesforcesample.repository; | |
import com.fasterxml.jackson.databind.MappingIterator; | |
import com.fasterxml.jackson.dataformat.csv.CsvMapper; | |
import com.fasterxml.jackson.dataformat.csv.CsvSchema; | |
import com.github.apz.salesforcesample.config.SalesforceProperties; | |
import com.github.apz.salesforcesample.model.AuthenticationResult; | |
import com.github.apz.salesforcesample.model.Company; | |
import lombok.AllArgsConstructor; | |
import lombok.Getter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.apz.salesforcesample.repository; | |
import com.github.apz.salesforcesample.config.SalesforceProperties; | |
import com.github.apz.salesforcesample.model.AuthenticationResult; | |
import com.github.apz.salesforcesample.model.Company; | |
import lombok.AllArgsConstructor; | |
import lombok.Getter; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.http.MediaType; | |
import org.springframework.stereotype.Repository; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Company find(String objectId, AuthenticationResult authenticationResult) { | |
Company result = salesforceWebClient.get() | |
.uri( salesforceProperties.getApplicationPath()+ "/sobjects/Account/" + objectId) // 作成した取引先のオブジェクトid | |
.header("Authorization", authenticationResult.bearerToken()) | |
.retrieve() | |
.bodyToMono(Company.class) | |
.block(); | |
log.info("result :{}", result); | |
return result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void delete(String objectId, AuthenticationResult authenticationResult) { | |
salesforceWebClient.delete() // 削除はDELETE | |
.uri( salesforceProperties.getApplicationPath()+ "/sobjects/Account/" + objectId) // 更新同様、削除するオブジェクトIDを指定 | |
.header("Authorization", authenticationResult.bearerToken()) | |
.retrieve() | |
.bodyToMono(Company.class) | |
.block(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void update(String objectId, Company company, AuthenticationResult authenticationResult) { | |
salesforceWebClient.patch() // 更新はPATCH | |
.uri( salesforceProperties.getApplicationPath()+ "/sobjects/Account/" + objectId) // 更新対処の取引先のオブジェクトIDを指定 | |
.header("Authorization", authenticationResult.bearerToken()) // 認証結果 | |
.contentType(MediaType.APPLICATION_JSON) | |
.body(Mono.just(company), Company.class).retrieve() | |
.toBodilessEntity() | |
.block(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.apz.salesforcesample.repository | |
import com.github.apz.salesforcesample.model.Company | |
import org.springframework.beans.factory.annotation.Autowired | |
import org.springframework.boot.test.context.SpringBootTest | |
import spock.lang.Specification | |
@SpringBootTest | |
class SalesforceRegisterTest extends Specification { | |
@Autowired |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.apz.salesforcesample.model; | |
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | |
import com.fasterxml.jackson.databind.annotation.JsonNaming; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import lombok.Setter; | |
import lombok.ToString; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INFO 14368 --- [ Test worker] c.g.a.s.r.SalesforceAuthentication : | |
result: | |
AuthenticationResult( | |
statusCode=0, | |
accessToken=**MASK** | |
signature=**MASK**, | |
instanceUrl=https://***********.salesforce.com, | |
id=https://test.salesforce.com/id/***************, | |
tokenType=Bearer, | |
issuedAt=1691308480245 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.apz.salesforcesample.repository | |
import org.springframework.beans.factory.annotation.Autowired | |
import org.springframework.boot.test.context.SpringBootTest | |
import spock.lang.Specification | |
@SpringBootTest | |
class SalesforceAuthenticationTest extends Specification { | |
@Autowired | |
SalesforceAuthentication sut |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.apz.salesforcesample.model; | |
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | |
import com.fasterxml.jackson.databind.annotation.JsonNaming; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import lombok.Setter; | |
import lombok.ToString; | |
@NoArgsConstructor @Getter @Setter @ToString |
NewerOlder