當前位置: 首頁>>代碼示例>>Java>>正文


Java Store類代碼示例

本文整理匯總了Java中de.espirit.firstspirit.access.store.Store的典型用法代碼示例。如果您正苦於以下問題:Java Store類的具體用法?Java Store怎麽用?Java Store使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Store類屬於de.espirit.firstspirit.access.store包,在下文中一共展示了Store類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addToExportOperation

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
@Override
public void addToExportOperation(StoreAgent storeAgent, boolean useReleaseState, ExportOperation exportOperation) {
    ContentStoreRoot store = (ContentStoreRoot) storeAgent.getStore(Store.Type.CONTENTSTORE, useReleaseState);

    final Content2 content2 = store.getContent2ByName(uid);
    if(content2 == null) {
        throw new IllegalStateException("Content2 with uid '" + uid + "' couldn't be found.");
    }
    Schema schema = content2.getSchema();
    if(schema == null) {
        throw new IllegalStateException("Schema for content2 object with uid " + uid + " couldn't be found.");
    }
    final ExportOperation.SchemaOptions schemaOptions = exportOperation.addSchema(schema);

    for (Dataset dataset : content2.getDatasets()) {
        schemaOptions.addEntity(dataset.getEntity());
    }
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:19,代碼來源:EntitiesIdentifier.java

示例2: createProblem

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
private ImportOperation.Problem createProblem(final Store.Type storeType, final long nodeId, final String message) {
    return new ImportOperation.Problem() {
        @Override
        public Store.Type getStoreType() {
            return storeType;
        }

        @Override
        public long getNodeId() {
            return nodeId;
        }

        @Override
        public String getMessage() {
            return message;
        }
    };
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:19,代碼來源:MockedImportResult.java

示例3: testDeleteMediaStoreElement

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
@Test
public void testDeleteMediaStoreElement() {
    when(store.getType()).thenReturn(Store.Type.MEDIASTORE);
    Task task = mock(Task.class);
    elementToBeDeleted = mock(Media.class);
    when(elementToBeDeleted.getStore()).thenReturn(store);

    workflowScriptContext = mock(WorkflowScriptContext.class);
    when(workflowScriptContext.getWorkflowable()).thenReturn(null);
    when(workflowScriptContext.getElement()).thenReturn(elementToBeDeleted);
    when(workflowScriptContext.getTask()).thenReturn(task);
    when(workflowScriptContext.is(BaseContext.Env.WEBEDIT)).thenReturn(Boolean.TRUE);

    runDelete();

    verify(workflowScriptContext, atLeastOnce()).is(BaseContext.Env.WEBEDIT);

    //deletion of empty parent folder
    verify(elementToBeDeleted, atLeastOnce()).getParent();
}
 
開發者ID:e-Spirit,項目名稱:basicworkflows,代碼行數:21,代碼來源:DeleteObjectTest.java

示例4: data

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
@Parameterized.Parameters(name = "{0}/execute:{2}")
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[]{Store.Type.PAGESTORE, mock(Page.class), Boolean.TRUE},
                         new Object[]{Store.Type.PAGESTORE, mock(PageFolder.class), Boolean.FALSE},
                         new Object[]{Store.Type.SITESTORE, mock(PageRef.class), Boolean.FALSE},
                         new Object[]{Store.Type.MEDIASTORE, mock(Media.class), Boolean.FALSE},
                         new Object[]{Store.Type.CONTENTSTORE, mock(Content2.class), Boolean.FALSE},
                         new Object[]{Store.Type.TEMPLATESTORE, mock(Template.class), Boolean.FALSE});
}
 
開發者ID:e-Spirit,項目名稱:FSTestTools,代碼行數:10,代碼來源:MyContextMenuItemTest.java

示例5: setUp

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
@Before
public void setUp() throws Exception {

    Connection connection = parameters.getConnection();

    when(connection.getProjectByName(PROJECT)).thenReturn(project);

    when(html.getUid()).thenReturn("html");
    when(project.getUserService()).thenReturn(userService);
    when(project.getTemplateSets()).thenReturn(Arrays.asList(html));

    when(userService.getStore(anyObject(), eq(false))).then(new Answer<Store>() {
        @Override
        public Store answer(InvocationOnMock invocation) throws Throwable {
            Store.Type storeType = (Store.Type) invocation.getArguments()[0];
            switch (storeType){
                case PAGESTORE:
                    return pageStore;
                case SITESTORE:
                    return siteStore;
                case TEMPLATESTORE:
                    when(templateStore.getFormatTemplates()).thenReturn(formatTemplates);
                    when(formatTemplates.createFormatTemplate(parameters.getName())).thenReturn(formatTemplate);

                    when(templateStore.getScripts()).thenReturn(scriptes);
                    when(scriptes.createScript(parameters.getName(), "")).thenReturn(script);

                    when(templateStore.getStoreElement(parameters.getName(),
                                                       IDProvider.UidType.TEMPLATESTORE_FORMATTEMPLATE)).thenReturn(formatTemplate);

                    when(templateStore.getStoreElement(parameters.getName(), IDProvider.UidType.TEMPLATESTORE)).thenReturn(template);

                    return templateStore;
            }
            return null;
        }
    });
}
 
