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


Java Validator.isNotNull方法代码示例

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


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

示例1: getPdfPkcs7Signer

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
public static PdfPkcs7Signer getPdfPkcs7Signer(String filePath,
		String certPath, String tempFilePath, String signedFilePath,
		boolean isVisible, String imagePath) {

	X509Certificate cert = null;
	PdfPkcs7Signer pdfSigner = null;
	try {
		cert = CertUtil.getX509CertificateByPath(certPath);
	} catch (Exception e) {
		_log.error(e);
	}

	if (cert != null) {
		pdfSigner = new PdfPkcs7Signer(filePath, cert, tempFilePath,
				signedFilePath, isVisible);

		if (Validator.isNotNull(imagePath)) {
			pdfSigner.setSignatureGraphic(imagePath);
		}

	}

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

示例2: getSibling

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
protected String getSibling(long groupId, long parentId, String sibling){
	int level = 0;
	
	if(parentId == 0){
		
	} else {
		
		WorkingUnit parentItem = workingUnitPersistence.fetchByPrimaryKey(parentId);
		
		level = Validator.isNotNull(parentItem)?parentItem.getLevel() + 1: 0;
	}
	WorkingUnit workingUnit = workingUnitPersistence.fetchByF_parentId_level_Last(groupId, parentId, level, null);
	if((Validator.isNotNull(workingUnit) && sibling.equals("0")) || sibling.equals("0")){
		try {
			sibling = workingUnit.getSibling() + 1 + StringPool.BLANK;
		} catch (Exception e) {
			sibling = String.valueOf(1);
		}
	}
	
	return sibling;

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

示例3: postProcessSearchQuery

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery,
        BooleanFilter fullQueryBooleanFilter, SearchContext searchContext)
        throws Exception {

    addSearchTerm(searchQuery, searchContext, "data", false);

    LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext
            .getAttribute("params");

    if (params != null) {
        String expandoAttributes = (String) params.get("expandoAttributes");

        if (Validator.isNotNull(expandoAttributes)) {
            addSearchExpando(searchQuery, searchContext, expandoAttributes);
        }
    }
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:19,代码来源:MeasurementIndexer.java

示例4: countLucense

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
public long countLucense(LinkedHashMap<String, Object> params, Sort[] sorts, int start, int end,
		SearchContext searchContext) throws ParseException, SearchException {
	String keywords = (String) params.get(Field.KEYWORD_SEARCH);
	String groupId = (String) params.get(Field.GROUP_ID);

	Indexer<Registration> indexer = IndexerRegistryUtil.nullSafeGetIndexer(Registration.class);

	searchContext.addFullQueryEntryClassName(CLASS_NAME);
	searchContext.setEntryClassNames(new String[] { CLASS_NAME });
	searchContext.setAttribute("paginationType", "regular");
	searchContext.setLike(true);
	searchContext.setAndSearch(true);

	BooleanQuery booleanQuery = null;

	if (Validator.isNotNull(keywords)) {
		booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
	} else {
		booleanQuery = indexer.getFullQuery(searchContext);
	}

	if (Validator.isNotNull(groupId)) {
		MultiMatchQuery query = new MultiMatchQuery(groupId);

		query.addFields(Field.GROUP_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}

	booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, CLASS_NAME);

	return IndexSearcherHelperUtil.searchCount(searchContext, booleanQuery);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:34,代码来源:RegistrationLogLocalServiceImpl.java

示例5: activationApplicant

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Override
public Applicant activationApplicant(ServiceContext context, long applicantId, String activationCode)
		throws PortalException {

	Applicant applicant = ApplicantLocalServiceUtil.getApplicant(applicantId);

	if (Validator.isNotNull(applicant.getActivationCode())
			&& applicant.getActivationCode().toLowerCase().contentEquals(activationCode.toLowerCase())) {
		return ApplicantLocalServiceUtil.activateApplicant(applicantId, context);
	} else {
		return null;
	}

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

示例6: convertStringToDateAPI

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
public static Date convertStringToDateAPI(String strDate) {
	DateFormat df = getDateTimeFormat(_DATE_TIME_TO_NAME);
	Date date = null;

	try {
		if (Validator.isNotNull(strDate)) {
			date = df.parse(strDate);
		}
	}
	catch (ParseException pe) {
		_log.error(pe);
	}

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

示例7: doGetDocument

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Override
protected Document doGetDocument(ResourceUser resourceUser) throws Exception {
	Document document = getBaseModelDocument(CLASS_NAME, resourceUser);

	document.addKeywordSortable(Field.COMPANY_ID, String.valueOf(resourceUser.getCompanyId()));
	document.addDateSortable(Field.MODIFIED_DATE, resourceUser.getModifiedDate());
	document.addKeywordSortable(Field.USER_ID, String.valueOf(resourceUser.getUserId()));
	document.addKeywordSortable(Field.USER_NAME, String.valueOf(resourceUser.getUserName()));

	document.addNumberSortable(ResourceUserTerm.GROUP_ID, resourceUser.getGroupId());
	document.addNumberSortable(ResourceUserTerm.RESOURCEUSER_ID, resourceUser.getResourceUserId());
	document.addTextSortable(ResourceUserTerm.CLASS_NAME, resourceUser.getClassName());
	document.addTextSortable(ResourceUserTerm.CLASS_PK, resourceUser.getClassPK());
	document.addNumberSortable(ResourceUserTerm.TO_USERID, resourceUser.getToUserId());
	document.addTextSortable("selected", Boolean.TRUE.toString());
	
	User user = UserLocalServiceUtil.fetchUser(resourceUser.getToUserId());
	
	String userName = StringPool.BLANK;
	String email = StringPool.BLANK;
	
	if(Validator.isNotNull(user)){
		
		userName = user.getFullName();
		email = user.getEmailAddress();
		
	}
	
	document.addTextSortable(ResourceUserTerm.TO_USERNAME, userName);
	document.addTextSortable(ResourceUserTerm.EMAIL, email);
	document.addTextSortable(ResourceUserTerm.USERCLASS, Employee.class.getName());
	
	return document;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:35,代码来源:ResourceUserIndexer.java

示例8: 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);

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

		String dossierStatus = dossier.getDossierStatus();

		for (ProcessAction act : actions) {

			String preStepCode = act.getPreStepCode();

			ProcessStep step = ProcessStepLocalServiceUtil.fetchBySC_GID(preStepCode, groupId, serviceProcessId);

			if (Validator.isNotNull(step)) {
				if (step.getDossierStatus().equalsIgnoreCase(dossierStatus)) {
					action = act;
					break;
				}
			} else {
				action = act;
				break;
			}

		}

	} catch (Exception e) {
		throw new NotFoundException("NotProcessActionFound");
	}

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

示例9: getVCard

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Override
public VCard getVCard() {

    String str = getCard();
    VCard vCard = null;

    if (Validator.isNotNull(str)) {
        vCard = Ezvcard.parse(str).first();
    } else {
        vCard = new VCard();
    }

    return vCard;

}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:16,代码来源:ContactImpl.java

示例10: hasPermitDoAction

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
public void hasPermitDoAction(long groupId, long userId, Dossier dossier, long serviceProcessId,
		ProcessAction action) throws PortalException {
	boolean isOwnner = false;

	if (dossier.getUserId() == userId) {
		isOwnner = true;
	}

	if (!isOwnner) {
		boolean isAuthorityEmpoyee = false;

		ProcessStep step = ProcessStepLocalServiceUtil.fetchBySC_GID(action.getPreStepCode(), groupId,
				serviceProcessId);

		if (Validator.isNotNull(step)) {
			List<ProcessStepRole> roles = ProcessStepRoleLocalServiceUtil.findByP_S_ID(step.getPrimaryKey());

			ok: for (ProcessStepRole role : roles) {
				long[] userIds = UserLocalServiceUtil.getRoleUserIds(role.getRoleId());

				for (long spUid : userIds) {
					if (spUid == userId) {
						isAuthorityEmpoyee = true;
						break ok;
					}
				}
			}

		}

		if (!isAuthorityEmpoyee) {
			throw new DossierAccessException("DossierAccessException");
		}

	}

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

示例11: convertStringToFullDate

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
public static Date convertStringToFullDate(String strDate) {
	DateFormat df = getDateTimeFormat(_VN_DATE_TIME_FORMAT);
	Date date = null;

	try {
		if (Validator.isNotNull(strDate)) {
			date = df.parse(strDate);
		}
	}
	catch (ParseException pe) {
		_log.error(pe);
	}

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

示例12: mappingToRegistrationResultsModel

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
public static List<RegistrationModel> mappingToRegistrationResultsModel(List<Registration> lstRegistration) {
	List<RegistrationModel> outputs = new ArrayList<RegistrationModel>();
	if (Validator.isNotNull(lstRegistration)) {
		for (Registration registration : lstRegistration) {

			RegistrationModel model = mappingToRegistrationModel(registration);

			outputs.add(model);
		}
	}
	return outputs;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:13,代码来源:RegistrationUtils.java

示例13: postProcessSearchQuery

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
        SearchContext searchContext) throws Exception {

    addSearchTerm(searchQuery, searchContext, "company", false);
    addSearchTerm(searchQuery, searchContext, "fullName", false);

    LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

    if (params != null) {
        String expandoAttributes = (String) params.get("expandoAttributes");

        if (Validator.isNotNull(expandoAttributes)) {
            addSearchExpando(searchQuery, searchContext, expandoAttributes);
        }
    }
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:18,代码来源:ContactIndexer.java

示例14: addDictItem

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
@Override
public DictItem addDictItem(long userId, long groupId, 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, NoSuchDictItemException, SystemException {
	// KhoaVD sua tam cho nay
	// DictItem dictColl =
	// dictItemPersistence.fetchByF_dictItemCode(itemCode, groupId);
	DictItem dictColl = dictItemPersistence.fetchByF_dictItemCode_dictCollectionId(itemCode, dictCollectionId,
			groupId);

	if (Validator.isNotNull(dictColl)) {

		throw new DuplicateCategoryException();

	}

	// 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);

	long dictItemId = counterLocalService.increment(DictItem.class.getName());

	DictItem dictItem = dictItemPersistence.create(dictItemId);

	sibling = getSibling(groupId, dictCollectionId, parentItemId, sibling, level);

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

	// Group instance
	dictItem.setGroupId(groupId);

	// Audit fields
	dictItem.setUuid(serviceContext.getUuid());
	dictItem.setCompanyId(user.getCompanyId());
	dictItem.setUserId(user.getUserId());
	dictItem.setUserName(user.getFullName());
	dictItem.setCreateDate(serviceContext.getCreateDate(now));
	dictItem.setModifiedDate(serviceContext.getCreateDate(now));

	// Other fields
	dictItem.setDictCollectionId(dictCollectionId);
	itemCode = itemCode;
	dictItem.setItemCode(itemCode);
	dictItem.setItemName(itemName);
	dictItem.setItemNameEN(itemNameEN);
	dictItem.setItemDescription(itemDescription);
	dictItem.setParentItemId(parentItemId);
	dictItem.setSibling(Validator.isNotNull(sibling) ? sibling : String.valueOf(1));
	dictItem.setTreeIndex(treeIndex);
	dictItem.setLevel(StringUtil.count(treeIndex, StringPool.PERIOD));
	dictItem.setMetaData(metaData);

	// referent dictcollection
	BaseModel<?> baseModel = DictCollectionLocalServiceUtil.fetchDictCollection(dictCollectionId);

	dictItem.setExpandoBridgeAttributes(baseModel);

	dictItemPersistence.update(dictItem);

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

示例15: buildSearchContext

import com.liferay.portal.kernel.util.Validator; //导入方法依赖的package包/类
protected SearchContext buildSearchContext(long userId, long groupId,
        String data, String id, String name, String range, Date timestamp,
        Date fromDate, Date untilDate, LinkedHashMap<String, Object> params,
        boolean andSearch, int start, int end, Sort sort)
        throws PortalException {

    SearchContext searchContext = new SearchContext();

    searchContext.setAttribute("advancedSearch", true);

    searchContext.setAttribute(Field.STATUS, WorkflowConstants.STATUS_ANY);

    if (Validator.isNotNull(data)) {
        searchContext.setAttribute("data", data);
    }

    if (Validator.isNotNull(id)) {
        searchContext.setAttribute("id", id);
    }

    if (Validator.isNotNull(name)) {
        searchContext.setAttribute("name", name);
    }

    if (Validator.isNotNull(range)) {
        searchContext.setAttribute("range", range);
    }

    if (Validator.isNotNull(timestamp)) {
        searchContext.setAttribute("timestamp", timestamp.getTime());
    }

    if (Validator.isNotNull(fromDate)) {
        searchContext.setAttribute("fromDate", fromDate);
    }

    if (Validator.isNotNull(untilDate)) {
        searchContext.setAttribute("untilDate", untilDate);
    }

    searchContext.setAttribute("paginationType", "more");

    Group group = GroupLocalServiceUtil.getGroup(groupId);

    searchContext.setCompanyId(group.getCompanyId());

    searchContext.setEnd(end);
    if (groupId > 0) {
        searchContext.setGroupIds(new long[] { groupId });
    }
    searchContext.setSorts(sort);
    searchContext.setStart(start);
    searchContext.setUserId(userId);

    searchContext.setAndSearch(andSearch);

    if (params != null) {

        String keywords = (String) params.remove("keywords");

        if (Validator.isNotNull(keywords)) {
            searchContext.setKeywords(keywords);
        }
    }

    QueryConfig queryConfig = new QueryConfig();

    queryConfig.setHighlightEnabled(false);
    queryConfig.setScoreEnabled(false);

    searchContext.setQueryConfig(queryConfig);

    if (sort != null) {
        searchContext.setSorts(sort);
    }

    searchContext.setStart(start);

    return searchContext;
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:81,代码来源:MeasurementLocalServiceImpl.java


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