Fórum

delete default Document Types

thumbnail
Nilesh Gundecha, modificado 12 Anos atrás.

delete default Document Types

Regular Member Postagens: 205 Data de Entrada: 01/12/09 Postagens Recentes
Dear All,

I am using Liferay 6.1. In Documents and Media portlet, there are some default Document Types like Online Marketing, Sales Presentation, etc. I do not want these default Document Types to be there.

I can login with Admin and delete these Document Types. But I do not want to this every time I do fresh installation.

Is there any way I can configure this once and all?

Regards,
Nilesh
thumbnail
Hitoshi Ozawa, modificado 12 Anos atrás.

RE: delete default Document Types

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Unfortunately no. There was request on having a property to turn off these links but for now, you'll have to modify the source code.

Try commenting out in the following:
/portal-impl/src/com/liferay/portal/events/AddDefaultDocumentLibraryStructuresAction.java
thumbnail
Nilesh Gundecha, modificado 12 Anos atrás.

RE: delete default Document Types

Regular Member Postagens: 205 Data de Entrada: 01/12/09 Postagens Recentes
Thanks for the reply Hitoshi.

I created EXT plugin and did comment some code in the AddDefaultDocumentLibraryStructuresAction.java.

But I am not able to figure out when this code is executed? Any idea?

Its not executed when I add "Documents and Media" portlet on to a page of new Site.

Regards,
Nilesh
thumbnail
Hitoshi Ozawa, modificado 12 Anos atrás.

RE: delete default Document Types

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Types can be erased by deleting rows #240 through #248 in /ROOT/html/portlet/document_library/view_folders.jsp

<li class="folder file-entry-type ....
thumbnail
Nilesh Gundecha, modificado 12 Anos atrás.

RE: delete default Document Types

Regular Member Postagens: 205 Data de Entrada: 01/12/09 Postagens Recentes
Thanks Hitoshi.

I am not very convinced to go with hook above jsp. There will be some more jsps to be hooked. Plus, this will make me lose the feature of custom document Types.

Here I am seeing one more strange problem, that when I login as Admin and delete the default Document Types, it gets deleted. But when I restart my Tomcat, all the Document Types are back.

Do I need to open ticket in JIRA for this?

Regards,
Nilesh
thumbnail
Hitoshi Ozawa, modificado 12 Anos atrás.

RE: delete default Document Types

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Right, deleting the rows will delete all the others items that should show.
I thought you just wanted to know which jsp and where these rows where being outputted.

But when I restart my Tomcat, all the Document Types are back.


I think that's the specs.

The values are being entered into the database table DDMSTRUCTURE so unless you reinstall from the modified version, it's getting the values from the database.
thumbnail
Juan Fernández, modificado 11 Anos atrás.

RE: delete default Document Types

Liferay Legend Postagens: 1261 Data de Entrada: 02/10/08 Postagens Recentes
Hi Hitoshi and Nilesh:
I have just seen this conversation, and somethings are wrong here: I'll write this for future visitors of the thread.

ctually the default document types are created in the class AddDefaultDDMStructuresAction, which is called from the class AddDefaultDataAction, which is a startup action.
This means that it will be launched everytime you restart your server.
In case you want to turn off this creation process, you'll need to comment the following lines in AddDefaultDataAction


SimpleAction addDefaultDDMStructuresAction = new AddDefaultDDMStructuresAction();
addDefaultDDMStructuresAction.run(ids);


OR

you can add a custom AddDefaultDataAction in the application.startup.events overriding the default one

And you can do this using an Ext Plugin
Thanks, guys
Juan Fernández
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: delete default Document Types

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Juan, thank you for you comment. It seems Nilesh doesn't want to completely disable all the default document types, but select the ones he wants to be displayed.

I'll write this to future readers who may be reading this thread. I've answered for Nilesh's particular use case, but to provide a general answer to future readers, much more consideration should be given. Modifying display characterics using ext plugin is not a preferred way unless it is absolutely certain the modification is OK for all portal instances now and in the future. Change the java code so it'll look up settings for a liferay instance in the liferay database table.
thumbnail
Sreeraj AV, modificado 11 Anos atrás.

