コード例 #1
0
 private static void setDatabaseInstance(SampleType sampleType, DatabaseInstance instance) {
   if (sampleType.getDatabaseInstance() != null) {
     assert sampleType.getDatabaseInstance().equals(instance)
         : "sample types from more than one database instance are not supported";
   } else {
     sampleType.setDatabaseInstance(instance);
   }
 }
コード例 #2
0
  private static List<SampleType> filter(
      final List<SampleType> sampleTypes, final boolean onlyListable) {
    final List<SampleType> result = new ArrayList<SampleType>();

    for (final SampleType sampleType : sampleTypes) {
      if (onlyListable && sampleType.isListable() == false) {
        continue;
      }
      result.add(sampleType);
    }
    return result;
  }
コード例 #3
0
  private static SampleTypeModel createAllTypesModel(List<SampleType> basicTypes) {
    final SampleType allSampleType = new SampleType();
    allSampleType.setCode(EntityType.ALL_TYPES_CODE);
    allSampleType.setListable(true);

    Set<SampleTypePropertyType> allPropertyTypes = new HashSet<SampleTypePropertyType>();
    for (SampleType basicType : basicTypes) {
      allPropertyTypes.addAll(basicType.getAssignedPropertyTypes());
      setDatabaseInstance(allSampleType, basicType.getDatabaseInstance());
    }

    allSampleType.setSampleTypePropertyTypes(
        new ArrayList<SampleTypePropertyType>(allPropertyTypes));

    return new SampleTypeModel(allSampleType);
  }
コード例 #4
0
 private static SampleTypeModel createTypeInFileModel() {
   final SampleType typeInFile = new SampleType();
   typeInFile.setCode(SampleType.DEFINED_IN_FILE);
   typeInFile.setListable(false);
   return new SampleTypeModel(typeInFile);
 }
コード例 #5
0
 public SampleTypeModel(final SampleType sampleType) {
   set(ModelDataPropertyNames.CODE, sampleType.getCode());
   set(ModelDataPropertyNames.OBJECT, sampleType);
 }