From cabccb110a8b0a2ef00450a63d81996fabd5f4d5 Mon Sep 17 00:00:00 2001 From: Ilia Naryzhny Date: Sun, 7 Nov 2021 07:52:04 -0800 Subject: [PATCH] Adopt OPoster to Transponder --- .../org/orienteer/oposter/OPosterModule.java | 2 +- .../oposter/facebook/IFacebookApp.java | 19 ++++++---- .../oposter/facebook/IFacebookConnection.java | 19 +++++----- .../oposter/instagram/IIGAccount.java | 20 +++++++---- .../orienteer/oposter/instagram/IIGApp.java | 6 ++-- .../org/orienteer/oposter/model/IChannel.java | 29 +++++++++------ .../org/orienteer/oposter/model/IContent.java | 36 +++++++++++-------- .../orienteer/oposter/model/IContentPlan.java | 16 +++++---- .../oposter/model/IImageAttachment.java | 11 +++--- .../orienteer/oposter/model/IOPosterDAO.java | 2 +- .../orienteer/oposter/model/IPlatformApp.java | 17 +++++---- .../org/orienteer/oposter/model/IPosting.java | 23 ++++++------ .../java/org/orienteer/oposter/ok/IOkApp.java | 16 +++++---- .../org/orienteer/oposter/ok/IOkChannel.java | 6 ++-- .../oposter/telegram/ITelegramBot.java | 11 +++--- .../oposter/telegram/ITelegramChannel.java | 10 +++--- .../oposter/twitter/ITwitterAccount.java | 10 +++--- .../oposter/twitter/ITwitterApp.java | 14 +++++--- .../java/org/orienteer/oposter/vk/IVkApp.java | 14 ++++---- .../org/orienteer/oposter/vk/IVkWall.java | 18 ++++++---- 20 files changed, 180 insertions(+), 119 deletions(-) diff --git a/oposter/src/main/java/org/orienteer/oposter/OPosterModule.java b/oposter/src/main/java/org/orienteer/oposter/OPosterModule.java index 9e5c42c..d119810 100644 --- a/oposter/src/main/java/org/orienteer/oposter/OPosterModule.java +++ b/oposter/src/main/java/org/orienteer/oposter/OPosterModule.java @@ -51,7 +51,7 @@ protected OPosterModule() { public ODocument onInstall(OrienteerWebApplication app, ODatabaseSession db) { super.onInstall(app, db); OSchemaHelper helper = OSchemaHelper.bind(db); - DAO.describe(helper, IContentPlan.class, + DAO.define(IContentPlan.class, IContent.class, IChannel.class, IPlatformApp.class, diff --git a/oposter/src/main/java/org/orienteer/oposter/facebook/IFacebookApp.java b/oposter/src/main/java/org/orienteer/oposter/facebook/IFacebookApp.java index e7891cf..6b52349 100644 --- a/oposter/src/main/java/org/orienteer/oposter/facebook/IFacebookApp.java +++ b/oposter/src/main/java/org/orienteer/oposter/facebook/IFacebookApp.java @@ -7,14 +7,16 @@ import org.orienteer.core.OrienteerWebApplication; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.oposter.model.IChannel; import org.orienteer.oposter.model.IContent; import org.orienteer.oposter.model.IImageAttachment; import org.orienteer.oposter.model.IPlatformApp; import org.orienteer.oposter.model.IPosting; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import com.google.inject.ProvidedBy; import com.orientechnologies.orient.core.metadata.schema.OType; @@ -31,23 +33,26 @@ * {@link IPlatformApp} for Facebook */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IFacebookApp.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = IFacebookApp.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface IFacebookApp extends IPlatformApp{ public static final String CLASS_NAME = "OPFacebookApp"; - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public String getAppId(); public void setAppId(String value); - @DAOField(notNull = true, visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) + @OrientDBProperty(notNull = true) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) public String getAppSecret(); public void setAppSecret(String value); - @DAOField(uiReadOnly = true) + @OrienteerOProperty(uiReadOnly = true) public String getAppAccessToken(); public void setAppAccessToken(String value); - @DAOField(type = OType.DATETIME, uiReadOnly = true) + @OrientDBProperty(type = OType.DATETIME) + @OrienteerOProperty(uiReadOnly = true) public Date getAppAccessTokenExpires(); public void setAppAccessTokenExpires(Date value); diff --git a/oposter/src/main/java/org/orienteer/oposter/facebook/IFacebookConnection.java b/oposter/src/main/java/org/orienteer/oposter/facebook/IFacebookConnection.java index 29ae424..1e942e9 100644 --- a/oposter/src/main/java/org/orienteer/oposter/facebook/IFacebookConnection.java +++ b/oposter/src/main/java/org/orienteer/oposter/facebook/IFacebookConnection.java @@ -6,9 +6,9 @@ import org.orienteer.core.component.FAIconType; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.core.method.IMethodContext; import org.orienteer.core.method.OFilter; import org.orienteer.core.method.OMethod; @@ -18,6 +18,8 @@ import org.orienteer.oposter.model.IOAuthReciever; import org.orienteer.oposter.model.IPlatformApp; import org.orienteer.oposter.web.OAuthCallbackResource; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import com.google.inject.ProvidedBy; import com.restfb.FacebookClient; @@ -31,11 +33,12 @@ * {@link IChannel} for Facebook */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IFacebookConnection.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = IFacebookConnection.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface IFacebookConnection extends IChannel, IOAuthReciever{ public static final String CLASS_NAME = "OPFacebookConnection"; - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public Long getFacebookId(); public void setFacebookId(Long value); @@ -44,13 +47,13 @@ public default String getFacebookIdAsString() { return pageId!=null?Long.toUnsignedString(pageId):null; } - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) public String getAccessToken(); public void setAccessToken(String value); - @DAOField(notNull = true, defaultValue = "false") - public Boolean isPage(); - public void setPage(Boolean value); + @OrientDBProperty(notNull = true, defaultValue = "false") + public boolean isPage(); + public void setPage(boolean value); @OMethod( diff --git a/oposter/src/main/java/org/orienteer/oposter/instagram/IIGAccount.java b/oposter/src/main/java/org/orienteer/oposter/instagram/IIGAccount.java index 9382db6..eb0f50a 100644 --- a/oposter/src/main/java/org/orienteer/oposter/instagram/IIGAccount.java +++ b/oposter/src/main/java/org/orienteer/oposter/instagram/IIGAccount.java @@ -4,10 +4,12 @@ import org.orienteer.core.OClassDomain; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.oposter.model.IChannel; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,24 +26,28 @@ * {@link IChannel} which represents Account in Instagram */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IIGAccount.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = IIGAccount.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface IIGAccount extends IChannel { public static final String CLASS_NAME = "OPIGAccount"; public static final Logger LOG = LoggerFactory.getLogger(IIGAccount.class); - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public String getUsername(); public void setUsername(String value); - @DAOField(notNull = true, visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) + @OrientDBProperty(notNull = true) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) public String getPassword(); public void setPassword(String value); - @DAOField(type = OType.CUSTOM, hidden = true) + @OrientDBProperty(type = OType.CUSTOM) + @OrienteerOProperty(hidden = true) public IGClient getIGClient(); public void setIGClient(IGClient value); - @DAOField(type = OType.CUSTOM, hidden = true) + @OrientDBProperty(type = OType.CUSTOM) + @OrienteerOProperty(hidden = true) public SerializableCookieJar getCookieJar(); public void setCookieJar(SerializableCookieJar value); diff --git a/oposter/src/main/java/org/orienteer/oposter/instagram/IIGApp.java b/oposter/src/main/java/org/orienteer/oposter/instagram/IIGApp.java index 52851b3..73778e0 100644 --- a/oposter/src/main/java/org/orienteer/oposter/instagram/IIGApp.java +++ b/oposter/src/main/java/org/orienteer/oposter/instagram/IIGApp.java @@ -5,14 +5,15 @@ import java.util.stream.Collectors; import org.orienteer.core.OClassDomain; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; import org.orienteer.oposter.model.IChannel; import org.orienteer.oposter.model.IContent; import org.orienteer.oposter.model.IImageAttachment; import org.orienteer.oposter.model.IPlatformApp; import org.orienteer.oposter.model.IPosting; import org.orienteer.oposter.vk.IVkApp; +import org.orienteer.transponder.annotation.EntityType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,7 +29,8 @@ * {@link IPlatformApp} for Instagram: no configuration - can be single for all IG Accounts */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IIGApp.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = IIGApp.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface IIGApp extends IPlatformApp{ public static final String CLASS_NAME = "OPIGApp"; public static final Logger LOG = LoggerFactory.getLogger(IIGApp.class); diff --git a/oposter/src/main/java/org/orienteer/oposter/model/IChannel.java b/oposter/src/main/java/org/orienteer/oposter/model/IChannel.java index f951cbd..6fcb826 100644 --- a/oposter/src/main/java/org/orienteer/oposter/model/IChannel.java +++ b/oposter/src/main/java/org/orienteer/oposter/model/IChannel.java @@ -9,15 +9,18 @@ import org.orienteer.core.component.FAIconType; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.core.method.IMethodContext; import org.orienteer.core.method.OFilter; import org.orienteer.core.method.OMethod; import org.orienteer.core.method.filters.PlaceFilter; import org.orienteer.core.method.filters.WidgetTypeFilter; import org.orienteer.logger.OLogger; +import org.orienteer.transponder.annotation.EntityProperty; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import com.google.common.base.Throwables; import com.google.inject.ProvidedBy; @@ -26,33 +29,37 @@ * Channel to send content to */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IChannel.CLASS_NAME, domain = OClassDomain.BUSINESS, - isAbstract = true, - parentProperty = "platformApp", - displayable = {"name", "url", "description", "platformApp"}) +@EntityType(value = IChannel.CLASS_NAME, isAbstract = true) +@OrienteerOClass(domain = OClassDomain.BUSINESS, + parentProperty = "platformApp", + displayable = {"name", "url", "description", "platformApp"}) public interface IChannel { public static final String CLASS_NAME = "OPChannel"; public String getName(); public void setName(String name); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_URL_LINK) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_URL_LINK) public String getUrl(); public void setUrl(String value); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) public String getDescription(); public void setDescription(String value); - @DAOField(inverse = "channels", notNull = true, visualization = UIVisualizersRegistry.VISUALIZER_LISTBOX) + @EntityProperty(inverse = "channels") + @OrientDBProperty(notNull = true) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_LISTBOX) public IPlatformApp getPlatformApp(); public void setPlatformApp(IPlatformApp value); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TABLE, inverse = "channels") + @EntityProperty(inverse = "channels") + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TABLE) public List getContent(); public void setContent(List value); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TABLE, inverse = "channel") + @EntityProperty(inverse = "channel") + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TABLE) public List getPostings(); public void setPostings(List value); diff --git a/oposter/src/main/java/org/orienteer/oposter/model/IContent.java b/oposter/src/main/java/org/orienteer/oposter/model/IContent.java index 1367772..e41d10a 100644 --- a/oposter/src/main/java/org/orienteer/oposter/model/IContent.java +++ b/oposter/src/main/java/org/orienteer/oposter/model/IContent.java @@ -10,15 +10,18 @@ import org.orienteer.core.component.BootstrapType; import org.orienteer.core.component.FAIconType; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.core.method.IMethodContext; import org.orienteer.core.method.OFilter; import org.orienteer.core.method.OMethod; import org.orienteer.core.method.filters.PlaceFilter; import org.orienteer.core.method.filters.WidgetTypeFilter; import org.orienteer.oposter.component.attachment.AttachmentsVisualizer; +import org.orienteer.transponder.annotation.EntityProperty; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import com.google.common.base.Splitter; import com.google.common.base.Throwables; @@ -29,28 +32,28 @@ * Content to be distributed to channels */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IContent.CLASS_NAME, - parentProperty = "contentPlan", - displayable = {"title", "when", "published", "created", "contentPlan", "channels"}) +@EntityType(value = IContent.CLASS_NAME) +@OrienteerOClass(parentProperty = "contentPlan", + displayable = {"title", "when", "published", "created", "contentPlan", "channels"}) public interface IContent { public static final String CLASS_NAME = "OPContent"; public String getTitle(); public void setTitle(String title); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) public String getContent(); public void setContent(String value); - @DAOField(type = OType.DATETIME) + @OrientDBProperty(type = OType.DATETIME) public Date getWhen(); public void setWhen(Date value); - @DAOField(defaultValue = "false") - public Boolean isPublished(); - public void setPublished(Boolean published); + @OrientDBProperty(defaultValue = "false") + public boolean isPublished(); + public void setPublished(boolean published); - @DAOField(type = OType.DATETIME, defaultValue = "sysdate()", readOnly = true) + @OrientDBProperty(type = OType.DATETIME, defaultValue = "sysdate()", readOnly = true) public Date getCreated(); public void setCreated(Date value); @@ -59,19 +62,22 @@ public default void published() { setPublished(true); } - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_SUGGEST, inverse = "content") + @EntityProperty(inverse = "content") + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_SUGGEST) public List getChannels(); public void setChannels(List value); - @DAOField(inverse = "content") + @EntityProperty(inverse = "content") public IContentPlan getContentPlan(); public void setContentPlan(IContentPlan value); - @DAOField(inverse = "content", visualization = AttachmentsVisualizer.NAME) + @EntityProperty(inverse = "content") + @OrienteerOProperty(visualization = AttachmentsVisualizer.NAME) public List getImages(); public void setImages(List value); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TABLE, inverse = "content") + @EntityProperty(inverse = "content") + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TABLE) public List getPostings(); public void setPostings(List value); diff --git a/oposter/src/main/java/org/orienteer/oposter/model/IContentPlan.java b/oposter/src/main/java/org/orienteer/oposter/model/IContentPlan.java index 364ba79..8819335 100644 --- a/oposter/src/main/java/org/orienteer/oposter/model/IContentPlan.java +++ b/oposter/src/main/java/org/orienteer/oposter/model/IContentPlan.java @@ -3,9 +3,11 @@ import java.util.List; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; +import org.orienteer.transponder.annotation.EntityProperty; +import org.orienteer.transponder.annotation.EntityType; import com.google.inject.ProvidedBy; @@ -13,20 +15,20 @@ * Content Plan - way to organize content */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value=IContentPlan.CLASS_NAME, - displayable = {"name", "description"}) +@EntityType(IContentPlan.CLASS_NAME) +@OrienteerOClass(displayable = {"name", "description"}) public interface IContentPlan { public static final String CLASS_NAME = "OPContentPlan"; public String getName(); public void setName(String name); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) public String getDescription(); public void setDescription(String value); - - @DAOField(inverse = "contentPlan", visualization = UIVisualizersRegistry.VISUALIZER_TABLE) + @EntityProperty(inverse = "contentPlan") + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TABLE) public List getContent(); public void setContent(List content); } diff --git a/oposter/src/main/java/org/orienteer/oposter/model/IImageAttachment.java b/oposter/src/main/java/org/orienteer/oposter/model/IImageAttachment.java index 0f60b2c..d5cc6d7 100644 --- a/oposter/src/main/java/org/orienteer/oposter/model/IImageAttachment.java +++ b/oposter/src/main/java/org/orienteer/oposter/model/IImageAttachment.java @@ -7,9 +7,10 @@ import org.apache.tika.Tika; import org.apache.wicket.util.string.Strings; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOProperty; +import org.orienteer.transponder.annotation.EntityProperty; +import org.orienteer.transponder.annotation.EntityType; import com.google.common.io.FileBackedOutputStream; import com.google.inject.ProvidedBy; @@ -18,7 +19,7 @@ * OClass for image attachments to a content */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IImageAttachment.CLASS_NAME) +@EntityType(IImageAttachment.CLASS_NAME) public interface IImageAttachment { public static final String CLASS_NAME = "OPImageAttachment"; @@ -34,11 +35,11 @@ public interface IImageAttachment { public Integer getOrder(); public void setOrder(Integer value); - @DAOField(inverse = "images") + @EntityProperty(inverse = "images") public IContent getContent(); public void setContent(IContent value); - @DAOField(hidden = true) + @OrienteerOProperty(hidden = true) public String getTempFilePath(); public void setTempFilePath(String value); diff --git a/oposter/src/main/java/org/orienteer/oposter/model/IOPosterDAO.java b/oposter/src/main/java/org/orienteer/oposter/model/IOPosterDAO.java index 7292b22..f56f3c6 100644 --- a/oposter/src/main/java/org/orienteer/oposter/model/IOPosterDAO.java +++ b/oposter/src/main/java/org/orienteer/oposter/model/IOPosterDAO.java @@ -5,7 +5,7 @@ import org.orienteer.core.dao.DAO; import org.orienteer.core.dao.DAOProvider; -import org.orienteer.core.dao.Query; +import org.orienteer.transponder.annotation.Query; import com.google.inject.ProvidedBy; import com.orientechnologies.orient.core.db.record.OIdentifiable; diff --git a/oposter/src/main/java/org/orienteer/oposter/model/IPlatformApp.java b/oposter/src/main/java/org/orienteer/oposter/model/IPlatformApp.java index b833f6e..905df6c 100644 --- a/oposter/src/main/java/org/orienteer/oposter/model/IPlatformApp.java +++ b/oposter/src/main/java/org/orienteer/oposter/model/IPlatformApp.java @@ -7,10 +7,12 @@ import org.orienteer.core.OClassDomain; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.logger.OLogger; +import org.orienteer.transponder.annotation.EntityProperty; +import org.orienteer.transponder.annotation.EntityType; import com.google.inject.ProvidedBy; import com.orientechnologies.orient.core.record.impl.ODocument; @@ -19,20 +21,21 @@ * Class which holds configuration about connectivity to some social media */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IPlatformApp.CLASS_NAME, domain = OClassDomain.BUSINESS, - isAbstract = true, - displayable = {"name", "description"}) +@EntityType(value = IPlatformApp.CLASS_NAME, isAbstract = true) +@OrienteerOClass(domain = OClassDomain.BUSINESS, + displayable = {"name", "description"}) public interface IPlatformApp { public static final String CLASS_NAME = "OPPlatformApp"; public String getName(); public void setName(String name); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) public String getDescription(); public void setDescription(String value); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TABLE, inverse = "platformApp") + @EntityProperty(inverse = "platformApp") + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TABLE) public List getChannels(); public void setChannels(List value); diff --git a/oposter/src/main/java/org/orienteer/oposter/model/IPosting.java b/oposter/src/main/java/org/orienteer/oposter/model/IPosting.java index 90edf97..ae55da3 100644 --- a/oposter/src/main/java/org/orienteer/oposter/model/IPosting.java +++ b/oposter/src/main/java/org/orienteer/oposter/model/IPosting.java @@ -4,10 +4,13 @@ import org.orienteer.core.component.visualizer.UIVisualizersRegistry; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.oposter.OPUtils; +import org.orienteer.transponder.annotation.EntityProperty; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import com.google.inject.ProvidedBy; import com.orientechnologies.orient.core.metadata.schema.OType; @@ -16,30 +19,30 @@ * {@link IPosting} is an DAO class for storing of facts of postings to a social networks */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IPosting.CLASS_NAME, - displayable = {"content", "channel", "posted", "successful", "url"}, +@EntityType(IPosting.CLASS_NAME) +@OrienteerOClass(displayable = {"content", "channel", "posted", "successful", "url"}, nameProperty = "content", parentProperty = "channel") public interface IPosting { public static final String CLASS_NAME = "OPPosting"; - @DAOField(inverse = "postings") + @EntityProperty(inverse = "postings") public IContent getContent(); public IPosting setContent(IContent value); - @DAOField(inverse = "postings") + @EntityProperty(inverse = "postings") public IChannel getChannel(); public IPosting setChannel(IChannel value); - @DAOField(type = OType.DATETIME, defaultValue = "sysdate()", readOnly = true) + @OrientDBProperty(type = OType.DATETIME, defaultValue = "sysdate()", readOnly = true) public Date getPosted(); public IPosting setPosted(Date value); - @DAOField(notNull = true, defaultValue = "true") + @OrientDBProperty(notNull = true, defaultValue = "true") public boolean isSuccessful(); public IPosting setSuccessful(boolean value); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_URL_LINK) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_URL_LINK) public String getUrl(); public IPosting setUrl(String value); @@ -55,7 +58,7 @@ public default IPosting setExternalPostingId(Object value) { return this; } - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TEXTAREA) public String getMessage(); public IPosting setMessage(String value); diff --git a/oposter/src/main/java/org/orienteer/oposter/ok/IOkApp.java b/oposter/src/main/java/org/orienteer/oposter/ok/IOkApp.java index 42b4092..51c5b6c 100644 --- a/oposter/src/main/java/org/orienteer/oposter/ok/IOkApp.java +++ b/oposter/src/main/java/org/orienteer/oposter/ok/IOkApp.java @@ -12,9 +12,9 @@ import org.orienteer.core.OClassDomain; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.logger.OLogger; import org.orienteer.oposter.OPUtils; import org.orienteer.oposter.model.IChannel; @@ -24,6 +24,8 @@ import org.orienteer.oposter.model.IPlatformApp; import org.orienteer.oposter.model.IPosting; import org.orienteer.oposter.web.OAuthCallbackResource; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,20 +47,22 @@ * {@link IPlatformApp} for Odnoklassniki */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IOkApp.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = IOkApp.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface IOkApp extends IPlatformApp { public static final Logger LOG = LoggerFactory.getLogger(IOkApp.class); public static final String CLASS_NAME = "OPOkApp"; - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public Long getAppId(); public void setAppId(Long value); - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public String getPublicKey(); public void setPublicKey(String value); - @DAOField(notNull = true, visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) + @OrientDBProperty(notNull = true) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) public String getSecretKey(); public void setSecretKey(String value); diff --git a/oposter/src/main/java/org/orienteer/oposter/ok/IOkChannel.java b/oposter/src/main/java/org/orienteer/oposter/ok/IOkChannel.java index c28fc06..cb59122 100644 --- a/oposter/src/main/java/org/orienteer/oposter/ok/IOkChannel.java +++ b/oposter/src/main/java/org/orienteer/oposter/ok/IOkChannel.java @@ -9,8 +9,8 @@ import org.orienteer.core.component.BootstrapType; import org.orienteer.core.component.FAIconType; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; import org.orienteer.core.method.IMethodContext; import org.orienteer.core.method.OFilter; import org.orienteer.core.method.OMethod; @@ -21,6 +21,7 @@ import org.orienteer.oposter.model.IChannel; import org.orienteer.oposter.model.IOAuthReciever; import org.orienteer.oposter.model.IPlatformApp; +import org.orienteer.transponder.annotation.EntityType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,7 +34,8 @@ * {@link IChannel} which user, group or page in Odnoklassniki */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IOkChannel.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = IOkChannel.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface IOkChannel extends IChannel, IOAuthReciever { public static final String CLASS_NAME = "OPOkChannel"; public static final Logger LOG = LoggerFactory.getLogger(IOkChannel.class); diff --git a/oposter/src/main/java/org/orienteer/oposter/telegram/ITelegramBot.java b/oposter/src/main/java/org/orienteer/oposter/telegram/ITelegramBot.java index 28be303..69c6791 100644 --- a/oposter/src/main/java/org/orienteer/oposter/telegram/ITelegramBot.java +++ b/oposter/src/main/java/org/orienteer/oposter/telegram/ITelegramBot.java @@ -8,14 +8,16 @@ import org.orienteer.core.OClassDomain; import org.orienteer.core.OrienteerWebApplication; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; import org.orienteer.oposter.model.IChannel; import org.orienteer.oposter.model.IContent; import org.orienteer.oposter.model.IImageAttachment; import org.orienteer.oposter.model.IPlatformApp; import org.orienteer.oposter.model.IPosting; +import org.orienteer.transponder.annotation.EntityProperty; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,12 +38,13 @@ * {@link IPlatformApp} for Telegram */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = ITelegramBot.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = ITelegramBot.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface ITelegramBot extends IPlatformApp { public static final Logger LOG = LoggerFactory.getLogger(ITelegramBot.class); public static final String CLASS_NAME = "OPTelegramBot"; - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public String getToken(); public void setToken(String value); diff --git a/oposter/src/main/java/org/orienteer/oposter/telegram/ITelegramChannel.java b/oposter/src/main/java/org/orienteer/oposter/telegram/ITelegramChannel.java index 502e52e..cdb2e3a 100644 --- a/oposter/src/main/java/org/orienteer/oposter/telegram/ITelegramChannel.java +++ b/oposter/src/main/java/org/orienteer/oposter/telegram/ITelegramChannel.java @@ -1,10 +1,11 @@ package org.orienteer.oposter.telegram; import org.orienteer.core.OClassDomain; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; import org.orienteer.oposter.model.IChannel; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import com.google.inject.ProvidedBy; @@ -12,11 +13,12 @@ * {@link IChannel} for Telegram */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = ITelegramChannel.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = ITelegramChannel.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface ITelegramChannel extends IChannel { public static final String CLASS_NAME = "OPTelegramChannel"; - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public String getTelegramChatId(); public void setTelegramChatId(String value); diff --git a/oposter/src/main/java/org/orienteer/oposter/twitter/ITwitterAccount.java b/oposter/src/main/java/org/orienteer/oposter/twitter/ITwitterAccount.java index d689efd..4f82bf8 100644 --- a/oposter/src/main/java/org/orienteer/oposter/twitter/ITwitterAccount.java +++ b/oposter/src/main/java/org/orienteer/oposter/twitter/ITwitterAccount.java @@ -14,9 +14,9 @@ import org.orienteer.core.component.FAIconType; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.core.method.IMethodContext; import org.orienteer.core.method.OFilter; import org.orienteer.core.method.OMethod; @@ -27,6 +27,7 @@ import org.orienteer.logger.OLogger; import org.orienteer.oposter.model.IChannel; import org.orienteer.oposter.model.IOAuthReciever; +import org.orienteer.transponder.annotation.EntityType; import com.github.scribejava.core.model.OAuth1AccessToken; import com.github.scribejava.core.model.OAuth1RequestToken; @@ -37,7 +38,8 @@ * {@link IChannel} which represents twitter account */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = ITwitterAccount.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = ITwitterAccount.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface ITwitterAccount extends IChannel, IOAuthReciever { public static final String CLASS_NAME = "OPTwitterAccount"; public static final MetaDataKey REQUEST_TOKEN_KEY = new MetaDataKey() {}; @@ -45,7 +47,7 @@ public interface ITwitterAccount extends IChannel, IOAuthReciever { public String getAccessToken(); public void setAccessToken(String value); - @DAOField(visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) public String getAccessTokenSecret(); public void setAccessTokenSecret(String value); diff --git a/oposter/src/main/java/org/orienteer/oposter/twitter/ITwitterApp.java b/oposter/src/main/java/org/orienteer/oposter/twitter/ITwitterApp.java index 18194ae..7780c48 100644 --- a/oposter/src/main/java/org/orienteer/oposter/twitter/ITwitterApp.java +++ b/oposter/src/main/java/org/orienteer/oposter/twitter/ITwitterApp.java @@ -11,9 +11,9 @@ import org.orienteer.core.OrienteerWebApplication; import org.orienteer.core.component.visualizer.UIVisualizersRegistry; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; +import org.orienteer.core.dao.OrienteerOProperty; import org.orienteer.logger.OLogger; import org.orienteer.oposter.model.IChannel; import org.orienteer.oposter.model.IContent; @@ -21,6 +21,8 @@ import org.orienteer.oposter.model.IPlatformApp; import org.orienteer.oposter.model.IPosting; import org.orienteer.oposter.web.OAuthCallbackResource; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import com.github.redouane59.twitter.TwitterClient; import com.github.redouane59.twitter.dto.tweet.MediaCategory; @@ -38,15 +40,17 @@ * key and secret key configured on app document */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = ITwitterApp.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = ITwitterApp.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface ITwitterApp extends IPlatformApp { public static final String CLASS_NAME = "OPTwitterApp"; - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public String getApiKey(); public void setApiKey(String value); - @DAOField(notNull = true, visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) + @OrientDBProperty(notNull = true) + @OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_PASSWORD) public String getApiSecretKey(); public void setApiSecretKey(String value); diff --git a/oposter/src/main/java/org/orienteer/oposter/vk/IVkApp.java b/oposter/src/main/java/org/orienteer/oposter/vk/IVkApp.java index ac23726..3c7472f 100644 --- a/oposter/src/main/java/org/orienteer/oposter/vk/IVkApp.java +++ b/oposter/src/main/java/org/orienteer/oposter/vk/IVkApp.java @@ -14,9 +14,8 @@ import org.orienteer.core.component.BootstrapType; import org.orienteer.core.component.FAIconType; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; import org.orienteer.core.method.IMethodContext; import org.orienteer.core.method.OFilter; import org.orienteer.core.method.OMethod; @@ -30,6 +29,8 @@ import org.orienteer.oposter.model.IPlatformApp; import org.orienteer.oposter.model.IPosting; import org.orienteer.oposter.web.OAuthCallbackResource; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import com.github.scribejava.apis.VkontakteApi; import com.github.scribejava.core.builder.ServiceBuilder; @@ -52,23 +53,24 @@ * {@link IPlatformApp} for VKontakte */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IVkApp.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = IVkApp.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface IVkApp extends IPlatformApp, IOAuthReciever { public static final MetaDataKey VK_APP_KEY = new MetaDataKey() {}; public static final String CLASS_NAME = "OPVkApp"; - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public Integer getAppId(); public void setAppId(Integer value); - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public String getAppSecret(); public void setAppSecret(String value); - @DAOField(notNull = true) + @OrientDBProperty(notNull = true) public String getServiceToken(); public void setServiceToken(String value); diff --git a/oposter/src/main/java/org/orienteer/oposter/vk/IVkWall.java b/oposter/src/main/java/org/orienteer/oposter/vk/IVkWall.java index 9b44979..ec0e310 100644 --- a/oposter/src/main/java/org/orienteer/oposter/vk/IVkWall.java +++ b/oposter/src/main/java/org/orienteer/oposter/vk/IVkWall.java @@ -10,9 +10,8 @@ import org.orienteer.core.component.BootstrapType; import org.orienteer.core.component.FAIconType; import org.orienteer.core.dao.DAO; -import org.orienteer.core.dao.DAOField; -import org.orienteer.core.dao.DAOOClass; import org.orienteer.core.dao.ODocumentWrapperProvider; +import org.orienteer.core.dao.OrienteerOClass; import org.orienteer.core.method.IMethodContext; import org.orienteer.core.method.OFilter; import org.orienteer.core.method.OMethod; @@ -24,6 +23,9 @@ import org.orienteer.oposter.model.IContent; import org.orienteer.oposter.model.IOAuthReciever; import org.orienteer.oposter.model.IPlatformApp; +import org.orienteer.transponder.annotation.DefaultValue; +import org.orienteer.transponder.annotation.EntityType; +import org.orienteer.transponder.orientdb.OrientDBProperty; import com.github.scribejava.core.oauth.OAuth20Service; import com.google.common.base.Throwables; @@ -34,16 +36,18 @@ * {@link IChannel} for VKontakte */ @ProvidedBy(ODocumentWrapperProvider.class) -@DAOOClass(value = IVkWall.CLASS_NAME, domain = OClassDomain.SPECIFICATION, orderOffset = 100) +@EntityType(value = IVkWall.CLASS_NAME, orderOffset = 100) +@OrienteerOClass(domain = OClassDomain.SPECIFICATION) public interface IVkWall extends IChannel, IOAuthReciever { public static final String CLASS_NAME = "OPVkWall"; public Long getOwnerId(); public void setOwnerId(Long value); - @DAOField(defaultValue = "true") - public Boolean isCommunity(); - public void setCommunity(Boolean value); + @OrientDBProperty(defaultValue = "true") + @DefaultValue("true") + public boolean isCommunity(); + public void setCommunity(boolean value); public Long getUserId(); public void setUserId(Long value); @@ -53,7 +57,7 @@ public interface IVkWall extends IChannel, IOAuthReciever { public default Long getAdjustedOwnerId() { Long ownerId = getOwnerId(); - if(ownerId!=null && Boolean.TRUE.equals(isCommunity())) return -ownerId; + if(ownerId!=null && isCommunity()) return -ownerId; else return ownerId; }