Package jeeves.server.context

Examples of jeeves.server.context.ServiceContext


     */
    protected URL getDefinitionsURL() {
        String overrideProjFile = System.getProperty(SYSTEM_DEFAULT_USER_PROJ_FILE);

        if (overrideProjFile == null) {
          ServiceContext srvContext = ServiceContext.get();
          if(srvContext != null) {
            overrideProjFile = srvContext.getServlet().getServletContext().getRealPath("/WEB-INF/override_epsg.properties");
          }
         
          if(overrideProjFile == null || !new File(overrideProjFile).exists()) {
                overrideProjFile = "override_epsg.properties";
          }
View Full Code Here


                    // Get the optional translator for the facet
                    final Translator translator;
                    if (ServiceContext.get() != null) {
                        try {
                            ServiceContext context = ServiceContext.get();
                            translator = facetConfig.getTranslator(context, langCode);
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                    } else {
View Full Code Here

     * @throws Exception
     */
    public static Map<String,Map<String,String>> getAllMetadataFromIndexFor(String priorityLang, String field, String value, Set<String> returnFields, boolean checkAllHits) throws Exception {
        final IndexAndTaxonomy indexAndTaxonomy;
        final SearchManager searchmanager;
        ServiceContext context = ServiceContext.get();
        GeonetworkMultiReader reader;
        if (context != null) {
            GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
            searchmanager = gc.getBean(SearchManager.class);
            indexAndTaxonomy = searchmanager.getNewIndexReader(priorityLang);
            reader = indexAndTaxonomy.indexReader;
        } else {
            throw new IllegalStateException("There needs to be a ServiceContext in the thread local for this thread");
View Full Code Here

    public void testDataManagerCutpoints() throws Exception {
        TransactionlessTesting.get().run
                (new TestTask() {
                    @Override
                    public void run() throws Exception {
                        final ServiceContext serviceContext = createServiceContext();
                        loginAsAdmin(serviceContext);

                        final String metadataCategory = metadataCategoryRepository.findAll().get(0).getName();
                        final Element sampleMetadataXml = getSampleMetadataXml();
                        final UserSession userSession = serviceContext.getUserSession();
                        final int userIdAsInt = userSession.getUserIdAsInt();
                        final DataManager dm = DataManagerWorksWithoutTransactionIntegrationTest.this.dataManager;
                        String schema = dm.autodetectSchema(sampleMetadataXml);
                        final String mdId = dm.insertMetadata(serviceContext, schema, sampleMetadataXml,
                                "uuid" + _inc.incrementAndGet(), userIdAsInt, "2", "source",
View Full Code Here

    public void testSetHarvesterData() throws Exception {
        TransactionlessTesting.get().run
                (new TestTask() {
                    @Override
                    public void run() throws Exception {
                        final ServiceContext serviceContext = createServiceContext();
                        loginAsAdmin(serviceContext);

                        final DataManagerWorksWithoutTransactionIntegrationTest test =
                                DataManagerWorksWithoutTransactionIntegrationTest.this;
                        final int metadataId =  DataManagerIntegrationTest.importMetadata(test, serviceContext);
View Full Code Here

    MetadataRepository _metadataRepository;

    @Test
    public void testDeleteMetadata() throws Exception {
        int count = (int) _metadataRepository.count();
        final ServiceContext serviceContext = createServiceContext();
        loginAsAdmin(serviceContext);
        final UserSession userSession = serviceContext.getUserSession();
        final String mdId = _dataManager.insertMetadata(serviceContext, "iso19139", new Element("MD_Metadata"), "uuid",
                userSession.getUserIdAsInt(),
                "" + ReservedGroup.all.getId(), "sourceid", "n", "doctype", null, new ISODate().getDateAndTime(), new ISODate().getDateAndTime(),
                false, false);
View Full Code Here

        assertEquals(count, _metadataRepository.count());
    }

    @Test
    public void testBuildPrivilegesMetadataInfo() throws Exception {
        final ServiceContext serviceContext = createServiceContext();
        loginAsAdmin(serviceContext);
        final UserSession userSession = serviceContext.getUserSession();
        final Element sampleMetadataXml = getSampleMetadataXml();
        String schema = _dataManager.autodetectSchema(sampleMetadataXml);

        final String mdId1 = _dataManager.insertMetadata(serviceContext, schema, new Element(sampleMetadataXml.getName(),
                        sampleMetadataXml.getNamespace()), "uuid",
View Full Code Here

        assertEqualsText("true", info, "featured");
    }

    @Test
    public void testCreateMetadataWithTemplateMetadata() throws Exception {
        final ServiceContext serviceContext = createServiceContext();
        loginAsAdmin(serviceContext);

        final User principal = serviceContext.getUserSession().getPrincipal();

        final GroupRepository bean = serviceContext.getBean(GroupRepository.class);
        Group group = bean.findAll().get(0);

        MetadataCategory category = serviceContext.getBean(MetadataCategoryRepository.class).findAll().get(0);

        final SourceRepository sourceRepository = serviceContext.getBean(SourceRepository.class);
        Source source = sourceRepository.save(new Source().setLocal(true).setName("GN").setUuid("sourceuuid"));

        final Element sampleMetadataXml = super.getSampleMetadataXml();
        final Metadata metadata = new Metadata();
        metadata.setDataAndFixCR(sampleMetadataXml)
View Full Code Here

    }

    @Test
    public void testSetStatus() throws Exception {
        final ServiceContext serviceContext = createServiceContext();
        loginAsAdmin(serviceContext);

        final int metadataId = importMetadata(this, serviceContext);

        final MetadataStatus status = _dataManager.getStatus(metadataId);

        assertEquals(null, status);

        final ISODate changeDate = new ISODate();
        final String changeMessage = "Set to draft";
        _dataManager.setStatus(serviceContext, metadataId, 0, changeDate, changeMessage);

        final MetadataStatus loadedStatus = _dataManager.getStatus(metadataId);

        assertEquals(changeDate, loadedStatus.getId().getChangeDate());
        assertEquals(changeMessage, loadedStatus.getChangeMessage());
        assertEquals(0, loadedStatus.getStatusValue().getId());
        assertEquals(metadataId, loadedStatus.getId().getMetadataId());
        assertEquals(0, loadedStatus.getId().getStatusId());
        assertEquals(serviceContext.getUserSession().getUserIdAsInt(), loadedStatus.getId().getUserId());
    }
View Full Code Here

        assertEquals(serviceContext.getUserSession().getUserIdAsInt(), loadedStatus.getId().getUserId());
    }

    @Test
    public void testSetHarvesterData() throws Exception {
        final ServiceContext serviceContext = createServiceContext();
        loginAsAdmin(serviceContext);

        final int metadataId = importMetadata(this, serviceContext);

        doSetHarvesterDataTest(_metadataRepository, _dataManager, metadataId);
View Full Code Here

TOP

Related Classes of jeeves.server.context.ServiceContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.