開發者ID:e-Spirit,項目名稱:FSTestTools,代碼行數:39,代碼來源:ModifyStoreCommandTest.java

示例6: setUp

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
    fillZipWithContent();
    final Connection connection = parameters.getConnection();
    final String projectName = parameters.getProjectName();

    when(connection.getProjectByName(projectName)).thenReturn(project);

    when(project.getUserService()).thenReturn(userService);

    when(userService.getStore(Store.Type.TEMPLATESTORE, false)).thenReturn(templateStoreRoot);
    when(userService.getStore(Store.Type.MEDIASTORE, false)).thenReturn(mediaStoreRoot);

    when(templateStoreRoot.getFormatTemplates()).thenReturn(formatTemplates);
    when(templateStoreRoot.getPageTemplates()).thenReturn(pageTemplates);
    when(templateStoreRoot.getLinkTemplates()).thenReturn(linkTemplates);
    when(templateStoreRoot.getWorkflows()).thenReturn(workflows);
    when(templateStoreRoot.getScripts()).thenReturn(scriptes);

    when(mediaStoreRoot.getStore()).thenReturn(mediaStore);

    when(formatTemplates.importStoreElements(any(ZipFile.class), any(ModuleImportHandler.class))).thenReturn(elements);
    when(pageTemplates.importStoreElements(any(ZipFile.class), any(ModuleImportHandler.class))).thenReturn(elements);
    when(linkTemplates.importStoreElements(any(ZipFile.class), any(ModuleImportHandler.class))).thenReturn(elements);
    when(workflows.importStoreElements(any(ZipFile.class), any(ModuleImportHandler.class))).thenReturn(elements);
    when(mediaStore.importStoreElements(any(ZipFile.class), any(ModuleImportHandler.class))).thenReturn(elements);
    when(scriptes.importStoreElements(any(ZipFile.class), any(ModuleImportHandler.class))).thenReturn(elements);

    when(elements.iterator()).thenReturn(Collections.emptyIterator());
}
 
開發者ID:e-Spirit,項目名稱:FSTestTools,代碼行數:31,代碼來源:ZipImportCommandsTest.java

