本文整理汇总了Java中org.apache.sling.jcr.resource.JcrResourceConstants类的典型用法代码示例。如果您正苦于以下问题:Java JcrResourceConstants类的具体用法?Java JcrResourceConstants怎么用?Java JcrResourceConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JcrResourceConstants类属于org.apache.sling.jcr.resource包,在下文中一共展示了JcrResourceConstants类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createEmptyCache
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
private Node createEmptyCache(HtmlLibrary library, String root, Session session) {
Node node = null;
// this.lock.writeLock().lock();
try {
Node swap = JcrUtils.getOrCreateByPath(root,
JcrResourceConstants.NT_SLING_FOLDER,
JcrResourceConstants.NT_SLING_FOLDER,
session, true);
node = swap.addNode(getLibraryName(library), JcrConstants.NT_FILE);
swap = node.addNode(JcrConstants.JCR_CONTENT, JcrConstants.NT_RESOURCE);
swap.setProperty(JcrConstants.JCR_LASTMODIFIED, 0L);
swap.setProperty(JcrConstants.JCR_MIMETYPE, library.getType().contentType);
swap.setProperty(JcrConstants.JCR_DATA,
session.getValueFactory().createBinary(new ByteArrayInputStream(new byte[0])));
session.save();
// this.lock.writeLock().unlock();
} catch(RepositoryException re) {
log.debug(re.getMessage());
}
return node;
}
开发者ID:steeleforge,项目名称:aemin,代码行数:22,代码来源:HtmlLibraryManagerDelegateImpl.java
示例2: accepts
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
/**
* Gateway method the Filter uses to determine if the request is a candidate for processing by Assets Folder Properties Support.
* These checks should be fast and fail broadest and fastest first.
*
* @param request the request
* @return true if Assets Folder Properties Support should process this request.
*/
@SuppressWarnings("squid:S3923")
protected boolean accepts(SlingHttpServletRequest request) {
if (!StringUtils.equalsIgnoreCase(POST_METHOD, request.getMethod())) {
// Only POST methods are processed
return false;
} else if (!DAM_FOLDER_SHARE_OPERATION.equals(request.getParameter(OPERATION))) {
// Only requests with :operation=dam.share.folder are processed
return false;
} else if (!StringUtils.startsWith(request.getResource().getPath(), DAM_PATH_PREFIX)) {
// Only requests under /content/dam are processed
return false;
} else if (!request.getResource().isResourceType(JcrResourceConstants.NT_SLING_FOLDER)
&& !request.getResource().isResourceType(JcrResourceConstants.NT_SLING_ORDERED_FOLDER)) {
// Only requests to sling:Folders or sling:Ordered folders are processed
return false;
}
// If the above checks do not fail, treat as a valid request
return true;
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:28,代码来源:AssetsFolderPropertiesSupport.java
示例3: create
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
@Override
public ReplicationContent create(Session session, ReplicationAction action, ReplicationContentFactory factory, Map<String, Object> map) throws ReplicationException {
String path = action.getPath();
ReplicationLog log = action.getLog();
if (StringUtils.isNotBlank(path)) {
try {
HashMap<String, Object> sessionMap = new HashMap<>();
sessionMap.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, session);
ResourceResolver resolver = resolverFactory.getResourceResolver(sessionMap);
Resource resource = resolver.getResource(path);
if (resource != null) {
String primaryType = resource.getValueMap().get(JcrConstants.JCR_PRIMARYTYPE, String.class);
ElasticSearchContentBuilder builder = getContentBuilder(primaryType, log);
if (builder != null) {
return createReplicationContent(factory, builder.create(path, resolver));
}
}
}
catch (LoginException e) {
log.error("Could not retrieve Page Manager", e);
}
}
log.info(getClass().getSimpleName() + ": Path is blank");
return ReplicationContent.VOID;
}
开发者ID:deveth0,项目名称:elasticsearch-aem,代码行数:29,代码来源:ElasticSearchIndexContentBuilder.java
示例4: serializeToJson
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
/**
* Returns a JSONObject that holds all the thing data we need.
*
* @param resource Resource to start serializing from
* @param serializeAssociatedItems option to resolve linked items. if true we will resolve and include them
*
* @return JSONObject of the thing
*/
@Override
public JSONObject serializeToJson(Resource resource,Boolean serializeAssociatedItems) {
JSONObject jsonObject = null;//empty result
//is it a page?
if(resource.isResourceType(NameConstants.NT_PAGE)){
try {
//ok so now that we know its a page, lets look at its jcr content
Resource contentResource = resource.getChild(NameConstants.NN_CONTENT);
ValueMap resourceVm = contentResource.adaptTo(ValueMap.class);
dumbResourcePropertiesToDebug(contentResource);
//if its not a thing we cant serialize it or we wont
if( (resourceVm.containsKey(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY)) && (resourceVm.get(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY).equals(ThingConstants.THING_RESOURCE_TYPE)) || (resourceVm.get(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY).equals(ThingConstants.THING_RESOURCE_SHORT_TYPE))){
log.debug("Doing build json");
jsonObject = buildJson(contentResource, jsonObject,serializeAssociatedItems,0,true);
}else{
log.debug("resource passed is not a thing : "+ resource.getResourceType());
}
}catch (Exception exc){
log.error(exc.getLocalizedMessage(),exc.getStackTrace());
}
}else {
log.debug("Resource passed is not a cq:Page its " + resource.getResourceType() + " so are whimping out on serializing it");
}
if(jsonObject == null){
return new JSONObject();//empty object
}else{
return jsonObject;
}
}
开发者ID:AdobeAtAdobe,项目名称:aaa-aem-boilerplate,代码行数:42,代码来源:ThingJsonBuilderImpl.java
示例5: getNodeType
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
public String getNodeType() {
if (FolderType.ORDERED_FOLDER.equals(folderType)) {
return JcrResourceConstants.NT_SLING_ORDERED_FOLDER;
} else {
return JcrResourceConstants.NT_SLING_FOLDER;
}
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:8,代码来源:AssetFolderCreator.java
示例6: visit
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
@Override
protected void visit(final Resource resource) {
final ValueMap properties = resource.adaptTo(ValueMap.class);
// Ensure jcr:primaryType = cq:PageContent and
// that the sling:resourceType is that of Bulk Workflow Manager Page
if (NT_PAGE_CONTENT.equals(properties.get(JcrConstants.JCR_PRIMARYTYPE, String.class))
&& StringUtils.equals(BulkWorkflowEngine.SLING_RESOURCE_TYPE,
properties.get(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY, String.class))) {
this.configurations.add(resource);
}
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:13,代码来源:ConfigResourceVisitor.java
示例7: getResourceResolver
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
/**
* @{inheritDoc}
**/
@Override
public final ResourceResolver getResourceResolver(WorkflowSession workflowSession) throws LoginException {
final Map<String, Object> authInfo = new HashMap<String, Object>();
authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, workflowSession.getSession());
return resourceResolverFactory.getResourceResolver(authInfo);
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:10,代码来源:WorkflowHelperImpl.java
示例8: setUp
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
request = new MockSlingHttpServletRequest(slingContext.resourceResolver(), osgiContext.bundleContext());
response = new MockSlingHttpServletResponse();
slingFolderResource = slingContext.create().resource("/content/dam/folder", ImmutableMap.<String, Object>builder()
.put(JcrConstants.JCR_PRIMARYTYPE, JcrResourceConstants.NT_SLING_FOLDER)
.build());
slingOrderedFolderResource = slingContext.create().resource("/content/dam/folder/ordered", ImmutableMap.<String, Object>builder()
.put(JcrConstants.JCR_PRIMARYTYPE, JcrResourceConstants.NT_SLING_ORDERED_FOLDER)
.build());
invalidResourceTypeResource = slingContext.create().resource("/content/dam/folder/asset.png", ImmutableMap.<String, Object>builder()
.put(JcrConstants.JCR_PRIMARYTYPE, "dam:Asset")
.build());
invalidPathResource
= slingContext.create().resource("/content/site/pages", ImmutableMap.<String, Object>builder()
.put(JcrConstants.JCR_PRIMARYTYPE, JcrResourceConstants.NT_SLING_FOLDER)
.build());
request.setResource(slingFolderResource);
request.setParameterMap(ImmutableMap.<String, Object>builder().put(":operation", "dam.share.folder").build());
request.setMethod("post");
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:28,代码来源:AssetsFolderPropertiesSupportTest.java
示例9: getResourceResolver
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
/**
* Helper methods.
*/
private ResourceResolver getResourceResolver(Session session) throws LoginException {
return resourceResolverFactory.getResourceResolver(Collections.<String, Object>singletonMap(JcrResourceConstants.AUTHENTICATION_INFO_SESSION,
session));
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:8,代码来源:SampleWrappingWorkflowProcess.java
示例10: getResourceResolver
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
private ResourceResolver getResourceResolver(Session session) throws LoginException {
return resourceResolverFactory.getResourceResolver(Collections.<String, Object>singletonMap(JcrResourceConstants.AUTHENTICATION_INFO_SESSION,
session));
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:5,代码来源:SampleCQWorkflowProcess.java
示例11: execute
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
@Override
public final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaData)
throws WorkflowException {
final WorkflowData workflowData = workItem.getWorkflowData();
final String type = workflowData.getPayloadType();
// Check if the payload is a path in the JCR
if (!StringUtils.equals(type, "JCR_PATH")) {
return;
}
String[] args = buildArguments(metaData);
// process arguments
String emailTemplate = getValueFromArgs(Arguments.TEMPLATE.getArgumentName(), args);
if (emailTemplate == null) {
log.warn("Invalid process arguments, returning");
return;
}
// set date format to be used in emails
String sdfParam = getValueFromArgs(Arguments.DATE_FORMAT.getArgumentName(), args);
SimpleDateFormat sdf = getSimpleDateFormat(sdfParam);
// Get the path to the JCR resource from the payload
final String payloadPath = workflowData.getPayload().toString();
// Get ResourceResolver
final Map<String, Object> authInfo = new HashMap<String, Object>();
authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, workflowSession.getSession());
final ResourceResolver resourceResolver;
try {
resourceResolver = resourceResolverFactory.getResourceResolver(authInfo);
Resource payloadRes = resourceResolver.getResource(payloadPath);
// Email Parameter map
Map<String, String> emailParams = new HashMap<String, String>();
// Set jcr path
emailParams.put(SendTemplatedEmailConstants.JCR_PATH, payloadPath);
// Get Payload params
Map<String, String> payloadProp = SendTemplatedEmailUtils.getPayloadProperties(payloadRes, sdf);
if (payloadProp != null) {
emailParams.putAll(payloadProp);
}
// Get Url params
Map<String, String> urlParams = getUrls(payloadRes);
emailParams.putAll(urlParams);
// Get Additional Parameters to add
Map<String, String> wfParams = getAdditionalParams(workItem, workflowSession, payloadRes);
emailParams.putAll(wfParams);
// get email addresses based on CQ user or group
String[] emailTo = getEmailAddrs(workItem, payloadRes, args);
List<String> failureList = emailService.sendEmail(emailTemplate, emailParams, emailTo);
if (failureList.isEmpty()) {
log.info("Email sent successfully to {} recipients", emailTo.length);
} else {
log.error("Email sent failed");
}
} catch (LoginException e) {
log.error("Could not acquire a ResourceResolver object from the Workflow Session's JCR Session: {}", e);
}
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:74,代码来源:SendTemplatedEmailProcess.java
示例12: getResourceResolver
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
public final ResourceResolver getResourceResolver(Session session) throws LoginException {
Map<String, Object> authInfo = new HashMap<String, Object>();
authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, session);
return resourceResolverFactory.getResourceResolver(authInfo);
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:6,代码来源:SyntheticWorkflowRunnerImpl.java
示例13: getResourceResolver
import org.apache.sling.jcr.resource.JcrResourceConstants; //导入依赖的package包/类
private ResourceResolver getResourceResolver(Session session) throws LoginException {
final Map<String, Object> authInfo = new HashMap<String, Object>();
authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, session);
return resourceResolverFactory.getResourceResolver(authInfo);
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:6,代码来源:DamMetadataPropertyResetProcess.java
注:本文中的org.apache.sling.jcr.resource.JcrResourceConstants类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论