com.greenpepper.confluence.actions.AbstractGreenPepperAction Maven / Gradle / Ivy
package com.greenpepper.confluence.actions;
import java.io.UnsupportedEncodingException;
import java.util.List;
import com.atlassian.confluence.core.ConfluenceActionSupport;
import com.atlassian.confluence.pages.Page;
import com.atlassian.confluence.velocity.htmlsafe.HtmlSafe;
import com.greenpepper.confluence.velocity.ConfluenceGreenPepper;
/**
* Abstract AbstractGreenPepperAction class.
*
* @author oaouattara
* @version $Id: $Id
*/
public abstract class AbstractGreenPepperAction extends ConfluenceActionSupport
{
protected ConfluenceGreenPepper gpUtil = new ConfluenceGreenPepper();
protected String bulkUID = "PAGE";
protected String executionUID;
protected int fieldId;
protected String spaceKey;
protected Long pageId;
protected Page page;
protected Boolean canEdit;
protected boolean refreshAll;
protected boolean isEditMode;
private String pageConent;
/**
* Getter for the field bulkUID
.
*
* @return a {@link java.lang.String} object.
*/
public String getBulkUID()
{
return bulkUID;
}
/**
* Setter for the field bulkUID
.
*
* @param bulkUID a {@link java.lang.String} object.
*/
public void setBulkUID(String bulkUID)
{
this.bulkUID = bulkUID;
}
/**
* Getter for the field executionUID
.
*
* @return a {@link java.lang.String} object.
*/
public String getExecutionUID()
{
return executionUID;
}
/**
* Setter for the field executionUID
.
*
* @param executionUID a {@link java.lang.String} object.
*/
public void setExecutionUID(String executionUID)
{
this.executionUID = executionUID;
}
/**
* Getter for the field fieldId
.
*
* @return a int.
*/
public int getFieldId()
{
return fieldId;
}
/**
* Setter for the field fieldId
.
*
* @param fieldId a int.
*/
public void setFieldId(int fieldId)
{
this.fieldId = fieldId;
}
/**
* Getter for the field page
.
*
* @return a {@link com.atlassian.confluence.pages.Page} object.
*/
public Page getPage()
{
return page;
}
/**
* Setter for the field page
.
*
* @param page a {@link com.atlassian.confluence.pages.Page} object.
*/
public void setPage(Page page)
{
this.page = page;
}
/**
* Getter for the field spaceKey
.
*
* @return a {@link java.lang.String} object.
*/
public String getSpaceKey()
{
return this.spaceKey;
}
/**
* Setter for the field spaceKey
.
*
* @param spaceKey a {@link java.lang.String} object.
*/
public void setSpaceKey(String spaceKey)
{
this.spaceKey = spaceKey;
}
/**
* Getter for the field pageId
.
*
* @return a {@link java.lang.Long} object.
*/
public Long getPageId()
{
return this.pageId;
}
/**
* Setter for the field pageId
.
*
* @param pageId a {@link java.lang.Long} object.
* @throws java.io.UnsupportedEncodingException if any.
*/
public void setPageId(Long pageId) throws UnsupportedEncodingException
{
page = gpUtil.getPageManager().getPage(pageId);
this.pageId = pageId;
}
/**
* Getter for the field isEditMode
.
*
* @return a boolean.
*/
public boolean getIsEditMode()
{
return this.isEditMode;
}
/**
* Setter for the field isEditMode
.
*
* @param isEditMode a boolean.
*/
public void setIsEditMode(boolean isEditMode)
{
this.isEditMode = isEditMode;
}
/**
* Getter for the field refreshAll
.
*
* @return a boolean.
*/
public boolean getRefreshAll()
{
return refreshAll;
}
/**
* Setter for the field refreshAll
.
*
* @param refreshAll a boolean.
*/
public void setRefreshAll(boolean refreshAll)
{
this.refreshAll = refreshAll;
}
/**
* getPageContent.
*
* @return a {@link java.lang.String} object.
*/
public String getPageContent()
{
if(pageConent != null){return pageConent;}
pageConent = gpUtil.getPageContent(page);
return pageConent;
}
/**
* getPermittedChildren.
*
* @param page a {@link com.atlassian.confluence.pages.Page} object.
* @return a {@link java.util.List} object.
*/
@SuppressWarnings("unchecked")
public List getPermittedChildren(Page page)
{
return gpUtil.getContentPermissionManager().getPermittedChildren(page, getRemoteUser());
}
/** {@inheritDoc} */
@HtmlSafe
public String getText(String key)
{
return gpUtil.getText(key);
}
/**
* Getter for the field canEdit
.
*
* @return a boolean.
*/
public boolean getCanEdit()
{
if(canEdit != null) return canEdit;
canEdit = gpUtil.canEdit(page);
return canEdit;
}
/**
* Setter for the field canEdit
.
*
* @param canEdit a boolean.
*/
public void setCanEdit(boolean canEdit)
{
this.canEdit = canEdit;
}
/** {@inheritDoc} */
public void addActionError(String msg)
{
if(!hasActionErrors())
super.addActionError(msg);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy