import org.slf4j.LoggerFactory;
public class ContactClientUtils {
+
private static final Logger logger =
LoggerFactory.getLogger(ContactClientUtils.class);
- public static MultipartOutput createContactInstance(String identifier) {
+ public static MultipartOutput createContactInstance(String identifier, String headerLabel) {
String inAuthority = "";
String inItem = "";
return createContactInstance(
inItem,
"addressText1-" + identifier,
"postcode-" + identifier,
- "addressType1-" + identifier);
+ "addressType1-" + identifier,
+ headerLabel);
}
public static MultipartOutput createContactInstance(
- String inAuthority, String inItem, String identifier) {
+ String inAuthority, String inItem, String identifier, String headerLabel) {
return createContactInstance(
inAuthority,
inItem,
"addressText1-" + identifier,
"postcode-" + identifier,
- "addressType1-" + identifier);
+ "addressType1-" + identifier,
+ headerLabel);
}
public static MultipartOutput createContactInstance(
String inAuthority, String inItem, String addressText,
- String postcode, String addressType) {
+ String postcode, String addressType, String headerLabel) {
ContactsCommon contact = new ContactsCommon();
contact.setInAuthority(inAuthority);
contact.setInItem(inItem);
OutputPart commonPart =
multipart.addPart(contact, MediaType.APPLICATION_XML_TYPE);
ContactClient client = new ContactClient();
- commonPart.getHeaders().add("label", client.getCommonPartName());
+ commonPart.getHeaders().add("label", headerLabel);
if(logger.isDebugEnabled()){
logger.debug("to be created, contact common");
// Submit the request to the service and store the response.
String identifier = createIdentifier();
- MultipartOutput multipart = ContactClientUtils.createContactInstance(identifier);
+ MultipartOutput multipart =
+ ContactClientUtils.createContactInstance(identifier, client.getCommonPartName());
ClientResponse<Response> res = client.create(multipart);
int statusCode = res.getStatus();
// The only relevant ID may be the one used in update(), below.
// The only relevant ID may be the one used in update(), below.
- MultipartOutput multipart = ContactClientUtils.createContactInstance(NON_EXISTENT_ID);
+ MultipartOutput multipart =
+ ContactClientUtils.createContactInstance(NON_EXISTENT_ID, client.getCommonPartName());
ClientResponse<MultipartInput> res =
client.update(NON_EXISTENT_ID, multipart);
int statusCode = res.getStatus();