use of org.talend.components.netsuite.client.NsStatus in project components by Talend.
the class NetSuiteClientServiceImpl method toNsStatus.
public static NsStatus toNsStatus(Status status) {
if (status == null) {
return null;
}
NsStatus nsStatus = new NsStatus();
nsStatus.setSuccess(status.getIsSuccess());
for (StatusDetail detail : status.getStatusDetail()) {
nsStatus.getDetails().add(toNsStatusDetail(detail));
}
return nsStatus;
}
use of org.talend.components.netsuite.client.NsStatus in project components by Talend.
the class NetSuiteClientServiceImpl method toNsStatus.
public static NsStatus toNsStatus(Status status) {
if (status == null) {
return null;
}
NsStatus nsStatus = new NsStatus();
nsStatus.setSuccess(status.getIsSuccess());
for (StatusDetail detail : status.getStatusDetail()) {
nsStatus.getDetails().add(toNsStatusDetail(detail));
}
return nsStatus;
}
use of org.talend.components.netsuite.client.NsStatus in project components by Talend.
the class TestNetSuiteClientService method toNsStatus.
public static NsStatus toNsStatus(Status status) {
if (status == null) {
return null;
}
NsStatus nsStatus = new NsStatus();
nsStatus.setSuccess(status.getIsSuccess());
for (StatusDetail detail : status.getStatusDetail()) {
nsStatus.getDetails().add(toNsStatusDetail(detail));
}
return nsStatus;
}
use of org.talend.components.netsuite.client.NsStatus in project components by Talend.
the class NetSuiteOutputWriter method createRejectRecord.
/**
* Create record for outgoing {@code reject} flow.
*
* @param response write response
* @param record indexed record which was submitted
* @return result record
*/
private IndexedRecord createRejectRecord(NsWriteResponse<RefT> response, IndexedRecord record) {
GenericData.Record targetRecord = new GenericData.Record(rejectSchema);
for (Schema.Field field : schema.getFields()) {
Schema.Field targetField = rejectSchema.getField(field.name());
if (targetField != null) {
Object value = record.get(field.pos());
targetRecord.put(targetField.name(), value);
}
}
String errorCode;
String errorMessage;
NsStatus status = response.getStatus();
if (!status.getDetails().isEmpty()) {
errorCode = status.getDetails().get(0).getCode();
errorMessage = status.getDetails().get(0).getMessage();
} else {
errorCode = "GENERAL_ERROR";
errorMessage = "Operation failed";
}
Schema.Field errorCodeField = NetSuiteDatasetRuntimeImpl.getNsFieldByName(rejectSchema, "errorCode");
if (errorCodeField != null) {
targetRecord.put(errorCodeField.pos(), errorCode);
}
Schema.Field errorMessageField = NetSuiteDatasetRuntimeImpl.getNsFieldByName(rejectSchema, "errorMessage");
if (errorMessageField != null) {
targetRecord.put(errorMessageField.pos(), errorMessage);
}
return targetRecord;
}
Aggregations