Java Code Examples for org.apache.commons.lang.SerializationUtils#clone()

The following examples show how to use org.apache.commons.lang.SerializationUtils#clone() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthorizeNetAimPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
@Override
public Payment capture(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(CAPTURE);


    final net.authorize.Merchant merchant = createMerchant();
    final net.authorize.aim.Transaction transaction = merchant.createAIMTransaction(
            net.authorize.TransactionType.PRIOR_AUTH_CAPTURE,
            payment.getPaymentAmount()
    );
    transaction.setTransactionId(payment.getTransactionReferenceId()); // prev auth


    return runTransaction(merchant, transaction, payment);

}
 
Example 2
Source File: AuthorizeNetAimPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment reverseAuthorization(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(REVERSE_AUTH);


    final net.authorize.Merchant merchant = createMerchant();
    final net.authorize.aim.Transaction transaction = merchant.createAIMTransaction(
            net.authorize.TransactionType.VOID,
            payment.getPaymentAmount()
    );
    transaction.setTransactionId(payment.getTransactionReferenceId()); // prev auth


    return runTransaction(merchant, transaction, payment);
}
 
Example 3
Source File: OWLGraphWrapperExtended.java    From owltools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * fetches the value of a single-valued annotation property for an OWLObject
 * <p>
 * TODO: provide a flag that determines behavior in the case of >1 value
 * 
 * @param c
 * @param lap
 * @return value
 */
public String getAnnotationValue(OWLObject c, OWLAnnotationProperty lap) {
	Set<OWLAnnotation>anns = new HashSet<OWLAnnotation>();
	if (c instanceof OWLEntity) {
		for (OWLOntology ont : getAllOntologies()) {
			anns.addAll(OwlHelper.getAnnotations((OWLEntity) c, lap, ont));
		}
	}
	else {
		return null;
	}
	for (OWLAnnotation a : anns) {
		if (a.getValue() instanceof OWLLiteral) {
			OWLLiteral val = (OWLLiteral) a.getValue();
			return (String) SerializationUtils.clone(val.getLiteral()); // return first - TODO - check zero or one
		}
	}

	return null;
}
 
Example 4
Source File: AuthorizeNetAimPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment voidCapture(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(VOID_CAPTURE);


    final net.authorize.Merchant merchant = createMerchant();
    final net.authorize.aim.Transaction transaction = merchant.createAIMTransaction(
            net.authorize.TransactionType.VOID,
            payment.getPaymentAmount()
    );
    transaction.setTransactionId(payment.getTransactionReferenceId()); // prev auth


    return runTransaction(merchant, transaction, payment);

}
 
Example 5
Source File: AbstractPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
protected Payment runDefaultOperation(final Payment paymentIn,
                                      final String operation,
                                      final String processorResult,
                                      final boolean settlement) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(operation);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(processorResult);
    payment.setPaymentProcessorBatchSettlement(settlement);
    return payment;
}
 
Example 6
Source File: AuthorizeNetSimPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment voidCapture(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(VOID_CAPTURE);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 7
Source File: LiqPayNoRefundPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Payment refund(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(REFUND);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 8
Source File: PayPalExpressCheckoutPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment voidCapture(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(VOID_CAPTURE);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 9
Source File: PostFinanceManualPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment authorizeCapture(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(AUTH);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 10
Source File: PayPalProPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment reverseAuthorization(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(REVERSE_AUTH);
    final NvpBuilder npvs = new NvpBuilder();
    npvs.addRaw("AUTHORIZATIONID", payment.getTransactionReferenceId());
    return runTransaction("DoVoid", npvs.toMap(), payment, REVERSE_AUTH);
}
 
Example 11
Source File: PayPalProPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment authorize(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(AUTH);
    final NvpBuilder npvs = createAuthRequest(payment, "Authorization");
    return runTransaction("DoDirectPayment", npvs.toMap(), payment, AUTH);
}
 
Example 12
Source File: AuthorizeNetSimPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment capture(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(CAPTURE);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 13
Source File: LiqPayPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment capture(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(CAPTURE);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 14
Source File: AuthorizeNetSimPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment refund(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(REFUND);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 15
Source File: TestPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment authorize(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(AUTH);
    if (isParameterActivated(AUTH_FAIL) || isParameterActivated(AUTH_FAIL_NO + getAuthNum()) || isParameterActivated(AUTH_FAIL_NO + payment.getPaymentAmount().toPlainString())) {
        payment.setTransactionOperationResultCode("EXTERNAL_ERROR_CODE");
        payment.setTransactionOperationResultMessage("Card rejected exception. Authorize failed for " + getAuthNum() + "@" + payment.getPaymentAmount().toPlainString());
        payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_FAILED);
        payment.setPaymentProcessorBatchSettlement(false);
    } else if (isParameterActivated(PROCESSING) || isParameterActivated(PROCESSING_NO + getAuthNum()) || isParameterActivated(PROCESSING_NO + payment.getPaymentAmount().toPlainString())) {
        payment.setTransactionReferenceId(UUID.randomUUID().toString());
        payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
        payment.setTransactionOperationResultCode("EXTERNAL_OK");
        payment.setTransactionOperationResultMessage("Authorize processing for " + getAuthNum() + "@" + payment.getPaymentAmount().toPlainString());
        payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_PROCESSING);
        payment.setPaymentProcessorBatchSettlement(false);
    } else {
        payment.setTransactionReferenceId(UUID.randomUUID().toString());
        payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
        payment.setTransactionOperationResultCode("EXTERNAL_OK");
        payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_OK);
        payment.setPaymentProcessorBatchSettlement(false);
    }
    authNum ++;

    return payment;
}
 
Example 16
Source File: PostFinancePaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment voidCapture(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(VOID_CAPTURE);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 17
Source File: TestExtFormPaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment authorize(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(AUTH);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 18
Source File: PostFinancePaymentGatewayImpl.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Payment refund(final Payment paymentIn, final boolean forceProcessing) {
    final Payment payment = (Payment) SerializationUtils.clone(paymentIn);
    payment.setTransactionOperation(REFUND);
    payment.setTransactionReferenceId(UUID.randomUUID().toString());
    payment.setTransactionAuthorizationCode(UUID.randomUUID().toString());
    payment.setPaymentProcessorResult(Payment.PAYMENT_STATUS_MANUAL_PROCESSING_REQUIRED);
    payment.setPaymentProcessorBatchSettlement(false);
    return payment;
}
 
Example 19
Source File: IsReserializable.java    From concurrentlinkedhashmap with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private T reserialize(T object) {
  return (T) SerializationUtils.clone((Serializable) object);
}
 
Example 20
Source File: MultiThreadedTest.java    From concurrentlinkedhashmap with Apache License 2.0 4 votes vote down vote up
@Override void execute(ConcurrentLinkedHashMap<Integer, Integer> cache, Integer key) {
  SerializationUtils.clone(cache);
}