use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class LayoutDescriptorServiceTest method testGetByKey.
@Test
public void testGetByKey() throws Exception {
final DescriptorKey key = DescriptorKey.from("myapp1:mylayout");
final LayoutDescriptor descriptor = this.service.getByKey(key);
assertNotNull(descriptor);
}
use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class AbstractDataSerializerTest method createPartComponent.
protected PartComponent createPartComponent(final String partName, final String descriptorKey, final PropertyTree partConfig) {
final DescriptorKey descriptor = DescriptorKey.from(descriptorKey);
Mockito.when(partDescriptorService.getByKey(descriptor)).thenReturn(PartDescriptor.create().key(descriptor).displayName(partName).config(Form.create().build()).build());
return PartComponent.create().descriptor(descriptor).config(partConfig).build();
}
use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class FlattenedPageRegionsIndexUpgrader method upgradeDescriptorBasedComponent.
private void upgradeDescriptorBasedComponent(PropertySet componentSet, final String componentType) {
final String descriptorKeyStr = componentSet.getString(TGT_DESCRIPTOR_KEY);
if (descriptorKeyStr != null) {
final DescriptorKey descriptorKey = DescriptorKey.from(descriptorKeyStr);
result.add(String.join(ELEMENT_DIVIDER, TGT_COMPONENTS_KEY, componentType, TGT_CONFIG_KEY, getSanitizedAppName(descriptorKey), getSanitizedComponentName(descriptorKey), "*"), IndexConfig.BY_TYPE);
}
}
use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class SchedulableTaskImpl method run.
@Override
public void run() {
try {
final TaskId taskId = taskContext().callWith(() -> OsgiSupport.withService(TaskService.class, taskService -> taskService.submitTask(SubmitTaskParams.create().descriptorKey(job.getDescriptor()).data(job.getConfig()).build())));
adminContext().runWith(() -> OsgiSupport.withService(NodeService.class, nodeService -> UpdateLastRunCommand.create().nodeService(nodeService).name(job.getName()).lastRun(Instant.now()).lastTaskId(taskId).build().execute()));
} catch (Exception e) {
LOG.warn("Error while running job [{}]", this.job.getName(), e);
} catch (Throwable t) {
LOG.error("Error while running job [{}], no further attempts will be made", this.job.getName(), t);
throw t;
}
}
use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class ServiceDescriptorServiceImpl method getByKey.
@Override
public ServiceDescriptor getByKey(final DescriptorKey descriptorKey) {
final ResourceProcessor<DescriptorKey, ServiceDescriptor> processor = newRootProcessor(descriptorKey);
final ServiceDescriptor descriptor = this.resourceService.processResource(processor);
if (descriptor != null) {
return descriptor;
}
return createDefaultDescriptor(descriptorKey);
}
Aggregations