本文整理汇总了Java中com.liferay.portal.kernel.util.GetterUtil.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java GetterUtil.getBoolean方法的具体用法?Java GetterUtil.getBoolean怎么用?Java GetterUtil.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.util.GetterUtil
的用法示例。
在下文中一共展示了GetterUtil.getBoolean方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postProcessSearchQuery
import com.liferay.portal.kernel.util.GetterUtil; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
SearchContext searchContext) throws Exception {
boolean advancedSearch = GetterUtil.getBoolean(searchContext.getAttribute("advancedSearch"), false);
addSearchTerm(searchQuery, searchContext, "description", false);
if (!advancedSearch) {
addSearchTerm(searchQuery, searchContext, "workPackage", true);
}
// TODO: add ticketURL
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);
}
}
}
示例2: postProcessContextBooleanFilter
import com.liferay.portal.kernel.util.GetterUtil; //导入方法依赖的package包/类
@Override
public void postProcessContextBooleanFilter(BooleanFilter contextBooleanFilter, SearchContext searchContext)
throws Exception {
addStatus(contextBooleanFilter, searchContext);
// from- and until-date
Date fromDate = GetterUtil.getDate(searchContext.getAttribute("fromDate"), DateFormat.getDateInstance(), null);
Date untilDate = GetterUtil.getDate(searchContext.getAttribute("untilDate"), DateFormat.getDateInstance(),
null);
long max = Long.MAX_VALUE;
long min = Long.MIN_VALUE;
if (fromDate != null) {
min = fromDate.getTime();
}
if (untilDate != null) {
max = untilDate.getTime();
}
contextBooleanFilter.addRangeTerm("fromDate_Number_sortable", min, max);
// workPackage
boolean advancedSearch = GetterUtil.getBoolean(searchContext.getAttribute("advancedSearch"), false);
String workPackage = (String) searchContext.getAttribute("workPackage");
if (Validator.isNotNull(workPackage) && advancedSearch) {
BooleanFilter booleanFilter = new BooleanFilter();
// Use the sortable index field, since the regular field is
// analyzed, which means, we can't use hyphens in workpackage
// names.
PrefixFilter prefixFilter = new PrefixFilter("workPackage_sortable", workPackage);
booleanFilter.add(prefixFilter);
contextBooleanFilter.add(booleanFilter, BooleanClauseOccur.MUST);
}
}
示例3: updatePaymentFileApprovalNoAttachment
import com.liferay.portal.kernel.util.GetterUtil; //导入方法依赖的package包/类
@Override
public Response updatePaymentFileApprovalNoAttachment(HttpServletRequest request, HttpHeaders header,
Company company, Locale locale, User user, ServiceContext serviceContext, String id, String referenceUid,
PaymentFileInputModel input) {
BackendAuth auth = new BackendAuthImpl();
long groupId = GetterUtil.getLong(header.getHeaderString("groupId"));
long dossierId = GetterUtil.getLong(id);
// TODO get Dossier by referenceUid if dossierId = 0
// String referenceUid = dossierId == 0 ? id : StringPool.BLANK;
Dossier dossier = null;
if (dossierId != 0) {
dossier = DossierLocalServiceUtil.fetchDossier(dossierId);
if (Validator.isNull(dossier)) {
dossier = DossierLocalServiceUtil.getByRef(groupId, id);
}
} else {
dossier = DossierLocalServiceUtil.getByRef(groupId, id);
}
if (Validator.isNotNull(dossier))
dossierId = dossier.getDossierId();
try {
if (!auth.isAuth(serviceContext)) {
throw new UnauthenticationException();
}
PaymentFileActions action = new PaymentFileActionsImpl();
PaymentFile paymentFile = action.updateFileApproval(groupId, dossierId, referenceUid,
input.getApproveDatetime(), input.getAccountUserName(), input.getGovAgencyTaxNo(),
input.getInvoiceTemplateNo(), input.getInvoiceIssueNo(), input.getInvoiceNo(), serviceContext);
if (!GetterUtil.getBoolean(input.getIsSync())) {
paymentFile.setIsNew(false);
PaymentFileLocalServiceUtil.updatePaymentFile(paymentFile);
}
PaymentFileModel result = PaymentFileUtils.mappingToPaymentFileModel(paymentFile);
return Response.status(200).entity(result).build();
} catch (Exception e) {
return processException(e);
}
}
示例4: getDossierFiles
import com.liferay.portal.kernel.util.GetterUtil; //导入方法依赖的package包/类
private void getDossierFiles(long groupId, long dossierId, List<JSONObject> lsFileSync) {
try {
InvokeREST rest = new InvokeREST();
HashMap<String, String> properties = new HashMap<String, String>();
properties.put("Content-Type", "application/x-www-form-urlencoded");
String path = "dossiers/" + dossierId + "/files";
ServiceContext serviceContext = new ServiceContext();
JSONObject resDossierFile = rest.callAPI(groupId, HttpMethods.GET, "application/json",
RESTFulConfiguration.SERVER_PATH_BASE, path, RESTFulConfiguration.SERVER_USER,
RESTFulConfiguration.SERVER_PASS, properties, serviceContext);
if (GetterUtil.getInteger(resDossierFile.get(RESTFulConfiguration.STATUS)) != HttpURLConnection.HTTP_OK) {
throw new RuntimeException(
"Failed : HTTP error code : " + resDossierFile.get(RESTFulConfiguration.STATUS));
} else {
JSONObject jsData = JSONFactoryUtil
.createJSONObject(resDossierFile.getString(RESTFulConfiguration.MESSAGE));
JSONArray array = JSONFactoryUtil.createJSONArray(jsData.getString("data"));
for (int i = 0; i < array.length(); i++) {
JSONObject object = array.getJSONObject(i);
if (GetterUtil.getBoolean(object.get("isNew"))) {
lsFileSync.add(object);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: buildQuery
import com.liferay.portal.kernel.util.GetterUtil; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public QueryStringQuery buildQuery(
JSONObject configurationObject, QueryParams queryParams)
throws Exception {
String operator =
GetterUtil.getString(configurationObject.get("operator"), "and");
float queryBoost =
GetterUtil.getFloat(configurationObject.get("boost"), 1.0f);
QueryStringQuery queryStringQuery = new QueryStringQuery(queryParams.getKeywords());
JSONArray fields = configurationObject.getJSONArray("fields");
for (int i = 0; i < fields.length(); i++) {
JSONObject item = fields.getJSONObject(i);
// Add non translated version
String fieldName = item.getString("fieldName");
float boost = GetterUtil.getFloat(item.getString("boost"), 1f);
queryStringQuery.addField(fieldName, boost);
// Add translated version
boolean isLocalized = GetterUtil.getBoolean(item.get("localized"), false);
if (isLocalized) {
String localizedFieldName = fieldName + "_" + queryParams.getLocale().toString();
float localizedBoost = GetterUtil.getFloat(item.getString("boostForLocalizedVersion"), 1f);
queryStringQuery.addField(localizedFieldName, localizedBoost);
}
}
// Set operator
if (operator.equals("or")) {
queryStringQuery.setDefaultOperator(Operator.OR);
}
else {
queryStringQuery.setDefaultOperator(Operator.AND);
}
// Query boost
queryStringQuery.setBoost(queryBoost);
// Analyzer
String analyzer = configurationObject.getString("analyzer");
if (analyzer != null && analyzer != "") {
queryStringQuery.setAnalyzer(analyzer);
}
return queryStringQuery;
}