Esempio n. 1
0
 /** {@inheritDoc} */
 @Override
 public int compareTo(AtmosObject o) {
   if (getContentMetadata().getName() == null) return -1;
   return (this == o)
       ? 0
       : getContentMetadata().getName().compareTo(o.getContentMetadata().getName());
 }
 static {
   EXPECTED =
       Guice.createInjector()
           .getInstance(AtmosObject.Factory.class)
           .create(
               ParseSystemMetadataFromHeadersTest.EXPECTED,
               ParseUserMetadataFromHeadersTest.EXPECTED);
   EXPECTED.getContentMetadata().setName("e913e09366364e9ba384b8fead643d43");
   EXPECTED.setPayload(RESPONSE.getPayload());
 }
Esempio n. 3
0
 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));
   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;
 }