use of com.google.api.services.storage.model.StorageObject.Owner in project google-cloud-java by GoogleCloudPlatform.
the class BlobInfo method toPb.
StorageObject toPb() {
StorageObject storageObject = blobId.toPb();
if (acl != null) {
storageObject.setAcl(Lists.transform(acl, new Function<Acl, ObjectAccessControl>() {
@Override
public ObjectAccessControl apply(Acl acl) {
return acl.toObjectPb();
}
}));
}
if (deleteTime != null) {
storageObject.setTimeDeleted(new DateTime(deleteTime));
}
if (updateTime != null) {
storageObject.setUpdated(new DateTime(updateTime));
}
if (createTime != null) {
storageObject.setTimeCreated(new DateTime(createTime));
}
if (size != null) {
storageObject.setSize(BigInteger.valueOf(size));
}
if (owner != null) {
storageObject.setOwner(new Owner().setEntity(owner.toPb()));
}
if (storageClass != null) {
storageObject.setStorageClass(storageClass.toString());
}
Map<String, String> pbMetadata = metadata;
if (metadata != null && !Data.isNull(metadata)) {
pbMetadata = Maps.newHashMapWithExpectedSize(metadata.size());
for (Map.Entry<String, String> entry : metadata.entrySet()) {
pbMetadata.put(entry.getKey(), firstNonNull(entry.getValue(), Data.<String>nullOf(String.class)));
}
}
if (customerEncryption != null) {
storageObject.setCustomerEncryption(customerEncryption.toPb());
}
storageObject.setMetadata(pbMetadata);
storageObject.setCacheControl(cacheControl);
storageObject.setContentEncoding(contentEncoding);
storageObject.setCrc32c(crc32c);
storageObject.setContentType(contentType);
storageObject.setMd5Hash(md5);
storageObject.setMediaLink(mediaLink);
storageObject.setMetageneration(metageneration);
storageObject.setContentDisposition(contentDisposition);
storageObject.setComponentCount(componentCount);
storageObject.setContentLanguage(contentLanguage);
storageObject.setEtag(etag);
storageObject.setId(generatedId);
storageObject.setSelfLink(selfLink);
return storageObject;
}
Aggregations