}
public MutableBlobMetadata apply(ObjectMetadata from) {
if (from == null)
return null;
MutableBlobMetadata to = new MutableBlobMetadataImpl();
HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata());
try {
AccessControlList bucketAcl = bucketAcls.getUnchecked(from.getBucket());
if (bucketAcl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ))
to.setPublicUri(from.getUri());
} catch (CacheLoader.InvalidCacheLoadException e) {
// nulls not permitted from cache loader
}
to.setUri(from.getUri());
to.setContainer(from.getBucket());
to.setETag(from.getETag());
to.setName(from.getKey());
to.setLastModified(from.getLastModified());
to.setUserMetadata(from.getUserMetadata());
to.setLocation(locationOfBucket.apply(from.getBucket()));
String directoryName = ifDirectoryReturnName.execute(to);
if (directoryName != null) {
to.setName(directoryName);
to.setType(StorageType.RELATIVE_PATH);
} else {
to.setType(StorageType.BLOB);
}
return to;
}