Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get Element from public space #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,22 @@ public Response<Collection<CollaborationElement>> listElements(SessionContext co
public Response<CollaborationElement> getElement(SessionContext context,
ElementContext elementContext,
Namespace namespace, Id elementId) {
return new Response<>(elementPrivateStore.get(context, elementContext, elementId)
.map(elementEntity -> ZusammenPluginUtil
.convertToCollaborationElement(elementContext, elementEntity))
.orElse(null));
return getElement(context, Space.PRIVATE, elementContext, namespace, elementId);
}

@Override
public Response<CollaborationElement> getElement(SessionContext context, Space space, ElementContext elementContext,
Namespace namespace, Id elementId) {
if(space == Space.PRIVATE) {
return new Response<>(elementPrivateStore.get(context, elementContext, elementId)
.map(elementEntity -> ZusammenPluginUtil
.convertToCollaborationElement(elementContext, elementEntity))
.orElse(null));
}
return new Response<>(elementPublicStore.get(context, elementContext, elementId)
.map(elementEntity -> ZusammenPluginUtil
.convertToCollaborationElement(elementContext, elementEntity))
.orElse(null));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import com.amdocs.zusammen.datatypes.response.Response;
import com.amdocs.zusammen.plugin.ZusammenPluginUtil;
import com.amdocs.zusammen.plugin.collaboration.ElementPrivateStore;
import com.amdocs.zusammen.plugin.collaboration.ElementPublicStore;
import com.amdocs.zusammen.plugin.collaboration.impl.ElementPrivateStoreImpl;
import com.amdocs.zusammen.plugin.collaboration.impl.ElementPublicStoreImpl;
import com.amdocs.zusammen.plugin.dao.ElementRepository;
import com.amdocs.zusammen.plugin.dao.ElementRepositoryFactory;
import com.amdocs.zusammen.plugin.dao.VersionDao;
Expand All @@ -47,6 +49,7 @@
public class CassandraStateStorePluginImpl extends StateStoreImpl {

private ElementPrivateStore elementPrivateStore = new ElementPrivateStoreImpl();
private ElementPublicStore elementPublicStore = new ElementPublicStoreImpl();

@Override
public Response<Void> deleteItem(SessionContext context, Id itemId) {
Expand Down Expand Up @@ -144,10 +147,20 @@ public Response<Collection<StateElement>> listElements(SessionContext context,
@Override
public Response<StateElement> getElement(SessionContext context, ElementContext elementContext,
Id elementId) {
return getElement(context, Space.PRIVATE, elementContext, elementId);
}

return new Response(elementPrivateStore.get(context, elementContext, elementId)
.map(elementEntity -> ZusammenPluginUtil.getStateElement(elementContext, elementEntity))
.orElse(null));
@Override
public Response<StateElement> getElement(SessionContext context, Space space, ElementContext elementContext,
Id elementId) {
if (space == Space.PRIVATE) {
return new Response(elementPrivateStore.get(context, elementContext, elementId)
.map(elementEntity -> ZusammenPluginUtil.getStateElement(elementContext, elementEntity))
.orElse(null));
}
return new Response(elementPublicStore.get(context, elementContext, elementId)
.map(elementEntity -> ZusammenPluginUtil.getStateElement(elementContext, elementEntity))
.orElse(null));
}

private ItemVersion getItemVersion(SessionContext context, String spaceName, Id itemId,
Expand Down