this.elementMutation = elementMutation;
}
}
public static <T extends Element> VisibilityAndElementMutation<T> updateElementVisibilitySource(VisibilityTranslator visibilityTranslator, Element element, SandboxStatus sandboxStatus, String visibilitySource, String workspaceId, Authorizations authorizations) {
VisibilityJson visibilityJson = LumifyProperties.VISIBILITY_JSON.getPropertyValue(element);
visibilityJson = sandboxStatus != SandboxStatus.PUBLIC ? updateVisibilitySourceAndAddWorkspaceId(visibilityJson, visibilitySource, workspaceId) : updateVisibilitySource(visibilityJson, visibilitySource);
LumifyVisibility lumifyVisibility = visibilityTranslator.toVisibility(visibilityJson);
ExistingElementMutation m = element.prepareMutation().alterElementVisibility(lumifyVisibility.getVisibility());
if (LumifyProperties.VISIBILITY_JSON.getPropertyValue(element) != null) {
Property visibilityJsonProperty = LumifyProperties.VISIBILITY_JSON.getProperty(element);
m.alterPropertyVisibility(visibilityJsonProperty.getKey(), LumifyProperties.VISIBILITY_JSON.getPropertyName(), lumifyVisibility.getVisibility());
}
Map<String, Object> metadata = new HashMap<String, Object>();
metadata.put(LumifyProperties.VISIBILITY_JSON.getPropertyName(), visibilityJson.toString());
LumifyProperties.VISIBILITY_JSON.setProperty(m, visibilityJson, metadata, lumifyVisibility.getVisibility());
m.save(authorizations);
return new VisibilityAndElementMutation<T>(lumifyVisibility, m);
}