Search in sources :

Example 6 with Category

use of com.ibm.watson.compare_comply.v1.model.Category in project uPMT by coco35700.

the class MainViewController method duplicate.

private Category duplicate(Category c) {
    Category newc = new Category(c.getName());
    newc.setColor(c.getColor());
    for (Type t : c.getTypes()) {
        newc.addType(t);
    }
    return newc;
}
Also used : AlertType(javafx.scene.control.Alert.AlertType) ButtonType(javafx.scene.control.ButtonType) Type(model.Type) Category(model.Category)

Example 7 with Category

use of com.ibm.watson.compare_comply.v1.model.Category in project molgenis by molgenis.

the class AttributeResponseMapperImpl method getCategories.

private List<Category> getCategories(EntityType entityType) {
    Repository<Entity> repository = metaDataService.getRepository(entityType).orElseThrow(() -> new UnknownRepositoryException(entityType.getId()));
    Attribute idAttribute = entityType.getIdAttribute();
    Attribute labelAttribute = entityType.getLabelAttribute();
    return repository.query().findAll().map(entity -> Category.builder().setId(entity.get(idAttribute)).setLabel(entity.get(labelAttribute).toString()).build()).collect(toList());
}
Also used : Range(org.molgenis.api.metadata.v3.model.Range) LocaleContextHolder(org.springframework.context.i18n.LocaleContextHolder) UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) Iterables(com.google.common.collect.Iterables) Order(org.molgenis.data.Sort.Order) LABEL(org.molgenis.data.meta.model.AttributeMetadata.LABEL) AttributeResponse(org.molgenis.api.metadata.v3.model.AttributeResponse) AttributesResponse(org.molgenis.api.metadata.v3.model.AttributesResponse) UnknownRepositoryException(org.molgenis.data.UnknownRepositoryException) ONE_TO_MANY(org.molgenis.data.meta.AttributeType.ONE_TO_MANY) LinksUtils(org.molgenis.api.support.LinksUtils) LinksResponse(org.molgenis.api.model.response.LinksResponse) Attribute(org.molgenis.data.meta.model.Attribute) MetaDataService(org.molgenis.data.meta.MetaDataService) ArrayList(java.util.ArrayList) I18nValue(org.molgenis.api.metadata.v3.model.I18nValue) Sort(org.molgenis.data.Sort) Objects.requireNonNull(java.util.Objects.requireNonNull) URI(java.net.URI) AttributeType(org.molgenis.data.meta.AttributeType) Category(org.molgenis.api.metadata.v3.model.Category) ImmutableMap(com.google.common.collect.ImmutableMap) Collections.emptyList(java.util.Collections.emptyList) EntityType(org.molgenis.data.meta.model.EntityType) ServletUriComponentsBuilder.fromCurrentRequestUri(org.springframework.web.servlet.support.ServletUriComponentsBuilder.fromCurrentRequestUri) Collectors.toList(java.util.stream.Collectors.toList) AttributeType.getValueString(org.molgenis.data.meta.AttributeType.getValueString) List(java.util.List) Component(org.springframework.stereotype.Component) Builder(org.molgenis.api.metadata.v3.model.AttributeResponseData.Builder) Direction(org.molgenis.api.model.Order.Direction) Repository(org.molgenis.data.Repository) EntityTypeUtils(org.molgenis.data.util.EntityTypeUtils) Optional(java.util.Optional) AttributeResponseData(org.molgenis.api.metadata.v3.model.AttributeResponseData) DESCRIPTION(org.molgenis.data.meta.model.AttributeMetadata.DESCRIPTION) PageResponse(org.molgenis.api.model.response.PageResponse) Entity(org.molgenis.data.Entity) Entity(org.molgenis.data.Entity) Attribute(org.molgenis.data.meta.model.Attribute) UnknownRepositoryException(org.molgenis.data.UnknownRepositoryException)

Example 8 with Category

use of com.ibm.watson.compare_comply.v1.model.Category in project springdoc-openapi-demos by springdoc.

the class PetApiDelegateImpl method initPets.

