Skip to content

Commit

Permalink
Adopt OPoster to Transponder
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomYdn committed Nov 7, 2021
1 parent 639d3b0 commit cabccb1
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);

Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
29 changes: 18 additions & 11 deletions oposter/src/main/java/org/orienteer/oposter/model/IChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<IContent> getContent();
public void setContent(List<IContent> value);

@DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TABLE, inverse = "channel")
@EntityProperty(inverse = "channel")
@OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TABLE)
public List<IPosting> getPostings();
public void setPostings(List<IPosting> value);

Expand Down
36 changes: 21 additions & 15 deletions oposter/src/main/java/org/orienteer/oposter/model/IContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -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<IChannel> getChannels();
public void setChannels(List<IChannel> 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<IImageAttachment> getImages();
public void setImages(List<IImageAttachment> value);

@DAOField(visualization = UIVisualizersRegistry.VISUALIZER_TABLE, inverse = "content")
@EntityProperty(inverse = "content")
@OrienteerOProperty(visualization = UIVisualizersRegistry.VISUALIZER_TABLE)
public List<IPosting> getPostings();
public void setPostings(List<IPosting> value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,32 @@
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;

/**
* 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<IContent> getContent();
public void setContent(List<IContent> content);
}
Loading

0 comments on commit cabccb1

Please sign in to comment.