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

org.molgenis.data.meta.model.PackageFactory Maven / Gradle / Ivy

There is a newer version: 8.4.5
Show newest version
package org.molgenis.data.meta.model;

import org.molgenis.data.AbstractSystemEntityFactory;
import org.molgenis.data.populate.EntityPopulator;
import org.molgenis.security.core.model.PackageValue;
import org.springframework.stereotype.Component;

@Component
public class PackageFactory extends AbstractSystemEntityFactory {
  PackageFactory(PackageMetadata packageMetadata, EntityPopulator entityPopulator) {
    super(Package.class, packageMetadata, entityPopulator);
  }

  public Package create(String id, String description) {
    Package pack = create(id);
    pack.setLabel(id);
    pack.setDescription(description);
    return pack;
  }

  @Override
  public Package create(String id) {
    Package pack = create();
    pack.setId(id);
    pack.setLabel(id);
    return pack;
  }

  public Package create(String id, String description, Package parentPackage) {
    Package pack = create(id);
    pack.setLabel(id);
    pack.setDescription(description);
    pack.setParent(parentPackage);
    return pack;
  }

  public Package create(PackageValue packageValue) {
    Package result = create(packageValue.getName());
    result.setLabel(packageValue.getLabel());
    result.setDescription(packageValue.getDescription());
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy