}
public MutableBlobMetadata apply(AtmosObject from) {
if (from == null)
return null;
MutableBlobMetadata to = new MutableBlobMetadataImpl();
to.setId(from.getSystemMetadata().getObjectID());
to.setLastModified(from.getSystemMetadata().getLastUserDataModification());
HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata());
to.setName(objectName.apply(from));
to.setUri(from.getContentMetadata().getUri());
to.setContainer(Iterables.get(Splitter.on('/').split(from.getContentMetadata().getPath()), 0));
if (from.getAllHeaders().containsEntry("x-emc-groupacl", "other=READ"))
to.setPublicUri(shareUrl.apply(from.getContentMetadata().getPath()));
if (from.getSystemMetadata().getType() == FileType.DIRECTORY) {
to.setType(StorageType.FOLDER);
} else {
to.setType(StorageType.BLOB);
}
Map<String, String> lowerKeyMetadata = Maps.newHashMap();
for (Entry<String, String> entry : from.getUserMetadata().getMetadata().entrySet()) {
String key = entry.getKey().toLowerCase();
if (!systemMetadata.contains(key))
lowerKeyMetadata.put(key, entry.getValue());
}
to.setUserMetadata(lowerKeyMetadata);
return to;
}