Adding a new aspect with a User property - content-management-system

Is it possible to add a property inside a new aspect that will hold a User from Alfresco's users ?
It will be used to input the User who's responsabile/authorizer of a document having a defined aspect.

The problem is that you've defined the same field twice. First as a d:text property and the second is an association.
In your model you've defined
<property name="txm:vacationPerson">
<title>Nom et prénom</title>
<type>d:text</type>
</property>
And as association you've defined:
<associations>
<association name="txm:vacationPerson">
<title>Assignee</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:person</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
</associations>
So it's rendering the first field as text and the second field isn't rendered anymore.
Remove the first d:text property or rename it.

Yes, and you may choose to use either an assocation or a property. Assuming you want users to pick the person manually, I'd go for the association since the default controls provided by share support picking a person out of the box.
Here is a sample aspect showing both - a property and an association to hold the user.
<aspect name="your:assignee">
<title>Your Aspect</title>
<properties>
<property name="your:assigedPersonUsername">
<title>Owner</title>
<type>d:text</type>
</property>
</properties>
<associations>
<association name="your:assignedPerson">
<title>Assignee</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:person</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
</associations>
</aspect>

Related

Mybatis generator configuration set tableName case sensitive

This is my xml configuration:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="DB2SAMPLE" defaultModelType="flat" targetRuntime="MyBatis3">
<plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin">
<property name="searchString" value="Example$"/>
<property name="replaceString" value="Criteria"/>
</plugin>
<plugin type="org.mybatis.generator.plugins.CaseInsensitiveLikePlugin" />
<plugin type="org.mybatis.generator.plugins.RowBoundsPlugin" />
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
<jdbcConnection driverClass="com.ibm.db2.jcc.DB2Driver" connectionURL="jdbc:db2://LOCALHOST:50000/mydb" userId="username" password="password">
</jdbcConnection>
<javaModelGenerator targetPackage="foo.package" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="false" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="foo.package" targetProject="src/main/resources">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER" targetPackage="foo.package" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<table schema="SCHEMA" tableName="MyTable" alias="MYTABLE" domainObjectName="MYTABLE"/>
</context>
</generatorConfiguration>
The problem is that it not found the table MyTable because it search MYTABLE.
How can I setup MyBatis generator for searching case sensitive name MyTable?
Thanks.
From https://www.codeday.top/2016/12/22/6853.html
1, If schema,catalog or tablename There are spaces in , So what format is set , On the exact use of the specified format to query ;
2, otherwise , If the database identifier uses uppercase , that MBG Automatically turn table name into uppercase search ;
3, otherwise , If the database identifier uses lowercase , that MBG Automatically turn table name to lowercase search ;
4, otherwise , Query using the specified case format ;
Additional , If the table is created , Using "" Specify database object size , Even if the database identifier is used , In this case a table name is created using a given case size ;
At this time , Please set delimitIdentifiers="true" Case preserving format ;

how to hide advance search by defalt in SmartField Value help in UI5?

I'm trying to hide Advance search in value help by default.
When this dialog opens, by default the category and category description Advance search options appears, I want this to be hidden.
Please help on how to approach this issue.
This is what I have
This is what I want: (Advance search to be hidden, not removed altogether)
It seems, you have used the Explored-Example from here
There you can also download the coding. Maybe you need to adjust the paths to the mockdata to get it up and running.
What happens if you try: sap:filterable="false" in your metadata.xml ?
Please see also the corresponding docu.
There it says:
“We notice that we have set sap:filterable="false" for the CURR property.
We do this, since we would otherwise also have a currency code search field in the dialog that we wish to avoid (default of sap:filterable is true).”
Now your adjusted metadata.xml from the SmartField example above could look like:
<EntityType Name="VL_SH_H_CATEGORY" sap:content-version="1">
<Key>
<PropertyRef Name="CATC" />
</Key>
<Property Name="CATC" Type="Edm.String" Nullable="false" MaxLength="4" sap:display-format="UpperCase" sap:label="Category" sap:text="LTXT" sap:filterable="false" />
<Property Name="LTXT" Type="Edm.String" Nullable="false" sap:label="Category Description" sap:filterable="false"/>
</EntityType>
…
Is this what you are looking for ?

Is it possible to assign default values to NAnt properties?

I'd like to use the property value as a part of an argument passed to a certain EXE via <exec/> task. There's a condition which influences the property initialization, that is, if condition is true, it should contain value, otherwise be just empty (but still defined).
This is what I ended up so far:
<property name="prop1" value="" />
<property name="prop1" value="some-value-based-on-condition" if="condition-goes-here" />
And later on:
<exec program="my.exe">
<arg value="C:\Root\Folder\${prop1}" />
...
</exec>
If the property is not set, I'd like to pass just C:\Root\Folder\ as an argument value.
Initializing the property in this way seems too much for such a simple operation. Is there a way to do it simpler using what's in NAnt at the moment? I would imagine something like:
<property name="prop1" value="somevalue-based-on-condition" if="condition" default="" />
The example below should meet your needs. It will create a property named 'SolutionConfiguration' and assign it the value 'Release' if and only if the same parameter isn't already defined (ie. it was defined via the command line).
<property name="SolutionConfiguration" value="Release" unless="${property::exists('SolutionConfiguration')}" />
For your scenario, try
<property name="RootFolder" value="c:\Root\Folder" unless="${property::exists('RootFolder')}" />
<exec program="my.exe">
<arg value="${RootFolder}\${prop1}" />
...
</exec>
Use overwrite="False"
<property name="RootFolder" value="c:\Root\Folder" overwrite="false" />

