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

com.kuangkie.carbon.record.FGRecordComplexus Maven / Gradle / Ivy

The newest version!
package com.kuangkie.carbon.record;

import java.util.Collection;
import java.util.Map;

import com.kuangkie.carbon.common.FGSerializable;

public interface FGRecordComplexus extends FGSerializable {

	String getHostCode();

	Collection getRecords();

	Collection getRecordCodes();

	FGRecord getRecord(String recordCode);

	default FGRecord getRecord(Long recordCode) {
		if (recordCode == null) {
			return null;
		} else {
			return getRecord(String.valueOf(recordCode));
		}
	}

	default FGRecord getRecord(String modelCode, Long recordCode) {
		if (recordCode == null) {
			return null;
		} else {
			return getRecord(modelCode, String.valueOf(recordCode));
		}
	}

	FGRecord getRecord(String modelCode, String recordCode);

	FGRecord getHostRecord();

	@Deprecated
	default Collection getAllGuestRecords(String modelCode, String recordCode, Long relationType) {
		return getGuestRecords(modelCode, recordCode, relationType);
	}

	@Deprecated
	default Collection getAllGuestProRecords(String modelCode, String recordCode, Long relationType) {
		return getGuestProRecords(modelCode, recordCode, relationType);
	}

	Collection getGuestRecords(String modelCode, String recordCode, Long relationType);

	default Collection getGuestRecords(String modelCode, Long recordCode, Long relationType) {
		if (recordCode == null) {
			return null;
		} else {
			return getGuestRecords(modelCode, String.valueOf(recordCode), relationType);
		}
	}

	default Collection getGuestProRecords(String modelCode, Long recordCode, Long relationType) {
		if (recordCode == null) {
			return null;
		} else {
			return getGuestProRecords(modelCode, String.valueOf(recordCode), relationType);
		}
	}

	Collection getGuestProRecords(String modelCode, String recordCode, Long relationType);

	default FGRecord getGuestRecord(String modelCode, String recordCode, Long relationType) {
		Collection records = getGuestRecords(modelCode, recordCode, relationType);
		if (records == null || records.isEmpty()) {
			return null;
		} else {
			return records.iterator().next();
		}
	}

	default ProRecord getGuestProRecord(String modelCode, String recordCode, Long relationType) {
		Collection records = getGuestProRecords(modelCode, recordCode, relationType);
		if (records == null || records.isEmpty()) {
			return null;
		} else {
			return records.iterator().next();
		}
	}

	default FGRecord getGuestRecord(String modelCode, Long recordCode, Long relationType) {
		if (recordCode == null) {
			return null;
		} else {
			return getGuestRecord(modelCode, String.valueOf(recordCode), relationType);
		}
	}

	default ProRecord getGuestProRecord(String modelCode, Long recordCode, Long relationType) {
		if (recordCode == null) {
			return null;
		} else {
			return getGuestProRecord(modelCode, String.valueOf(recordCode), relationType);
		}
	}
	
	default String getGuestCode(String modelCode, String recordCode, Long relationType) {
		FGRelationCorrelation relationCorrelation=getRelationCorrelation(modelCode,recordCode);
		return relationCorrelation==null?null: relationCorrelation.getGuestRecordCode(relationType);
	}
	
	default Collection getGuestCodes(String modelCode, String recordCode, Long relationType) {
		FGRelationCorrelation relationCorrelation=getRelationCorrelation(modelCode,recordCode);
		return relationCorrelation==null?null: relationCorrelation.getGuestRecordCodes(relationType);
	}
	
	default String getGuestCode(String modelCode, Long recordCode, Long relationType) {
		if (recordCode == null) {
			return null;
		} else {
			return getGuestCode(modelCode, String.valueOf(recordCode), relationType);
		}
	}
	
	default Collection getGuestCodes(String modelCode, Long recordCode, Long relationType) {
		if (recordCode == null) {
			return null;
		} else {
			return getGuestCodes(modelCode, String.valueOf(recordCode), relationType);
		}
	}
	
	default FGRelationCorrelation getGuestCorrelation(String modelCode, String recordCode, Long relationType) {
		Map map = getGuestCorrelations( modelCode,  recordCode,  relationType);
		if(map==null || map.isEmpty()) {
			return null;
		}else {
			return map.values().iterator().next();
		}
	}
	
	default FGRelationCorrelation getGuestCorrelation(String modelCode, Long recordCode, Long relationType) {
		if (recordCode == null) {
			return null;
		} else {
			return getGuestCorrelation(modelCode, String.valueOf(recordCode), relationType);
		}
	}

	Map getGuestCorrelations(String modelCode, String recordCode, Long relationType);

	default Map getGuestCorrelations(String modelCode, Long recordCode,
			Long relationType) {
		if (recordCode == null) {
			return null;
		} else {
			return getGuestCorrelations(modelCode, String.valueOf(recordCode), relationType);
		}
	}

	ProRecord getProRecord(String recordCode);

	default ProRecord getProRecord(Long recordCode) {
		if (recordCode == null) {
			return null;
		} else {
			return getProRecord(String.valueOf(recordCode));
		}
	}

	ProRecord getProRecord(String modelCode, String recordCode);

	default ProRecord getProRecord(String modelCode, Long recordCode) {
		if (recordCode == null) {
			return null;
		} else {
			return getProRecord(modelCode, String.valueOf(recordCode));
		}
	}
	
	ProRecord getHostProRecord();

	FGRelationCorrelation getRelationCorrelation(String modelCode, String recordCode);

	FGRelationCorrelation getRelationCorrelation(String recordCode);

	default FGRelationCorrelation getRelationCorrelation(String modelCode, Long recordCode) {
		if (recordCode == null) {
			return null;
		} else {
			return getRelationCorrelation(modelCode, String.valueOf(recordCode));
		}
	}

	default FGRelationCorrelation getRelationCorrelation(Long recordCode) {
		if (recordCode == null) {
			return null;
		} else {
			return getRelationCorrelation(String.valueOf(recordCode));
		}
	}

	Collection getRelationCorrelations();

	 T getRecordBean(String code, Class clazz);

	 T getRecordBean(String code, Class clazz, int maxDepth);

	default  T getRecordBean(Long recordCode, Class clazz) {
		if (recordCode == null) {
			return null;
		} else {
			return getRecordBean(String.valueOf(recordCode), clazz);
		}
	}

	default  T getRecordBean(Long recordCode, Class clazz, int maxDepth) {
		if (recordCode == null) {
			return null;
		} else {
			return getRecordBean(String.valueOf(recordCode), clazz, maxDepth);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy