@Override public void setNode (final @Nonnull SiteNode node) { nodeHolder.set(node); dynamicNodePropertiesHolder.set(modelFactory.createProperties().build()); }
@Override @Nonnull public ResourceProperties getContentProperties() { if (contentHolder.get() == null) // FIXME: should never occur { log.warn("NO CONTENT IN CONTEXT"); // Thread.dumpStack(); // FIXME return modelFactory.createProperties().build(); } return contentHolder.get().getProperties(); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public ResourceProperties getExtraViewProperties (final @Nonnull Id viewId) { return modelFactory.createProperties().withId(viewId).build(); }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Nonnull private ResourceProperties loadProperties() throws IOException { final ResourceFile file = getFile(); log.debug("loadProperties() for {}", file.getPath().asString()); ResourceProperties properties = modelFactory.createProperties().withPropertyResolver(propertyResolver).build(); try { final ResourceFile propertyFile = file.findChildren().withName("Properties.xml").result(); // FIXME reuse the inheritance helper // log.trace(">>>> reading properties from {} ({})...", propertyFile.getPath().asString(), locale); @Cleanup final InputStream is = propertyFile.getInputStream(); final ResourceProperties tempProperties = // modelFactory.createProperties().build().as(Unmarshallable).unmarshal(is); modelFactory.createProperties().withPropertyResolver(propertyResolver).build().as(Unmarshallable).unmarshal(is); // log.trace(">>>>>>>> read properties: {} ({})", tempProperties, locale); properties = properties.merged(tempProperties); } catch (NotFoundException e) { // ok, no properties } return properties; } }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() throws IOException { ContextManager.Locator.set(new DefaultContextManagerProvider()); modelFactory = new ModelFactorySupport() { @Override @Nonnull public ResourceProperties build (final @Nonnull ResourceProperties.Builder builder) { return new DefaultResourceProperties(builder); } }; properties = modelFactory.createProperties().build().withProperty(PROPERTY_1, ORIGINAL_PROPERTY_1_VALUE) .withProperty(PROPERTY_2, ORIGINAL_PROPERTY_2_VALUE); callback = mock(UpdateCallback.class); underTest = new ResourcePropertiesBinder(properties); }
@BeforeClass public void prepareProperties() { factory = new AdminModelFactory(); properties = factory.createProperties().build() .withProperty(Properties.PROPERTY_CREATION_TIME2, new DateTime(1342536534636L)) .withProperty(Properties.PROPERTY_TITLE, "the title"); PropertyUtilities.setLocale(Locale.UK); PropertyUtilities.setZone(DateTimeZone.forID("CET")); }