/** * Locally adds the role and its capabilities to the current * permissions for the document. * @param role the role for users permitted to access the document * @param capabilities the permissions to be granted to users with the role * @return the document metadata handle */ public DocumentMetadataHandle withPermission( String role, Capability... capabilities ) { getPermissions().add(role, capabilities); return this; }
/** * Locally adds the role and its capabilities to the current * permissions for the document. * @param role the role for users permitted to access the document * @param capabilities the permissions to be granted to users with the role * @return the document metadata handle */ public DocumentMetadataHandle withPermission( String role, Capability... capabilities ) { getPermissions().add(role, capabilities); return this; }
private void sendPermissionsImpl(XMLStreamWriter serializer) throws XMLStreamException { serializer.writeStartElement("rapi", "permissions", REST_API_NS); for (Map.Entry<String, Set<Capability>> permission: getPermissions().entrySet()) { serializer.writeStartElement("rapi", "permission", REST_API_NS); serializer.writeStartElement("rapi", "role-name", REST_API_NS); serializer.writeCharacters(permission.getKey()); serializer.writeEndElement(); for (Capability capability: permission.getValue()) { serializer.writeStartElement("rapi", "capability", REST_API_NS); serializer.writeCharacters(capability.name().toLowerCase()); serializer.writeEndElement(); } serializer.writeEndElement(); } serializer.writeEndElement(); } private void sendPropertiesImpl(final XMLStreamWriter serializer) throws XMLStreamException, TransformerFactoryConfigurationError, TransformerException {
@Override protected void processProperties(DocumentFile documentFile, Properties properties) { String name = documentFile.getFile().getName(); if (properties.containsKey(name)) { String value = properties.getProperty(name); documentPermissionsParser.parsePermissions(value, documentFile.getDocumentMetadata().getPermissions()); } }
@Override public DocumentFile processDocumentFile(DocumentFile documentFile) { if (permissions != null && documentPermissionsParser != null) { DocumentMetadataHandle metadata = documentFile.getDocumentMetadata(); if (metadata != null) { documentPermissionsParser.parsePermissions(permissions, metadata.getPermissions()); } } return documentFile; } }
protected DocumentMetadataHandle buildMetadata() { DocumentMetadataHandle h = new DocumentMetadataHandle(); h = h.withCollections(collections); if (permissions != null) { String[] array = permissions.split(","); for (int i = 0; i < array.length; i += 2) { h.getPermissions().add(array[i], Capability.valueOf(array[i + 1].toUpperCase())); } } return h; }
public DocumentMetadataHandle setUpdatedMetadataCollections() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle().withCollections("my-collection3", "my-collection4"); // metadataHandle.getCollections().addAll("my-collection1","my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the metadata DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the meta-data DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the meta-data DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
private void addFinalDocs() { clearDatabases(HubConfig.DEFAULT_STAGING_NAME, HubConfig.DEFAULT_FINAL_NAME); DocumentMetadataHandle meta = new DocumentMetadataHandle(); meta.getCollections().add("tester"); meta.getPermissions().add(getHubAdminConfig().getHubRoleName(), READ, UPDATE, EXECUTE); installFinalDoc("/employee1.xml", meta, "flow-manager-test/input/employee1.xml"); installFinalDoc("/employee2.xml", meta, "flow-manager-test/input/employee2.xml"); }
private void addStagingDocs() { clearDatabases(HubConfig.DEFAULT_STAGING_NAME, HubConfig.DEFAULT_FINAL_NAME); DocumentMetadataHandle meta = new DocumentMetadataHandle(); meta.getCollections().add("tester"); meta.getPermissions().add(getHubAdminConfig().getHubRoleName(), READ, UPDATE, EXECUTE); installStagingDoc("/employee1.xml", meta, "flow-manager-test/input/employee1.xml"); installStagingDoc("/employee2.xml", meta, "flow-manager-test/input/employee2.xml"); }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the meta-data DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the meta-data DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the meta-data DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }
public DocumentMetadataHandle setMetadata() { // create and initialize a handle on the meta-data DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("my-collection1", "my-collection2"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.getProperties().put("myString", "foo"); metadataHandle.getProperties().put("myInteger", 10); metadataHandle.getProperties().put("myDecimal", 34.56678); metadataHandle.getProperties().put("myCalendar", Calendar.getInstance().get(Calendar.YEAR)); metadataHandle.setQuality(23); return metadataHandle; }