List of usage examples for com.liferay.portal.kernel.util ContentTypes TEXT_HTML
String TEXT_HTML
To view the source code for com.liferay.portal.kernel.util ContentTypes TEXT_HTML.
Click Source Link
From source file:at.meduni.liferay.portlet.bbmrieric.service.impl.D2BiobankLocalServiceImpl.java
License:Open Source License
/** * //from w w w. j a va2 s .co m * @param biobankId * @param serviceContext * @return */ public D2Biobank addD2Biobank(long biobankId, long companyId, long groupId, long userId, String biobankName, String ldapbiobankID, String ldapupdateuuid, String contactIDRef, long contactPriority, String biobankJurisdicalPerson, String biobankCountry, boolean biobankPartnerCharterSigned, String bioresourceReference, String biobankNetworkIDRef, String geoLatitude, String geoLongitude, boolean collaborationPartnersCommercial, boolean collaborationPartnersNonforprofit, boolean biobankITSupportAvailable, long biobankITStaffSize, boolean biobankISAvailable, boolean biobankHISAvailable, String biobankAcronym, String biobankDescription, String biobankURL, String biobankHeadFirstName, String biobankHeadLastName, String biobankHeadRole, boolean biobankClinical, boolean biobankPopulation, boolean biobankResearchStudy, boolean biobankNonHuman, boolean biobankCollection, String biobankType, ServiceContext serviceContext) { try { // Create the Biobank Entry // Set Primary Key if (biobankId == 0) { biobankId = counterLocalService.increment(); } D2Biobank d2biobank = d2BiobankPersistence.create(biobankId); // Set provenance fields if (companyId == 0) { companyId = serviceContext.getCompanyId(); } if (groupId == 0) { groupId = serviceContext.getScopeGroupId(); } if (userId == 0) { userId = serviceContext.getUserId(); } Date now = new Date(); d2biobank.setCreateDate(serviceContext.getCreateDate(now)); d2biobank.setModifiedDate(serviceContext.getModifiedDate(now)); d2biobank.setUserId(userId); d2biobank.setGroupId(groupId); d2biobank.setCompanyId(companyId); // Set mandatory fields d2biobank.setBiobankName(biobankName); d2biobank.setBbmribiobankID(ldapbiobankID); d2biobank.setUpdateuuid(ldapupdateuuid); d2biobank.setContactIDRef(contactIDRef); d2biobank.setContactPriority(contactPriority); d2biobank.setBiobankJurisdicalPerson(biobankJurisdicalPerson); d2biobank.setBiobankCountry(biobankCountry.toUpperCase()); d2biobank.setBiobankPartnerCharterSigned(biobankPartnerCharterSigned); // Set optional fields d2biobank.setBioresourceReference(bioresourceReference); d2biobank.setBiobankNetworkIDRef(biobankNetworkIDRef); d2biobank.setGeoLatitude(geoLatitude); d2biobank.setGeoLongitude(geoLongitude); d2biobank.setCollaborationPartnersCommercial(collaborationPartnersCommercial); d2biobank.setCollaborationPartnersNonforprofit(collaborationPartnersNonforprofit); d2biobank.setBiobankITSupportAvailable(biobankITSupportAvailable); d2biobank.setBiobankITStaffSize(biobankITStaffSize); d2biobank.setBiobankISAvailable(biobankISAvailable); d2biobank.setBiobankHISAvailable(biobankHISAvailable); d2biobank.setBiobankAcronym(biobankAcronym); d2biobank.setBiobankDescription(biobankDescription); d2biobank.setBiobankURL(biobankURL); d2biobank.setBiobankHeadFirstName(biobankHeadFirstName); d2biobank.setBiobankHeadLastName(biobankHeadLastName); d2biobank.setBiobankHeadRole(biobankHeadRole); d2biobank.setBiobankClinical(biobankClinical); d2biobank.setBiobankPopulation(biobankPopulation); d2biobank.setBiobankResearchStudy(biobankResearchStudy); d2biobank.setBiobankNonHuman(biobankNonHuman); d2biobank.setBiobankCollection(biobankCollection); d2biobank.setBiobankType(biobankType); // Liferay Expension Fields d2biobank.setExpandoBridgeAttributes(serviceContext); d2BiobankPersistence.update(d2biobank); // Add Asset Entry to Liferay resourceLocalService.addResources(companyId, groupId, userId, D2Biobank.class.getName(), biobankId, false, true, true); AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, groupId, d2biobank.getCreateDate(), d2biobank.getModifiedDate(), D2Biobank.class.getName(), d2biobank.getBiobankId(), d2biobank.getUuid(), 0, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames(), true, null, null, null, ContentTypes.TEXT_HTML, d2biobank.getBiobankName(), d2biobank.getBiobankDescription(), null, null, null, 0, 0, null, false); //updateEntry(userId, groupId, createDate, modifiedDate, className, classPK, classUuid, classTypeId=0, categoryIds, tagNames, visible, startDate, endDate, expirationDate, mimeType, title, description, summary, url, layoutUuid, height, width, priority, sync) assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), serviceContext.getAssetLinkEntryIds(), AssetLinkConstants.TYPE_RELATED); Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(D2Biobank.class); indexer.reindex(d2biobank); return d2biobank; } catch (Exception e) { System.out.println("[" + date_format_apache_error.format(new Date()) + "] [error] [BBMRIERICDatabase-portlet::at.meduni.liferay.portlet.bbmrieric.service.impl.D2BiobankLocalServiceImpl::addD2Biobank] Error creating D2Biobank with (D2Biobank newbiobank, ServiceContext serviceContext)."); e.printStackTrace(); } return null; }
From source file:at.meduni.liferay.portlet.bbmrieric.service.impl.D2BiobankLocalServiceImpl.java
License:Open Source License
/** * /*w ww .j a va 2s . c o m*/ * @param newbiobank * @param serviceContext * @return */ public D2Biobank updateD2Biobank(D2Biobank d2biobank, ServiceContext serviceContext) { try { // Set provenance fields if (d2biobank.getUserId() == 0) { d2biobank.setUserId(serviceContext.getUserId()); } Date now = new Date(); d2biobank.setModifiedDate(serviceContext.getModifiedDate(now)); d2biobank.setBiobankCountry(d2biobank.getBiobankCountry().toUpperCase()); // Liferay Expension Fields d2biobank.setExpandoBridgeAttributes(serviceContext); d2BiobankPersistence.update(d2biobank); // Add Asset Entry to Liferay resourceLocalService.updateResources(d2biobank.getCompanyId(), d2biobank.getGroupId(), d2biobank.getBiobankName(), d2biobank.getBiobankId(), serviceContext.getGroupPermissions(), serviceContext.getGuestPermissions()); AssetEntry assetEntry = assetEntryLocalService.updateEntry(d2biobank.getUserId(), d2biobank.getGroupId(), d2biobank.getCreateDate(), d2biobank.getModifiedDate(), D2Biobank.class.getName(), d2biobank.getBiobankId(), d2biobank.getUuid(), 0, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames(), true, null, null, null, ContentTypes.TEXT_HTML, d2biobank.getBiobankName(), d2biobank.getBiobankDescription(), null, null, null, 0, 0, null, false); //updateEntry(userId, groupId, createDate, modifiedDate, className, classPK, classUuid, classTypeId=0, categoryIds, tagNames, visible, startDate, endDate, expirationDate, mimeType, title, description, summary, url, layoutUuid, height, width, priority, sync) assetLinkLocalService.updateLinks(d2biobank.getUserId(), assetEntry.getEntryId(), serviceContext.getAssetLinkEntryIds(), AssetLinkConstants.TYPE_RELATED); Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(D2Biobank.class); indexer.reindex(d2biobank); return d2biobank; } catch (Exception e) { System.out.println("[" + date_format_apache_error.format(new Date()) + "] [error] [BBMRIERICDatabase-portlet::at.meduni.liferay.portlet.bbmrieric.service.impl.D2BiobankLocalServiceImpl::updateD2Biobank] Error updateing D2Biobank with (D2Biobank newbiobank, ServiceContext serviceContext)."); e.printStackTrace(); } return null; }
From source file:at.meduni.liferay.portlet.bbmrieric.service.impl.D2BiobankLocalServiceImpl.java
License:Open Source License
/** * //from w ww . jav a2s . com * @param biobankId * @param serviceContext * @return */ public D2Biobank updateD2Biobank(long biobankId, long userId, String biobankName, String ldapbiobankID, String ldapupdateuuid, String contactIDRef, long contactPriority, String biobankJurisdicalPerson, String biobankCountry, boolean biobankPartnerCharterSigned, String bioresourceReference, String biobankNetworkIDRef, String geoLatitude, String geoLongitude, boolean collaborationPartnersCommercial, boolean collaborationPartnersNonforprofit, boolean biobankITSupportAvailable, long biobankITStaffSize, boolean biobankISAvailable, boolean biobankHISAvailable, String biobankAcronym, String biobankDescription, String biobankURL, String biobankHeadFirstName, String biobankHeadLastName, String biobankHeadRole, boolean biobankClinical, boolean biobankPopulation, boolean biobankResearchStudy, boolean biobankNonHuman, boolean biobankCollection, String biobankType, ServiceContext serviceContext) { try { // Update the Biobank Entry D2Biobank d2biobank = getD2Biobank(biobankId); // Set provenance fields if (userId == 0) { userId = serviceContext.getUserId(); } Date now = new Date(); d2biobank.setModifiedDate(serviceContext.getModifiedDate(now)); d2biobank.setUserId(userId); // Set mandatory fields d2biobank.setBiobankName(biobankName); d2biobank.setBbmribiobankID(ldapbiobankID); d2biobank.setUpdateuuid(ldapupdateuuid); d2biobank.setContactIDRef(contactIDRef); d2biobank.setContactPriority(contactPriority); d2biobank.setBiobankJurisdicalPerson(biobankJurisdicalPerson); if (biobankCountry.equalsIgnoreCase("ee")) { biobankCountry = "et"; } d2biobank.setBiobankCountry(biobankCountry); d2biobank.setBiobankPartnerCharterSigned(biobankPartnerCharterSigned); // Set optional fields d2biobank.setBioresourceReference(bioresourceReference); d2biobank.setBiobankNetworkIDRef(biobankNetworkIDRef); d2biobank.setGeoLatitude(geoLatitude); d2biobank.setGeoLongitude(geoLongitude); d2biobank.setCollaborationPartnersCommercial(collaborationPartnersCommercial); d2biobank.setCollaborationPartnersNonforprofit(collaborationPartnersNonforprofit); d2biobank.setBiobankITSupportAvailable(biobankITSupportAvailable); d2biobank.setBiobankITStaffSize(biobankITStaffSize); d2biobank.setBiobankISAvailable(biobankISAvailable); d2biobank.setBiobankHISAvailable(biobankHISAvailable); d2biobank.setBiobankAcronym(biobankAcronym); d2biobank.setBiobankDescription(biobankDescription); d2biobank.setBiobankURL(biobankURL); d2biobank.setBiobankHeadFirstName(biobankHeadFirstName); d2biobank.setBiobankHeadLastName(biobankHeadLastName); d2biobank.setBiobankHeadRole(biobankHeadRole); d2biobank.setBiobankClinical(biobankClinical); d2biobank.setBiobankPopulation(biobankPopulation); d2biobank.setBiobankResearchStudy(biobankResearchStudy); d2biobank.setBiobankNonHuman(biobankNonHuman); d2biobank.setBiobankCollection(biobankCollection); d2biobank.setBiobankType(biobankType); // Liferay Expension Fields d2biobank.setExpandoBridgeAttributes(serviceContext); d2BiobankPersistence.update(d2biobank); // Add Asset Entry to Liferay resourceLocalService.updateResources(d2biobank.getCompanyId(), d2biobank.getGroupId(), d2biobank.getBiobankName(), biobankId, serviceContext.getGroupPermissions(), serviceContext.getGuestPermissions()); AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, d2biobank.getGroupId(), d2biobank.getCreateDate(), d2biobank.getModifiedDate(), D2Biobank.class.getName(), d2biobank.getBiobankId(), d2biobank.getUuid(), 0, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames(), true, null, null, null, ContentTypes.TEXT_HTML, d2biobank.getBiobankName(), d2biobank.getBiobankDescription(), null, null, null, 0, 0, null, false); //updateEntry(userId, groupId, createDate, modifiedDate, className, classPK, classUuid, classTypeId=0, categoryIds, tagNames, visible, startDate, endDate, expirationDate, mimeType, title, description, summary, url, layoutUuid, height, width, priority, sync) assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), serviceContext.getAssetLinkEntryIds(), AssetLinkConstants.TYPE_RELATED); Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(D2Biobank.class); indexer.reindex(d2biobank); return d2biobank; } catch (Exception e) { System.out.println("[" + date_format_apache_error.format(new Date()) + "] [error] [BBMRIERICDatabase-portlet::at.meduni.liferay.portlet.bbmrieric.service.impl.D2BiobankLocalServiceImpl::updateD2Biobank] Error updateing D2Biobank with (D2Biobank newbiobank, ServiceContext serviceContext)."); e.printStackTrace(); } return null; }
From source file:br.com.prodevelopment.associado.service.impl.AssociadoLocalServiceImpl.java
License:Open Source License
public void updateAsset(long userId, Associado associado, long[] assetCategoryIds, String[] assetTagNames, long[] assetLinkEntryIds) throws PortalException, SystemException { AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, associado.getGroupId(), associado.getCreateDate(), associado.getModifiedDate(), Associado.class.getName(), associado.getAssociadoId(), StringPool.BLANK, 0, assetCategoryIds, assetTagNames, true, null, null, null, ContentTypes.TEXT_HTML, associado.getNome(), null, null, null, null, 0, 0, null, false); assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds, AssetLinkConstants.TYPE_RELATED); }
From source file:br.com.prodevelopment.lapidarios.loja.service.impl.LojaLocalServiceImpl.java
License:Open Source License
public void updateAsset(long userId, Loja loja, long[] assetCategoryIds, String[] assetTagNames, long[] assetLinkEntryIds) throws PortalException, SystemException { boolean visible = true; String summary = HtmlUtil.extractText(StringUtil.shorten(loja.getNomeFantasia(), 500)); AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, loja.getGroupId(), loja.getCreateDate(), loja.getModifiedDate(), Loja.class.getName(), loja.getLojaId(), loja.getUuid(), 0, assetCategoryIds, assetTagNames, visible, null, null, null, ContentTypes.TEXT_HTML, loja.getNomeFantasia(), loja.getNomeFantasia(), summary, null, null, 0, 0, null, false); assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds, AssetLinkConstants.TYPE_RELATED); }
From source file:br.com.seatecnologia.treinamento.service.impl.ModeloLocalServiceImpl.java
License:Open Source License
public Modelo addModelo(Modelo modelo, ServiceContext serviceContext) throws SystemException, PortalException { modelo.setGroupId(serviceContext.getScopeGroupId()); modelo.setCompanyId(serviceContext.getCompanyId()); Modelo resource = addModelo(modelo); AssetEntryLocalServiceUtil.updateEntry(resource.getUserId(), resource.getGroupId(), Modelo.class.getName(), resource.getModeloId(), serviceContext.getUuid(), 0, new long[0], new String[0], true, null, null, new Date(), null, ContentTypes.TEXT_HTML, resource.getNome(), null, "", null, null, 0, 0, null, false);//www . j a v a2s . c om return resource; }
From source file:ca.efendi.datafeeds.service.impl.CJProductLocalServiceImpl.java
License:Open Source License
@Override @Indexable(type = IndexableType.REINDEX) public CJProduct refresh(final FtpSubscription subscription, final CJProduct newCJProduct) throws PortalException { final Date now = new Date(); CJProduct cjProduct;/*from w ww . ja va 2s .c o m*/ try { cjProduct = cjProductPersistence.findByPROGRAM_CATALOG_SKU(newCJProduct.getProgramName(), newCJProduct.getCatalogName(), newCJProduct.getSku()); } catch (final NoSuchCJProductException e) { final long productId = counterLocalService.increment(CJProduct.class.getName()); cjProduct = cjProductPersistence.create(productId); resourceLocalService.addModelResources(subscription.getCompanyId(), subscription.getGroupId(), subscription.getUserId(), CJProduct.class.getName(), productId, new String[] { "VIEW" }, new String[] { "VIEW" }); cjProduct.setUuid(PortalUUIDUtil.generate()); cjProduct.setGroupId(subscription.getGroupId()); cjProduct.setCompanyId(subscription.getCompanyId()); cjProduct.setUserId(subscription.getUserId()); cjProduct.setUserName(subscription.getUserName()); cjProduct.setProgramName(newCJProduct.getProgramName()); cjProduct.setCatalogName(newCJProduct.getCatalogName()); cjProduct.setSku(newCJProduct.getSku()); // TODO: is it already implemented by Liferay? //cjProduct.setCreateDate(now); } cjProduct.setProgramUrl(newCJProduct.getProgramUrl()); cjProduct.setLastUpdated(newCJProduct.getLastUpdated()); cjProduct.setName(newCJProduct.getName()); cjProduct.setKeywords(newCJProduct.getKeywords()); cjProduct.setDescription(newCJProduct.getDescription()); cjProduct.setManufacturer(newCJProduct.getManufacturer()); cjProduct.setManufacturerId(newCJProduct.getManufacturerId()); cjProduct.setCurrency(newCJProduct.getCurrency()); cjProduct.setPrice(newCJProduct.getPrice()); cjProduct.setBuyUrl(newCJProduct.getBuyUrl()); cjProduct.setImpressionUrl(newCJProduct.getImpressionUrl()); cjProduct.setImageUrl(newCJProduct.getImageUrl()); cjProduct.setInStock(newCJProduct.getInStock()); // TODO: is it already implemented by Liferay? //cjProduct.setModifiedDate(now); //cjProduct.setCompanyId(COMPANY_ID); //cjProduct.setGroupId(GROUP_ID); //cjProduct.setUserId(USER_ID); Date current = new Date(); Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, 1); Date expire = cal.getTime(); /* assetEntryLocalService.updateEntry( cjProduct.getUserId(), cjProduct.getGroupId(), CJProduct.class.getName(), cjProduct.getProductId(), new long[]{}, //serviceContext.getAssetCategoryIds(), new String[]{"shopping"}); //serviceContext.getAssetTagNames()); assetEntryLocalService.updateEntry( CJProduct.class.getName(), cjProduct.getProductId(), current, expire, true, true); */ String summary = HtmlUtil.extractText(StringUtil.shorten(cjProduct.getDescription(), 500)); long[] assetCategoryIds = null; String[] assetTagNames = null; boolean visible = true; Double priority = null; AssetEntry assetEntry = assetEntryLocalService.updateEntry(cjProduct.getUserId(), cjProduct.getGroupId(), cjProduct.getCreateDate(), cjProduct.getModifiedDate(), CJProduct.class.getName(), cjProduct.getProductId(), cjProduct.getUuid(), 0, assetCategoryIds, assetTagNames, true, visible, current, expire, current, expire, ContentTypes.TEXT_HTML, cjProduct.getName(), cjProduct.getDescription(), summary, cjProduct.getBuyUrl(), null, 0, 0, priority); long[] assetLinkEntryIds = null; assetLinkLocalService.updateLinks(cjProduct.getUserId(), assetEntry.getEntryId(), assetLinkEntryIds, AssetLinkConstants.TYPE_RELATED); Indexer<CJProduct> indexer = IndexerRegistryUtil.nullSafeGetIndexer(CJProduct.class); indexer.reindex(cjProduct); return cjProductPersistence.update(cjProduct); }
From source file:ch.inofix.contact.service.impl.ContactLocalServiceImpl.java
License:Open Source License
@Override public void updateAsset(long userId, Contact contact, long[] assetCategoryIds, String[] assetTagNames, long[] assetLinkEntryIds, Double priority) throws PortalException { // TODO//from w ww . j ava2 s . co m boolean visible = true; // boolean visible = false; // if (contact.isApproved()) { // visible = true; // publishDate = contact.getCreateDate(); // } Date publishDate = contact.getCreateDate(); // TODO String description = "TODO: contact description"; String summary = HtmlUtil.extractText(StringUtil.shorten(contact.getCard(), 500)); String className = Contact.class.getName(); long classPK = contact.getContactId(); AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, contact.getGroupId(), contact.getCreateDate(), contact.getModifiedDate(), className, classPK, contact.getUuid(), 0, assetCategoryIds, assetTagNames, true, visible, null, null, publishDate, null, ContentTypes.TEXT_HTML, // contact.getName(), "TODO: contact.getName()", description, summary, null, null, 0, 0, priority); assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds, AssetLinkConstants.TYPE_RELATED); // assetEntryLocalService.updateVisible(Contact.class.getName(), // classPK, visible); }
From source file:ch.inofix.referencemanager.service.impl.BibliographyLocalServiceImpl.java
License:Open Source License
public void updateAsset(long userId, Bibliography bibliography, long[] assetCategoryIds, String[] assetTagNames, long[] assetLinkEntryIds, Double priority) throws PortalException { boolean visible = false; Date publishDate = null;// www . j ava 2 s .c o m if (bibliography.isApproved()) { visible = true; publishDate = bibliography.getCreateDate(); } String summary = HtmlUtil.extractText(StringUtil.shorten(bibliography.getTitle(), 500)); AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, bibliography.getGroupId(), bibliography.getCreateDate(), bibliography.getModifiedDate(), Bibliography.class.getName(), bibliography.getBibliographyId(), bibliography.getUuid(), 0, assetCategoryIds, assetTagNames, true, visible, null, null, publishDate, null, ContentTypes.TEXT_HTML, bibliography.getTitle(), bibliography.getTitle(), summary, null, null, 0, 0, priority); assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds, AssetLinkConstants.TYPE_RELATED); }
From source file:ch.inofix.referencemanager.service.impl.ReferenceLocalServiceImpl.java
License:Open Source License
public void updateAsset(long userId, Reference reference, long[] assetCategoryIds, String[] assetTagNames, long[] assetLinkEntryIds, Double priority) throws PortalException { boolean visible = false; Date publishDate = null;//from w w w . ja v a 2s. com if (reference.isApproved()) { visible = true; publishDate = reference.getCreateDate(); } String summary = HtmlUtil.extractText(StringUtil.shorten(reference.getCitation(), 500)); AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId, reference.getGroupId(), reference.getCreateDate(), reference.getModifiedDate(), Reference.class.getName(), reference.getReferenceId(), reference.getUuid(), 0, assetCategoryIds, assetTagNames, true, visible, null, null, publishDate, null, ContentTypes.TEXT_HTML, reference.getTitle(), reference.getCitation(), summary, null, null, 0, 0, priority); assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(), assetLinkEntryIds, AssetLinkConstants.TYPE_RELATED); }