-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change entity name, fields, and read simple configurations
- Loading branch information
vjain
committed
Jun 24, 2015
1 parent
5470ed9
commit 388d6cf
Showing
10 changed files
with
314 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
import com.redhat.lightblue.config.LightblueFactoryAware; | ||
import com.redhat.lightblue.crud.InsertionRequest; | ||
import com.redhat.lightblue.hook.publish.model.Event; | ||
import com.redhat.lightblue.hook.publish.model.EventIdentity; | ||
import com.redhat.lightblue.hook.publish.model.Identity; | ||
import com.redhat.lightblue.hooks.CRUDHook; | ||
import com.redhat.lightblue.hooks.HookDoc; | ||
import com.redhat.lightblue.metadata.EntityMetadata; | ||
|
@@ -33,7 +33,7 @@ public class PublishHook implements CRUDHook, LightblueFactoryAware { | |
private final Logger LOGGER = LoggerFactory.getLogger(PublishHook.class); | ||
|
||
public static final String HOOK_NAME = "publishHook"; | ||
public static final String ENTITY_NAME = "publish"; | ||
public static final String ENTITY_NAME = "esbEvents"; | ||
public static final String ERR_MISSING_ID = HOOK_NAME + ":MissingID"; | ||
|
||
private LightblueFactory lightblueFactory; | ||
|
@@ -59,16 +59,18 @@ public void processHook(EntityMetadata entityMetadata, HookConfiguration hookCon | |
for (HookDoc doc : docs) { | ||
Event event = new Event(); | ||
|
||
event.setEntityName(doc.getEntityMetadata().getName()); | ||
event.setVersionText(doc.getEntityMetadata().getVersion().getValue()); | ||
|
||
event.setEntityName(publishHookConfiguration.getEntityName()); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dcrissman
Member
|
||
event.setRootEntityName(publishHookConfiguration.getRootEntityName()); | ||
event.setEndSystem(publishHookConfiguration.getEndSystem()); | ||
event.setVersion(doc.getEntityMetadata().getVersion().getValue()); | ||
This comment has been minimized.
Sorry, something went wrong.
dcrissman
Member
|
||
event.setPriorityValue(Integer.parseInt(publishHookConfiguration.getDefaultPriority())); | ||
event.setCreatedBy(HOOK_NAME); | ||
event.setCreationDate(new Date()); | ||
|
||
event.setLastUpdatedBy(HOOK_NAME); | ||
event.setLastUpdateDate(new Date()); | ||
|
||
event.setCRUDOperation(doc.getCRUDOperation().toString()); | ||
event.setOperation(doc.getCRUDOperation().toString()); | ||
|
||
event.setStatus("unprocessed"); | ||
|
||
|
@@ -86,9 +88,9 @@ else if (doc.getPostDoc() != null) { | |
throw Error.get(ERR_MISSING_ID, "path:" + p.toString()); | ||
} | ||
|
||
EventIdentity identity = new EventIdentity(); | ||
identity.setFieldText(p.toString()); | ||
identity.setValueText(node.asText()); | ||
Identity identity = new Identity(); | ||
identity.setField(p.toString()); | ||
identity.setValue(node.asText()); | ||
event.addIdentities(identity); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
src/main/java/com/redhat/lightblue/hook/publish/model/EventIdentity.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
src/main/java/com/redhat/lightblue/hook/publish/model/Header.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.redhat.lightblue.hook.publish.model; | ||
|
||
public class Header { | ||
|
||
private String name; | ||
private String value; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/redhat/lightblue/hook/publish/model/Identity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.redhat.lightblue.hook.publish.model; | ||
|
||
public class Identity { | ||
|
||
private String field; | ||
private String value; | ||
|
||
public String getField() { | ||
return field; | ||
} | ||
|
||
public void setField(String field) { | ||
this.field = field; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
} | ||
|
||
} |
Oops, something went wrong.
Why do we need the entityName set in the configuration, when we already have access to it on the document?