Commit 62d456c1 authored by Elias Englmeier's avatar Elias Englmeier
Browse files

new service builder for projects. New iteration of the ideas-service

parent a142d90f
......@@ -87,6 +87,7 @@ $(document).ready(function(){
if (!data) {
return;
}
console.log(themeDisplay);
//post to db
Liferay.Service(
'/idea.ideas/insert-new-idea',
......@@ -102,7 +103,9 @@ $(document).ready(function(){
published: true,
showOnMap: true,
groupId: themeDisplay.getScopeGroupId(),
rating : 6
rating : 6,
projectIdRef: themeDisplay.getLayoutId(),
titleFileRef: 0
},
function(obj) {
var response = jQuery.parseJSON(obj)
......
......@@ -87,6 +87,7 @@ $(document).ready(function(){
if (!data) {
return;
}
console.log(themeDisplay);
//post to db
Liferay.Service(
'/idea.ideas/insert-new-idea',
......@@ -102,7 +103,9 @@ $(document).ready(function(){
published: true,
showOnMap: true,
groupId: themeDisplay.getScopeGroupId(),
rating : 6
rating : 6,
projectIdRef: themeDisplay.getLayoutId(),
titleFileRef: 0
},
function(obj) {
var response = jQuery.parseJSON(obj)
......
......@@ -75,14 +75,15 @@ public class IdeaBoardPortlet extends MVCPortlet {
public void insertNewIdea(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, SystemException, IOException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(
Ideas.class.getName(), actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
String title = ParamUtil.getString(actionRequest, "title");
String description = ParamUtil.getString(actionRequest, "description");
String shortDescription = ParamUtil.getString(actionRequest, "short description");
Ideas nextIdea = IdeasLocalServiceUtil.creadeIdeasWithAutomatedDbId(title, serviceContext.getUserId(),serviceContext.getScopeGroupId(),
null, null, shortDescription, description, 0.0, 0.0, true, false,0);
null, null, shortDescription, description, 0.0, 0.0, true, false,0,themeDisplay.getLayout().getPrimaryKey(),0L);
IdeasLocalServiceUtil.persistIdeasAndPerformTypeChecks(nextIdea);
//Redirect to avoid duplicate submissions
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
actionResponse.sendRedirect(PortalUtil.getLayoutURL(themeDisplay.getLayout(),themeDisplay));
}
......
......@@ -350,6 +350,34 @@ public interface IdeasModel extends BaseModel<Ideas>, GroupedModel, ShardedModel
*/
public void setRating(int rating);
/**
* Returns the project ref of this ideas.
*
* @return the project ref of this ideas
*/
public long getProjectRef();
/**
* Sets the project ref of this ideas.
*
* @param projectRef the project ref of this ideas
*/
public void setProjectRef(long projectRef);
/**
* Returns the title file ref of this ideas.
*
* @return the title file ref of this ideas
*/
public long getTitleFileRef();
/**
* Sets the title file ref of this ideas.
*
* @param titleFileRef the title file ref of this ideas
*/
public void setTitleFileRef(long titleFileRef);
@Override
public boolean isNew();
......
......@@ -51,6 +51,8 @@ public class IdeasSoap implements Serializable {
soapModel.setPublished(model.getPublished());
soapModel.setIsVisibleOnMap(model.getIsVisibleOnMap());
soapModel.setRating(model.getRating());
soapModel.setProjectRef(model.getProjectRef());
soapModel.setTitleFileRef(model.getTitleFileRef());
return soapModel;
}
......@@ -247,6 +249,22 @@ public class IdeasSoap implements Serializable {
_rating = rating;
}
public long getProjectRef() {
return _projectRef;
}
public void setProjectRef(long projectRef) {
_projectRef = projectRef;
}
public long getTitleFileRef() {
return _titleFileRef;
}
public void setTitleFileRef(long titleFileRef) {
_titleFileRef = titleFileRef;
}
private long _ideasId;
private long _companyId;
private long _userId;
......@@ -264,4 +282,6 @@ public class IdeasSoap implements Serializable {
private boolean _published;
private boolean _isVisibleOnMap;
private int _rating;
private long _projectRef;
private long _titleFileRef;
}
\ No newline at end of file
......@@ -74,6 +74,8 @@ public class IdeasWrapper implements Ideas, ModelWrapper<Ideas> {
attributes.put("published", getPublished());
attributes.put("isVisibleOnMap", getIsVisibleOnMap());
attributes.put("rating", getRating());
attributes.put("projectRef", getProjectRef());
attributes.put("titleFileRef", getTitleFileRef());
return attributes;
}
......@@ -181,6 +183,18 @@ public class IdeasWrapper implements Ideas, ModelWrapper<Ideas> {
if (rating != null) {
setRating(rating);
}
Long projectRef = (Long)attributes.get("projectRef");
if (projectRef != null) {
setProjectRef(projectRef);
}
Long titleFileRef = (Long)attributes.get("titleFileRef");
if (titleFileRef != null) {
setTitleFileRef(titleFileRef);
}
}
/**
......@@ -448,6 +462,26 @@ public class IdeasWrapper implements Ideas, ModelWrapper<Ideas> {
return _ideas.getPrimaryKey();
}
/**
* Returns the project ref of this ideas.
*
* @return the project ref of this ideas
*/
@Override
public long getProjectRef() {
return _ideas.getProjectRef();
}
/**
* Returns the title file ref of this ideas.
*
* @return the title file ref of this ideas
*/
@Override
public long getTitleFileRef() {
return _ideas.getTitleFileRef();
}
/**
* Returns the user ID of this ideas.
*
......@@ -614,6 +648,16 @@ public class IdeasWrapper implements Ideas, ModelWrapper<Ideas> {
_ideas.setPrimaryKeyObj(primaryKeyObj);
}
/**
* Sets the project ref of this ideas.
*
* @param projectRef the project ref of this ideas
*/
@Override
public void setProjectRef(long projectRef) {
_ideas.setProjectRef(projectRef);
}
/**
* Sets whether this ideas is published.
*
......@@ -654,6 +698,16 @@ public class IdeasWrapper implements Ideas, ModelWrapper<Ideas> {
_ideas.setTitle(title);
}
/**
* Sets the title file ref of this ideas.
*
* @param titleFileRef the title file ref of this ideas
*/
@Override
public void setTitleFileRef(long titleFileRef) {
_ideas.setTitleFileRef(titleFileRef);
}
/**
* Sets the user ID of this ideas.
*
......
......@@ -99,7 +99,8 @@ public interface IdeasLocalService extends BaseLocalService,
long userId, long groupId, java.lang.String type,
java.lang.String icon, java.lang.String shortDescription,
java.lang.String description, double latitude, double longitude,
boolean published, boolean showOnMap, int rating);
boolean published, boolean showOnMap, int rating, long projectIdRef,
long titleFileRef);
/**
* Creates a new ideas with the primary key. Does not add the ideas to the database.
......@@ -210,6 +211,13 @@ public interface IdeasLocalService extends BaseLocalService,
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public List<Ideas> getAllIdeas();
/**
* @param projectId the project id
* @return all Ideas with projectRef == projectId
*/
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public List<Ideas> getAllIdeasForProject(long projectId);
/**
* Finds all ideas with Category cat.
*
......
......@@ -88,11 +88,11 @@ public class IdeasLocalServiceUtil {
java.lang.String type, java.lang.String icon,
java.lang.String shortDescription, java.lang.String description,
double latitude, double longitude, boolean published,
boolean showOnMap, int rating) {
boolean showOnMap, int rating, long projectIdRef, long titleFileRef) {
return getService()
.creadeIdeasWithAutomatedDbId(title, userId, groupId, type,
icon, shortDescription, description, latitude, longitude,
published, showOnMap, rating);
published, showOnMap, rating, projectIdRef, titleFileRef);
}
/**
......@@ -230,6 +230,15 @@ public class IdeasLocalServiceUtil {
return getService().getAllIdeas();
}
/**
* @param projectId the project id
* @return all Ideas with projectRef == projectId
*/
public static java.util.List<ideaService.model.Ideas> getAllIdeasForProject(
long projectId) {
return getService().getAllIdeasForProject(projectId);
}
/**
* Finds all ideas with Category cat.
*
......
......@@ -85,10 +85,10 @@ public class IdeasLocalServiceWrapper implements IdeasLocalService,
java.lang.String type, java.lang.String icon,
java.lang.String shortDescription, java.lang.String description,
double latitude, double longitude, boolean published,
boolean showOnMap, int rating) {
boolean showOnMap, int rating, long projectIdRef, long titleFileRef) {
return _ideasLocalService.creadeIdeasWithAutomatedDbId(title, userId,
groupId, type, icon, shortDescription, description, latitude,
longitude, published, showOnMap, rating);
longitude, published, showOnMap, rating, projectIdRef, titleFileRef);
}
/**
......@@ -236,6 +236,16 @@ public class IdeasLocalServiceWrapper implements IdeasLocalService,
return _ideasLocalService.getAllIdeas();
}
/**
* @param projectId the project id
* @return all Ideas with projectRef == projectId
*/
@Override
public java.util.List<ideaService.model.Ideas> getAllIdeasForProject(
long projectId) {
return _ideasLocalService.getAllIdeasForProject(projectId);
}
/**
* Finds all ideas with Category cat.
*
......
......@@ -113,7 +113,8 @@ public interface IdeasService extends BaseService {
java.lang.String category, long userId, java.lang.String icon,
java.lang.String shortDescription, java.lang.String description,
double latitude, double longitude, boolean published,
boolean showOnMap, long groupId, int rating);
boolean showOnMap, long groupId, int rating, long projectIdRef,
long titleFileRef);
@JSONWebService(method = "GET")
public java.lang.String seachIdeasByFieldArray(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment