Java Code Examples for com.opensymphony.xwork2.Action#SUCCESS

The following examples show how to use com.opensymphony.xwork2.Action#SUCCESS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentThreadConfigContentTypesAction.java    From entando-components with GNU Lesser General Public License v3.0 6 votes vote down vote up
public String removeContentType() {
    try {
        List<ContentTypeElem> config = this.getTypes();

        if (StringUtils.isNotBlank(this.getContentType())) {
            ContentTypeElem elem = null;
            for (ContentTypeElem contentTypeElem : config) {
                if (contentTypeElem.getContentType().equalsIgnoreCase(this.getContentType())) {
                    elem = contentTypeElem;
                    break;
                }
            }
            if (null != elem) {
                config.remove(elem);
            }
        }
        this.setConfigItemOnSession(config);

        this.addActionMessage(this.getText("jpcontentscheduler.removeContentType.success"));
    } catch (Throwable t) {
        _logger.error("Error in removeContentType", t);
        return FAILURE;
    }
    return Action.SUCCESS;
}
 
Example 2
Source File: ContentThreadConfigUsersAction.java    From entando-components with GNU Lesser General Public License v3.0 6 votes vote down vote up
public String saveUsersContentType() {
	try {
		String selectedUser = this.getRequest().getParameter("user");
		if (StringUtils.isBlank(selectedUser)) {
			selectedUser = this.getUsername();
		}

		Map<String, List<String>> config = this.getUsersContentType();

		if (null == config.get(username) || config.get(selectedUser).isEmpty()) {
			this.addActionError(this.getText("jpcontentscheduler.error.contentTypes.empty"));
			return INPUT;
		}

	} catch (Throwable t) {
		_logger.error("Error in saveUsersContentType", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 3
Source File: ContentThreadConfigUsersAction.java    From entando-components with GNU Lesser General Public License v3.0 6 votes vote down vote up
public String removeUser() {
	try {
		Map<String, List<String>> config = this.getUsersContentType();
		boolean isValidInput = this.validateRemoveUser();
		if (this.hasErrors()) {
			return INPUT;
		}
		if (isValidInput) {

			if (!config.containsKey(this.getUsername())) {
				return Action.SUCCESS;
			}
			config.remove(this.getUsername());
			this.setConfigItemOnSession(config);

			this.addActionMessage(this.getText("jpcontentscheduler.removeContentType.success"));
		}

	} catch (Throwable t) {
		_logger.error("Error in removeContentType", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 4
Source File: ContentThreadConfigContentTypesAction.java    From entando-components with GNU Lesser General Public License v3.0 6 votes vote down vote up
public String entryContentType() {

        String contentTypeParam = this.getRequest().getParameter("contentType");
        if (StringUtils.isNotBlank(contentTypeParam)) {
            List<ContentTypeElem> types = this.getTypes();
            ContentTypeElem elem = null;
            for (ContentTypeElem contentTypeElem : types) {
                if (contentTypeElem.getContentType().equalsIgnoreCase(this.getContentType())) {
                    if (contentTypeElem.getContentType().equalsIgnoreCase(contentTypeParam)) {
                        elem = contentTypeElem;
                        break;
                    }

                }
            }
            this.setCategoryCodes(elem.getIdsCategories());
            this.setContentTypeElem(elem);
        }

        return Action.SUCCESS;
    }
 
Example 5
Source File: ContentThreadConfigContentTypesAction.java    From entando-components with GNU Lesser General Public License v3.0 6 votes vote down vote up
public String addContentType() {
    try {
        boolean alreadyExist = false;
        List<ContentTypeElem> config = this.getTypes();
        ContentTypeElem elem = this.getContentTypeElem();
        elem.setIdsCategories(this.getCategoryCodes());
        ContentTypeElem existingElem = null;
        for (int i = 0; i < config.size(); i++) {
            if (config.get(i).getContentType().equalsIgnoreCase(elem.getContentType())) {
                alreadyExist = true;
                config.set(i, elem);
                break;
            }
        }
        if (!alreadyExist) {
            config.add(elem);
        }

        this.setConfigItemOnSession(config);

    } catch (Throwable t) {
        _logger.error("Error in addContentType", t);
        return FAILURE;
    }
    return Action.SUCCESS;
}
 
Example 6
Source File: ContentThreadConfigGroupsAction.java    From entando-components with GNU Lesser General Public License v3.0 6 votes vote down vote up
public String removeContentType() {
	try {
		Map<String, List<String>> config = this.getGroupsContentType();
		boolean isValidInput = this.validateAdd();
		if (this.hasErrors()) {
			return INPUT;
		}
		if (isValidInput) {

			if (!config.containsKey(this.getGroupName())) {
				return Action.SUCCESS;
			}
			if (config.get(this.getGroupName()).contains(this.getContentType())) {
				config.get(this.getGroupName()).remove(this.getContentType());
			}
			this.setConfigItemOnSession(config);
		}

	} catch (Throwable t) {
		_logger.error("Error in removeContentType", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 7
Source File: ContentThreadConfigGroupsAction.java    From entando-components with GNU Lesser General Public License v3.0 6 votes vote down vote up
public String removeGroup() {
	try {
		Map<String, List<String>> config = this.getGroupsContentType();
		boolean isValidInput = this.validateAdd();
		if (this.hasErrors()) {
			return INPUT;
		}
		if (isValidInput) {

			if (!config.containsKey(this.getGroupName())) {
				return Action.SUCCESS;
			}
			if (config.get(this.getGroupName()).contains(this.getContentType())) {
				config.get(this.getGroupName()).remove(this.getContentType());
			}
			this.setConfigItemOnSession(config);
		}

	} catch (Throwable t) {
		_logger.error("Error in removeContentType", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 8
Source File: ContentThreadConfigContentTypesAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String saveContentTypeItem() {
    try {
        ContentThreadConfig config = this.getContentSchedulerManager().getConfig();
        config.setTypesList(this.getTypes());

        this.getContentSchedulerManager().updateConfig(config);

        this.addActionMessage(this.getText("jpcontentscheduler.saveItem.success"));
    } catch (Throwable t) {
        _logger.error("Error saving ContentTypeItem", t);
        return FAILURE;
    }
    return Action.SUCCESS;
}
 
Example 9
Source File: ActionLoggerAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String delete() {
	try {
		this.getActionLogManager().deleteActionRecord(this.getId());
	} catch (Throwable t) {
		_logger.error("error in delete", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 10
Source File: ConfigAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String viewEmail() {
	try {
		this.setConfigOnSession();
	} catch (Throwable t) {
		_logger.error("Error in viewEmail", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 11
Source File: ConfigAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String viewContentTypes() {
	try {
		this.setConfigOnSession();
	} catch (Throwable t) {
		_logger.error("Error in viewContentTypes", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 12
Source File: ConfigAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String viewUsers() {
	try {
		this.setConfigOnSession();
	} catch (Throwable t) {
		_logger.error("Error in viewUsers", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 13
Source File: ContentThreadConfigEmailAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String saveItem() {
	try {

		ContentThreadConfig config = this.getContentSchedulerManager().getConfig();

		config.setSenderCode(this.getSenderCode());
		config.setMailAttrName(this.getMailAttrName());
		config.setAlsoHtml(this.isAlsoHtml());

		config.setSubject(this.getSubject());

		config.setHtmlFooter(this.getHtmlFooter());
		config.setHtmlHeader(this.getHtmlHeader());
		config.setHtmlSeparator(this.getHtmlSeparator());

		config.setTextFooter(this.getTextFooter());
		config.setTextHeader(this.getTextHeader());
		config.setTextSeparator(this.getTextSeparator());

		config.setHtmlFooterMove(this.getHtmlFooterMove());
		config.setHtmlHeaderMove(this.getHtmlHeaderMove());
		config.setHtmlSeparatorMove(this.getHtmlSeparatorMove());

		config.setTextFooterMove(this.getTextFooterMove());
		config.setTextHeaderMove(this.getTextHeaderMove());
		config.setTextSeparatorMove(this.getTextSeparatorMove());

		this.getContentSchedulerManager().updateConfig(config);

		this.addActionMessage(this.getText("jpcontentscheduler.saveItem.success"));
	} catch (Throwable t) {
		_logger.error("Error saving item", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 14
Source File: ContentThreadConfigEmailAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * entrypoint
 * 
 * @return
 */
public String viewEmail() {
	try {

		ContentThreadConfig config = this.getContentSchedulerManager().getConfig();

		this.setSenderCode(config.getSenderCode());
		this.setMailAttrName(config.getMailAttrName());
		this.setAlsoHtml(config.isAlsoHtml());

		this.setSubject(config.getSubject());

		this.setHtmlFooter(config.getHtmlFooter());
		this.setHtmlHeader(config.getHtmlHeader());
		this.setHtmlSeparator(config.getHtmlSeparator());

		this.setTextFooter(config.getTextFooter());
		this.setTextHeader(config.getTextHeader());
		this.setTextSeparator(config.getTextSeparator());

		this.setHtmlFooterMove(config.getHtmlFooterMove());
		this.setHtmlHeaderMove(config.getHtmlHeaderMove());
		this.setHtmlSeparatorMove(config.getHtmlSeparatorMove());

		this.setTextFooterMove(config.getTextFooterMove());
		this.setTextHeaderMove(config.getTextHeaderMove());
		this.setTextSeparatorMove(config.getTextSeparatorMove());

	} catch (Throwable t) {
		_logger.error("Error in viewEmail", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 15
Source File: ContentThreadConfigGroupsAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String saveGroupsItem() {
	try {
		ContentThreadConfig config = this.getContentSchedulerManager().getConfig();
		config.setGroupsContentType(this.getGroupsContentType());

		this.getContentSchedulerManager().updateConfig(config);

		this.addActionMessage(this.getText("jpcontentscheduler.saveItem.success"));
	} catch (Throwable t) {
		_logger.error("Error saving item", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 16
Source File: ContentThreadConfigUsersAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String saveUsersItem() {
	try {
		ContentThreadConfig config = this.getContentSchedulerManager().getConfig();
		config.setUsersContentType(this.getUsersContentType());

		this.getContentSchedulerManager().updateConfig(config);

		this.addActionMessage(this.getText("jpcontentscheduler.saveItem.success"));
	} catch (Throwable t) {
		_logger.error("Error saving item", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 17
Source File: ContentThreadConfigContentTypesAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * entrypoint
 *
 * @return
 */
public String viewContentTypes() {
    try {
        this.setConfigItemOnSession();

    } catch (Throwable t) {
        _logger.error("Error in viewUsers", t);
        return FAILURE;
    }
    return Action.SUCCESS;
}
 
Example 18
Source File: ContentThreadConfigUsersAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String addContentType() {
	try {

		Map<String, List<String>> config = this.getUsersContentType();
		boolean isValidInput = this.validateAdd();
		if (this.hasErrors()) {
			return INPUT;
		}
		if (isValidInput) {

			if (!config.containsKey(this.getUsername())) {
				config.put(this.getUsername(), new ArrayList<String>());
			}
			if (!config.get(this.getUsername()).contains(this.getContentType())) {
				if (this.getContentType().equals(ALL_TYPES)) {
					config.get(this.getUsername()).clear();
				}

				config.get(this.getUsername()).add(this.getContentType());
			}
			this.setConfigItemOnSession(config);
		}

	} catch (Throwable t) {
		_logger.error("Error in viewUsers", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}
 
Example 19
Source File: ContentThreadConfigUsersAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String entry() {

		String selectedUser = this.getRequest().getParameter("user");
		if (StringUtils.isNotBlank(selectedUser)) {
			this.setUsername(selectedUser);
		}
		return Action.SUCCESS;
	}
 
Example 20
Source File: ContentThreadConfigUsersAction.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * entrypoint
 * 
 * @return
 */
public String viewUsers() {
	try {
		this.setConfigItemOnSession();

	} catch (Throwable t) {
		_logger.error("Error in viewUsers", t);
		return FAILURE;
	}
	return Action.SUCCESS;
}