Passing values between workflow tasks

I have a problem with passing property values between tasks. For example, in a start task I have defined a property:
<type name="mcwm:submitStart">
<parent>bpm:startTask</parent>
<properties>
<property name="mcwm:projectName">
<title>Naziv projekta</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
In my share-config-custom.xml I show that property on the start page and that's ok.
...
<show id="mcwm:projectName"/>
...
<field id="mcwm:projectName" set="general" />
...
Now on my second form I want to show the same field with the value that has been entered in the start form. In the model I didn't specify again this property for the second task, I just wrote:
...
<type name="mcwm:preparationOfProjectCharter">
<parent>bpm:workflowTask</parent>
</type>
...
And in the share-config-custom.xml, I copied the first form configuration for the second form with one little change in the force="true" attribute:
...
<show id="mcwm:projectName" force="true"/>
...
<field id="mcwm:projectName" set="general" />
...
Now the field is there in my second form, but the value that is entered on my first form isn't - do I have to do something else to accomplish that and pass property values between forms?
Regards,
Aleksadnar
Yes, you need to do something extra. See the Workflowadministration Wiki.
You need to pass variables through the workflow-context, either via mapping as shown in the Wiki or through the context itself (at least for JBPM, and probably also for Activiti)

In Entity Framework, getting the value of an identity column after inserting

I'm using EF4. I want to insert a new MyObject into the database. MyObject has two fields:
Id: int (Identity) and
Name: string
As I've seen in documentation Entity Framework is supposed to set MyObject.Id to the value generated by database after the call to SaveChanges() but in my case that doesn't happen.
using (var context = new MyEntities())
{
var myObject = MyObjects.CreateMyObject(0, "something"); // The first parameter is identity "Id"
context.MyObjects.AddObject(myObject);
context.SaveChanges();
return myObject.Id; // The returned value is 0
}
UPDATE:
This happens in one of my entities and others work fine. By the way, I checked and the DB column is identity and StoreGeneratedPattern is set to Identity.
Here is the SSDL. I don't see any difference. The first one isn't working right:
<EntityType Name="OrgUnit">
<Key>
<PropertyRef Name="Srl" />
</Key>
<Property Name="Srl" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="TypeId" Type="smallint" Nullable="false" />
<Property Name="Name" Type="varchar" Nullable="false" MaxLength="80" />
</EntityType>
<EntityType Name="OrgType">
<Key>
<PropertyRef Name="Srl" />
</Key>
<Property Name="Srl" Type="smallint" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="Title" Type="varchar" Nullable="false" MaxLength="120" />
<Property Name="Options" Type="int" Nullable="false" />
</EntityType>
The update is done successfully in the database and the identity is generated but the entity object is not updated with the new identity.
In that case, you EF model is probably not up to date - EF should automagically get your new ID from the database. Try refreshing your EF model.
Your identity column's properties should look like this in your EDMX model:
If you're using Oracle Entity Framework 4 Provider, like I do, from ODP.NET, there is a bug in Designer. Just selecting the Identity value in drop down box will not do. It will annotate the conceptual property in conceptual model with
annotation:StoreGeneratedPattern="Identity"
like in
<Property Type="Int32" Name="Id" Nullable="false" cg:SetterAccess="Private" annotation:StoreGeneratedPattern="Identity" />
But, it will fail to do the same for Storage Model, ie. you need to do it manually. Find the Property (in my case ID) in EntityType of interest and add StoreGeneratedPattern="Identity".
<EntityType Name="PROBLEMI">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="number" Nullable="false" Precision="10" StoreGeneratedPattern="Identity" />
I'm not aware of the same bug in SQL EF provider 'cos I didn't use it.
This should "just work." Make sure the DB column actually is IDENTITY, and that StoreGeneratedPattern is set to Identity in EDMX.
wow! that was a nightmare but at last I solved it, although I didn't understand what the problem was. Maybe this helps someone with the same problem.
Generate the script for creating the table and its data.
Drop the table.
Run the script.
If you are using Linq To Entities, and get this error even if you followed the advices of marc_s (that are really good), you should look at your entites directly in the edmx (xml view) and check if they have the following attribute :
<EntityType Name="MyEntity">
<Key>
<PropertyRef Name="pk" />
</Key>
<Property Name="pk" Type="bigint" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="value" Type="float" Nullable="false" />
</EntityType>
The StoreGeneratedPattern="Identity" is also required.
Try using refresh method after Save Changes, it has been documented in MSDN
"To ensure that objects on the client have been updated by data source-side logic, you can call the Refresh method with the StoreWins value after you call SaveChanges."
http://msdn.microsoft.com/en-us/library/bb336792.aspx
Though i feel what #Craig has suggested might also work.
I ran into this today. The difference though was I was using an insert function, where the above person doesn't specify that. What I had to do was make my insert function stored procedure return SCOPE_IDENTITY() and use a result binding for the id returned.
Fixed my issue.