本文整理汇总了Java中javax.portlet.PortletConfig.getPortletName方法的典型用法代码示例。如果您正苦于以下问题:Java PortletConfig.getPortletName方法的具体用法?Java PortletConfig.getPortletName怎么用?Java PortletConfig.getPortletName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.portlet.PortletConfig
的用法示例。
在下文中一共展示了PortletConfig.getPortletName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PortletConfigPropertyValues
import javax.portlet.PortletConfig; //导入方法依赖的package包/类
/**
* Create new PortletConfigPropertyValues.
* @param config PortletConfig we'll use to take PropertyValues from
* @param requiredProperties set of property names we need, where
* we can't accept default values
* @throws PortletException if any required properties are missing
*/
private PortletConfigPropertyValues(PortletConfig config, Set<String> requiredProperties)
throws PortletException {
Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
new HashSet<String>(requiredProperties) : null;
Enumeration<String> en = config.getInitParameterNames();
while (en.hasMoreElements()) {
String property = en.nextElement();
Object value = config.getInitParameter(property);
addPropertyValue(new PropertyValue(property, value));
if (missingProps != null) {
missingProps.remove(property);
}
}
// fail if we are still missing properties
if (missingProps != null && missingProps.size() > 0) {
throw new PortletException(
"Initialization from PortletConfig for portlet '" + config.getPortletName() +
"' failed; the following required properties were missing: " +
StringUtils.collectionToDelimitedString(missingProps, ", "));
}
}
示例2: PortletConfigPropertyValues
import javax.portlet.PortletConfig; //导入方法依赖的package包/类
/**
* Create new PortletConfigPropertyValues.
* @param config PortletConfig we'll use to take PropertyValues from
* @param requiredProperties set of property names we need, where
* we can't accept default values
* @throws PortletException if any required properties are missing
*/
private PortletConfigPropertyValues(PortletConfig config, Set<String> requiredProperties)
throws PortletException {
Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
new HashSet<String>(requiredProperties) : null;
Enumeration en = config.getInitParameterNames();
while (en.hasMoreElements()) {
String property = (String) en.nextElement();
Object value = config.getInitParameter(property);
addPropertyValue(new PropertyValue(property, value));
if (missingProps != null) {
missingProps.remove(property);
}
}
// fail if we are still missing properties
if (missingProps != null && missingProps.size() > 0) {
throw new PortletException(
"Initialization from PortletConfig for portlet '" + config.getPortletName() +
"' failed; the following required properties were missing: " +
StringUtils.collectionToDelimitedString(missingProps, ", "));
}
}
示例3: serveResource
import javax.portlet.PortletConfig; //导入方法依赖的package包/类
public void serveResource(
ResourceRequest request, ResourceResponse response)
throws IOException, PortletException {
PortletConfig portletConfig =
(PortletConfig)request.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
String resourceId = request.getResourceID();
String portletId = portletConfig.getPortletName();
OutputUtils.servePortletFileEntry(portletId, resourceId, response);
}
示例4: TaskRecordSearch
import javax.portlet.PortletConfig; //导入方法依赖的package包/类
public TaskRecordSearch(PortletRequest portletRequest, String curParam, PortletURL iteratorURL) {
super(portletRequest, new TaskRecordDisplayTerms(portletRequest), new TaskRecordSearchTerms(portletRequest),
curParam, DEFAULT_DELTA, iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
PortletConfig portletConfig = (PortletConfig) portletRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
TaskRecordDisplayTerms displayTerms = (TaskRecordDisplayTerms) getDisplayTerms();
TaskRecordSearchTerms searchTerms = (TaskRecordSearchTerms) getSearchTerms();
String portletId = PortletProviderUtil.getPortletId(User.class.getName(), PortletProvider.Action.VIEW);
String portletName = portletConfig.getPortletName();
if (!portletId.equals(portletName)) {
displayTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
searchTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
}
iteratorURL.setParameter(TaskRecordDisplayTerms.TASKRECORDID, String.valueOf(displayTerms.getTaskRecordId()));
iteratorURL.setParameter(TaskRecordDisplayTerms.STATUS, String.valueOf(displayTerms.getStatus()));
iteratorURL.setParameter(TaskRecordDisplayTerms.WORK_PACKAGE, displayTerms.getWorkPackage());
iteratorURL.setParameter(TaskRecordDisplayTerms.DESCRIPTION, displayTerms.getDescription());
iteratorURL.setParameter(TaskRecordDisplayTerms.USER_NAME, displayTerms.getUserName());
iteratorURL.setParameter(TaskRecordDisplayTerms.TICKET_URL, displayTerms.getTicketURL());
iteratorURL.setParameter(TaskRecordDisplayTerms.CREATE_DATE, displayTerms.getCreateDate());
iteratorURL.setParameter(TaskRecordDisplayTerms.MODIFIED_DATE, displayTerms.getModifiedDate());
iteratorURL.setParameter(TaskRecordDisplayTerms.FROM_DATE, displayTerms.getFromDate());
iteratorURL.setParameter(TaskRecordDisplayTerms.UNTIL_DATE, displayTerms.getUntilDate());
iteratorURL.setParameter(TaskRecordDisplayTerms.DURATION, String.valueOf(displayTerms.getDuration()));
try {
PortalPreferences preferences = PortletPreferencesFactoryUtil.getPortalPreferences(portletRequest);
String orderByCol = ParamUtil.getString(portletRequest, "orderByCol");
String orderByType = ParamUtil.getString(portletRequest, "orderByType");
if (Validator.isNotNull(orderByCol) && Validator.isNotNull(orderByType)) {
preferences.setValue(portletId, "task-records-order-by-col", orderByCol);
preferences.setValue(portletId, "task-records-order-by-type", orderByType);
} else {
orderByCol = preferences.getValue(portletId, "task-records-order-by-col", "modified-date");
orderByType = preferences.getValue(portletId, "task-records-order-by-type", "asc");
}
setOrderableHeaders(orderableHeaders);
if (Validator.isNotNull(orderableHeaders.get(orderByCol))) {
setOrderByCol(orderableHeaders.get(orderByCol));
} else {
_log.error(orderByCol + " is not an orderable header.");
setOrderByCol(orderByCol);
}
setOrderByType(orderByType);
} catch (Exception e) {
_log.error(e);
}
}
示例5: ContactSearch
import javax.portlet.PortletConfig; //导入方法依赖的package包/类
public ContactSearch(PortletRequest portletRequest, String curParam, PortletURL iteratorURL) {
super(portletRequest, new ContactDisplayTerms(portletRequest), new ContactSearchTerms(portletRequest), curParam,
DEFAULT_DELTA, iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
PortletConfig portletConfig = (PortletConfig) portletRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
ContactDisplayTerms displayTerms = (ContactDisplayTerms) getDisplayTerms();
ContactSearchTerms searchTerms = (ContactSearchTerms) getSearchTerms();
String portletId = PortletProviderUtil.getPortletId(User.class.getName(), PortletProvider.Action.VIEW);
String portletName = portletConfig.getPortletName();
if (!portletId.equals(portletName)) {
displayTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
searchTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
}
iteratorURL.setParameter(ContactDisplayTerms.COMPANY, String.valueOf(displayTerms.getCompany()));
iteratorURL.setParameter(ContactDisplayTerms.CONTACT_ID, String.valueOf(displayTerms.getContactId()));
iteratorURL.setParameter(ContactDisplayTerms.CREATE_DATE, String.valueOf(displayTerms.getCreateDate()));
iteratorURL.setParameter(ContactDisplayTerms.EMAIL, String.valueOf(displayTerms.getEmail()));
iteratorURL.setParameter(ContactDisplayTerms.FAX, String.valueOf(displayTerms.getFax()));
iteratorURL.setParameter(ContactDisplayTerms.FULL_NAME, String.valueOf(displayTerms.getFullName()));
// TODO: add default impp
iteratorURL.setParameter(ContactDisplayTerms.MODIFIED_DATE, String.valueOf(displayTerms.getModifiedDate()));
iteratorURL.setParameter(ContactDisplayTerms.NAME, String.valueOf(displayTerms.getName()));
iteratorURL.setParameter(ContactDisplayTerms.PHONE, String.valueOf(displayTerms.getPhone()));
iteratorURL.setParameter(ContactDisplayTerms.USER_NAME, String.valueOf(displayTerms.getUserName()));
try {
PortalPreferences preferences = PortletPreferencesFactoryUtil.getPortalPreferences(portletRequest);
String orderByCol = ParamUtil.getString(portletRequest, "orderByCol");
String orderByType = ParamUtil.getString(portletRequest, "orderByType");
if (Validator.isNotNull(orderByCol) && Validator.isNotNull(orderByType)) {
preferences.setValue(portletId, "contacts-order-by-col", orderByCol);
preferences.setValue(portletId, "contacts-order-by-type", orderByType);
} else {
orderByCol = preferences.getValue(portletId, "contacts-order-by-col", "modified-date");
orderByType = preferences.getValue(portletId, "contacts-order-by-type", "asc");
}
setOrderableHeaders(orderableHeaders);
if (Validator.isNotNull(orderableHeaders.get(orderByCol))) {
setOrderByCol(orderableHeaders.get(orderByCol));
} else {
_log.error(orderByCol + " is not an orderable header.");
setOrderByCol(orderByCol);
}
setOrderByType(orderByType);
} catch (Exception e) {
_log.error(e);
}
}
示例6: MeasurementSearch
import javax.portlet.PortletConfig; //导入方法依赖的package包/类
public MeasurementSearch(PortletRequest portletRequest, String curParam, PortletURL iteratorURL) {
super(portletRequest, new MeasurementDisplayTerms(portletRequest), new MeasurementSearchTerms(portletRequest),
curParam, DEFAULT_DELTA, iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
PortletConfig portletConfig = (PortletConfig) portletRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
MeasurementDisplayTerms displayTerms = (MeasurementDisplayTerms) getDisplayTerms();
MeasurementSearchTerms searchTerms = (MeasurementSearchTerms) getSearchTerms();
String portletId = PortletProviderUtil.getPortletId(User.class.getName(), PortletProvider.Action.VIEW);
String portletName = portletConfig.getPortletName();
if (!portletId.equals(portletName)) {
displayTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
searchTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
}
iteratorURL.setParameter(MeasurementDisplayTerms.CREATE_DATE, displayTerms.getCreateDate());
iteratorURL.setParameter(MeasurementDisplayTerms.DATA, displayTerms.getData());
iteratorURL.setParameter(MeasurementDisplayTerms.MEASUREMENT_ID,
String.valueOf(displayTerms.getMeasurementId()));
iteratorURL.setParameter(MeasurementDisplayTerms.STATUS, String.valueOf(displayTerms.getStatus()));
iteratorURL.setParameter(MeasurementDisplayTerms.USER_NAME, displayTerms.getUserName());
iteratorURL.setParameter(MeasurementDisplayTerms.MODIFIED_DATE, displayTerms.getModifiedDate());
iteratorURL.setParameter(MeasurementDisplayTerms.FROM, String.valueOf(displayTerms.getFrom()));
iteratorURL.setParameter(MeasurementDisplayTerms.UNTIL, String.valueOf(displayTerms.getUntil()));
try {
PortalPreferences preferences = PortletPreferencesFactoryUtil.getPortalPreferences(portletRequest);
String orderByCol = ParamUtil.getString(portletRequest, "orderByCol");
String orderByType = ParamUtil.getString(portletRequest, "orderByType");
if (Validator.isNotNull(orderByCol) && Validator.isNotNull(orderByType)) {
preferences.setValue(portletId, "measurements-order-by-col", orderByCol);
preferences.setValue(portletId, "measurements-order-by-type", orderByType);
} else {
orderByCol = preferences.getValue(portletId, "measurements-order-by-col", "modified-date");
orderByType = preferences.getValue(portletId, "measurements-order-by-type", "asc");
}
setOrderableHeaders(orderableHeaders);
if (Validator.isNotNull(orderableHeaders.get(orderByCol))) {
setOrderByCol(orderableHeaders.get(orderByCol));
} else {
_log.error(orderByCol + " is not an orderable header.");
setOrderByCol(orderByCol);
}
setOrderByType(orderByType);
} catch (Exception e) {
_log.error(e);
}
}
示例7: doView
import javax.portlet.PortletConfig; //导入方法依赖的package包/类
public void doView(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
PortletConfig portletConfig =
(PortletConfig)renderRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
String updateMessage = getUpdateMessage(portletConfig);
renderRequest.setAttribute("updateMessage", updateMessage);
List<String> outputList = IndexCheckerOutput.generateCSVOutput(
portletConfig, renderRequest);
String portletId = portletConfig.getPortletName();
long userId = PortalUtil.getUserId(renderRequest);
String outputContent = OutputUtils.listStringToString(outputList);
FileEntry exportCsvFileEntry = OutputUtils.addPortletOutputFileEntry(
portletId, userId, outputContent);
if (exportCsvFileEntry != null) {
ResourceURL exportCsvResourceURL =
renderResponse.createResourceURL();
exportCsvResourceURL.setResourceID(exportCsvFileEntry.getTitle());
renderRequest.setAttribute(
"exportCsvResourceURL", exportCsvResourceURL.toString());
}
try {
List<Long> siteGroupIds = this.getSiteGroupIds();
renderRequest.setAttribute("groupIdList", siteGroupIds);
List<String> groupDescriptionList = getSiteGroupDescriptions(
siteGroupIds, renderRequest.getLocale());
renderRequest.setAttribute(
"groupDescriptionList", groupDescriptionList);
}
catch (Exception e) {
throw new PortletException(e);
}
try {
List<Model> modelList = this.getModelList();
renderRequest.setAttribute("modelList", modelList);
}
catch (SystemException se) {
throw new PortletException(se);
}
long filterModifiedDate = ParamUtil.getLong(
renderRequest, "filterModifiedDate", 0L);
renderRequest.setAttribute("filterModifiedDate", filterModifiedDate);
super.doView(renderRequest, renderResponse);
}
示例8: init
import javax.portlet.PortletConfig; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void init() throws PortletException {
PortletConfig config = getPortletConfig();
// Load the context, if present...
try {
// Bootstrap the portlet Grammar instance...
final Grammar root = XmlGrammar.getMainGrammar();
final InputStream inpt = CernunnosPortlet.class.getResourceAsStream("portlet.grammar"); // Can't rely on classpath:// protocol handler...
final Document doc = new SAXReader().read(inpt);
final Task k = new ScriptRunner(root).compileTask(doc.getRootElement());
final RuntimeRequestResponse req = new RuntimeRequestResponse();
final ReturnValueImpl rslt = new ReturnValueImpl();
req.setAttribute(Attributes.RETURN_VALUE, rslt);
k.perform(req, new RuntimeRequestResponse());
Grammar g = (Grammar) rslt.getValue();
runner = new ScriptRunner(g);
// Choose a context location & load it if it exists...
String defaultLoc = "/WEB-INF/" + config.getPortletName() + "-portlet.xml";
URL defaultUrl = getPortletConfig().getPortletContext().getResource(defaultLoc);
URL u = Settings.locateContextConfig(
getPortletConfig().getPortletContext().getResource("/").toExternalForm(),
config.getInitParameter(CONFIG_LOCATION_PARAM),
defaultUrl);
if (u != null) {
// There *is* a resource mapped to this path name...
spring_context = new FileSystemXmlApplicationContext(u.toExternalForm());
}
if (log.isTraceEnabled()) {
log.trace("Loaction of spring context (null means none): " + u);
}
// Load the Settings...
Map<String,String> settingsMap = new HashMap<String,String>(); // default...
if (spring_context != null && spring_context.containsBean("settings")) {
settingsMap = (Map<String,String>) spring_context.getBean("settings");
}
settings = Settings.load(settingsMap);
} catch (Throwable t) {
String msg = "Failure in CernunnosPortlet.init()";
throw new PortletException(msg, t);
}
}
示例9: UserSearchContainer
import javax.portlet.PortletConfig; //导入方法依赖的package包/类
public UserSearchContainer(
PortletRequest portletRequest, String curParam,
PortletURL iteratorURL) {
super(
portletRequest, new UserDisplayTerms(portletRequest),
new UserSearchTerms(portletRequest), curParam, DEFAULT_DELTA,
iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
PortletConfig portletConfig =
(PortletConfig)portletRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
UserDisplayTerms displayTerms = (UserDisplayTerms)getDisplayTerms();
UserSearchTerms searchTerms = (UserSearchTerms)getSearchTerms();
String portletName = portletConfig.getPortletName();
if (!portletName.equals(PortletKeys.USERS_ADMIN)) {
displayTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
searchTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
}
iteratorURL.setParameter(
UserDisplayTerms.STATUS, Integer.toString(displayTerms.getStatus()));
iteratorURL.setParameter(
UserDisplayTerms.EMAIL_ADDRESS, displayTerms.getEmailAddress());
iteratorURL.setParameter(
UserDisplayTerms.FIRST_NAME, displayTerms.getFirstName());
iteratorURL.setParameter(
UserDisplayTerms.LAST_NAME, displayTerms.getLastName());
iteratorURL.setParameter(
UserDisplayTerms.SCREEN_NAME, displayTerms.getScreenName());
iteratorURL.setParameter(
UserDisplayTerms.TEAM, Long.toString(displayTerms.getTeamId()));
try {
PortalPreferences preferences =
PortletPreferencesFactoryUtil.getPortalPreferences(
portletRequest);
String orderByCol = ParamUtil.getString(
portletRequest, "orderByCol");
String orderByType = ParamUtil.getString(
portletRequest, "orderByType");
if (Validator.isNotNull(orderByCol) &&
Validator.isNotNull(orderByType)) {
preferences.setValue(
PortletKeys.USERS_ADMIN, "users-order-by-col", orderByCol);
preferences.setValue(
PortletKeys.USERS_ADMIN, "users-order-by-type",
orderByType);
}
else {
orderByCol = preferences.getValue(
PortletKeys.USERS_ADMIN, "users-order-by-col", "last-name");
orderByType = preferences.getValue(
PortletKeys.USERS_ADMIN, "users-order-by-type", "asc");
}
OrderByComparator orderByComparator =
UsersAdminUtil.getUserOrderByComparator(
orderByCol, orderByType);
setOrderableHeaders(orderableHeaders);
setOrderByCol(orderByCol);
setOrderByType(orderByType);
setOrderByComparator(orderByComparator);
}
catch (Exception e) {
_log.error(e);
}
//Cargamos el displayTerms
}