I am running alfresco 5.0.a and I want to modify the default activitiAdhoc template to set the title and description of the task. I run an activti flow when a file is added to a directory via script. My script is.
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiAdhoc";
workflow.parameters["bpm:sendEMailNotifications"] = true;
workflow.parameters["wf:notifyMe"] = true;
workflow.parameters["wf:workflowDescription"] = "A workflow task has been completed. ";
workflow.parameters["bpm:assignee"] = people.getPerson("admin");
workflow.parameters["wf:workflowTitle"] = "Please generate a cover letter for";
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);
Also i would like to change the template subject email. It currently says "You have been assigned a task" I have changed this in the workflow template as well as
/opt/alfresco-5.0.a/tomcat/webapps/alfresco/WEB-INF/lib/alfresco/messages/notification-service.properties
I have set bootstrap-context.xml file to redeploy for the ad hoc default. Restarted and still never see a change in the wf-email.ftl or when i run.
How do I modify this? No documentation I have found talks about how to change this.
To change the subject of the notification email sent from a workflow, I did the following:
Copied the notification-service.properties file into my project, and changed the value of the assigned-task field. The location I placed that file in my project was \src\main\amp\config\alfresco\module\\messages
I also added a spring bean to my project, which points to that file. I put mine in \src\main\amp\config\alfresco\module\\context\service-context.xml. (This bean overrides the one provided by alfresco in /repository/config/alfresco/notification-services-context.xml)
<bean id="notificationServiceResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.module.${project.artifactId}.messages.notification-service</value>
</list>
</property>
</bean>
Related
I have looked everywhere and I can't find out how to do this; I'm so frustrated...
How can I allow the user to send (via email) the SQLite db file?
That's it in a nutshell. I can convert it to string and attach, but I want to send the actual db file. And I'm using a new phone that doesn't have an external SD card.
The app is just a form that the user fills out, then it's saved to a SQLite database. That works wonderfully. As does printing the db to string (text) and then sending it. But, I want the user to email the actual db file (so I can use C# to read, process it, and "recreate" a real form).
Or should I be using something other than SQLite?
Edit: This is as far as I've made it. It seems to work, but it does not actually attach the file or rather the file is "blank/empty". Debug log says no such file or directory. screenshot of debug log here:http://imgur.com/oyzdtuJ
//trying again to send a SQL db file
//this seems to work and shows that it's attaching a file, but the file is empty so it won't attach
//gmail will say "cant attach empty file"
private void sendFile(String email){
File myFile = this.getFileStreamPath("testresults.db");
if(myFile != null) {
Log.d("LOG PRINT SHARE DB", "File Found, Here is file location: " + myFile.toString());
}else {
Log.w("Tag", "file not found!");
}
Uri contentUri = FileProvider.getUriForFile(this, "com.columbiawestengineering.columbiawest.MainActivity", myFile);
Log.d("LOG PRINT SHARE DB", "contentUri got: here is contentUri: " + contentUri.toString());
//grant permision for app with package "com.columbiawestengineering.columbiawest", eg. before starting other app via intent
this.grantUriPermission("com.columbiawestengineering.columbiawest", contentUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
Log.d("LOG PRINT SHARE DB", "permission granted, here is contentUri: " + contentUri.toString());
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("application/octet-stream");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "blaaa subject");
String to[] = { email };
shareIntent.putExtra(Intent.EXTRA_EMAIL, to);
shareIntent.putExtra(Intent.EXTRA_TEXT, "blah blah message");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
startActivityForResult(Intent.createChooser(shareIntent, "Send mail..."), 1252);
//revoke permisions
this.revokeUriPermission(contentUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
See this answer
Android Utility to send sqlite db to server
You could do this any number of ways. I'd say posting it to a web service is easiest. If you can only use email then I'd compress and encode it and attach it to an email but that sounds painful.
Solved. FileProvider cannot access the database directory. The db file must be copied to the files directory before it is attached. See solution here:Android: FileProvider "Failed to find configured root"
Based on this tutorial I'm trying to have Internationalization capability in my project.
I have these resources files for saving words in different languages:
resources.resx --> for default language (en-US)
resources.fa.resx --> for farsi language
resources.es.resx --> for spanish language
words like fa and es shows the culture.
in views I have replaced words with their equal in resource files in this way :
<a href="#" >#Resources.IranNewsStand</a>
Edit: I've implemented all of the logic based on the tutorial.but I have one view for all of the languages and in this view I'm using resources.resx . Is it a correct logic?
My question is that how my project knows to load which resource file based on the value of Thread.CurrentThread.CurrentCulture ? What did I miss?
Edit: I've implemented these steps:
1-I have a Class Library Project named Resources containing three mentioned resx files(resources.resx,resources.fa.resx,resources.es.resx).
2-Resource project is added in my mvc application as a reference.
3-controllers inherits this Base Controller :
public class BaseController : Controller
{
protected override void ExecuteCore()
{
string cultureName;
HttpCookie cultureCookie = Request.Cookies["_culture"];
if (cultureCookie != null)
cultureName = cultureCookie.Value;
else
cultureName = Request.UserLanguages[0];
cultureName = utilities.CultureHelper.GetValidCulture(cultureName);
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cultureName);
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
base.ExecuteCore();
}
}
4-as I said in view I have used resource strings from resource.resx file that contains the default language(en-US) strings:
<p>#Resources.Resources.Home</p>
5-in view I have a link that when clicking on it,this jquery code is run:
<script type="text/javascript">
$("#btnChangeLanguage").click(function () {
$.cookie("_culture", "fa-IR", { expires: 365, path: '/' });
window.location.reload(); // reload
})
</script>
fa-IR is a culture selected by user.but when clicking on this link the language doesn't change.
Edit:Solution
I found 2 problems in my project that solving them made everything ok:
1-jQuery cookie plugin was required to have jquery code work correctely:
<script type="text/javascript" src="~/Scripts/jquery.cookie.js" ></script>
2-the ExecuteCore event in BaseController wouldn't fire and that sounds like it was a problem in asp.net MVC 4 .So based on this question I tryed to override OnActionExecuted instead.
The logic of pulling the resource based on the current culture is built into .NET itself.
There are two steps to this:
The current culture needs to be set appropriately in the request. ASP.NET has some built-in mechanisms to do this, such as what is described in the article you linked to.
Once that is set, the .NET Framework will use the request's current culture to load the appropriate resource. If the requested locale is not available, the culture neutral resource will be loaded (the "fallback").
Following Hanselman's post about the new ASP.NET Universal Providers:
http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx
How would you configue it to read the connection string for the CSCFG file as opposed to web.config?
I don't think you can make the Universal Providers read from the ServiceConfiguration (as opposed to the web.config). But what you can do is modify the web.config with information from the ServiceConfiguration each time you deploy your application OR each time you modify the ServiceConfiguration.
In your WebRole.cs you would first write some code that does this. There is a topic on MSDN that kinda explains how you can do this:
Run in elevated mode
Reference %WINDIR%\system32\inetsrv\Microsoft.Web.Administration.dll
Write this in the OnStart method (you will need to change this code):
using (var server = new ServerManager())
{
// get the site's web configuration
var siteNameFromServiceModel = "Web"; // update this site name for your site.
var siteName =
string.Format("{0}_{1}", RoleEnvironment.CurrentRoleInstance.Id, siteNameFromServiceModel);
var siteConfig = server.Sites[siteName].GetWebConfiguration();
// get the appSettings section
var appSettings = siteConfig.GetSection("appSettings").GetCollection()
.ToDictionary(e => (string)e["key"], e => (string)e["value"]);
// reconfigure the machine key
var machineKeySection = siteConfig.GetSection("system.web/machineKey");
machineKeySection.SetAttributeValue("validationKey", appSettings["validationKey"]);
machineKeySection.SetAttributeValue("validation", appSettings["validation"]);
machineKeySection.SetAttributeValue("decryptionKey", appSettings["decryptionKey"]);
machineKeySection.SetAttributeValue("decryption", appSettings["decryption"]);
server.CommitChanges();
}
Now what this topic doesn't cover are changes to the ServiceConfiguration (say you modify the connection string from the portal without redeploying). That's why you'll also need to handle the RoleEnvironment.Changing event, to update the configuration on such a change (you can also prevent the instance to reboot here).
I'm working on a build script in the Flash Builder version of Eclipse. This build script needs to import launch configuration .launch files into the user's workspace. However there doesn't seem to be an available ANT var for determining the workspace location. While stepping through the available vars with intellisense I noticed that ${osgi.instance.area} does point to my current workspace but when I tried to echo it back in a running ant script it just spat out "${osgi.instance.area}" and not the path.
Any help would be greatly appreciated. Thank you!!!
If anyone is curious here is how I achieved this, however this is specifically tailored to Flash Builder/Flex Builder (as that's what our team uses) and unfortunately I could never get the ${eclipse.home} property to work in Ant so I had to use ${eclipse.pdebuild.scripts} to get at the installation directory:
<property name="install_loc" value=""/>
<!-- find the eclipse install location -->
<script language="javascript">
<![CDATA[
// Because ${eclipse.home} is not available, determine the install
// location using the pdebuild.scripts location
self.log("Looking for Eclipse installation...");
var base = project.getProperty("eclipse.pdebuild.scripts");
var path_pieces = base.split("/");
var path = "";
outterLoop: for(var i = path_pieces.length; i >= 0; --i)
{
if(path_pieces[i] == "Adobe Flash Builder 4" || path_pieces[i] == "Adobe Flex Builder 3")
{
// After determining which array item refers to the Adobe Flash Builder or Flex Builder
// installation, start at the beginning of the array and count up to that point, adding
// paths as you go.
var k = 0;
while( k <= i )
{
path += path_pieces[k] + "/";
++k;
}
break outterLoop;
}
}
// TODO: MAKE SURE THE PATH IS NOT EMPTY
self.log("Install path found at: " + path);
project.setProperty("install_loc", path);
]]>
</script>
<loadfile
property="workspace_prefs"
srcFile="${install_loc}configuration/.settings/org.eclipse.ui.ide.prefs">
</loadfile>
<property name="workspace_loc" value=""/>
<scriptdef name="find-workspace" language="javascript">
<attribute name="workspace_data"/>
<![CDATA[
// Find and return the workspace location
self.log("Looking for Eclipse workspace...");
var defs = attributes.get("workspace_data").split("=");
var loc = defs[defs.length - 1];
self.log("Workspace found: " + loc);
project.setProperty("workspace_loc", loc);
]]>
</scriptdef>
<find-workspace workspace_data="${workspace_prefs}" />
</target>
FWIW, I think this may give you similar functionality to the javascript part of your solution. The regular expression may be too simplistic for real-world use.
<pathconvert property="install_loc" dirsep="/">
<path location="${eclipse.pdebuild.scripts}"/>
<regexpmapper from="(^.*/Adobe [^/]*)" to="\1/"/>
</pathconvert>
For reference: Ant pathconvert and mapper docs.
This worked for me with a regular Eclipse installation, providing the script is run in Eclipse's own JVM:
<eclipse.convertPath resourcepath="workspace_loc:/" property="eclipse.workspace.home"/>
In order to denote an Ant script should run in Eclipse's own JVM, open the "External Tools Configurations..." dialog, choose your script from the left panel, go to the "JRE" tab, and choose the obvious radio button.
Amnon Grossman
I am using WSO2-EI 6.4.0. I have tried this development with link. It work for me. But I need to get user name and password from other back end service. In this example was showed the hard corded user and password. I have added that code for your reference. Please help me to get those user name and password from property file.
public boolean processSecurity(String credentials) {
String decodedCredentials = new String(new Base64().decode(credentials.getBytes()));
String usernName = decodedCredentials.split(":")[0];
String password = decodedCredentials.split(":")[1];
if ("admin".equals(username) && "admin".equals(password)) {
return true;
} else {
return false;
}
}
I have added WSO2 EI handler like following. I need to pass the value from back service or call other sequence and load.
<api context="/test">
<resource methods="POST">
<inSequence>
................
</inSequence>
<outSequence>
................
</outSequence>
</resource>
<handlers>
<handler class="rezg.ride.common.BasicAuthHandler">
<property name="cm_password" value="admin"/>
<property name="cm_userName" value="admin"/>
</handler>
</handlers>
</api>
When we run the above API, handlers are running first and then running in and out sequences. So I need to get user name and password calling Sequence or any other method before run this BasicAuthHandler.
If you need to read the property file from the class mediator it's just straight forward java property file reading. Please refer the following call sample of reading a property file. In this scenario, Just read the carbon.properties file exists in the conf directory.
public boolean mediate(MessageContext context) {
String passwordFileLocation = System.getProperty("conf.location")+"/carbon.properties";
try (FileInputStream input = new FileInputStream(passwordFileLocation)) {
Properties prop = new Properties();
// load a properties file
prop.load(input);
log.info("------org.wso2.CipherTransformation : " + prop.getProperty("org.wso2.CipherTransformation"));
} catch (IOException ex) {
ex.printStackTrace();
}
return true;
}
To get the server location and the conf locating, There are JAVA system properties are set at the time wso2 server starts. Following are some of the useful System system properties.
carbon.local.ip
carbon.home
conf.location