Skip to content

Commit

Permalink
#11735 Missing code for setting host.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilvam committed May 31, 2017
1 parent c6639ef commit e2e56c6
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,17 @@ public ContentType save(ContentType contentType, List<Field> fields, List<FieldV
if (!localFields.isEmpty())
newContentType.constructWithFields(localFields);

// Sets the host:
try {
HostAPI hapi = APILocator.getHostAPI();
Host host = UUIDUtil.isUUID(newContentType.host()) || "SYSTEM_HOST".equalsIgnoreCase(newContentType.host())
? hapi.find(newContentType.host(), APILocator.systemUser(), true)
: hapi.resolveHostName(newContentType.host(), APILocator.systemUser(), true);
newContentType = ContentTypeBuilder.builder(newContentType).host(host.getIdentifier()).build();
} catch (DotDataException | DotSecurityException e) {
throw new DotStateException("unable to resolve host:" + newContentType.host(), e);
}

ContentType oldType = newContentType;
try {
if (newContentType.id() != null)
Expand Down

0 comments on commit e2e56c6

Please sign in to comment.