当前位置: 首页>>代码示例>>Java>>正文


Java CharPool类代码示例

本文整理汇总了Java中com.liferay.portal.kernel.util.CharPool的典型用法代码示例。如果您正苦于以下问题:Java CharPool类的具体用法?Java CharPool怎么用?Java CharPool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CharPool类属于com.liferay.portal.kernel.util包,在下文中一共展示了CharPool类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValue

import com.liferay.portal.kernel.util.CharPool; //导入依赖的package包/类
protected static int getValue(char c) {
	if ((c >= CharPool.UPPER_CASE_A) && (c <= CharPool.UPPER_CASE_Z)) {
		return c - 65;
	}

	if ((c >= CharPool.LOWER_CASE_A) && (c <= CharPool.LOWER_CASE_Z)) {
		return (c - 97) + 26;
	}

	if ((c >= CharPool.NUMBER_0) && (c <= CharPool.NUMBER_9)) {
		return (c - 48) + 52;
	}

	if (c == CharPool.PLUS) {
		return 62;
	}

	if (c == CharPool.SLASH) {
		return 63;
	}

	return c != CharPool.EQUAL ? -1 : 0;
}
 
开发者ID:bejondshao,项目名称:personal,代码行数:24,代码来源:Decode.java

示例2: initCsv

import com.liferay.portal.kernel.util.CharPool; //导入依赖的package包/类
private CSVWriter initCsv(ResourceResponse resourceResponse)
		throws IOException, UnsupportedEncodingException {
	//Necesario para crear el fichero csv.
	resourceResponse.setCharacterEncoding(StringPool.UTF8);
	resourceResponse.setContentType(ContentTypes.TEXT_CSV_UTF8);
	resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION,"attachment; fileName=Statistics.csv");
	byte b[] = {(byte)0xEF, (byte)0xBB, (byte)0xBF};
	
	resourceResponse.getPortletOutputStream().write(b);
	
	CSVWriter writer = new CSVWriter(new OutputStreamWriter(resourceResponse.getPortletOutputStream(),StringPool.UTF8),CharPool.SEMICOLON);
	return writer;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:14,代码来源:CourseStats.java

示例3: processTreePath

import com.liferay.portal.kernel.util.CharPool; //导入依赖的package包/类
public static Object processTreePath(Object treePath) {
	if (treePath == null) {
		return null;
	}

	if (treePath instanceof Set) {
		Set<?> treePathSet = (Set<?>)treePath;

		Set<Object> treePathFiltered = new HashSet<Object>();

		for (Object obj : treePathSet) {
			if (Validator.isNotNull(obj)) {
				treePathFiltered.add(obj);
			}
		}

		return treePathFiltered;
	}

	if (!(treePath instanceof String)) {
		return treePath;
	}

	String treePathStr = (String)treePath;

	if ((treePathStr.length() > 0) &&
		(treePathStr.charAt(0) == CharPool.SLASH)) {

		treePathStr = treePathStr.substring(1);
	}

	if (Validator.isNull(treePathStr)) {
		return StringPool.BLANK;
	}

	return StringUtil.split(treePathStr, CharPool.SLASH);
}
 
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:38,代码来源:IndexCheckerQueryHelper.java

示例4: _toInt

import com.liferay.portal.kernel.util.CharPool; //导入依赖的package包/类
private int _toInt(String color) {
	if (color.charAt(0) == CharPool.POUND) {
		color = color.substring(1);
	}

	return Integer.parseInt(color, 16);
}
 
开发者ID:vilmospapp,项目名称:qrcode-display-portlet,代码行数:8,代码来源:QRCodeDisplayPortlet.java

示例5: execute

