Skip to content

Commit

Permalink
#11735 Missing code for setting host. (#11771)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilvam committed May 31, 2017
1 parent bef12a7 commit 9ecb1d8
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,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 9ecb1d8

Please sign in to comment.