Skip to content

Instantly share code, notes, and snippets.

View MafaldaLandeiro's full-sized avatar

Mafalda Landeiro MafaldaLandeiro

View GitHub Profile
package org.example.companyHumanResourcesAPI;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
package org.example.companyHumanResourcesAPI.config;
import org.example.companyHumanResourcesAPI.dao.CompanyDAO;
import org.example.companyHumanResourcesAPI.dao.HumanResourceDAO;
import org.example.companyHumanResourcesAPI.domain.Company;
import org.example.companyHumanResourcesAPI.domain.HumanResource;
import org.example.companyHumanResourcesAPI.mutation.HumanResourceMutation;
import org.example.companyHumanResourcesAPI.query.HumanResourceQuery;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@MafaldaLandeiro
MafaldaLandeiro / HumanResourceMutation.java
Last active December 3, 2020 14:39
Human Resource Mutation
package org.example.companyHumanResourcesAPI.mutation;
import com.coxautodev.graphql.tools.GraphQLMutationResolver;
import org.example.companyHumanResourcesAPI.dao.CompanyDAO;
import org.example.companyHumanResourcesAPI.dao.HumanResourceDAO;
import org.example.companyHumanResourcesAPI.domain.Company;
import org.example.companyHumanResourcesAPI.domain.HumanResource;
import java.util.Optional;
@MafaldaLandeiro
MafaldaLandeiro / HumanResourceQuery.java
Last active December 3, 2020 14:39
Human Resource Query
package org.example.companyHumanResourcesAPI.query;
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import org.example.companyHumanResourcesAPI.dao.HumanResourceDAO;
import org.example.companyHumanResourcesAPI.domain.HumanResource;
import java.util.List;
import java.util.Optional;
public class HumanResourceQuery implements GraphQLQueryResolver {
@MafaldaLandeiro
MafaldaLandeiro / humanResourcesSchema.graphqls
Created December 3, 2020 12:35
GraphQL schema of CompanyHumanResourcesAPI
type HumanResource {
id: ID!
name: String!
age: Int!
category: String
salary: Float
companyId: ID!
}
# The Root Query for the application
@MafaldaLandeiro
MafaldaLandeiro / pom.xml
Last active December 3, 2020 14:38
Pom file of CompanyHumanResourcesAPI
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>CompanyHumanResourcesAPI</artifactId>
<version>1.0-SNAPSHOT</version>
@MafaldaLandeiro
MafaldaLandeiro / TopologyExecutor.java
Created September 19, 2020 16:27
Topology Executor
package org.ApacheStormTopologyJava.topology;
import org.ApacheStormTopologyJava.bolt.AggregatingMessagesBolt;
import org.ApacheStormTopologyJava.bolt.FilteringMessageBolt;
import org.ApacheStormTopologyJava.bolt.PrintingAggregatedMessagesBolt;
import org.ApacheStormTopologyJava.spout.RandomMessageSpout;
import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.topology.TopologyBuilder;
import org.apache.storm.topology.base.BaseWindowedBolt;
@MafaldaLandeiro
MafaldaLandeiro / PrintingAggregatedMessagesBolt.java
Created September 19, 2020 16:23
Printing Aggregated Messages Bolt
package org.ApacheStormTopologyJava.bolt;
import org.apache.storm.topology.BasicOutputCollector;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.topology.base.BaseBasicBolt;
import org.apache.storm.tuple.Tuple;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PrintingAggregatedMessagesBolt extends BaseBasicBolt {
@MafaldaLandeiro
MafaldaLandeiro / AggregatingMessagesBolt.java
Created September 19, 2020 16:20
Aggregating Messages Bolt
package org.ApacheStormTopologyJava.bolt;
import org.apache.storm.task.OutputCollector;
import org.apache.storm.task.TopologyContext;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.topology.base.BaseWindowedBolt;
import org.apache.storm.tuple.Fields;
import org.apache.storm.tuple.Tuple;
import org.apache.storm.tuple.Values;
import org.apache.storm.windowing.TupleWindow;
@MafaldaLandeiro
MafaldaLandeiro / FilteringMessageBolt.java
Created September 19, 2020 16:15
Filtering Message Bolt
package org.ApacheStormTopologyJava.bolt;
import org.apache.storm.topology.BasicOutputCollector;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.topology.base.BaseBasicBolt;
import org.apache.storm.tuple.Fields;
import org.apache.storm.tuple.Tuple;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;