RE: delete default Document Types

Regular Member Postagens: 239 Data de Entrada: 27/04/10 Postagens Recentes
can you please tell me how we can fix this issue using hooks???


Juan Fernández:
Hi Hitoshi and Nilesh:
I have just seen this conversation, and somethings are wrong here: I'll write this for future visitors of the thread.

ctually the default document types are created in the class AddDefaultDDMStructuresAction, which is called from the class AddDefaultDataAction, which is a startup action.
This means that it will be launched everytime you restart your server.
In case you want to turn off this creation process, you'll need to comment the following lines in AddDefaultDataAction


SimpleAction addDefaultDDMStructuresAction = new AddDefaultDDMStructuresAction();
addDefaultDDMStructuresAction.run(ids);


OR

you can add a custom AddDefaultDataAction in the application.startup.events overriding the default one

And you can do this using an Ext Plugin
Thanks, guys
Juan Fernández
thumbnail
Andrius Kurtinaitis, modificado 11 Anos atrás.

RE: delete default Document Types

Junior Member Postagens: 62 Data de Entrada: 25/01/10 Postagens Recentes
I just added to portal-ext.properties the following line:
application.startup.events=com.liferay.portal.events.ChannelHubAppStartupAction

And those pesky structures are gone :-)
Also gone are all the default layoutsets, but who really needs them?
thumbnail
Olaf Kock, modificado 10 Anos atrás.

RE: delete default Document Types

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
From stackoverflow

If you look at the default configuration, found in portal.properties, there it says

#
# Application startup event that runs once for every web site instance of
# the portal that initializes.
#
application.startup.events=com.liferay.portal.events.AddDefaultDataAction,\
     com.liferay.portal.events.AppStartupAction,\
     com.liferay.portal.events.ChannelHubAppStartupAction


So you can remove the default com.liferay.portal.events.AddDefaultDataAction from this list by just stating the others in your portal-ext.properties:

application.startup.events=com.liferay.portal.events.AppStartupAction,\
     com.liferay.portal.events.ChannelHubAppStartupAction


If you want to do this for all new installations, you'll have to add this change before the first start of the instance. Or you should write an ext plugin that does this out-of-the-box. Why do you need an ext? A hook can only add another StartupAction, not change the existing ones. An ext can change or remove existing startup actions or override their code.

In an ext plugin you could also implement

application.startup.events=com.mariaioannidou.MyCustomAddDefaultDataAction,\
     com.liferay.portal.events.AppStartupAction,\
     com.liferay.portal.events.ChannelHubAppStartupAction


and implement MyCustomAddDefaultDataAction as doing the same that the default action does, sans creating the document types.

On the other hand, a hook could find all of the standard document types that you don't want, check that they are indeed unused, and then delete them. As you can see, AddDefaultDataAction does quite a bit more than just adding the document types, so you might want the rest of the code in the action to run.

Another alternative is to write an ext plugin that actually changes the implementation of com.liferay.portal.events.AddDefaultDataAction, but there you are again with an ext - if you don't deploy this in every installation before your first startup, you'll end up with the default content anyway and you might want to have some code to delete it automatically.

My personal recommendation would be with a hook, deleting the unneeded document types (if they're unused) - the reasons are:

  • Ease of deployment (hot-deployment possible),
  • if you don't deploy your plugin before the first run, you end up needing to delete the unwanted document types anyway,
  • maintainability: It's easier to maintain a hook than an ext plugin.
srini vasulu, modificado 7 Anos atrás.

RE: delete default Document Types

Regular Member Postagens: 139 Data de Entrada: 22/02/11 Postagens Recentes
Thanks olaf for your post here.

I would like to know that you are mentioned that we can achieve this using hook
but i would like to know that on hook how we can delete the document types?.
which hook we need to use?