Include tags when converting between Map and Drive{Info,Data}

This commit is contained in:
Alasdair Hodge 2011-12-21 11:28:32 +00:00
parent ede85e28f5
commit 3f0f782f9d
2 changed files with 4 additions and 2 deletions

View File

@ -45,6 +45,8 @@ public class BaseDriveToMap implements Function<Drive, Map<String, String>> {
builder.put("size", from.getSize() + ""); builder.put("size", from.getSize() + "");
if (from.getClaimType() != ClaimType.EXCLUSIVE) if (from.getClaimType() != ClaimType.EXCLUSIVE)
builder.put("claim:type", from.getClaimType().toString()); builder.put("claim:type", from.getClaimType().toString());
if (from.getTags().size() != 0)
builder.put("tags", Joiner.on(' ').join(from.getTags()));
if (from.getReaders().size() != 0) if (from.getReaders().size() != 0)
builder.put("readers", Joiner.on(' ').join(from.getReaders())); builder.put("readers", Joiner.on(' ').join(from.getReaders()));
if (from.getUse().size() != 0) if (from.getUse().size() != 0)

View File

@ -48,8 +48,6 @@ public class MapToDriveInfo implements Function<Map<String, String>, DriveInfo>
@Override @Override
public DriveInfo apply(Map<String, String> from) { public DriveInfo apply(Map<String, String> from) {
if (from.size() == 0)
return null;
if (from.size() == 0) if (from.size() == 0)
return null; return null;
DriveInfo.Builder builder = new DriveInfo.Builder(); DriveInfo.Builder builder = new DriveInfo.Builder();
@ -66,6 +64,8 @@ public class MapToDriveInfo implements Function<Map<String, String>, DriveInfo>
builder.claimType(ClaimType.fromValue(from.get("claim:type"))); builder.claimType(ClaimType.fromValue(from.get("claim:type")));
if (from.containsKey("claimed")) if (from.containsKey("claimed"))
builder.claimed(Splitter.on(' ').split(from.get("claimed"))); builder.claimed(Splitter.on(' ').split(from.get("claimed")));
if (from.containsKey("tags"))
builder.tags(Splitter.on(' ').split(from.get("tags")));
if (from.containsKey("readers")) if (from.containsKey("readers"))
builder.readers(Splitter.on(' ').split(from.get("readers"))); builder.readers(Splitter.on(' ').split(from.get("readers")));
if (from.containsKey("size")) if (from.containsKey("size"))