if (GlobalUtil.isContentEmpty(photoUrl)) {
savePlayer(null);
} else {
AssetContentItem photo = new AssetContentItem(null, new Date(), new HashSet<Long>(),
photoUrl, Importance.MEDIUM, null, AssetType.IMAGE, name, previewPhotoUrl);
photo.setLocation(new Location(null, null, ""));
photo.setPublishState(PublishState.PUBLISHED);
contentService.createOrChangeContentItem(photo, new AsyncCallback<BaseContentItem>() {
@Override
public void onFailure(Throwable caught) {
problemLabel.setVisible(true);
callbackWork.onFailure(caught);
resetButtons();
}
@Override
public void onSuccess(BaseContentItem result) {
savePlayer((AssetContentItem)result);
}
});
}
}
private void savePlayer(AssetContentItem photo) {
List<String> aliasList = new ArrayList<String>();
for (String alias : aliasesBox.getText().split(",")) {
String trimmed = alias.trim();
if (!trimmed.isEmpty()) {
aliasList.add(trimmed);
}
}
// Collections.emptySet() and Collections.emptyList() don't serialize properly.
PlayerContentItem player = new PlayerContentItem(null, new Date(), new HashSet<Long>(),
bioArea.getText(), Importance.MEDIUM, nameBox.getText(), aliasList,
typeSelector.getSelectedConstant(), photo);
// Kinda broken, but this isn't done automatically:
player.setLocation(new Location(null, null, ""));
player.setPublishState(PublishState.PUBLISHED);
problemLabel.setVisible(false);
contentService.createOrChangeContentItem(player, new AsyncCallback<BaseContentItem>() {
@Override
public void onFailure(Throwable caught) {