use of org.structr.core.property.PropertyMap in project structr by structr.
the class StructrODFModuleTest method createTestNodes.
protected <T extends AbstractNode> List<T> createTestNodes(final Class<T> type, final int number, final long delay) throws FrameworkException {
try (final Tx tx = app.tx()) {
final PropertyMap properties = new PropertyMap();
final List<T> nodes = new LinkedList<>();
properties.put(NodeInterface.visibleToAuthenticatedUsers, false);
properties.put(NodeInterface.visibleToPublicUsers, false);
properties.put(NodeInterface.deleted, false);
properties.put(NodeInterface.hidden, false);
for (int i = 0; i < number; i++) {
nodes.add(app.create(type, properties));
try {
Thread.sleep(delay);
} catch (InterruptedException ex) {
}
}
tx.success();
return nodes;
} catch (Throwable t) {
logger.warn("", t);
}
return null;
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class StructrKnowledgeModuleTest method createTestNodes.
protected <T extends AbstractNode> List<T> createTestNodes(final Class<T> type, final int number, final long delay) throws FrameworkException {
try (final Tx tx = app.tx()) {
final PropertyMap properties = new PropertyMap();
final List<T> nodes = new LinkedList<>();
properties.put(NodeInterface.visibleToAuthenticatedUsers, false);
properties.put(NodeInterface.visibleToPublicUsers, false);
properties.put(NodeInterface.deleted, false);
properties.put(NodeInterface.hidden, false);
for (int i = 0; i < number; i++) {
nodes.add(app.create(type, properties));
try {
Thread.sleep(delay);
} catch (InterruptedException ex) {
}
}
tx.success();
return nodes;
} catch (Throwable t) {
logger.warn("", t);
}
return null;
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class MQTTClient method onModification.
static void onModification(MQTTClient thisClient, final SecurityContext securityContext, final ErrorBuffer errorBuffer, final ModificationQueue modificationQueue) throws FrameworkException {
if (modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "protocol")) || modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "url")) || modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "port"))) {
MQTTContext.disconnect(thisClient);
}
if (modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "isEnabled")) || modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "protocol")) || modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "url")) || modificationQueue.isPropertyModified(thisClient, StructrApp.key(MQTTClient.class, "port"))) {
MQTTClientConnection connection = MQTTContext.getClientForId(thisClient.getUuid());
boolean enabled = thisClient.getIsEnabled();
if (!enabled) {
if (connection != null && connection.isConnected()) {
MQTTContext.disconnect(thisClient);
thisClient.setProperties(securityContext, new PropertyMap(StructrApp.key(MQTTClient.class, "isConnected"), false));
}
} else {
if (connection == null || !connection.isConnected()) {
MQTTContext.connect(thisClient);
MQTTContext.subscribeAllTopics(thisClient);
}
connection = MQTTContext.getClientForId(thisClient.getUuid());
if (connection != null) {
if (connection.isConnected()) {
thisClient.setProperties(securityContext, new PropertyMap(StructrApp.key(MQTTClient.class, "isConnected"), true));
} else {
thisClient.setProperties(securityContext, new PropertyMap(StructrApp.key(MQTTClient.class, "isConnected"), false));
}
}
}
}
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class JavaParserModuleTest method createTestNode.
protected <T extends AbstractNode> T createTestNode(final Class<T> type, final String name) throws FrameworkException {
final PropertyMap map = new PropertyMap();
map.put(AbstractNode.name, name);
return (T) createTestNode(type, map);
}
use of org.structr.core.property.PropertyMap in project structr by structr.
the class Importer method readPage.
public Page readPage(final String uuid) throws FrameworkException {
Page page = Page.createNewPage(securityContext, uuid, name);
if (page != null) {
final PropertyMap changedProperties = new PropertyMap();
changedProperties.put(AbstractNode.visibleToAuthenticatedUsers, authVisible);
changedProperties.put(AbstractNode.visibleToPublicUsers, publicVisible);
page.setProperties(securityContext, changedProperties);
createChildNodes(parsedDocument, page, page);
if (!isDeployment) {
logger.info("##### Finished fetching {} for page {} #####", new Object[] { address, name });
}
}
return page;
}
Aggregations