示例7: exportCurrentState

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
@Test
public void exportCurrentState() throws Exception {
    ExportCommand command = new ExportCommand();
    command.setProject(PROJECT_NAME_WITH_DB);
    initContextWithDefaultConfiguration(command);


    // make some changes to page 'imprint' which is based on pagetemplate 'default' of integration test project
    final Page page = (Page) command.getContext().requireSpecialist(StoreAgent.TYPE).getStore(Store.Type.PAGESTORE).getStoreElement("imprint", Page.UID_TYPE);
    changeDisplayName(page, command.getContext().getProject().getMasterLanguage(), "new displayname");

    command.addIdentifier("pagetemplate:default");
    command.addIdentifier("page:imprint");


    ExportResult result = command.call();
    final File syncFolder = getFirstSpiritFileSyncFolder(testFolder.getRoot());
    Assert.assertTrue("Export folder TemplateStore not found.", containsSubDirectory(syncFolder, "TemplateStore"));
    Assert.assertTrue("Export folder PageStore not found.", containsSubDirectory(syncFolder, "PageStore"));

    // check content of storeelement.xml
    final Set<FileHandle> createdFiles = result.get().getCreatedFiles();
    // search imprint storeelement.xml
    FileHandle imprintStoreElementXmlFileHandle = null;
    for (final FileHandle createdFile : createdFiles) {
        if ("/PageStore/imprint_1/imprint/StoreElement.xml".equals(createdFile.getPath())) {
            imprintStoreElementXmlFileHandle = createdFile;
            break;
        }
    }
    Assert.assertNotNull("imprint storeelement.xml should be created", imprintStoreElementXmlFileHandle);

    // check content of StoreElement.xml --> should contain displayname of current state
    final ByteArrayOutputStream bout = new ByteArrayOutputStream((int) imprintStoreElementXmlFileHandle.getSize());
    IoUtil.copyStream(imprintStoreElementXmlFileHandle.load(), bout, true);
    final String xmlContent = new String(bout.toByteArray(), "UTF-8");
    Assert.assertTrue("displayname of currentstate missing", xmlContent.contains("new displayname"));
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:39,代碼來源:ExportCommandIT.java

示例8: exportReleaseState

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
@Test
public void exportReleaseState() throws Exception {
    ExportCommand command = new ExportCommand();
     command.setProject(PROJECT_NAME_WITH_DB);
    initContextWithDefaultConfiguration(command);


    // make some changes to page 'imprint' which is based on pagetemplate 'default' of integration test project
    final Page page = (Page) command.getContext().requireSpecialist(StoreAgent.TYPE).getStore(Store.Type.PAGESTORE).getStoreElement("imprint", Page.UID_TYPE);
    changeDisplayName(page, command.getContext().getProject().getMasterLanguage(), "new displayname");

    command.addIdentifier("pagetemplate:default");
    command.addIdentifier("page:imprint");
    command.setExportReleaseState(true);


    ExportResult result = command.call();
    final File syncFolder = getFirstSpiritFileSyncFolder(testFolder.getRoot());
    Assert.assertTrue("Export folder TemplateStore not found.", containsSubDirectory(syncFolder, "TemplateStore"));
    Assert.assertTrue("Export folder PageStore not found.", containsSubDirectory(syncFolder, "PageStore"));

    // check content of storeelement.xml
    final Set<FileHandle> createdFiles = result.get().getCreatedFiles();
    // search imprint storeelement.xml
    FileHandle imprintStoreElementXmlFileHandle = null;
    for (final FileHandle createdFile : createdFiles) {
        if ("/PageStore/imprint_1/imprint/StoreElement.xml".equals(createdFile.getPath())) {
            imprintStoreElementXmlFileHandle = createdFile;
            break;
        }
    }
    Assert.assertNotNull("imprint storeelement.xml should be created", imprintStoreElementXmlFileHandle);

    // check content of StoreElement.xml --> should contain displayname of current state
    final ByteArrayOutputStream bout = new ByteArrayOutputStream((int) imprintStoreElementXmlFileHandle.getSize());
    IoUtil.copyStream(imprintStoreElementXmlFileHandle.load(), bout, true);
    final String xmlContent = new String(bout.toByteArray(), "UTF-8");
    Assert.assertFalse("displayname of currentstate should not be available in export", xmlContent.contains("new displayname"));
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:40,代碼來源:ExportCommandIT.java

示例9: createMediaElementAndExportItWithGivenUidMappingUidType

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
/**
 * Mocks a MediaStore and adds a dummy object X of type Media to it. Afterwards creates an ExportOperation
 * and adds an identifier matching X's uid to it, but uses the passed uidMappings uidType.
 * @param uidMapping the mapping from which the uidType is retrieved that is used for adding an element to
 *                   the export operation
 * @return the created ExportOperation mock
 */
private ExportOperation createMediaElementAndExportItWithGivenUidMappingUidType(UidMapping uidMapping) {
    String uidString = "reference_name";
    UidIdentifier uid = new UidIdentifier(uidMapping, uidString);

    StoreAgent storeAgent = mock(StoreAgent.class);
    ExportOperation exportOperation = mock(ExportOperation.class);
    Store mediaStoreRoot = mock(MediaStoreRoot.class);
    Store.Type storeType = uidMapping.getStoreType();
    when(storeAgent.getStore(storeType, false)).thenReturn(mediaStoreRoot);
    IDProvider storeElement = mock(Media.class);
    when(mediaStoreRoot.getStoreElement(uidString, uidMapping.getUidType())).thenReturn(storeElement);
    uid.addToExportOperation(storeAgent, false, exportOperation);
    return exportOperation;
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:22,代碼來源:UidIdentifierTest.java

示例10: testLogEmptyImportResult

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
@Test
public void testLogEmptyImportResult() throws Exception {
    {
        final MockLogger logger = new MockLogger(true);
        final MockedStoreAgent storeAgent = new MockedStoreAgent();
        storeAgent.addStore(Store.Type.PAGESTORE, new MockedStore(Store.Type.PAGESTORE));
        AdvancedLogger.logImportResult(logger, null, new MockedImportResult(false));
        // @formatter:off
        final String expected =
                "[INFO] Import done."                + NEW_LINE +
                        "[INFO] == DETAILS =="       + NEW_LINE +
                        "[INFO] Created elements: 0" + NEW_LINE +
                        "[INFO] Updated elements: 0" + NEW_LINE +
                        "[INFO] Deleted elements: 0" + NEW_LINE +
                        "[INFO] Moved elements: 0"   + NEW_LINE +
                        "[INFO] L&Found elements: 0" + NEW_LINE +
                        "[INFO] Problems: 0"         + NEW_LINE +
                        "[INFO] == SUMMARY =="       + NEW_LINE +
                        "[INFO] Created elements: 0" + NEW_LINE +
                        "[INFO] Updated elements: 0" + NEW_LINE +
                        "[INFO] Deleted elements: 0" + NEW_LINE +
                        "[INFO]   Moved elements: 0" + NEW_LINE +
                        "[INFO] L&Found elements: 0" + NEW_LINE +
                        "[INFO]         Problems: 0" + NEW_LINE;

        // @formatter:on
        assertEquals("Result does not match.", expected, logger.toString());
    }
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:30,代碼來源:AdvancedLoggerTest.java

示例11: getStore

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
@Override
public Store getStore(final Store.Type type) {
    Store store = _stores.get(type);
    if (store == null) {
        store = new MockedStore(type);
        addStore(type, store);
    }
    return store;
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:10,代碼來源:MockedStoreAgent.java

示例12: MockedElementExportInfo

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
MockedElementExportInfo(final Store.Type storeType, final String name, final String nodeTag, final ExportStatus exportStatus) {
    super(Type.ELEMENT, name, exportStatus);
    _basicElementInfo = new BasicElementInfoImpl(storeType, nodeTag, -1, name, -1);
    setCreatedFileHandles(createFileHandleCollection(this, 1));
    setUpdatedFileHandles(createFileHandleCollection(this, 2));
    setDeletedFileHandles(createFileHandleCollection(this, 3));
    setMovedFileHandles(createMovedFileHandleCollection(this, 4));
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:9,代碼來源:MockedElementExportInfo.java

示例13: fillCollection

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
private void fillCollection(final Set<BasicElementInfo> set, final String description) {
    set.add(createElementInfo(4, Store.Type.TEMPLATESTORE, TagNames.PAGETEMPLATES, description));
    set.add(createElementInfo(3, Store.Type.MEDIASTORE, TagNames.MEDIUM, description));
    set.add(createElementInfo(1, Store.Type.PAGESTORE, TagNames.PAGE, description));
    set.add(createElementInfo(5, Store.Type.TEMPLATESTORE, TagNames.LINKTEMPLATE, description));
    set.add(createElementInfo(2, Store.Type.MEDIASTORE, TagNames.MEDIUM, description));
    set.add(createElementInfo(6, Store.Type.TEMPLATESTORE, TagNames.FORMATTEMPLATE, description));
    set.add(createElementInfo(7, Store.Type.TEMPLATESTORE, TagNames.FORMATTEMPLATE, description));
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:10,代碼來源:MockedImportResult.java

示例14: MockedEntityTypeExportInfo

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
MockedEntityTypeExportInfo(final String entityType, final String schemaName, final int entityCount) {
    super(Type.ENTITY_TYPE);
    _entityType = entityType;
    _schemaElementInfo = new BasicElementInfoImpl(Store.Type.TEMPLATESTORE, schemaName, -1, schemaName, -1);
    _entities = new ArrayList<>();
    for (int index = 0; index < entityCount; index++) {
        _entities.add(new BasicEntityInfoImpl(UUID.nameUUIDFromBytes(("entity_" + index).getBytes()), entityType, schemaName));
    }
    setCreatedFileHandles(createFileHandleCollection(this, 1));
    setUpdatedFileHandles(createFileHandleCollection(this, 2));
    setDeletedFileHandles(createFileHandleCollection(this, 3));
    setMovedFileHandles(createMovedFileHandleCollection(this, 4));
}
 
開發者ID:e-Spirit,項目名稱:FSDevTools,代碼行數:14,代碼來源:MockedEntityTypeExportInfo.java

示例15: getContent2ObjectsForEntity

import de.espirit.firstspirit.access.store.Store; //導入依賴的package包/類
private Listable<Content2> getContent2ObjectsForEntity(final Entity entityFromReference) {

        StoreAgent storeAgent = workflowScriptContext.requireSpecialist(StoreAgent.TYPE);
        ContentStoreRoot contentStoreRoot = (ContentStoreRoot) storeAgent.getStore(Store.Type.CONTENTSTORE);

        return contentStoreRoot.getChildren(new TypedFilter<Content2>(Content2.class) {
            @Override
            public boolean accept(Content2 storeElement) {
                return (storeElement.getEntityType().equals(entityFromReference.getEntityType())) && storeElement.getEntity(entityFromReference.getKeyValue()) != null;
            }
        }, true);
    }
 
開發者ID:e-Spirit,項目名稱:basicworkflows,代碼行數:13,代碼來源:WorkflowObject.java


注:本文中的de.espirit.firstspirit.access.store.Store類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。