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


Java Validator.isNull方法代码示例

本文整理汇总了Java中com.liferay.portal.kernel.util.Validator.isNull方法的典型用法代码示例。如果您正苦于以下问题:Java Validator.isNull方法的具体用法?Java Validator.isNull怎么用?Java Validator.isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.kernel.util.Validator的用法示例。


在下文中一共展示了Validator.isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDossier

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
protected Dossier getDossier(String id, long groupId) throws PortalException {
	// TODO update logic here
	long dossierId = GetterUtil.getLong(id);

	Dossier dossier = null;
	
	if (dossierId != 0) {
		dossier = DossierLocalServiceUtil.fetchDossier(dossierId);
	}

	if (Validator.isNull(dossier)) {
		dossier = DossierLocalServiceUtil.getByRef(groupId, id);
	}

	return dossier;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:17,代码来源:PaymentFileManagementImpl.java

示例2: getTitlePattern

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Override
protected String getTitlePattern(String groupName, SocialActivity activity) {

    _log.info("getTitlePattern");

    int activityType = activity.getType();

    if (activityType == TaskRecordActivityKeys.ADD_TASK_RECORD) {
        if (Validator.isNull(groupName)) {
            return "activity-task-record-add-task-record";
        } else {
            return "activity-task-record-add-task-record-in";
        }
    } else if (activityType == SocialActivityConstants.TYPE_MOVE_TO_TRASH) {
        if (Validator.isNull(groupName)) {
            return "activity-task-record-move-to-trash";
        } else {
            return "activity-task-record-move-to-trash-in";
        }
    } else if (activityType == SocialActivityConstants.TYPE_RESTORE_FROM_TRASH) {

        if (Validator.isNull(groupName)) {
            return "activity-task-record-restore-from-trash";
        } else {
            return "activity-task-record-restore-from-trash-in";
        }
    } else if (activityType == TaskRecordActivityKeys.UPDATE_TASK_RECORD) {
        if (Validator.isNull(groupName)) {
            return "activity-task-record-update-task-record";
        } else {
            return "activity-task-record-update-task-record-in";
        }
    }

    return StringPool.BLANK;
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:37,代码来源:TaskRecordActivityInterpreter.java

示例3: convertStringToLongArray

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
/**
 * Convert string array to long array
 * 
 * @param source String array of ids
 * @return long array of ids
 */
static public long[] convertStringToLongArray(String[] source) {
	if (Validator.isNull(source) || source.length <= 0) {
		return null;
	}

	return Arrays.stream(source).distinct().mapToLong(Long::parseLong).toArray();
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:14,代码来源:CommonUtil.java

示例4: saveGlobalSettings

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Override
public void saveGlobalSettings(String adtUuid, boolean doSearchOnStartup, String doSearchOnStartupKeywords, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException {
    if(Validator.isNull(doSearchOnStartupKeywords)) {
        doSearchOnStartupKeywords = FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS;
    }
    preferences.setValue(CONF_KEY_ADT_UUID, adtUuid);
    preferences.setValue(CONF_KEY_DO_SEARCH_ON_STARTUP, Boolean.toString(doSearchOnStartup));
    preferences.setValue(CONF_KEY_DO_SEARCH_ON_STARTUP_KEYWORDS, doSearchOnStartupKeywords);
    preferences.store();
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:11,代码来源:ConfigurationStorageV1.java

示例5: convertStringToDate

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
public static Date convertStringToDate(String source, String pattern) {
	
	if (Validator.isNull(source) || Validator.isNull(pattern)) {
		return null;
	}
	
	SimpleDateFormat sdf = new SimpleDateFormat(pattern);
	
	try {
		return sdf.parse(source);
	} catch (Exception e) {
		return null;
	}
	
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:16,代码来源:APIDateTimeUtils.java

示例6: removeDeliverableType

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
public DeliverableType removeDeliverableType(long groupId, String deliverableTypeId) throws PortalException {
	// TODO remove DeliverableType

	validateRemoveDeliverableType(groupId, deliverableTypeId);

	DeliverableType deliverableTypeObj = null;
	long id = Long.valueOf(deliverableTypeId);
	deliverableTypeObj = deliverableTypePersistence.fetchByPrimaryKey(id);
	if (Validator.isNull(deliverableTypeObj)) {
		deliverableTypeObj = deliverableTypePersistence.fetchByG_DLT(groupId, deliverableTypeId);
	}
	return deliverableTypePersistence.remove(deliverableTypeObj);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:14,代码来源:DeliverableTypeLocalServiceImpl.java

示例7: getDossier

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
protected Dossier getDossier(String id, long groupId) throws PortalException {
	// TODO update logic here
	long dossierId = GetterUtil.getLong(id);

	Dossier dossier = null;

	dossier = DossierLocalServiceUtil.fetchDossier(dossierId);

	if (Validator.isNull(dossier)) {
		dossier = DossierLocalServiceUtil.getByRef(groupId, id);
	}

	return dossier;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:15,代码来源:DossierSyncManagementImpl.java

示例8: updateDictItemListener

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
public DictItem updateDictItemListener(long userId, long dictItemId, long dictCollectionId, String itemCode,
		String itemName, String itemNameEN, String itemDescription, long parentItemId, String sibling, int level,
		String metaData, ServiceContext serviceContext)
		throws DuplicateCategoryException, UnauthenticationException, UnauthorizationException, NoSuchUserException,
		NotFoundException, PortalException {

	Date now = new Date();

	User user = userPersistence.findByPrimaryKey(userId);

	DictItem dictItem = dictItemPersistence.fetchByPrimaryKey(dictItemId);

	DictItem dictColl = dictItemPersistence.fetchByF_dictItemCode(itemCode, dictItem.getGroupId());

	if (Validator.isNotNull(dictColl) && dictColl.getDictItemId() != dictItemId) {

		throw new DuplicateCategoryException();

	}

	if (Validator.isNull(dictItem)) {
		throw new NotFoundException();
	}

	// Audit fields
	dictItem.setUserId(user.getUserId());
	dictItem.setUserName(user.getFullName());
	dictItem.setModifiedDate(serviceContext.getCreateDate(now));

	// Other fields
	dictItem.setDictCollectionId(dictCollectionId);
	dictItem.setItemCode(itemCode);
	dictItem.setItemName(itemName);
	dictItem.setItemNameEN(itemNameEN);
	dictItem.setItemDescription(itemDescription);
	dictItem.setParentItemId(parentItemId);
	dictItem.setSibling(sibling);
	dictItem.setMetaData(metaData);

	String treeIndex = getTreeIndex(dictItemId, parentItemId, sibling);

	dictItem.setTreeIndex(treeIndex);
	dictItem.setLevel(StringUtil.count(treeIndex, StringPool.PERIOD));
	// referent dictcollection
	BaseModel<?> baseModel = DictCollectionLocalServiceUtil.fetchDictCollection(dictCollectionId);

	dictItem.setExpandoBridgeAttributes(baseModel);
	// dictItem.setExpandoBridgeAttributes(serviceContext);

	dictItemPersistence.update(dictItem);

	return dictItem;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:55,代码来源:DictItemLocalServiceImpl.java

示例9: convertDateToString

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
public static String convertDateToString(Date date, String pattern) {
	DateFormat dateFormat = DateFormatFactoryUtil.getSimpleDateFormat(
		pattern);

	if (Validator.isNull(date) || Validator.isNull(pattern)) {
		return StringPool.BLANK;
	}

	dateFormat.setTimeZone(TimeZoneUtil.getTimeZone("Asia/Ho_Chi_Minh"));

	Calendar calendar = Calendar.getInstance();

	calendar.setTime(date);

	return dateFormat.format(calendar.getTime());
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:17,代码来源:DateTimeUtils.java

示例10: getProcessAction

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
protected ProcessAction getProcessAction(long groupId, long dossierId, String refId, String actionCode,
		long serviceProcessId) throws PortalException {

	ProcessAction action = null;

	try {
		List<ProcessAction> actions = ProcessActionLocalServiceUtil.getByActionCode(groupId, actionCode,
				serviceProcessId);
		
		_log.info("actionCode" + actionCode);
		_log.info("serviceProcessId" + serviceProcessId);

		Dossier dossier = getDossier(groupId, dossierId, refId);

		String dossierStatus = dossier.getDossierStatus();

		String dossierSubStatus = Validator.isNull(dossier.getDossierSubStatus()) ? StringPool.BLANK
				: dossier.getDossierSubStatus();

		_log.info("GROUPID_" + groupId);
		_log.info("dossierId" + dossierId);
		_log.info("refId" + refId);
		_log.info("DOSSIER_STATUS_" + dossierStatus);
		_log.info("DOSSIER_SUB_STATUS_" + dossierSubStatus);
		_log.info("ACTION_SIZE" + actions.size());

		for (ProcessAction act : actions) {

			String preStepCode = act.getPreStepCode();
			
			_log.info(JSONFactoryUtil.looseSerialize(act));

			ProcessStep step = ProcessStepLocalServiceUtil.fetchBySC_GID(preStepCode, groupId, serviceProcessId);
			
			String subStepStatus = StringPool.BLANK;
			
			if (Validator.isNotNull(step)) {
				subStepStatus = Validator.isNull(step.getDossierSubStatus()) ? StringPool.BLANK
						: step.getDossierSubStatus();
			}
			
			_log.info(JSONFactoryUtil.looseSerialize(step));

			if (Validator.isNull(step)) {
				action = act;
				break;
			} else {

				if (step.getDossierStatus().contentEquals(dossierStatus)
						&& subStepStatus.contentEquals(dossierSubStatus)) {

					action = act;
					break;
				}
			}
		}

	} catch (Exception e) {
		
		_log.error(e);
		
		throw new NotFoundException("ProcessActionNotFoundException with actionCode= " + actionCode
				+ "|serviceProcessId= " + serviceProcessId + "|referenceUid= " + refId + "|groupId= " + groupId);
	}

	return action;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:68,代码来源:DossierActionsImpl.java

示例11: updateResourceRole

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
@Override
public ResourceRole updateResourceRole(long userId, long resourceRoleId, String className, String classPK,
		long roleId, ServiceContext serviceContext)
		throws UnauthenticationException, UnauthorizationException, NotFoundException, NoSuchUserException {
	// authen
	BackendAuthImpl authImpl = new BackendAuthImpl();

	boolean isAuth = authImpl.isAuth(serviceContext, StringPool.BLANK, StringPool.BLANK);

	if (!isAuth) {
		throw new UnauthenticationException();
	}

	boolean hasPermission = authImpl.hasResource(serviceContext, ModelNameKeys.WORKINGUNIT_MGT_CENTER,
			ActionKeys.EDIT_DATA);

	if (!hasPermission) {
		throw new UnauthorizationException();
	}

	Role role = RoleLocalServiceUtil.fetchRole(roleId);
	
	if(Validator.isNull(role)){
		throw new NotFoundException();
	}
	
	Date now = new Date();

	User user = userPersistence.findByPrimaryKey(userId);

	ResourceRole resourceRole = resourceRolePersistence.fetchByPrimaryKey(resourceRoleId);

	if (Validator.isNull(resourceRole)) {
		throw new NotFoundException();
	}

	// Audit fields
	resourceRole.setUserId(user.getUserId());
	resourceRole.setUserName(user.getFullName());
	resourceRole.setModifiedDate(serviceContext.getCreateDate(now));

	// Other fields

	resourceRole.setClassName(className);
	resourceRole.setClassPK(classPK);
	resourceRole.setRoleId(roleId);

	resourceRole.setExpandoBridgeAttributes(serviceContext);

	resourceRolePersistence.update(resourceRole);

	return resourceRole;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:55,代码来源:ResourceRoleLocalServiceImpl.java

示例12: updateResourceUser

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
@Override
public ResourceUser updateResourceUser(long userId, long resourceUserId, String className, String classPK,
		long toUserId, String fullname, String email, boolean readonly, ServiceContext serviceContext)
		throws UnauthenticationException, UnauthorizationException, NotFoundException, NoSuchUserException {
	// authen
	BackendAuthImpl authImpl = new BackendAuthImpl();

	boolean isAuth = authImpl.isAuth(serviceContext, StringPool.BLANK, StringPool.BLANK);

	if (!isAuth) {
		throw new UnauthenticationException();
	}

	boolean hasPermission = authImpl.hasResource(serviceContext, ModelNameKeys.WORKINGUNIT_MGT_CENTER,
			ActionKeys.EDIT_DATA);

	if (!hasPermission) {
		throw new UnauthorizationException();
	}

	User toUser = userPersistence.fetchByPrimaryKey(toUserId);
	
	if (Validator.isNull(toUser)) {
		throw new NotFoundException();
	}
	
	Date now = new Date();

	User user = userPersistence.findByPrimaryKey(userId);

	ResourceUser resourceUser = resourceUserPersistence.fetchByPrimaryKey(resourceUserId);

	if (Validator.isNull(resourceUser)) {
		throw new NotFoundException();
	}

	// Audit fields
	resourceUser.setUserId(user.getUserId());
	resourceUser.setUserName(user.getFullName());
	resourceUser.setModifiedDate(serviceContext.getCreateDate(now));

	// Other fields

	resourceUser.setClassName(className);
	resourceUser.setClassPK(classPK);
	resourceUser.setToUserId(toUserId);
	resourceUser.setFullname(fullname);
	resourceUser.setEmail(email);
	resourceUser.setReadonly(readonly);
	
	resourceUser.setExpandoBridgeAttributes(serviceContext);

	resourceUserPersistence.update(resourceUser);

	return resourceUser;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:58,代码来源:ResourceUserLocalServiceImpl.java

示例13: deleteDictCollection

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
/**
 * @author binhth
 * @param code
 *            ( collectionCode unique )
 * @param groupId
 * @param serviceContext
 * @throws NotFoundException,
 *             UnauthenticationException, UnauthorizationException
 * @return boolean
 */
public boolean deleteDictCollection(String code, long groupId, ServiceContext serviceContext)
		throws NotFoundException, UnauthenticationException, UnauthorizationException {
	boolean flag = false;

	DictCollection dictColl = DictCollectionLocalServiceUtil.fetchByF_dictCollectionCode(code,
			groupId);

	if (Validator.isNull(dictColl)) {

		flag = false;

	} else {

		DictCollectionLocalServiceUtil.deleteDictCollection(dictColl.getDictCollectionId(), serviceContext);

		flag = true;

	}
	return flag;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:31,代码来源:DictCollectionActions.java

示例14: getApplicantProfile

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Override
public Response getApplicantProfile(HttpServletRequest request, HttpHeaders header, Company company, Locale locale,
		User user, ServiceContext serviceContext, long id) {
	ApplicantActions actions = new ApplicantActionsImpl();
	BackendAuth auth = new BackendAuthImpl();
	Applicant applicant = null;
	try {

		if (!auth.isAuth(serviceContext)) {
			throw new UnauthenticationException();
		}

		User requestUser = ApplicantUtils.getUser(id);

		boolean isAllowed = false;

		if (auth.hasResource(serviceContext, Applicant.class.getName(), ActionKeys.ADD_ENTRY)) {
			isAllowed = true;
		} else {
			if (Validator.isNull(requestUser)) {
				throw new NoSuchUserException();
			} else {
				// check userLogin is equal userRequest get detail
				if (requestUser.getUserId() == user.getUserId()) {
					isAllowed = true;
				}
			}
		}

		if (isAllowed) {
			applicant = actions.getApplicantDetail (serviceContext, id);

			JSONObject result = JSONFactoryUtil.createJSONObject(applicant.getProfile());
			
			return Response.status(200).entity(JSONFactoryUtil.looseSerialize(result)).build();
		} else {
			throw new UnauthorizationException();
		}

	} catch (Exception e) {
		ErrorMsg error = new ErrorMsg();

		if (e instanceof UnauthenticationException) {
			error.setMessage("Non-Authoritative Information.");
			error.setCode(HttpURLConnection.HTTP_NOT_AUTHORITATIVE);
			error.setDescription("Non-Authoritative Information.");

			return Response.status(HttpURLConnection.HTTP_NOT_AUTHORITATIVE).entity(error).build();
		} else {
			if (e instanceof UnauthorizationException) {
				error.setMessage("Unauthorized.");
				error.setCode(HttpURLConnection.HTTP_NOT_AUTHORITATIVE);
				error.setDescription("Unauthorized.");

				return Response.status(HttpURLConnection.HTTP_UNAUTHORIZED).entity(error).build();

			} else {

				if (e instanceof NoSuchUserException) {
					error.setMessage("Not Found");
					error.setCode(HttpURLConnection.HTTP_NOT_FOUND);
					error.setDescription("Not Found");

					return Response.status(HttpURLConnection.HTTP_NOT_FOUND).entity(error).build();

				} else {
					error.setMessage("Internal Server Error");
					error.setCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
					error.setDescription(e.getMessage());

					return Response.status(HttpURLConnection.HTTP_INTERNAL_ERROR).entity(error).build();
				}

			}
		}
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:78,代码来源:ApplicantManagementImpl.java

示例15: updateHoliday

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
@Override
public Holiday updateHoliday(long userId, long holidayId, Date holidayDate, String description,
		ServiceContext serviceContext)
		throws UnauthenticationException, UnauthorizationException, NotFoundException, NoSuchUserException {
	// authen
	BackendAuthImpl authImpl = new BackendAuthImpl();

	boolean isAuth = authImpl.isAuth(serviceContext);

	if (!isAuth) {
		throw new UnauthenticationException();
	}

	boolean hasPermission = authImpl.hasResource(serviceContext, ModelNameKeys.WORKINGUNIT_MGT_CENTER,
			ActionKeys.EDIT_DATA);

	if (!hasPermission) {
		throw new UnauthorizationException();
	}

	Date now = new Date();

	User user = userPersistence.findByPrimaryKey(userId);

	Holiday holiday = holidayPersistence.fetchByPrimaryKey(holidayId);

	if (Validator.isNull(holiday)) {
		throw new NotFoundException();
	}

	// Audit fields
	holiday.setUserId(user.getUserId());
	holiday.setUserName(user.getFullName());
	holiday.setModifiedDate(serviceContext.getCreateDate(now));

	// Other fields
	holiday.setHolidayDate(holidayDate);
	holiday.setDescription(description);

	holiday.setExpandoBridgeAttributes(serviceContext);

	holidayPersistence.update(holiday);

	return holiday;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:47,代码来源:HolidayLocalServiceImpl.java


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