@PostConstruct
private void initPets() {
    Category dogs = new Category().id(1L).name("Dogs");
    Category cats = new Category().id(2L).name("Cats");
    Category rabbits = new Category().id(3L).name("Rabbits");
    Category lions = new Category().id(4L).name("Lions");
    petRepository.save(createPet(1, cats, "Cat 1", new String[] { "url1", "url2" }, new String[] { "tag1", "tag2" }, Pet.StatusEnum.AVAILABLE));
    petRepository.save(createPet(2, cats, "Cat 2", new String[] { "url1", "url2" }, new String[] { "tag2", "tag3" }, Pet.StatusEnum.AVAILABLE));
    petRepository.save(createPet(3, cats, "Cat 3", new String[] { "url1", "url2" }, new String[] { "tag3", "tag4" }, Pet.StatusEnum.PENDING));
    petRepository.save(createPet(4, dogs, "Dog 1", new String[] { "url1", "url2" }, new String[] { "tag1", "tag2" }, Pet.StatusEnum.AVAILABLE));
    petRepository.save(createPet(5, dogs, "Dog 2", new String[] { "url1", "url2" }, new String[] { "tag2", "tag3" }, Pet.StatusEnum.SOLD));
    petRepository.save(createPet(6, dogs, "Dog 3", new String[] { "url1", "url2" }, new String[] { "tag3", "tag4" }, Pet.StatusEnum.PENDING));
    petRepository.save(createPet(7, lions, "Lion 1", new String[] { "url1", "url2" }, new String[] { "tag1", "tag2" }, Pet.StatusEnum.AVAILABLE));
    petRepository.save(createPet(8, lions, "Lion 2", new String[] { "url1", "url2" }, new String[] { "tag2", "tag3" }, Pet.StatusEnum.AVAILABLE));
    petRepository.save(createPet(9, lions, "Lion 3", new String[] { "url1", "url2" }, new String[] { "tag3", "tag4" }, Pet.StatusEnum.AVAILABLE));
    petRepository.save(createPet(10, rabbits, "Rabbit 1", new String[] { "url1", "url2" }, new String[] { "tag3", "tag4" }, Pet.StatusEnum.AVAILABLE));
}
Also used : Category(org.springdoc.demo.app2.model.Category) PostConstruct(javax.annotation.PostConstruct)

Example 9 with Category

use of com.ibm.watson.compare_comply.v1.model.Category in project Happourse_online_study_web by infiq2000.

the class CourseUtil method getCategories.

public List<Category> getCategories() throws SQLException {
    Connection myConn = null;
    PreparedStatement myStmt = null;
    ResultSet myRS = null;
    myConn = dataSource.getConnection();
    String sql = "SELECT * FROM category;";
    myStmt = myConn.prepareStatement(sql);
    myRS = myStmt.executeQuery();
    List<Category> ls = new ArrayList<>();
    while (myRS.next()) {
        int cid = myRS.getInt("cid");
        String name = myRS.getString("name");
        Category category = new Category(cid, name);
        ls.add(category);
    }
    myConn.close();
    return ls;
}
Also used : Category(Model.Category) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) ArrayList(java.util.ArrayList) PreparedStatement(java.sql.PreparedStatement)

Aggregations

ArrayList (java.util.ArrayList)3 AlertType (javafx.scene.control.Alert.AlertType)3 ButtonType (javafx.scene.control.ButtonType)3 Category (model.Category)3 Type (model.Type)3 AddFeedbackOptions (com.ibm.watson.compare_comply.v1.model.AddFeedbackOptions)2 Category (com.ibm.watson.compare_comply.v1.model.Category)2 FeedbackDataInput (com.ibm.watson.compare_comply.v1.model.FeedbackDataInput)2 FeedbackReturn (com.ibm.watson.compare_comply.v1.model.FeedbackReturn)2 Label (com.ibm.watson.compare_comply.v1.model.Label)2 Location (com.ibm.watson.compare_comply.v1.model.Location)2 OriginalLabelsIn (com.ibm.watson.compare_comply.v1.model.OriginalLabelsIn)2 ShortDoc (com.ibm.watson.compare_comply.v1.model.ShortDoc)2 TypeLabel (com.ibm.watson.compare_comply.v1.model.TypeLabel)2 UpdatedLabelsIn (com.ibm.watson.compare_comply.v1.model.UpdatedLabelsIn)2 List (java.util.List)2 Optional (java.util.Optional)2 PostConstruct (javax.annotation.PostConstruct)2 Category (Model.Category)1 ImmutableMap (com.google.common.collect.ImmutableMap)1