All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cdm.product.collateral.functions.CheckIssuerName Maven / Gradle / Ivy

package cdm.product.collateral.functions;

import cdm.base.staticdata.party.LegalEntity;
import cdm.product.collateral.EligibilityQuery;
import com.google.inject.ImplementedBy;
import com.rosetta.model.lib.functions.RosettaFunction;
import com.rosetta.model.lib.mapper.MapperC;
import com.rosetta.model.lib.mapper.MapperS;
import java.util.Collections;
import java.util.List;

import static com.rosetta.model.lib.expression.ExpressionOperators.*;

@ImplementedBy(CheckIssuerName.CheckIssuerNameDefault.class)
public abstract class CheckIssuerName implements RosettaFunction {

	/**
	* @param issuerName 
	* @param query 
	* @return isEqual 
	*/
	public Boolean evaluate(List issuerName, EligibilityQuery query) {
		Boolean isEqual = doEvaluate(issuerName, query);
		
		return isEqual;
	}

	protected abstract Boolean doEvaluate(List issuerName, EligibilityQuery query);

	public static class CheckIssuerNameDefault extends CheckIssuerName {
		@Override
		protected Boolean doEvaluate(List issuerName, EligibilityQuery query) {
			if (issuerName == null) {
				issuerName = Collections.emptyList();
			}
			Boolean isEqual = null;
			return assignOutput(isEqual, issuerName, query);
		}
		
		protected Boolean assignOutput(Boolean isEqual, List issuerName, EligibilityQuery query) {
			isEqual = notExists(MapperC.of(issuerName)).or(contains(MapperC.of(issuerName), MapperS.of(query).map("getIssuerName", eligibilityQuery -> eligibilityQuery.getIssuerName()))).get();
			
			return isEqual;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy