r7069 - dumbhippo/trunk/server/src/com/dumbhippo/server/dm
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7069 - dumbhippo/trunk/server/src/com/dumbhippo/server/dm
- Date: Mon, 17 Dec 2007 12:29:22 -0600 (CST)
Author: otaylor
Date: 2007-12-17 12:29:21 -0600 (Mon, 17 Dec 2007)
New Revision: 7069
Modified:
dumbhippo/trunk/server/src/com/dumbhippo/server/dm/BlockDMO.java
dumbhippo/trunk/server/src/com/dumbhippo/server/dm/PostBlockDMO.java
dumbhippo/trunk/server/src/com/dumbhippo/server/dm/PostDMO.java
Log:
Add a bunch more block properties
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/dm/BlockDMO.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/dm/BlockDMO.java 2007-12-14 23:55:36 UTC (rev 7068)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/dm/BlockDMO.java 2007-12-17 18:29:21 UTC (rev 7069)
@@ -13,9 +13,11 @@
import com.dumbhippo.dm.annotations.DMProperty;
import com.dumbhippo.dm.annotations.Inject;
import com.dumbhippo.dm.annotations.MetaConstruct;
+import com.dumbhippo.dm.annotations.PropertyType;
import com.dumbhippo.dm.store.StoreKey;
import com.dumbhippo.identity20.Guid;
import com.dumbhippo.persistence.BlockType;
+import com.dumbhippo.persistence.StackReason;
import com.dumbhippo.persistence.UserBlockData;
import com.dumbhippo.persistence.BlockType.BlockVisibility;
import com.dumbhippo.server.NotFoundException;
@@ -110,7 +112,17 @@
blockView = view;
}
+ @DMProperty(defaultInclude=true, type=PropertyType.URL)
+ public String getIcon() {
+ return blockView.getIcon();
+ }
+
@DMProperty(defaultInclude=true)
+ public long getTimestamp() {
+ return blockView.getBlock().getTimestampAsLong();
+ }
+
+ @DMProperty(defaultInclude=true)
public String getTitle() {
if (blockView instanceof TitleBlockView)
return ((TitleBlockView)blockView).getTitle();
@@ -119,6 +131,14 @@
}
@DMProperty(defaultInclude=true)
+ public String getTitleLink() {
+ if (blockView instanceof TitleBlockView)
+ return ((TitleBlockView)blockView).getLink();
+ else
+ return null;
+ }
+
+ @DMProperty(defaultInclude=true)
public String getDescription() {
if (blockView instanceof TitleDescriptionBlockView)
return ((TitleDescriptionBlockView)blockView).getDescription();
@@ -127,6 +147,11 @@
}
@DMProperty(defaultInclude=true)
+ public String getChatId() {
+ return blockView.getChatId();
+ }
+
+ @DMProperty(defaultInclude=true)
public boolean isPublic() {
return blockView.getBlockType().getBlockVisibility() == BlockVisibility.PUBLIC;
}
@@ -145,27 +170,57 @@
@DMProperty(defaultInclude=true, group=USER_BLOCK_DATA_GROUP, cached=false)
public long getClickedTimestamp() {
- long clickedTimestamp = userBlockData.getClickedTimestampAsLong();
- if (clickedTimestamp < 0) // Prettification, not to return -1000, which is what is stored in the DB
+ if (userBlockData == null)
return -1;
- else
- return clickedTimestamp;
+ else {
+ long clickedTimestamp = userBlockData.getClickedTimestampAsLong();
+ if (clickedTimestamp < 0) // Prettification, not to return -1000, which is what is stored in the DB
+ return -1;
+ else
+ return clickedTimestamp;
+ }
}
@DMProperty(defaultInclude=true, group=USER_BLOCK_DATA_GROUP, cached=false)
public long getIgnoredTimestamp() {
- if (userBlockData.isIgnored())
- return userBlockData.getIgnoredTimestampAsLong();
- else
+ if (userBlockData == null)
return -1;
+ else {
+ if (userBlockData.isIgnored())
+ return userBlockData.getIgnoredTimestampAsLong();
+ else
+ return -1;
+ }
}
+ // This isn't 101% right ... the stack reason should be the stack reason of
+ // the block in the stack (and is thus stack dependent), not the stack reason
+ // of the viewer. But for right now, the data model stack is only being used
+ // to view the user's own stack, for which the two things are the same.
+ //
+ // I'm not sure that the stack dependence of the stack reason is ever used,
+ // so it may be possible to move the reason from UserBlockData to Block to use
+ // the data model for the web, where we view blocks for which there is no
+ // UserBlockData for the viewer.
+ //
+ @DMProperty(defaultInclude=true, group=USER_BLOCK_DATA_GROUP, cached=false)
+ public String getStackReason() {
+ if (userBlockData == null ||
+ userBlockData.getStackReason() == StackReason.NEW_BLOCK)
+ return null;
+ else
+ return userBlockData.getStackReason().name();
+ }
+
//////////////////////////////////////////////////////////////////////
- // These properties are here for the implementation of Viewpoint.canSeePrivateBlock(),
+ // These properties are used for the implementation of Viewpoint.canSeePrivateBlock(),
// Viewpoint.canSeeBlockDelegate()
- @DMProperty
+ // This is also used to determine "isMine" by the client; since the owner is also
+ // always returned by some other property, the expense of this in the protocol
+ // over a boolean isn't big
+ @DMProperty(defaultInclude=true, defaultChildren="+")
public UserDMO getOwner() {
switch (blockView.getBlockType().getBlockOwnership()) {
case DIRECT_DATA1:
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/dm/PostBlockDMO.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/dm/PostBlockDMO.java 2007-12-14 23:55:36 UTC (rev 7068)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/dm/PostBlockDMO.java 2007-12-17 18:29:21 UTC (rev 7069)
@@ -3,6 +3,7 @@
import com.dumbhippo.dm.annotations.DMO;
import com.dumbhippo.dm.annotations.DMProperty;
import com.dumbhippo.dm.store.StoreKey;
+import com.dumbhippo.persistence.FeedPost;
import com.dumbhippo.persistence.Post;
import com.dumbhippo.server.blocks.PostBlockView;
@@ -18,6 +19,16 @@
return session.findUnchecked(PostDMO.class, post.getGuid());
}
+ @DMProperty(defaultInclude=true)
+ public boolean isFeed() {
+ return ((PostBlockView)blockView).getPostView().getPost() instanceof FeedPost;
+ }
+
+ @DMProperty(defaultInclude=true)
+ public int getSignificantClickedCount() {
+ return blockView.getSignificantClickedCount();
+ }
+
@Override
public StoreKey<?,?> getVisibilityDelegate() {
return getPost().getStoreKey();
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/dm/PostDMO.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/dm/PostDMO.java 2007-12-14 23:55:36 UTC (rev 7068)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/dm/PostDMO.java 2007-12-17 18:29:21 UTC (rev 7069)
@@ -77,7 +77,7 @@
return post.getPostDate().getTime();
}
- @DMProperty(defaultInclude=true)
+ @DMProperty(defaultInclude=true, defaultChildren="+")
@DMFilter("viewer.canSeePrivate(any)")
public List<UserDMO> getUserRecipients() {
List<UserDMO> result = new ArrayList<UserDMO>();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]