Skip to content

Commit

Permalink
event schema metadata changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nocs00 committed Jul 11, 2016
1 parent 706acc1 commit 66fdf4c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Expand Up @@ -22,7 +22,15 @@ public class EventSchemaMetadata {

private String fqn;
private EventClassType type;
private String schema;
private String ctlSchemaId;

public String getCtlSchemaId() {
return ctlSchemaId;
}

public void setCtlSchemaId(String ctlSchemaId) {
this.ctlSchemaId = ctlSchemaId;
}

public String getFqn() {
return fqn;
Expand All @@ -40,21 +48,13 @@ public void setType(EventClassType type) {
this.type = type;
}

public String getSchema() {
return schema;
}

public void setSchema(String schema) {
this.schema = schema;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fqn == null) ? 0 : fqn.hashCode());
result = prime * result + ((schema == null) ? 0 : schema.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((ctlSchemaId == null) ? 0 : ctlSchemaId.hashCode());
return result;
}

Expand All @@ -77,14 +77,14 @@ public boolean equals(Object obj) {
} else if (!fqn.equals(other.fqn)) {
return false;
}
if (schema == null) {
if (other.schema != null) {
return false;
}
} else if (!schema.equals(other.schema)) {
if (type != other.type) {
return false;
}
if (type != other.type) {
if (ctlSchemaId == null) {
if (other.ctlSchemaId != null) {
return false;
}
} else if (!ctlSchemaId.equals(other.ctlSchemaId)) {
return false;
}
return true;
Expand Down
Expand Up @@ -31,6 +31,7 @@ public class EventSchemaProcessorImpl implements EventSchemaProcessor {
private static final Logger LOG = LoggerFactory.getLogger(EventSchemaProcessorImpl.class);

private static final String CLASS_TYPE = "classType";
private static final String CTL_SCHEMA_ID = "ctlSchemaId";

@Override
public List<EventSchemaMetadata> processSchema(String schema)
Expand Down Expand Up @@ -58,8 +59,9 @@ public List<EventSchemaMetadata> processSchema(String schema)
LOG.error("Can't process provided event class family schema. Invalid classType [{}]. Exception catched: {}", strClassType, e);
throw new EventSchemaException("Can't process provided event class family schema. Invalid classType: " + strClassType);
}
String ctlSchemaId = parsedEventClassSchema.getProp(CTL_SCHEMA_ID);
eventClassSchema.setCtlSchemaId(ctlSchemaId);
eventClassSchema.setType(classType);
eventClassSchema.setSchema(parsedEventClassSchema.toString());
eventClassSchemas.add(eventClassSchema);
}
} catch (Exception e) {
Expand Down

0 comments on commit 66fdf4c

Please sign in to comment.