Reputation: 69
I've one repository where I create some Site for store all documents and folders that my organization create. I've one web app that include this php library https://github.com/dkd/php-cmis-client (port of Apache Chemistry Java implementation). So I can creates documents, folder, set some properties, etc... but I would like to do "more".
I would like to extend the model and create my own model. In this case, It's very simple, I create "myPersonal" model, and create one custom type 'folderAmp' (his parents is cm:folder). And I extend this custom type and create a new property "myP:idNew" where I want to store some id code.
So, When I create a folder with this library (or maybe in java) I create it with...
JAVA
Folder parent = ....
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.NAME, "a new folder");
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
// create the folder
Folder newFolder = parent.createFolder(properties);
PHP
$properties = array(
\Dkd\PhpCmis\PropertyIds::OBJECT_TYPE_ID => 'cmis:folder',
\Dkd\PhpCmis\PropertyIds::NAME => 'Demo Folder'
);
try {
$folder = $session->createFolder(
$properties,
$session->createObjectId($session->getRepositoryInfo()->getRootFolderId())
);
So if I want to add my new custom type... What I've to do?
I try to add with this:
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder, myP:folderAmp" but it doesn't works.
Upvotes: 0
Views: 1177
Reputation: 69
But...if create type button is not enable... this repository is not "CMIS standar" ¿no?
Finally, the problem I solved it...very simple... I change
$properties = array(
\Dkd\PhpCmis\PropertyIds::OBJECT_TYPE_ID => 'cmis:folder',
\Dkd\PhpCmis\PropertyIds::NAME => 'Demo Folder'
);
try {
$folder = $session->createFolder(
$properties,
$session->createObjectId($session->getRepositoryInfo()->getRootFolderId())
);
By this...
$properties = array(
\Dkd\PhpCmis\PropertyIds::OBJECT_TYPE_ID => 'F:oto:Historia',
\Dkd\PhpCmis\PropertyIds::NAME => 'Demo Folder'
);
try {
$folder = $session->createFolder(
$properties,
$session->createObjectId($session->getRepositoryInfo()->getRootFolderId())
);
Where oto it's a model and Historia it's a custom type that I create with Alfresco Console Admin. I included all parent (cm:folder) properties in oto:Historia and create same custom properties.
When I create the folder, it's create with oto:Historia type.
Upvotes: 0
Reputation: 3235
You are looking for createType(). Not all repositories support it.
Get the CMIS Workbench from https://chemistry.apache.org/java/download.html , login into your repository, and open the "Types window". Select the folder type (cmis:folder
). If the "Create Type" button on the top is enabled you can create a new subtype of cmis:folder
. If not, either the repository doesn't support it or you don't have the permissions to do this.
Upvotes: 2