import com.liferay.portal.kernel.util.CharPool; //导入依赖的package包/类
@Override
public BackgroundTaskResult execute(BackgroundTask backgroundTask) throws PortalException {

    ExportImportConfiguration exportImportConfiguration = getExportImportConfiguration(backgroundTask);

    long userId = backgroundTask.getUserId();

    StringBundler sb = new StringBundler(4);

    sb.append(StringUtil.replace(exportImportConfiguration.getName(), CharPool.SPACE, CharPool.UNDERLINE));
    sb.append(StringPool.DASH);
    sb.append(Time.getTimestamp());
    sb.append(".zip");

    File xmlFile = TaskRecordLocalServiceUtil.exportTaskRecordsAsFile(exportImportConfiguration);

    BackgroundTaskManagerUtil.addBackgroundTaskAttachment(userId, backgroundTask.getBackgroundTaskId(),
            sb.toString(), xmlFile);

    return BackgroundTaskResult.SUCCESS;
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:22,代码来源:TaskRecordExportBackgroundTaskExecutor.java

示例6: execute

import com.liferay.portal.kernel.util.CharPool; //导入依赖的package包/类
@Override
public BackgroundTaskResult execute(BackgroundTask backgroundTask) throws PortalException {

    ExportImportConfiguration exportImportConfiguration = getExportImportConfiguration(backgroundTask);

    long userId = backgroundTask.getUserId();

    StringBundler sb = new StringBundler(4);

    sb.append(StringUtil.replace(exportImportConfiguration.getName(), CharPool.SPACE, CharPool.UNDERLINE));
    sb.append(StringPool.DASH);
    sb.append(Time.getTimestamp());
    sb.append(".zip");

    File xmlFile = ContactLocalServiceUtil.exportContactsAsFile(exportImportConfiguration);

    BackgroundTaskManagerUtil.addBackgroundTaskAttachment(userId, backgroundTask.getBackgroundTaskId(),
            sb.toString(), xmlFile);

    return BackgroundTaskResult.SUCCESS;
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:22,代码来源:ContactExportBackgroundTaskExecutor.java

示例7: execute

import com.liferay.portal.kernel.util.CharPool; //导入依赖的package包/类
@Override
public BackgroundTaskResult execute(BackgroundTask backgroundTask) throws PortalException {

    ExportImportConfiguration exportImportConfiguration = getExportImportConfiguration(backgroundTask);

    long userId = backgroundTask.getUserId();

    StringBundler sb = new StringBundler(4);

    sb.append(StringUtil.replace(exportImportConfiguration.getName(), CharPool.SPACE, CharPool.UNDERLINE));
    sb.append(StringPool.DASH);
    sb.append(Time.getTimestamp());
    sb.append(".zip");

    File xmlFile = MeasurementLocalServiceUtil.exportMeasurementsAsFile(exportImportConfiguration);

    BackgroundTaskManagerUtil.addBackgroundTaskAttachment(userId, backgroundTask.getBackgroundTaskId(),
            sb.toString(), xmlFile);

    return BackgroundTaskResult.SUCCESS;
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:22,代码来源:MeasurementExportBackgroundTaskExecutor.java

示例8: serveResource

import com.liferay.portal.kernel.util.CharPool; //导入依赖的package包/类
@Override
public void serveResource(ResourceRequest resourceRequest,
		ResourceResponse resourceResponse) throws IOException,
		PortletException {
	ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
	String action = ParamUtil.getString(resourceRequest, "action");
	long actId = ParamUtil.getLong(resourceRequest, "actId",0);


	if(action.equals("export")){

		try {

			CalificationType ct = new CalificationTypeRegistry().getCalificationType(CourseLocalServiceUtil.getCourseByGroupCreatedId(themeDisplay.getScopeGroupId()).getCalificationType());

			//Necesario para crear el fichero csv.
			resourceResponse.setCharacterEncoding(StringPool.UTF8);
			resourceResponse.setContentType(ContentTypes.TEXT_CSV_UTF8);
			resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION,"attachment; fileName=data.csv");
			byte b[] = {(byte)0xEF, (byte)0xBB, (byte)0xBF};

			resourceResponse.getPortletOutputStream().write(b);

			CSVWriter writer = new CSVWriter(new OutputStreamWriter(resourceResponse.getPortletOutputStream(),StringPool.UTF8),CharPool.SEMICOLON);
			String[] cabeceras = new String[4];


			//En esta columna vamos a tener el nombre del usuario.
			cabeceras[0]= LanguageUtil.get(getPortletConfig(), themeDisplay.getLocale(), "onlinetaskactivity.export.user");
			cabeceras[1]= LanguageUtil.get(getPortletConfig(), themeDisplay.getLocale(), "onlinetaskactivity.export.date");
			cabeceras[2]= LanguageUtil.get(getPortletConfig(), themeDisplay.getLocale(), "onlinetaskactivity.export.result");
			cabeceras[3]= LanguageUtil.get(getPortletConfig(), themeDisplay.getLocale(), "onlinetaskactivity.export.comment");

			writer.writeNext(cabeceras);
			DynamicQuery dq=DynamicQueryFactoryUtil.forClass(LearningActivityResult.class);
			Criterion criterion=PropertyFactoryUtil.forName("actId").eq(actId);
			dq.add(criterion);

			//Partiremos del usuario para crear el csv para que sea más facil ver los intentos.
			List<LearningActivityResult> listresult = LearningActivityResultLocalServiceUtil.dynamicQuery(dq);
			for(LearningActivityResult learningActivityResult:listresult){
				//Array con los resultados de los intentos.
				String[] resultados = new String[4];
				//En la primera columna del csv introducidos el nombre del estudiante.
				resultados[0] = UserLocalServiceUtil.getUser(learningActivityResult.getUserId()).getScreenName();
				resultados[1] = _dateFormat.format(learningActivityResult.getEndDate());
				resultados[2] = ct.translate(themeDisplay.getLocale(), themeDisplay.getScopeGroupId(), learningActivityResult.getResult());
				resultados[3] = learningActivityResult.getComments()!=null?learningActivityResult.getComments():"";

				//Escribimos las respuestas obtenidas para el intento en el csv.
				writer.writeNext(resultados);
			}
			writer.flush();
			writer.close();
			resourceResponse.getPortletOutputStream().flush();
			resourceResponse.getPortletOutputStream().close();

		} catch (NestableException e) {

		}finally{
			resourceResponse.getPortletOutputStream().flush();
			resourceResponse.getPortletOutputStream().close();
		}
	} 
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:66,代码来源:OfflineActivity.java

示例9: fixTypeSettings

import com.liferay.portal.kernel.util.CharPool; //导入依赖的package包/类
protected void fixTypeSettings(Layout layout) throws Exception {
	if (!layout.isTypeURL()) {
		return;
	}

	UnicodeProperties typeSettings = layout.getTypeSettingsProperties();

	String url = GetterUtil.getString(typeSettings.getProperty("url"));

	String friendlyURLPrivateGroupPath =
		PropsValues.LAYOUT_FRIENDLY_URL_PRIVATE_GROUP_SERVLET_MAPPING;
	String friendlyURLPrivateUserPath =
		PropsValues.LAYOUT_FRIENDLY_URL_PRIVATE_USER_SERVLET_MAPPING;
	String friendlyURLPublicPath =
		PropsValues.LAYOUT_FRIENDLY_URL_PUBLIC_SERVLET_MAPPING;

	if (!url.startsWith(friendlyURLPrivateGroupPath) &&
		!url.startsWith(friendlyURLPrivateUserPath) &&
		!url.startsWith(friendlyURLPublicPath)) {

		return;
	}

	int x = url.indexOf(CharPool.SLASH, 1);

	if (x == -1) {
		return;
	}

	int y = url.indexOf(CharPool.SLASH, x + 1);

	if (y == -1) {
		return;
	}

	String friendlyURL = url.substring(x, y);

	if (!friendlyURL.equals(LayoutExporter.SAME_GROUP_FRIENDLY_URL)) {
		return;
	}

	Group group = layout.getGroup();

	typeSettings.setProperty(
		"url",
		url.substring(0, x) + group.getFriendlyURL() + url.substring(y));
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:48,代码来源:LayoutImporter.java


注:本文中的com.liferay.portal.kernel.util.CharPool类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。