本文整理匯總了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;
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}