|
|
|
@ -74,16 +74,18 @@ public class CommonServiceUtils {
|
|
|
|
|
* Validate an aggregated GRSF record. TODO use @Valid tags
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public static void validateAggregatedRecord(Common record) throws Exception {
|
|
|
|
|
public static void validateAggregatedRecord(Common record, Sources sourceInPath) throws Exception {
|
|
|
|
|
|
|
|
|
|
if(sourceInPath.equals(Sources.GRSF)) {
|
|
|
|
|
List<RefersToBean> refersToList = record.getRefersTo();
|
|
|
|
|
if(refersToList == null || refersToList.isEmpty())
|
|
|
|
|
throw new Exception("refers_to cannot be null/empty");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<RefersToBean> refersToList = record.getRefersTo();
|
|
|
|
|
String shortTitle = record.getShortName();
|
|
|
|
|
Boolean traceabilityFlag = record.isTraceabilityFlag();
|
|
|
|
|
Status status = record.getStatus();
|
|
|
|
|
|
|
|
|
|
if(refersToList == null || refersToList.isEmpty())
|
|
|
|
|
throw new Exception("refers_to cannot be null/empty");
|
|
|
|
|
|
|
|
|
|
if(traceabilityFlag == null)
|
|
|
|
|
throw new Exception("traceability_flag cannot be null");
|
|
|
|
|
|
|
|
|
@ -508,7 +510,7 @@ public class CommonServiceUtils {
|
|
|
|
|
addRecordToGroupSources(groups, new ArrayList(sourcesList), productType, sourceInPath);
|
|
|
|
|
|
|
|
|
|
// validate
|
|
|
|
|
CommonServiceUtils.validateAggregatedRecord(record);
|
|
|
|
|
CommonServiceUtils.validateAggregatedRecord(record, sourceInPath);
|
|
|
|
|
|
|
|
|
|
// set the domain
|
|
|
|
|
record.setDomain(productType.getOrigName());
|
|
|
|
|