本文整理汇总了Java中com.liferay.portal.kernel.search.Document.get方法的典型用法代码示例。如果您正苦于以下问题:Java Document.get方法的具体用法?Java Document.get怎么用?Java Document.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.search.Document
的用法示例。
在下文中一共展示了Document.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAssetViewURL
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
/**
* Gets the search result's view URL
*
* @param document The searched document
* @param request The request
* @param response The response
* @param currentLayout The current page
* @param tabId The search tab ID
*
* @return The search result URL
*/
private String getAssetViewURL(Document document, PortletRequest request, PortletResponse response, Layout currentLayout, String tabId, String keywords) {
String className = document.get(Field.ENTRY_CLASS_NAME);
long classPK = GetterUtil.getLong(document.get(Field.ENTRY_CLASS_PK));
String currentUrl = this.portal.getCurrentURL(request);
String returnedUrl;
if(ASSET_TYPE.equals(className) && classPK > 0) {
try {
String portletId = (String) request.getAttribute(WebKeys.PORTLET_ID);
PortletURL viewInPortletUrlObj = this.portletUrlFactory.create(request, portletId, currentLayout, LIFECYCLE_RENDER);
viewInPortletUrlObj.setParameter(PortletRequestParameter.VIEW_MODE.getName(), ViewMode.VIEW_JOURNAL.getParamValue());
viewInPortletUrlObj.setParameter(Field.ENTRY_CLASS_PK, Long.toString(classPK));
viewInPortletUrlObj.setParameter(PortletRequestParameter.TAB_ID.getName(), tabId);
viewInPortletUrlObj.setParameter(PortletRequestParameter.KEYWORDS.getName(), keywords);
String viewInPortletUrl = viewInPortletUrlObj.toString();
AssetRendererFactory<?> assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(className);
AssetRenderer<?> assetRenderer = assetRendererFactory.getAssetRenderer(classPK);
returnedUrl = assetRenderer.getURLViewInContext((LiferayPortletRequest) request, (LiferayPortletResponse) response, viewInPortletUrl);
} catch(Exception e) {
returnedUrl = currentUrl;
}
} else {
returnedUrl = currentUrl;
}
return returnedUrl;
}
示例2: mappingToDeliverableFormDataModel
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
public static String mappingToDeliverableFormDataModel(List<Document> documents) {
Document doc = documents.get(0);
if (doc != null) {
return doc.get(DeliverableTerm.FORM_DATA);
} else {
return null;
}
}
示例3: mappingToDossierLogResultsModel
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
public static List<DossierLogModel> mappingToDossierLogResultsModel(List<Document> documents) {
List<DossierLogModel> outputs = new ArrayList<DossierLogModel>();
for (Document document : documents) {
DossierLogModel model = new DossierLogModel();
long dossierLogId = GetterUtil.getLong(document.get("entryClassPK"));
long dossierId = GetterUtil.getLong(document.get(DossierLogTerm.DOSSIER_ID));
// String notificationType =
// GetterUtil.getInteger(document.get(DossierLogTerm.NOTIFICATION_TYPE));
int counter = GetterUtil.getInteger(document.get(DossierLogTerm.COUNTER));
model.setDossierLogId(dossierLogId);
String strDate = document.get(DossierLogTerm.CREATE_DATE);
Date date = null;
if (Validator.isNotNull(strDate)) {
date = APIDateTimeUtils.convertStringToDate(strDate, "yyyyMMddHHmmss");
}
model.setCreateDate(date != null ? APIDateTimeUtils.convertDateToString(date, APIDateTimeUtils._TIMESTAMP): strDate);
model.setAuthor(document.get(DossierLogTerm.AUTHOR));
model.setContent(document.get(DossierLogTerm.CONTENT));
model.setNotificationType(document.get(DossierLogTerm.NOTIFICATION_TYPE));
model.setPayload(document.get(DossierLogTerm.PAYLOAD));
model.setDossierId(dossierId);
model.setServiceCode(document.get(DossierLogTerm.SERVICE_CODE));
model.setServiceName(document.get(DossierLogTerm.SERVICE_NAME));
model.setGovAgencyCode(document.get(DossierLogTerm.GOVAGENCYCODE));
model.setGovAgencyName(document.get(DossierLogTerm.GOVAGENCYNAME));
model.setCounter(counter);
outputs.add(model);
}
return outputs;
}
示例4: getResultBuilder
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public ResultItemBuilder getResultBuilder(
PortletRequest portletRequest, PortletResponse portletResponse,
Document document, String assetPublisherPageFriendlyURL) {
String entryClassName = document.get(Field.ENTRY_CLASS_NAME);
ResultItemBuilder resultItemBuilder;
if (BlogsEntry.class.getName().equals(entryClassName)) {
resultItemBuilder = new BlogsEntryItemBuilder();
}
else if (DLFileEntry.class.getName().equals(entryClassName)) {
resultItemBuilder = new DLFileEntryItemBuilder();
}
else if (JournalArticle.class.getName().equals(entryClassName)) {
resultItemBuilder = new JournalArticleItemBuilder();
}
else if (MBMessage.class.getName().equals(entryClassName)) {
resultItemBuilder = new MBMessageItemBuilder();
}
else if (WikiPage.class.getName().equals(entryClassName)) {
resultItemBuilder = new WikiPageItemBuilder();
}
else if ("non-liferay-type".equals(entryClassName)) {
resultItemBuilder = new NonLiferaySampleItemBuilder();
} else {
throw new UnsupportedOperationException("Result item builder not implemented for " + entryClassName);
}
resultItemBuilder.setProperties(
portletRequest, portletResponse, document,
assetPublisherPageFriendlyURL);
return resultItemBuilder;
}
示例5: mappingToDeliverable
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
public static DeliverableModel mappingToDeliverable (Document doc) {
DeliverableModel model = new DeliverableModel();
model.setDeliverableId(Long.valueOf(doc.get(DeliverableTerm.DELIVERABLE_ID)));
model.setUserId(Long.valueOf(doc.get(Field.USER_ID)));
model.setUserName(doc.get(Field.USER_NAME));
//Convert Date to String
String strCreateDate = doc.get(Field.CREATE_DATE);
Date createDate = null;
if (Validator.isNotNull(strCreateDate)) {
createDate = APIDateTimeUtils.convertStringToDate(strCreateDate, "yyyyMMddHHmmss");
}
model.setCreateDate(createDate != null
? APIDateTimeUtils.convertDateToString(createDate, APIDateTimeUtils._TIMESTAMP) : strCreateDate);
String strModifiedDate = doc.get(Field.MODIFIED_DATE);
Date modifiedDate = null;
if (Validator.isNotNull(strModifiedDate)) {
modifiedDate = APIDateTimeUtils.convertStringToDate(strModifiedDate, "yyyyMMddHHmmss");
}
model.setModifiedDate(modifiedDate != null
? APIDateTimeUtils.convertDateToString(modifiedDate, APIDateTimeUtils._TIMESTAMP)
: strModifiedDate);
model.setDeliverableCode(doc.get(DeliverableTerm.DELIVERABLE_CODE));
model.setDeliverableName(doc.get(DeliverableTerm.DELIVERABLE_NAME));
model.setDeliverableType(doc.get(DeliverableTerm.DELIVERABLE_TYPE));
model.setGovAgencyCode(doc.get(DeliverableTerm.GOV_AGENCY_CODE));
model.setGovAgencyName(doc.get(DeliverableTerm.GOV_AGENCY_NAME));
model.setApplicantIdNo(doc.get(DeliverableTerm.APPLICANT_ID_NO));
model.setApplicantName(doc.get(DeliverableTerm.APPLICANT_NAME));
model.setSubject(doc.get(DeliverableTerm.SUBJECT));
//Convert Date to String
String strIssueDate = doc.get(DeliverableTerm.ISSUE_DATE);
Date issueDate = null;
if (Validator.isNotNull(strIssueDate)) {
issueDate = APIDateTimeUtils.convertStringToDate(strIssueDate, "yyyyMMddHHmmss");
}
model.setModifiedDate(issueDate != null
? APIDateTimeUtils.convertDateToString(issueDate, APIDateTimeUtils._TIMESTAMP)
: strIssueDate);
String strExpireDate = doc.get(DeliverableTerm.EXPIRE_DATE);
Date expireDate = null;
if (Validator.isNotNull(strExpireDate)) {
expireDate = APIDateTimeUtils.convertStringToDate(strExpireDate, "yyyyMMddHHmmss");
}
model.setModifiedDate(expireDate != null
? APIDateTimeUtils.convertDateToString(expireDate, APIDateTimeUtils._TIMESTAMP)
: strExpireDate);
String strRevalidate = doc.get(DeliverableTerm.REVALIDATE);
Date revalidate = null;
if (Validator.isNotNull(strRevalidate)) {
revalidate = APIDateTimeUtils.convertStringToDate(strRevalidate, "yyyyMMddHHmmss");
}
model.setModifiedDate(revalidate != null
? APIDateTimeUtils.convertDateToString(revalidate, APIDateTimeUtils._TIMESTAMP)
: strRevalidate);
model.setDeliverableState(doc.get(DeliverableTerm.DELIVERABLE_STATE));
return model;
}
示例6: getDataFormByTypeCode
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
@Override
public Response getDataFormByTypeCode(HttpServletRequest request, HttpHeaders header, Company company,
Locale locale, User user, ServiceContext serviceContext, String agencyNo, String typeCode,
String keyword) {
BackendAuth auth = new BackendAuthImpl();
try {
// Check user is login
if (!auth.isAuth(serviceContext)) {
throw new UnauthenticationException();
}
long groupId = GetterUtil.getLong(header.getHeaderString("groupId"));
JSONObject keyJson = JSONFactoryUtil.createJSONObject(keyword);
String pattern = String.valueOf(keyJson.get("query"));
String paramValues = String.valueOf(keyJson.get("values"));
String paramTypes = String.valueOf(keyJson.get("type"));
LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>();
params.put(Field.GROUP_ID, String.valueOf(groupId));
params.put(DeliverableTerm.GOV_AGENCY_CODE, agencyNo);
params.put(DeliverableTerm.DELIVERABLE_TYPE, typeCode);
params.put("pattern", pattern);
params.put("paramValues", paramValues);
params.put("paramTypes", paramTypes);
// String _properties = search.getProperties();
// String[] splitProperties = null;
// if (Validator.isNotNull(_properties)) {
// splitProperties = _properties.split(";");
// }
DeliverableActions actions = new DeliverableActionsImpl();
// DeliverableResultModel results = new DeliverableResultModel();
JSONObject results = JSONFactoryUtil.createJSONObject();
Sort[] sorts = new Sort[] {
SortFactoryUtil.create(Field.MODIFIED_DATE + "_sortable", Sort.STRING_TYPE, true) };
// get JSON data deliverable
JSONObject jsonData = actions.getFormDataByTypecode(serviceContext.getCompanyId(), params, sorts,
-1, -1, serviceContext);
// results.setTotal(jsonData.getInt("total"));
// results.getData()
// .addAll(DeliverableUtils.mappingToDeliverableResultModel((List<Document>) jsonData.get("data")));
//TODO
results.put("total", jsonData.getInt("total"));
// results.getData()
// .addAll(
List<Document> docList =(List<Document>) jsonData.get("data");
JSONArray formDataArr = JSONFactoryUtil.createJSONArray();
for (Document doc : docList) {
String formData = doc.get(DeliverableTerm.FORM_DATA);
formDataArr.put(JSONFactoryUtil.createJSONObject(formData));
}
results.put("data", formDataArr);
return Response.status(200).entity(JSONFactoryUtil.looseSerialize(results)).build();
} catch (Exception e) {
ErrorMsg error = new ErrorMsg();
error.setMessage("not found!");
error.setCode(404);
error.setDescription("not found!");
return Response.status(404).entity(error).build();
}
}
示例7: mappingToRegistrationLoggDataListDocument
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
public static List<RegistrationLogModel> mappingToRegistrationLoggDataListDocument(List<Document> lstregistrationLogs) {
List<RegistrationLogModel> outputs = new ArrayList<RegistrationLogModel>();
for (Document document : lstregistrationLogs) {
RegistrationLogModel model = new RegistrationLogModel();
long registrationLogId = GetterUtil.getLong(document.get("entryClassPK"));
String strDate = document.get(RegistrationLogTerm.CREATE_DATE);
Date date = null;
if (Validator.isNotNull(strDate)) {
date = APIDateTimeUtils.convertStringToDate(strDate, "yyyyMMddHHmmss");
}
model.setCreateDate(date != null ? APIDateTimeUtils.convertDateToString(date, APIDateTimeUtils._TIMESTAMP): strDate);
model.setAuthor(document.get(RegistrationLogTerm.AUTHOR));
model.setContent(document.get(RegistrationLogTerm.CONTENT));
model.setPayload(document.get(RegistrationLogTerm.PAYLOAD));
model.setRegistrationLogId(registrationLogId);
outputs.add(model);
}
return outputs;
}
示例8: mappingToDossierLogSearchByIdResultsModel
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
public static List<DossierLogSearchIdModel> mappingToDossierLogSearchByIdResultsModel(List<Document> documents) {
List<DossierLogSearchIdModel> outputs = new ArrayList<DossierLogSearchIdModel>();
for (Document document : documents) {
DossierLogSearchIdModel model = new DossierLogSearchIdModel();
long dossierLogId = GetterUtil.getLong(document.get("entryClassPK"));
// int notificationType =
// GetterUtil.getInteger(document.get(DossierLogTerm.NOTIFICATION_TYPE));
model.setDossierLogId(dossierLogId);
model.setAuthor(document.get(DossierLogTerm.AUTHOR));
model.setContent(document.get(DossierLogTerm.CONTENT));
String strDate = document.get(DossierLogTerm.CREATE_DATE);
Date date = null;
if (Validator.isNotNull(strDate)) {
date = APIDateTimeUtils.convertStringToDate(strDate, "yyyyMMddHHmmss");
}
model.setCreateDate(date != null ? APIDateTimeUtils.convertDateToString(date, APIDateTimeUtils._TIMESTAMP): strDate);
//model.setCreateDate(document.get(DossierLogTerm.CREATE_DATE));
model.setNotificationType(document.get(DossierLogTerm.NOTIFICATION_TYPE));
model.setPayload(document.get(DossierLogTerm.PAYLOAD));
outputs.add(model);
}
return outputs;
}
示例9: getDossierLogById
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
@Override
public Response getDossierLogById(HttpServletRequest request, HttpHeaders header, Company company, Locale locale,
User user, ServiceContext serviceContext, DossierLogSearchModel query, long dossierId, String password) {
// BackendAuth auth = new BackendAuthImpl();
long groupId = GetterUtil.getLong(header.getHeaderString("groupId"));
try {
// if (!auth.isAuth(serviceContext)) {
// throw new UnauthenticationException();
// }
// DossierLogSearchIdResultsModel results = new
// DossierLogSearchIdResultsModel();
JSONObject results = JSONFactoryUtil.createJSONObject();
DossierLogActions action = new DossierLogActionsImpl();
JSONObject dossierLogJsonObject = action.getDossierLogById(groupId, dossierId, password, query.isOwner(),
query.getStart(),
query.getEnd(), query.getSort(), query.getOrder(), serviceContext);
List<Document> documents = (List<Document>) dossierLogJsonObject.get("data");
JSONArray models = JSONFactoryUtil.createJSONArray();
for (Document document : documents) {
JSONObject model = JSONFactoryUtil.createJSONObject();
long dossierLogId = GetterUtil.getLong(document.get("entryClassPK"));
// int notificationType =
// GetterUtil.getInteger(document.get(DossierLogTerm.NOTIFICATION_TYPE));
model.put("dossierLogId", dossierLogId);
model.put("author", document.get(DossierLogTerm.AUTHOR));
model.put("content", document.get(DossierLogTerm.CONTENT));
String strDate = document.get(DossierLogTerm.CREATE_DATE);
Date date = null;
if (Validator.isNotNull(strDate)) {
date = APIDateTimeUtils.convertStringToDate(strDate, "yyyyMMddHHmmss");
}
model.put("createDate", date != null
? APIDateTimeUtils.convertDateToString(date, APIDateTimeUtils._TIMESTAMP) : strDate);
model.put("notificationType", document.get(DossierLogTerm.NOTIFICATION_TYPE));
JSONObject payload = JSONFactoryUtil.createJSONObject(document.get(DossierLogTerm.PAYLOAD));
model.put("payload", payload);
models.put(model);
}
results.put("total", dossierLogJsonObject.getInt("total"));
results.put("data", models);
// results.getData().addAll(DossierLogUtils.mappingToDossierLogSearchByIdResultsModel(documents));
return Response.status(200).entity(results.toJSONString()).build();
} catch (Exception e) {
return processException(e);
}
}