Fixed license headers, added JavaDoc

pull/10/head
Jens Pelzetter 2021-04-02 14:46:10 +02:00
parent b2b7d8d7b6
commit f79b6abe09
106 changed files with 4136 additions and 554 deletions

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package com.arsdigita.cms.ui.authoring; package com.arsdigita.cms.ui.authoring;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package com.arsdigita.cms.ui.authoring; package com.arsdigita.cms.ui.authoring;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package com.arsdigita.cms.ui.authoring.event; package com.arsdigita.cms.ui.authoring.event;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package com.arsdigita.cms.ui.authoring.news; package com.arsdigita.cms.ui.authoring.news;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package com.arsdigita.cms.ui.folder; package com.arsdigita.cms.ui.folder;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package com.arsdigita.cms.ui.pages; package com.arsdigita.cms.ui.pages;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package com.arsdigita.cms.ui.pages; package com.arsdigita.cms.ui.pages;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package db.migrations.org.librecms.ccm_cms.h2; package db.migrations.org.librecms.ccm_cms.h2;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package db.migrations.org.librecms.ccm_cms.pgsql; package db.migrations.org.librecms.ccm_cms.pgsql;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.libreccm.ui.admin.contentsections; package org.libreccm.ui.admin.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.libreccm.ui.admin.contentsections; package org.libreccm.ui.admin.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.libreccm.ui.admin.contentsections; package org.libreccm.ui.admin.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.contentsection; package org.librecms.contentsection;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.contentsection; package org.librecms.contentsection;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.contentsection; package org.librecms.contentsection;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.contentsection; package org.librecms.contentsection;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.contentsection; package org.librecms.contentsection;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.contenttypes; package org.librecms.contenttypes;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.contenttypes; package org.librecms.contenttypes;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.contenttypes; package org.librecms.contenttypes;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.contenttypes; package org.librecms.contenttypes;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui; package org.librecms.ui;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui; package org.librecms.ui;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui; package org.librecms.ui;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui; package org.librecms.ui;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -62,7 +75,7 @@ public class AssetPermissionsModelProvider {
* Builds an {@link AssetPermissionsModel} for the provided assets * Builds an {@link AssetPermissionsModel} for the provided assets
* {@link Asset} * {@link Asset}
* *
* @param folder The {@link Asset} for which the * @param asset The {@link Asset} for which the
* {@link AssetPermissionsModel} is build. * {@link AssetPermissionsModel} is build.
* *
* @return The {@link AssetFolderModel} for the {@link Asset}. * @return The {@link AssetFolderModel} for the {@link Asset}.

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,10 +1,26 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.categorization.Category;
import org.libreccm.l10n.GlobalizationHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -12,43 +28,99 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Model for the details view of a category.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class CategoryModel { public class CategoryModel {
/**
* The ID of the category.
*/
private long categoryId; private long categoryId;
/**
* The UUID of the category.
*/
private String uuid; private String uuid;
/**
* The unique ID of the category.
*/
private String uniqueId; private String uniqueId;
/**
* The name of the category.
*/
private String name; private String name;
/**
* The path of the category.
*/
private String path; private String path;
/**
* The title of the category to display. This value is determined from
* {@link Category#title} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String title; private String title;
/**
* The localized titles of the category.
*/
private Map<String, String> localizedTitles; private Map<String, String> localizedTitles;
/**
* The description of the category to display. This value is determined from
* {@link Category#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String description; private String description;
/**
* The localized descriptions of the category.
*/
private Map<String, String> localizedDescriptions; private Map<String, String> localizedDescriptions;
/**
* Is the category enabled?
*/
private boolean enabled; private boolean enabled;
/**
* Is the category visible?
*/
private boolean visible; private boolean visible;
/**
* Is the category an abstract category?
*/
private boolean abstractCategory; private boolean abstractCategory;
/**
* The sub categories of the category.
*/
private List<CategoryModel> subCategories; private List<CategoryModel> subCategories;
/**
* The objects assigned to which the category is assigned.
*/
private List<CategorizedObjectModel> objects; private List<CategorizedObjectModel> objects;
/**
* The order of the category.
*/
private long categoryOrder; private long categoryOrder;
/**
* Locales for which no localized title has been defined yet.
*/
private List<String> unusedTitleLocales; private List<String> unusedTitleLocales;
/**
* Locales for which no localized description has been defined yet.
*/
private List<String> unusedDescriptionLocales; private List<String> unusedDescriptionLocales;
public CategoryModel() { public CategoryModel() {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -13,6 +26,8 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model for showing the {@link Domain}s (category systems) and categories
* assigned to a content section.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -20,14 +35,27 @@ import javax.inject.Named;
@Named("CategorySystemModel") @Named("CategorySystemModel")
public class CategorySystemModel { public class CategorySystemModel {
/**
* List of the category systems/{@link Domain} assigned to the current
* content section.
*/
private List<DomainListEntryModel> categorySystems; private List<DomainListEntryModel> categorySystems;
/**
* The currently selected category system.
*/
private DomainListEntryModel selectedCategorySystem; private DomainListEntryModel selectedCategorySystem;
/**
* The category tree of the currently selected category system.
*/
private CategoryTreeNodeModel categoryTree; private CategoryTreeNodeModel categoryTree;
/**
* The currently selected category.
*/
private CategoryModel selectedCategory; private CategoryModel selectedCategory;
public CategorySystemModel() { public CategorySystemModel() {
categorySystems = new ArrayList<>(); categorySystems = new ArrayList<>();
} }

View File

@ -1,35 +1,69 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.categorization.Category;
import org.libreccm.l10n.GlobalizationHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
* Node of a category tree representing a category.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class CategoryTreeNodeModel { public class CategoryTreeNodeModel {
/**
* The UUID of the category.
*/
private String uuid; private String uuid;
/**
* Is the category the active category.
*/
private boolean active; private boolean active;
/**
* The path of the category.
*/
private String path; private String path;
/**
* The title of the category. This value is determined from
* {@link Category#title} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String title; private String title;
/**
* The subcategories of the category.
*/
private List<CategoryTreeNodeModel> subCategories; private List<CategoryTreeNodeModel> subCategories;
public CategoryTreeNodeModel() { public CategoryTreeNodeModel() {
subCategories = new ArrayList<>(); subCategories = new ArrayList<>();
} }
public String getPath() { public String getPath() {
return path; return path;
} }
@ -71,6 +105,5 @@ public class CategoryTreeNodeModel {
public void setActive(final boolean active) { public void setActive(final boolean active) {
this.active = active; this.active = active;
} }
} }

View File

@ -1,16 +1,26 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.api.Identifier;
import org.libreccm.api.IdentifierParser;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.PermissionChecker; import org.libreccm.security.PermissionChecker;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.contentsection.privileges.AdminPrivileges; import org.librecms.contentsection.privileges.AdminPrivileges;
import java.util.Optional; import java.util.Optional;
@ -18,13 +28,14 @@ import java.util.Optional;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.mvc.Controller; import javax.mvc.Controller;
import javax.mvc.Models;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
/** /**
* Controller for the index page of the configuration of a
* {@link ContentSection}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -33,24 +44,32 @@ import javax.ws.rs.PathParam;
@Path("/{sectionIdentifier}/configuration") @Path("/{sectionIdentifier}/configuration")
public class ConfigurationController { public class ConfigurationController {
/**
* Model for the current content section.
*/
@Inject @Inject
private ContentSectionModel sectionModel; private ContentSectionModel sectionModel;
@Inject /**
private ContentSectionRepository sectionRepo; * Common functions for controllers working with content sections.
*/
@Inject @Inject
private ContentSectionsUi sectionsUi; private ContentSectionsUi sectionsUi;
@Inject /**
private IdentifierParser identifierParser; * Checks permissions.
*/
@Inject
private Models models;
@Inject @Inject
private PermissionChecker permissionChecker; private PermissionChecker permissionChecker;
/**
* Shows the configuration index page for the current content section.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
*
* @return The template for the index page.
*/
@GET @GET
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
@ -74,6 +93,15 @@ public class ConfigurationController {
return "org/librecms/ui/contentsection/configuration/index.xhtml"; return "org/librecms/ui/contentsection/configuration/index.xhtml";
} }
/**
* Checks if the current user is permitted to access the configurations page
* of the content section.
*
* @param section The content section.
*
* @return {@code true} if the current user is permitted, {@code false}
* otherwise.
*/
private boolean hasRequiredPermission(final ContentSection section) { private boolean hasRequiredPermission(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
AdminPrivileges.ADMINISTER_CONTENT_TYPES, section AdminPrivileges.ADMINISTER_CONTENT_TYPES, section

View File

@ -1,13 +1,26 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.api.Identifier;
import org.libreccm.api.IdentifierParser; import org.libreccm.api.IdentifierParser;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.l10n.LocalizedTextsUtil; import org.libreccm.l10n.LocalizedTextsUtil;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.PermissionChecker; import org.libreccm.security.PermissionChecker;
@ -16,11 +29,9 @@ import org.libreccm.security.Role;
import org.libreccm.workflow.Workflow; import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionManager; import org.librecms.contentsection.ContentSectionManager;
import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.contentsection.ContentType; import org.librecms.contentsection.ContentType;
import org.librecms.contentsection.ContentTypeManager; import org.librecms.contentsection.ContentTypeManager;
import org.librecms.contentsection.ContentTypeMode; import org.librecms.contentsection.ContentTypeMode;
import org.librecms.contentsection.privileges.AdminPrivileges;
import org.librecms.contentsection.privileges.TypePrivileges; import org.librecms.contentsection.privileges.TypePrivileges;
import org.librecms.contenttypes.ContentTypeInfo; import org.librecms.contenttypes.ContentTypeInfo;
import org.librecms.contenttypes.ContentTypesManager; import org.librecms.contenttypes.ContentTypesManager;
@ -45,6 +56,8 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
/** /**
* Controller for managing the document types assigned to a
* {@link ContentSection}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -53,48 +66,81 @@ import javax.ws.rs.PathParam;
@Path("/{sectionIdentifier}/configuration/documenttypes") @Path("/{sectionIdentifier}/configuration/documenttypes")
public class ConfigurationDocumentTypesController { public class ConfigurationDocumentTypesController {
/**
* Checks admin permissions for {@link ContentSection}s.
*/
@Inject @Inject
private AdminPermissionsChecker adminPermissionsChecker; private AdminPermissionsChecker adminPermissionsChecker;
/**
* Provides some localized messages.
*/
@Inject @Inject
private CmsAdminMessages cmsAdminMessages; private CmsAdminMessages cmsAdminMessages;
/**
* Model for the current content section.
*/
@Inject @Inject
private ContentSectionModel sectionModel; private ContentSectionModel sectionModel;
/**
* Provides functions for working with content sections.
*/
@Inject @Inject
private ContentSectionManager sectionManager; private ContentSectionManager sectionManager;
/**
* Common functions for controllers working with content sections.
*/
@Inject @Inject
private ContentSectionsUi sectionsUi; private ContentSectionsUi sectionsUi;
/**
* Provides functions for working with content types.
*/
@Inject @Inject
private ContentTypeManager typeManager; private ContentTypeManager typeManager;
/**
* Provides function for managing the content types assigned to a content
* section.
*/
@Inject @Inject
private ContentTypesManager typesManager; private ContentTypesManager typesManager;
@Inject /**
private DocumentTypeModel documentTypeModel; * Model for displaying a list of document types.
*/
@Inject @Inject
private DocumentTypesModel documentTypesModel; private DocumentTypesModel documentTypesModel;
/**
* Provides functions for working with {@link LocalizedString}s.
*/
@Inject @Inject
private GlobalizationHelper globalizationHelper; private GlobalizationHelper globalizationHelper;
@Inject /**
private IdentifierParser identifierParser; * Used to provide data for the views without a named bean.
*/
@Inject @Inject
private Models models; private Models models;
/**
* Checks permissions.
*/
@Inject @Inject
private PermissionChecker permissionChecker; private PermissionChecker permissionChecker;
@Inject /**
private PermissionManager permissionManager; * Shows a list of {@link ContentType}s assigned to a content section.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
*
* @return The template of the list of document types.
*/
@GET @GET
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
@ -168,6 +214,19 @@ public class ConfigurationDocumentTypesController {
return "org/librecms/ui/contentsection/configuration/documenttypes.xhtml"; return "org/librecms/ui/contentsection/configuration/documenttypes.xhtml";
} }
/**
* Adds a document type to a {@link ContentSection}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param contentItemClass The class of the content type to add.
* @param defaultLifecycleUuid The UUID of the default lifecycle for the
* type.
* @param defaultWorkflowUuid The UUID of the default workflow for the
* type.
*
* @return A redirect to the list of document types.
*/
@POST @POST
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
@ -260,6 +319,19 @@ public class ConfigurationDocumentTypesController {
); );
} }
/**
* Updates a document type.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param documentTypeParam the identifier of the type to update.
* @param defaultLifecycleUuid The UUID of the new default lifecycle.
* @param defaultWorkflowUuid The UUID of the new default workflow.
* @param roleUuids The roles that are permitted to use the
* type.
*
* @return A redirect to the list of document types.
*/
@POST @POST
@Path("/{documentType}") @Path("/{documentType}")
@AuthorizationRequired @AuthorizationRequired
@ -351,90 +423,15 @@ public class ConfigurationDocumentTypesController {
); );
} }
// @POST /**
// @Path("/{documentType}/default-workflow") * Removes a {@link ContentType} from a {@link ContentSection}.
// public String setDefaultWorkflow( *
// @PathParam("sectionIdentifier") final String sectionIdentifierParam, * @param sectionIdentifierParam The identifier of the current content
// @PathParam("documentType") final String documentTypeParam, * section.
// @FormParam("defaultWorkflowUuid") final String defaultWorkflowUuid * @param documentTypeParam The identifier of the type to remove.
// ) { *
// final Identifier sectionIdentifier = identifierParser.parseIdentifier( * @return A redirect to the list of document types.
// sectionIdentifierParam */
// );
//
// final Optional<ContentSection> sectionResult;
// switch (sectionIdentifier.getType()) {
// case ID:
// sectionResult = sectionRepo.findById(
// Long.parseLong(
// sectionIdentifier.getIdentifier()
// )
// );
// break;
// case UUID:
// sectionResult = sectionRepo.findByUuid(
// sectionIdentifier.getIdentifier()
// );
// break;
// default:
// sectionResult = sectionRepo.findByLabel(
// sectionIdentifier.getIdentifier()
// );
// break;
// }
//
// if (!sectionResult.isPresent()) {
// models.put("sectionIdentifier", sectionIdentifier);
// return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
// }
// final ContentSection section = sectionResult.get();
// sectionModel.setSection(section);
//
// if (!permissionChecker.isPermitted(
// AdminPrivileges.ADMINISTER_CONTENT_TYPES, section
// )) {
// models.put("sectionIdentifier", sectionIdentifier);
// return "org/librecms/ui/contentsection/access-denied.xhtml";
// }
//
// final Optional<ContentType> typeResult = section
// .getContentTypes()
// .stream()
// .filter(type -> type.getContentItemClass().equals(documentTypeParam))
// .findAny();
//
// if (!typeResult.isPresent()) {
// return "org/librecms/ui/contentsection/configuration/documenttype-not-found.xhtml";
// }
//
// final Optional<Workflow> defaultWorkflow = section
// .getWorkflowTemplates()
// .stream()
// .filter(def -> def.getUuid().equals(defaultWorkflowUuid))
// .findAny();
//
// if (!defaultWorkflow.isPresent()) {
// models.put(
// "errors",
// cmsAdminMessages.getMessage(
// "contentsection.configuration.documenttypes.selected_workflow_not_available",
// new String[]{defaultWorkflowUuid}
// )
// );
//
// return listDocumentTypes(sectionIdentifierParam);
// }
//
// typeManager.setDefaultWorkflow(
// typeResult.get(), defaultWorkflow.get()
// );
//
// return String.format(
// "redirect:%s/configuration/documenttypes/%s",
// sectionIdentifierParam,
// documentTypeParam
// );
// }
@POST @POST
@Path("/{documentType}/@remove") @Path("/{documentType}/@remove")
@AuthorizationRequired @AuthorizationRequired
@ -480,6 +477,13 @@ public class ConfigurationDocumentTypesController {
); );
} }
/**
* Builds a {@link DocumentTypesTableRowModel} for a {@link ContentType}.
*
* @param type The content type.
*
* @return The {@link DocumentTypesTableRowModel} for the the {@code type}.
*/
private DocumentTypesTableRowModel buildDocumentTypesTableRowModel( private DocumentTypesTableRowModel buildDocumentTypesTableRowModel(
final ContentType type final ContentType type
) { ) {
@ -552,6 +556,13 @@ public class ConfigurationDocumentTypesController {
return model; return model;
} }
/**
* Builds a {@link DocumentTypeInfoModel} from a {@link ContentTypeInfo}.
*
* @param typeInfo The type info.
*
* @return A {@link DocumentTypeInfoModel} for the {@code typeInfo}.
*/
private DocumentTypeInfoModel buildDocumentTypeInfoModel( private DocumentTypeInfoModel buildDocumentTypeInfoModel(
final ContentTypeInfo typeInfo final ContentTypeInfo typeInfo
) { ) {
@ -569,6 +580,17 @@ public class ConfigurationDocumentTypesController {
return model; return model;
} }
/**
* Builds a {@link DocumentTypeLifecycleModel} for a
* {@link LifecycleDefinition}.
*
* @param definition The lifecycle definition.
* @param defaultLifecycle Is the definition the default lifecycle for the
* content types.
*
* @return The {@link DocumentTypeLifecycleModel} for the
* {@code definition}.
*/
private DocumentTypeLifecycleModel buildLifecycleModel( private DocumentTypeLifecycleModel buildLifecycleModel(
final LifecycleDefinition definition, final LifecycleDefinition definition,
final boolean defaultLifecycle final boolean defaultLifecycle
@ -592,6 +614,14 @@ public class ConfigurationDocumentTypesController {
return model; return model;
} }
/**
* Builds a {@link DocumentTypeWorkflowModel} for a {@link Workflow}.
*
* @param workflow The workflow (template).
* @param defaultWorkflow Is the workflow the default workflow for the type?
*
* @return A {@link DocumentTypeWorkflowModel} for the {@code workflow}.
*/
private DocumentTypeWorkflowModel buildWorkflowModel( private DocumentTypeWorkflowModel buildWorkflowModel(
final Workflow workflow, final boolean defaultWorkflow final Workflow workflow, final boolean defaultWorkflow
) { ) {
@ -612,6 +642,16 @@ public class ConfigurationDocumentTypesController {
return model; return model;
} }
/**
* Builds a {@link DocumentTypePermissionModel} for a {@link ContentType}
* and a {@code Role}.
*
* @param type The content type.
* @param role The role.
*
* @return A {@link DocumentTypePermissionModel} for the {@link ContentType}
* and {@link Role}.
*/
private DocumentTypePermissionModel buildDocumentTypePermissionModel( private DocumentTypePermissionModel buildDocumentTypePermissionModel(
final ContentType type, final Role role final ContentType type, final Role role
) { ) {

View File

@ -1,13 +1,27 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.api.Identifier; import org.libreccm.api.Identifier;
import org.libreccm.api.IdentifierParser; import org.libreccm.api.IdentifierParser;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionManager; import org.librecms.contentsection.ContentSectionManager;
@ -35,6 +49,8 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
/** /**
* Controller for managing the {@link LifecycleDefinition}s of a
* {@link ContentSection}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -43,42 +59,86 @@ import javax.ws.rs.PathParam;
@Path("/{sectionIdentifier}/configuration/lifecycles") @Path("/{sectionIdentifier}/configuration/lifecycles")
public class ConfigurationLifecyclesController { public class ConfigurationLifecyclesController {
/**
* Checks admin permissions for the current content section.
*/
@Inject @Inject
private AdminPermissionsChecker adminPermissionsChecker; private AdminPermissionsChecker adminPermissionsChecker;
/**
* Used for some operations on {@link ContentSection}s.
*/
@Inject @Inject
private ContentSectionManager sectionManager; private ContentSectionManager sectionManager;
/**
* Model for the current content section.
*/
@Inject @Inject
private ContentSectionModel sectionModel; private ContentSectionModel sectionModel;
/**
* Provides common functions for controllers working with content sections.
*/
@Inject @Inject
private ContentSectionsUi sectionsUi; private ContentSectionsUi sectionsUi;
/**
* Provides functions for working with {@link LocalizedString}s.
*/
@Inject @Inject
private GlobalizationHelper globalizationHelper; private GlobalizationHelper globalizationHelper;
/**
* Used to parse identifiers.
*/
@Inject @Inject
private IdentifierParser identifierParser; private IdentifierParser identifierParser;
/**
* Used to manage lifecycles.
*/
@Inject @Inject
private LifecycleManager lifecycleManager; private LifecycleManager lifecycleManager;
/**
* Used to retrieve and save {@link LifecycleDefinition}s.
*/
@Inject @Inject
private LifecycleDefinitionRepository definitionRepo; private LifecycleDefinitionRepository definitionRepo;
/**
* Used to provide data for the views without a named bean.
*/
@Inject @Inject
private Models models; private Models models;
/**
* Used to retrive and save {@link PhaseDefinition}s.
*/
@Inject @Inject
private PhaseDefinititionRepository phaseDefinititionRepo; private PhaseDefinititionRepository phaseDefinititionRepo;
/**
* Model for the current {@link LifecycleDefinition}.
*/
@Inject @Inject
private SelectedLifecycleDefinitionModel selectedLifecycleDefModel; private SelectedLifecycleDefinitionModel selectedLifecycleDefModel;
/**
* Model for the selected {@link PhaseDefinition}.
*/
@Inject @Inject
private SelectedPhaseDefinitionModel selectedPhaseDefModel; private SelectedPhaseDefinitionModel selectedPhaseDefModel;
/**
* List all {@link LifecycleDefinition}s of the current content section.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
*
* @return The template for the list of {@link LifecycleDefinition}s.
*/
@GET @GET
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
@ -110,6 +170,17 @@ public class ConfigurationLifecyclesController {
return "org/librecms/ui/contentsection/configuration/lifecycles.xhtml"; return "org/librecms/ui/contentsection/configuration/lifecycles.xhtml";
} }
/**
* Show the details view for a {@link LifecycleDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the lifecycle
* definition.
*
* @return The template for the details view of
* {@link LifecycleDefinition}s.
*/
@GET @GET
@Path("/{lifecycleIdentifier}") @Path("/{lifecycleIdentifier}")
@AuthorizationRequired @AuthorizationRequired
@ -206,6 +277,17 @@ public class ConfigurationLifecyclesController {
return "org/librecms/ui/contentsection/configuration/lifecycle.xhtml"; return "org/librecms/ui/contentsection/configuration/lifecycle.xhtml";
} }
/**
* Add a {@link LifecycleDefinition} to the current {@link ContentSection}
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param label The label of the new
* {@link LifecycleDefinition}.
*
* @return A redirect to the list of lifecycle definitions of the content
* section.
*/
@POST @POST
@Path("/@add") @Path("/@add")
@AuthorizationRequired @AuthorizationRequired
@ -241,6 +323,17 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Deletes a {@link LifecycleDefinition} of the current
* {@link ContentSection}
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the lifecycle to delete.
*
* @return A redirect to the list of lifecycle definitions of the content
* section.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/@delete") @Path("/{lifecycleIdentifier}/@delete")
@AuthorizationRequired @AuthorizationRequired
@ -280,6 +373,18 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Adds a localized label to a {@link LifecycleDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the lifecycle
* definition.
* @param localeParam The locale of the value to add.
* @param value The value to add.
*
* @return A redirect to the details view of the lifecycle.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/label/@add") @Path("/{lifecycleIdentifier}/label/@add")
@AuthorizationRequired @AuthorizationRequired
@ -321,6 +426,18 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Updates a localized label of a {@link LifecycleDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the lifecycle
* definition.
* @param localeParam The locale of the value to update.
* @param value The updated value.
*
* @return A redirect to the details view of the lifecycle.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/label/@edit/{locale}") @Path("/{lifecycleIdentifier}/label/@edit/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -362,6 +479,17 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Removes a localized label from a {@link LifecycleDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the lifecycle
* definition.
* @param localeParam The locale of the value to remove.
*
* @return A redirect to the details view of the lifecycle.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/label/@remove/{locale}") @Path("/{lifecycleIdentifier}/label/@remove/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -402,6 +530,18 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Adds a localized description to a {@link LifecycleDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the lifecycle
* definition.
* @param localeParam The locale of the value to add.
* @param value The value to add.
*
* @return A redirect to the details view of the lifecycle.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/description/@add") @Path("/{lifecycleIdentifier}/description/@add")
@AuthorizationRequired @AuthorizationRequired
@ -443,6 +583,18 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Updates a localized description of a {@link LifecycleDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the lifecycle
* definition.
* @param localeParam The locale of the value to update.
* @param value The updated value.
*
* @return A redirect to the details view of the lifecycle.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/description/@edit/{locale}") @Path("/{lifecycleIdentifier}/description/@edit/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -484,6 +636,17 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Removes a localized description from a {@link LifecycleDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the lifecycle
* definition.
* @param localeParam The locale of the value to remove
*
* @return A redirect to the details view of the lifecycle.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/description/@remove/{locale}") @Path("/{lifecycleIdentifier}/description/@remove/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -524,6 +687,23 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Adds a {@link PhaseDefinition} to a {@link LifecycleDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle.
* @param label The label of the new phase definition.
* @param defaultDelayDays The day part of the default deplay.
* @param defaultDelayHours The hours part of the default delay.
* @param defaultDelayMinutes The minutes part of the default delay.
* @param defaultDurationDays The day part of the default duration.
* @param defaultDurationHours The hours part of the default duration.
* @param defaultDurationMinutes The minutes part of the default duration.
*
* @return A redirect to the details view of the
* {@link LifecycleDefinition}.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/phases/@add") @Path("/{lifecycleIdentifier}/phases/@add")
@AuthorizationRequired @AuthorizationRequired
@ -562,23 +742,23 @@ public class ConfigurationLifecyclesController {
final LifecycleDefinition definition = definitionResult.get(); final LifecycleDefinition definition = definitionResult.get();
final PhaseDefinition phaseDefinition = new PhaseDefinition(); final PhaseDefinition phaseDefinition = new PhaseDefinition();
final Duration defaultDelay = new Duration(); final Duration defaultDelay = new Duration();
defaultDelay.setDays(defaultDelayDays); defaultDelay.setDays(defaultDelayDays);
defaultDelay.setHours(defaultDelayHours); defaultDelay.setHours(defaultDelayHours);
defaultDelay.setMinutes(defaultDelayMinutes); defaultDelay.setMinutes(defaultDelayMinutes);
phaseDefinition.setDefaultDelay(defaultDelay.toMinutes()); phaseDefinition.setDefaultDelay(defaultDelay.toMinutes());
final Duration defaultDuration = new Duration(); final Duration defaultDuration = new Duration();
defaultDuration.setDays(defaultDurationDays); defaultDuration.setDays(defaultDurationDays);
defaultDuration.setHours(defaultDurationHours); defaultDuration.setHours(defaultDurationHours);
defaultDuration.setMinutes(defaultDurationMinutes); defaultDuration.setMinutes(defaultDurationMinutes);
phaseDefinition.setDefaultDuration(defaultDuration.toMinutes()); phaseDefinition.setDefaultDuration(defaultDuration.toMinutes());
phaseDefinition phaseDefinition
.getLabel() .getLabel()
.addValue(globalizationHelper.getNegotiatedLocale(), label); .addValue(globalizationHelper.getNegotiatedLocale(), label);
phaseDefinititionRepo.save(phaseDefinition); phaseDefinititionRepo.save(phaseDefinition);
lifecycleManager.addPhaseDefinition(definition, phaseDefinition); lifecycleManager.addPhaseDefinition(definition, phaseDefinition);
@ -589,6 +769,18 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Show the details view of a phase definition.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle
* definition.
* @param phaseIdentifierParam the identifier of the lifecycle
* definition.
*
* @return The template for the details view of the phase definition.
*/
@GET @GET
@Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}") @Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}")
@AuthorizationRequired @AuthorizationRequired
@ -705,6 +897,23 @@ public class ConfigurationLifecyclesController {
return "org/librecms/ui/contentsection/configuration/lifecycle-phase.xhtml"; return "org/librecms/ui/contentsection/configuration/lifecycle-phase.xhtml";
} }
/**
* Updates the parameters of a phase definition.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle.
* @param phaseIdentifier The identifier of the phase to update.
* @param defaultDelayDays The day part of the default deplay.
* @param defaultDelayHours The hours part of the default delay.
* @param defaultDelayMinutes The minutes part of the default delay.
* @param defaultDurationDays The day part of the default duration.
* @param defaultDurationHours The hours part of the default duration.
* @param defaultDurationMinutes The minutes part of the default duration.
*
* @return A redirect to the details view of the
* {@link LifecycleDefinition}.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/@edit") @Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/@edit")
@AuthorizationRequired @AuthorizationRequired
@ -751,13 +960,13 @@ public class ConfigurationLifecyclesController {
); );
} }
final PhaseDefinition phaseDefinition = phaseDefinitionResult.get(); final PhaseDefinition phaseDefinition = phaseDefinitionResult.get();
final Duration defaultDelay = new Duration(); final Duration defaultDelay = new Duration();
defaultDelay.setDays(defaultDelayDays); defaultDelay.setDays(defaultDelayDays);
defaultDelay.setHours(defaultDelayHours); defaultDelay.setHours(defaultDelayHours);
defaultDelay.setMinutes(defaultDelayMinutes); defaultDelay.setMinutes(defaultDelayMinutes);
phaseDefinition.setDefaultDelay(defaultDelay.toMinutes()); phaseDefinition.setDefaultDelay(defaultDelay.toMinutes());
final Duration defaultDuration = new Duration(); final Duration defaultDuration = new Duration();
defaultDuration.setDays(defaultDurationDays); defaultDuration.setDays(defaultDurationDays);
defaultDuration.setHours(defaultDurationHours); defaultDuration.setHours(defaultDurationHours);
@ -774,6 +983,18 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Removes a phase definition from the a lifecycle definition.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle
* definition.
* @param phaseIdentifierParam The identifier of the phase definition to
* remove.
*
* @return A redirect to the details view of the lifecycle definition.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/@remove") @Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/@remove")
@AuthorizationRequired @AuthorizationRequired
@ -824,6 +1045,19 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Adds a localized label to a {@link PhaseDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle
* definition.
* @param phaseIdentifierParam Identifier of the {@link PhaseDefinition}.
* @param localeParam The locale of the value to add.
* @param value The value to add.
*
* @return A redirect to the details view of the {@link PhaseDefinition}.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/label/@add") @Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/label/@add")
@AuthorizationRequired @AuthorizationRequired
@ -877,6 +1111,19 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Updates the localized label of a {@link PhaseDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle
* definition.
* @param phaseIdentifierParam Identifier of the {@link PhaseDefinition}.
* @param localeParam The locale of the value to update.
* @param value The updated value.
*
* @return A redirect to the details view of the {@link PhaseDefinition}.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/label/@edit/{locale}") @Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/label/@edit/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -930,6 +1177,18 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Removes a localized label of a {@link PhaseDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle
* definition.
* @param phaseIdentifierParam Identifier of the {@link PhaseDefinition}.
* @param localeParam The locale of the value to remove.
*
* @return A redirect to the details view of the {@link PhaseDefinition}.
*/
@POST @POST
@Path( @Path(
"/{lifecycleIdentifier}/phases/{phaseIdentifier}/label/@remove/{locale}" "/{lifecycleIdentifier}/phases/{phaseIdentifier}/label/@remove/{locale}"
@ -984,6 +1243,19 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Adds a localized description to a {@link PhaseDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle
* definition.
* @param phaseIdentifierParam Identifier of the {@link PhaseDefinition}.
* @param localeParam The locale of the value to add.
* @param value The value to add.
*
* @return A redirect to the details view of the {@link PhaseDefinition}.
*/
@POST @POST
@Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@add") @Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@add")
@AuthorizationRequired @AuthorizationRequired
@ -1039,6 +1311,19 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Updates the localized description of a {@link PhaseDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle
* definition.
* @param phaseIdentifierParam Identifier of the {@link PhaseDefinition}.
* @param localeParam The locale of the value to update.
* @param value The updated value.
*
* @return A redirect to the details view of the {@link PhaseDefinition}.
*/
@POST @POST
@Path( @Path(
"/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@edit/{locale}" "/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@edit/{locale}"
@ -1096,6 +1381,18 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Removes a localized description of a {@link PhaseDefinition}.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param lifecycleIdentiferParam The identifier of the current lifecycle
* definition.
* @param phaseIdentifierParam Identifier of the {@link PhaseDefinition}.
* @param localeParam The locale of the value to remove.
*
* @return A redirect to the details view of the {@link PhaseDefinition}.
*/
@POST @POST
@Path( @Path(
"/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@remove/{locale}" "/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@remove/{locale}"
@ -1150,6 +1447,15 @@ public class ConfigurationLifecyclesController {
); );
} }
/**
* Builds a {@link LifecycleDefinitionListModel} for a
* {@link LifecycleDefinition}.
*
* @param definition The lifecycle definition.
*
* @return A {@link LifecycleDefinitionListModel} for the
* {@code definition}.
*/
private LifecycleDefinitionListModel buildListModel( private LifecycleDefinitionListModel buildListModel(
final LifecycleDefinition definition final LifecycleDefinition definition
) { ) {
@ -1170,6 +1476,16 @@ public class ConfigurationLifecyclesController {
return model; return model;
} }
/**
* Finds a lifecycle definition.
*
* @param section The current content section.
* @param definitionIdentifierParam The identifier of the definition.
*
* @return An {@link Optional} with the {@link LifecycleDefinition} or an
* empty {@link Optional} if the current content section has no
* matching {@link LifecycleDefinition}.
*/
private Optional<LifecycleDefinition> findLifecycleDefinition( private Optional<LifecycleDefinition> findLifecycleDefinition(
final ContentSection section, final String definitionIdentifierParam final ContentSection section, final String definitionIdentifierParam
) { ) {
@ -1196,6 +1512,14 @@ public class ConfigurationLifecyclesController {
} }
} }
/**
* Shows the "lifecycle definition not found" error page.
*
* @param section The current content section.
* @param definitionIdentifier The identifier of the lifecycle definition.
*
* @return The template for the "lifecycle definition not found" error page.
*/
private String showLifecycleDefinitionNotFound( private String showLifecycleDefinitionNotFound(
final ContentSection section, final ContentSection section,
final String definitionIdentifier final String definitionIdentifier
@ -1205,6 +1529,13 @@ public class ConfigurationLifecyclesController {
return "org/librecms/ui/contentsection/configuration/lifecycle-not-found.xhtml"; return "org/librecms/ui/contentsection/configuration/lifecycle-not-found.xhtml";
} }
/**
* Build the {@link PhaseDefinitionModel} for a {@link PhaseDefinition}.
*
* @param definition The phase definition.
*
* @return A {@link PhaseDefinitionModel} for the {@code definition}.
*/
private PhaseDefinitionModel buildPhaseDefinitionModel( private PhaseDefinitionModel buildPhaseDefinitionModel(
final PhaseDefinition definition final PhaseDefinition definition
) { ) {
@ -1227,6 +1558,17 @@ public class ConfigurationLifecyclesController {
return model; return model;
} }
/**
* Finds a {@link PhaseDefinition}.
*
* @param lifecycleDefinition The lifecycle definition.
* @param phaseDefinitionIdentifierParam The identifier of the phase
* definition.
*
* @return An {@link Optional} with the {@link PhaseDefinition} or an empty
* {@link Optional} if the {@link LifecycleDefinition} has the
* {@link PhaseDefinition} with the provided identifier.
*/
private Optional<PhaseDefinition> findPhaseDefinition( private Optional<PhaseDefinition> findPhaseDefinition(
final LifecycleDefinition lifecycleDefinition, final LifecycleDefinition lifecycleDefinition,
final String phaseDefinitionIdentifierParam final String phaseDefinitionIdentifierParam
@ -1240,6 +1582,16 @@ public class ConfigurationLifecyclesController {
).findAny(); ).findAny();
} }
/**
* Shows the "phase definition not found" error page.
*
* @param section The current content section.
* @param definitionIdentifier The identifier of the lifecycle
* definition.
* @param phaseDefinitionIdentifier The idenfifier of the phase definition.
*
* @return The template for the "phase definition not found" error page.
*/
private String showPhaseDefinitionNotFound( private String showPhaseDefinitionNotFound(
final ContentSection section, final ContentSection section,
final String definitionIdentifier, final String definitionIdentifier,

View File

@ -1,13 +1,27 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.api.Identifier; import org.libreccm.api.Identifier;
import org.libreccm.api.IdentifierParser; import org.libreccm.api.IdentifierParser;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.Party; import org.libreccm.security.Party;
import org.libreccm.security.PartyRepository; import org.libreccm.security.PartyRepository;
@ -47,6 +61,7 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST; import javax.ws.rs.POST;
/** /**
* Controller for managing the roles of a content section.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -55,50 +70,98 @@ import javax.ws.rs.POST;
@Path("/{sectionIdentifier}/configuration/roles") @Path("/{sectionIdentifier}/configuration/roles")
public class ConfigurationRolesController { public class ConfigurationRolesController {
/**
* Used to check admin permissions for content sections.
*/
@Inject @Inject
private AdminPermissionsChecker adminPermissionsChecker; private AdminPermissionsChecker adminPermissionsChecker;
/**
* Wrapper around the messages bundle for CMS admin messages.
*/
@Inject @Inject
private CmsAdminMessages messages; private CmsAdminMessages messages;
/**
* Used to perform actions involing {@link ContentSection}s.
*/
@Inject @Inject
private ContentSectionManager sectionManager; private ContentSectionManager sectionManager;
/**
* Model for the current content section.
*/
@Inject @Inject
private ContentSectionModel sectionModel; private ContentSectionModel sectionModel;
// @Inject /**
// private ContentSectionRepository sectionRepo; * Provides common functions for all controllers working with
* {@link ContentSection}s.
*/
@Inject @Inject
private ContentSectionsUi sectionsUi; private ContentSectionsUi sectionsUi;
/**
* Provides several functions for working with {@link LocalizedString}
*/
@Inject @Inject
private GlobalizationHelper globalizationHelper; private GlobalizationHelper globalizationHelper;
/**
* Used to parse identifiers.
*/
@Inject @Inject
private IdentifierParser identifierParser; private IdentifierParser identifierParser;
/**
* Used to provide data for views with a named bean.
*/
@Inject @Inject
private Models models; private Models models;
/**
* Used to retrieve and save parties.
*/
@Inject @Inject
private PartyRepository partyRepository; private PartyRepository partyRepository;
/**
* Used to check permissions.
*/
@Inject @Inject
private PermissionChecker permissionChecker; private PermissionChecker permissionChecker;
/**
* Used for complex operations on permissions.
*/
@Inject @Inject
private PermissionManager permissionManager; private PermissionManager permissionManager;
/**
* Used for operations on roles.
*/
@Inject @Inject
private RoleManager roleManager; private RoleManager roleManager;
/**
* Used to retrieve and save {@link Role}s.
*/
@Inject @Inject
private RoleRepository roleRepo; private RoleRepository roleRepo;
/**
* Model for the selected role.
*/
@Inject @Inject
private SelectedRoleModel selectedRoleModel; private SelectedRoleModel selectedRoleModel;
/**
* List all roles of the current content section.
*
* @param sectionIdentifierParam Identifier of the current content section.
*
* @return The template for the roles list.
*/
@GET @GET
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
@ -148,6 +211,14 @@ public class ConfigurationRolesController {
return "org/librecms/ui/contentsection/configuration/roles.xhtml"; return "org/librecms/ui/contentsection/configuration/roles.xhtml";
} }
/**
* Show the details view for a role.
*
* @param sectionIdentifierParam Identifier of the current content section.
* @param roleName The name of the role.
*
* @return The template for the details view of the role.
*/
@GET @GET
@Path("/{roleName}") @Path("/{roleName}")
@AuthorizationRequired @AuthorizationRequired
@ -219,6 +290,15 @@ public class ConfigurationRolesController {
return "org/librecms/ui/contentsection/configuration/role.xhtml"; return "org/librecms/ui/contentsection/configuration/role.xhtml";
} }
/**
* Renames a role
*
* @param sectionIdentifierParam Identifier of the current content section.
* @param roleName The name of the role to rename.
* @param newRoleName The new name of the role.
*
* @return A redirect to the details view of the role.
*/
@POST @POST
@Path("/{roleName}/@rename") @Path("/{roleName}/@rename")
@AuthorizationRequired @AuthorizationRequired
@ -263,6 +343,18 @@ public class ConfigurationRolesController {
); );
} }
/**
* Update the permissions granted to the role for the current content
* section.
*
* @param sectionIdentifierParam Identifier of the current content section.
* @param roleName The name of the role.
* @param grantedPermissions The permissions granted to the role for the
* current content section. Permissions not
* included here, but are granted are removed.
*
* @return A redirect to the details view of the role.
*/
@POST @POST
@Path("/{roleName}/@permissions") @Path("/{roleName}/@permissions")
@AuthorizationRequired @AuthorizationRequired
@ -345,6 +437,18 @@ public class ConfigurationRolesController {
); );
} }
/**
* Updates the members of a role.
*
* @param sectionIdentifierParam Identifier of the current content section.
* @param roleName The name of the role.
* @param roleMembersParam The members of the role. Parties that are a
* member of the role but not included this
* list are removed from the members of the
* role.
*
* @return A redirect to the details view of the role.
*/
@POST @POST
@Path("/{roleName}/@members") @Path("/{roleName}/@members")
@AuthorizationRequired @AuthorizationRequired
@ -409,6 +513,17 @@ public class ConfigurationRolesController {
); );
} }
/**
* Adds a localized description to a role.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param roleName The name of the role.
* @param localeParam The locale of the value to add.
* @param value The value to add.
*
* @return A redirect to the details view of the role.
*/
@POST @POST
@Path("/{roleName}/description/@add") @Path("/{roleName}/description/@add")
@AuthorizationRequired @AuthorizationRequired
@ -455,6 +570,17 @@ public class ConfigurationRolesController {
); );
} }
/**
* Updates a localized description of a role.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param roleName The name of the role.
* @param localeParam The locale of the value to update.
* @param value The updated value.
*
* @return A redirect to the details view of the role.
*/
@POST @POST
@Path("/{roleName}/description/@edit/{locale}") @Path("/{roleName}/description/@edit/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -501,6 +627,16 @@ public class ConfigurationRolesController {
); );
} }
/**
* Removes a localized description from a role.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param roleName The name of the role.
* @param localeParam The locale of the value to remove.
*
* @return A redirect to the details view of the role.
*/
@POST @POST
@Path("/{roleName}/description/@remove/{locale}") @Path("/{roleName}/description/@remove/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -545,6 +681,15 @@ public class ConfigurationRolesController {
); );
} }
/**
* Creates a new role for the current content section.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param roleName The name of the new role.
*
* @return A redirect to the list of roles.
*/
@POST @POST
@Path("/@new") @Path("/@new")
@AuthorizationRequired @AuthorizationRequired
@ -595,6 +740,16 @@ public class ConfigurationRolesController {
); );
} }
/**
* Adds some existing roles the content section.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param rolesToAdd The existing roles to add to the current
* content section.
*
* @return A redirect to the list of roles.
*/
@POST @POST
@Path("/@add") @Path("/@add")
@AuthorizationRequired @AuthorizationRequired
@ -632,6 +787,16 @@ public class ConfigurationRolesController {
); );
} }
/**
* Removes a role from the current content section. The role is
* <strong>not</strong> deleted.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param roleIdentifierParam The identifier of the role to remove.
*
* @return A redirect to the list of roles.
*/
@POST @POST
@Path("/{roleIdentifier}/@remove") @Path("/{roleIdentifier}/@remove")
@AuthorizationRequired @AuthorizationRequired
@ -654,7 +819,7 @@ public class ConfigurationRolesController {
"sectionIdentifier", sectionIdentifierParam "sectionIdentifier", sectionIdentifierParam
); );
} }
final Optional<Role> roleResult = findRole(roleIdentifierParam); final Optional<Role> roleResult = findRole(roleIdentifierParam);
if (!roleResult.isPresent()) { if (!roleResult.isPresent()) {
return showRoleNotFound(section, roleIdentifierParam); return showRoleNotFound(section, roleIdentifierParam);
@ -667,6 +832,15 @@ public class ConfigurationRolesController {
); );
} }
/**
* Removes a role from the current content section and deletes the role.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param roleIdentifierParam The identifier of the role to delete.
*
* @return A redirect to the list of roles.
*/
@POST @POST
@Path("/{roleIdentifier}/@delete") @Path("/{roleIdentifier}/@delete")
@AuthorizationRequired @AuthorizationRequired
@ -702,6 +876,14 @@ public class ConfigurationRolesController {
); );
} }
/**
* Helper method for finding a role.
*
* @param roleIdentifierParam The identifier of the role.
*
* @return An {@link Optional} with the role, or an empty {@link Optional}
* if there is not role with the provided identifier.
*/
private Optional<Role> findRole(final String roleIdentifierParam) { private Optional<Role> findRole(final String roleIdentifierParam) {
final Identifier roleIdentifier = identifierParser.parseIdentifier( final Identifier roleIdentifier = identifierParser.parseIdentifier(
roleIdentifierParam roleIdentifierParam
@ -722,6 +904,14 @@ public class ConfigurationRolesController {
} }
} }
/**
* Shows the "role not found" error page.
*
* @param section The current content section.
* @param roleName The name of the role.
*
* @return The template of the "role not found" error page.
*/
private String showRoleNotFound( private String showRoleNotFound(
final ContentSection section, final String roleName final ContentSection section, final String roleName
) { ) {
@ -730,6 +920,13 @@ public class ConfigurationRolesController {
return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml"; return "org/librecms/ui/contentsection/configuration/role-not-found.xhtml";
} }
/**
* Helper method for building a {@link RoleListItemModel} for a role.
*
* @param role The role.
*
* @return A {@link RoleListItemModel} for the {@code role}.
*/
private RoleListItemModel buildRoleListModel(final Role role) { private RoleListItemModel buildRoleListModel(final Role role) {
final RoleListItemModel model = new RoleListItemModel(); final RoleListItemModel model = new RoleListItemModel();
model.setRoleId(role.getRoleId()); model.setRoleId(role.getRoleId());
@ -743,6 +940,13 @@ public class ConfigurationRolesController {
return model; return model;
} }
/**
* Build a {@link RoleMembershipModel} for showing the members of a role.
*
* @param membership The membership from which the model is build.
*
* @return {@link RoleMembershipModel} for the {@code membership}.
*/
private RoleMembershipModel buildRoleMembershipModel( private RoleMembershipModel buildRoleMembershipModel(
final RoleMembership membership final RoleMembership membership
) { ) {
@ -753,6 +957,16 @@ public class ConfigurationRolesController {
return model; return model;
} }
/**
* Builds the {@link RoleSectionPermissionModel}s for a role and content
* section.
*
* @param role The role.
* @param section The content section
*
* @return A list of {@link RoleSectionPermissionModel}s for the role and
* the content section.
*/
private List<RoleSectionPermissionModel> buildRolePermissions( private List<RoleSectionPermissionModel> buildRolePermissions(
final Role role, final ContentSection section final Role role, final ContentSection section
) { ) {
@ -791,6 +1005,16 @@ public class ConfigurationRolesController {
return permissions; return permissions;
} }
/**
* Builds a {@link RoleSectionPermissionModel} for a role, a privilege and a
* content section.
*
* @param role The role.
* @param privilege The privilege.
* @param section The content section.
*
* @return A {@link RoleSectionPermissionModel} for the provided parameters.
*/
private RoleSectionPermissionModel buildRoleSectionPermissionModel( private RoleSectionPermissionModel buildRoleSectionPermissionModel(
final Role role, final String privilege, final ContentSection section final Role role, final String privilege, final ContentSection section
) { ) {
@ -803,6 +1027,16 @@ public class ConfigurationRolesController {
return model; return model;
} }
/**
* Builds a {@link RoleSectionPermissionModel} for a role, a privilege and a
* folder.
*
* @param role The role.
* @param privilege The privilege.
* @param folder The folder
*
* @return A {@link RoleSectionPermissionModel} for the provided parameters.
*/
private RoleSectionPermissionModel buildRoleSectionPermissionModel( private RoleSectionPermissionModel buildRoleSectionPermissionModel(
final Role role, final String privilege, final Folder folder final Role role, final String privilege, final Folder folder
) { ) {
@ -815,6 +1049,15 @@ public class ConfigurationRolesController {
return model; return model;
} }
/**
* Checks if a role has a member.
*
* @param role The role.
* @param memberName The name of the member.
*
* @return {@code true} if the role has member with the provided name,
* {@code false} otherwise.
*/
private boolean hasMember(final Role role, final String memberName) { private boolean hasMember(final Role role, final String memberName) {
return role return role
.getMemberships() .getMemberships()
@ -823,6 +1066,12 @@ public class ConfigurationRolesController {
.anyMatch(name -> name.equals(memberName)); .anyMatch(name -> name.equals(memberName));
} }
/**
* Adds a new member to a role.
*
* @param role The role.
* @param newMemberName The name of the new member.
*/
private void addNewMember(final Role role, final String newMemberName) { private void addNewMember(final Role role, final String newMemberName) {
final Optional<Party> result = partyRepository.findByName( final Optional<Party> result = partyRepository.findByName(
newMemberName newMemberName
@ -833,6 +1082,12 @@ public class ConfigurationRolesController {
} }
} }
/**
* Removes a new member from a role.
*
* @param role The role.
* @param removedMemberName The name of the member to remove from the role.
*/
private void removeMember(final Role role, final String removedMemberName) { private void removeMember(final Role role, final String removedMemberName) {
final Optional<Party> result = partyRepository.findByName( final Optional<Party> result = partyRepository.findByName(
removedMemberName removedMemberName

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -37,6 +50,8 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
/** /**
* Controller for managing the {@link Workflow} templates of the
* {@link ContentSection}
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -45,45 +60,92 @@ import javax.ws.rs.PathParam;
@Path("/{sectionIdentifier}/configuration/workflows") @Path("/{sectionIdentifier}/configuration/workflows")
public class ConfigurationWorkflowController { public class ConfigurationWorkflowController {
/**
* Used to check the admin permissions of a content section.
*/
@Inject @Inject
private AdminPermissionsChecker adminPermissionsChecker; private AdminPermissionsChecker adminPermissionsChecker;
/**
* Used for actions involving content sections.
*/
@Inject @Inject
private ContentSectionManager sectionManager; private ContentSectionManager sectionManager;
/**
* Model for the current content section.
*/
@Inject @Inject
private ContentSectionModel sectionModel; private ContentSectionModel sectionModel;
/**
* Common functions for views working with {@link ContentSection}s.
*/
@Inject @Inject
private ContentSectionsUi sectionsUi; private ContentSectionsUi sectionsUi;
/**
* Used for globaliazation stuff.
*/
@Inject @Inject
private GlobalizationHelper globalizationHelper; private GlobalizationHelper globalizationHelper;
/**
* Used to parse identifiers.
*/
@Inject @Inject
private IdentifierParser identifierParser; private IdentifierParser identifierParser;
/**
* Used to provide data for the views without a named bean.
*/
@Inject @Inject
private Models models; private Models models;
/**
* Used to manage workflows and workflow templates.
*/
@Inject @Inject
private WorkflowManager workflowManager; private WorkflowManager workflowManager;
/**
* Used to retrieve and save workflows and workflow templates.
*/
@Inject @Inject
private WorkflowRepository workflowRepo; private WorkflowRepository workflowRepo;
/**
* Model for the selected {@link Workflow} template.
*/
@Inject @Inject
private SelectedWorkflowTemplateModel selectedWorkflowTemplateModel; private SelectedWorkflowTemplateModel selectedWorkflowTemplateModel;
/**
* Model for the selected task template of a workflow template.
*/
@Inject @Inject
private SelectedWorkflowTaskTemplateModel selectedWorkflowTaskTemplateModel; private SelectedWorkflowTaskTemplateModel selectedWorkflowTaskTemplateModel;
/**
* Used to manage the task of a workflow template.
*/
@Inject @Inject
private TaskManager taskManager; private TaskManager taskManager;
/**
* Used to retrieve and save tasks.
*/
@Inject @Inject
private TaskRepository taskRepo; private TaskRepository taskRepo;
/**
* List all {@link Workflow} templates in the current content section.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
*
* @return The template for the list of workflow templates.
*/
@GET @GET
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
@ -115,6 +177,15 @@ public class ConfigurationWorkflowController {
return "org/librecms/ui/contentsection/configuration/workflows.xhtml"; return "org/librecms/ui/contentsection/configuration/workflows.xhtml";
} }
/**
* Show the details view for a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the workflow to show.
*
* @return The template of the details view for workflow templates.
*/
@GET @GET
@Path("/{workflowIdentifier}") @Path("/{workflowIdentifier}")
@AuthorizationRequired @AuthorizationRequired
@ -214,6 +285,15 @@ public class ConfigurationWorkflowController {
return "org/librecms/ui/contentsection/configuration/workflow.xhtml"; return "org/librecms/ui/contentsection/configuration/workflow.xhtml";
} }
/**
* Add a new workflow template to the current content section.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param label The label of the new workflow template.
*
* @return A redirect to the list of workflow templates.
*/
@POST @POST
@Path("/@add") @Path("/@add")
@AuthorizationRequired @AuthorizationRequired
@ -248,6 +328,16 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Deletes a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the workflow template to
* remove.
*
* @return A redirect to the list of workflow templates.
*/
@POST @POST
@Path("/{workflowIdentifier}/@delete") @Path("/{workflowIdentifier}/@delete")
@AuthorizationRequired @AuthorizationRequired
@ -286,6 +376,17 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Add a localized name to a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the workflow template.
* @param localeParam The locale of the value to add.
* @param value The value to add.
*
* @return A redirect to the details view of the workflow template.
*/
@POST @POST
@Path("/{workflowIdentifier}/label/@add") @Path("/{workflowIdentifier}/label/@add")
@AuthorizationRequired @AuthorizationRequired
@ -326,6 +427,17 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Updates tzhe localized name of a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the workflow template.
* @param localeParam The locale of the value to update.
* @param value The updated.
*
* @return A redirect to the details view of the workflow template.
*/
@POST @POST
@Path("/{workflowIdentifier}/label/@edit/{locale}") @Path("/{workflowIdentifier}/label/@edit/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -366,6 +478,16 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Removes a localized name from a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the workflow template.
* @param localeParam The locale of the value to remove.
*
* @return A redirect to the details view of the workflow template.
*/
@POST @POST
@Path("/{workflowIdentifier}/label/@remove/{locale}") @Path("/{workflowIdentifier}/label/@remove/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -373,8 +495,7 @@ public class ConfigurationWorkflowController {
public String removeWorkflowTemplateName( public String removeWorkflowTemplateName(
@PathParam("sectionIdentifier") final String sectionIdentifierParam, @PathParam("sectionIdentifier") final String sectionIdentifierParam,
@PathParam("workflowIdentifier") final String workflowIdentiferParam, @PathParam("workflowIdentifier") final String workflowIdentiferParam,
@PathParam("locale") final String localeParam, @PathParam("locale") final String localeParam
@FormParam("value") final String value
) { ) {
final Optional<ContentSection> sectionResult = sectionsUi final Optional<ContentSection> sectionResult = sectionsUi
@ -407,6 +528,17 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Adds a localized description to a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the workflow template.
* @param localeParam The locale of the value to add.
* @param value The value to add.
*
* @return A redirect to the details view of the workflow template.
*/
@POST @POST
@Path("/{workflowIdentifier}/description/@add") @Path("/{workflowIdentifier}/description/@add")
@AuthorizationRequired @AuthorizationRequired
@ -447,6 +579,17 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Updates a localized description of a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the workflow template.
* @param localeParam The locale of the value to update.
* @param value The updated value.
*
* @return A redirect to the details view of the workflow template.
*/
@POST @POST
@Path("/{workflowIdentifier}/description/@edit/{locale}") @Path("/{workflowIdentifier}/description/@edit/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -487,6 +630,16 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Removes a localized description from a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the workflow template.
* @param localeParam The locale of the value to remove.
*
* @return A redirect to the details view of the workflow template.
*/
@POST @POST
@Path("/{workflowIdentifier}/description/@remove/{locale}") @Path("/{workflowIdentifier}/description/@remove/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -494,8 +647,7 @@ public class ConfigurationWorkflowController {
public String removeWorkflowTemplateDescription( public String removeWorkflowTemplateDescription(
@PathParam("sectionIdentifier") final String sectionIdentifierParam, @PathParam("sectionIdentifier") final String sectionIdentifierParam,
@PathParam("workflowIdentifier") final String workflowIdentiferParam, @PathParam("workflowIdentifier") final String workflowIdentiferParam,
@PathParam("locale") final String localeParam, @PathParam("locale") final String localeParam
@FormParam("value") final String value
) { ) {
final Optional<ContentSection> sectionResult = sectionsUi final Optional<ContentSection> sectionResult = sectionsUi
.findContentSection(sectionIdentifierParam); .findContentSection(sectionIdentifierParam);
@ -527,6 +679,17 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Shows the details view for a task of a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the current workflow
* template.
* @param taskIdentifierParam The identifier of the task to show.
*
* @return The template for the details view of the task.
*/
@GET @GET
@Path("/{workflowIdentifier}/tasks/{taskIdentifier}") @Path("/{workflowIdentifier}/tasks/{taskIdentifier}")
@AuthorizationRequired @AuthorizationRequired
@ -674,6 +837,17 @@ public class ConfigurationWorkflowController {
return "org/librecms/ui/contentsection/configuration/workflow-task.xhtml"; return "org/librecms/ui/contentsection/configuration/workflow-task.xhtml";
} }
/**
* Adds a task to a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the current workflow
* template.
* @param label The label of the new task.
*
* @return A redirect to the details view of the workflow.
*/
@POST @POST
@Path("/{workflowIdentifier}/tasks/@add") @Path("/{workflowIdentifier}/tasks/@add")
@AuthorizationRequired @AuthorizationRequired
@ -718,6 +892,16 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Removes a task from a workflow template.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifier of the current workflow
* @param taskIdentifierParam The identifier of the task to remove.
*
* @return A redirect to the details view of the workflow template.
*/
@POST @POST
@Path("/{workflowIdentifier}/tasks/{taskIdentifier}/@remove") @Path("/{workflowIdentifier}/tasks/{taskIdentifier}/@remove")
@AuthorizationRequired @AuthorizationRequired
@ -765,6 +949,18 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Adds a localized label the a task.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifer of the current workflow.
* @param taskIdentifierParam The identifier of the current task.
* @param localeParam The locale of the value to add.
* @param value The value to add.
*
* @return A redirect to the details view of the task.
*/
@POST @POST
@Path("/{workflowIdentifier}/tasks/{taskIdentifier}/label/@add") @Path("/{workflowIdentifier}/tasks/{taskIdentifier}/label/@add")
@AuthorizationRequired @AuthorizationRequired
@ -816,6 +1012,18 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Updates a localized label of a task.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifer of the current workflow.
* @param taskIdentifierParam The identifier of the current task.
* @param localeParam The locale of the value to update.
* @param value The updated value.
*
* @return A redirect to the details view of the task.
*/
@POST @POST
@Path("/{workflowIdentifier}/tasks/{taskIdentifier}/label/@edit/{locale}") @Path("/{workflowIdentifier}/tasks/{taskIdentifier}/label/@edit/{locale}")
@AuthorizationRequired @AuthorizationRequired
@ -867,6 +1075,17 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Removes a localized label from a task.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifer of the current workflow.
* @param taskIdentifierParam The identifier of the current task.
* @param localeParam The locale of the value to remove.
*
* @return A redirect to the details view of the task.
*/
@POST @POST
@Path( @Path(
"/{workflowIdentifier}/tasks/{taskIdentifier}/label/@remove/{locale}") "/{workflowIdentifier}/tasks/{taskIdentifier}/label/@remove/{locale}")
@ -918,6 +1137,18 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Adds a localized description to a task.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifer of the current workflow.
* @param taskIdentifierParam The identifier of the current task.
* @param localeParam The locale of the value to add.
* @param value The value to add.
*
* @return A redirect to the details view of the task.
*/
@POST @POST
@Path("/{workflowIdentifier}/tasks/{taskIdentifier}/description/@add") @Path("/{workflowIdentifier}/tasks/{taskIdentifier}/description/@add")
@AuthorizationRequired @AuthorizationRequired
@ -969,6 +1200,18 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Updates a localized description of a task.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifer of the current workflow.
* @param taskIdentifierParam The identifier of the current task.
* @param localeParam The locale of the value to update.
* @param value The updated value.
*
* @return A redirect to the details view of the task.
*/
@POST @POST
@Path( @Path(
"/{workflowIdentifier}/tasks/{taskIdentifier}/description/@edit/{locale}") "/{workflowIdentifier}/tasks/{taskIdentifier}/description/@edit/{locale}")
@ -1021,6 +1264,17 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Removes a localized description from a task.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifer of the current workflow.
* @param taskIdentifierParam The identifier of the current task.
* @param localeParam The locale of the value to remove.
*
* @return A redirect to the details view of the task.
*/
@POST @POST
@Path( @Path(
"/{workflowIdentifier}/tasks/{taskIdentifier}/description/@remove/{locale}") "/{workflowIdentifier}/tasks/{taskIdentifier}/description/@remove/{locale}")
@ -1072,6 +1326,18 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Adds a blocking task to a task. Both task must exist and be part of the
* the current workflow.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifer of the current workflow.
* @param taskIdentifierParam The identifier of the current task.
* @param blockingTaskParam The identifier of the blocking task.
*
* @return A redirect to the details view of the task.
*/
@POST @POST
@Path( @Path(
"/{workflowIdentifier}/tasks/{taskIdentifier}/blocking-tasks/@add") "/{workflowIdentifier}/tasks/{taskIdentifier}/blocking-tasks/@add")
@ -1141,6 +1407,18 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Removes a blocking task from a task. Both task must exist and be part of
* the the current workflow.
*
* @param sectionIdentifierParam The identifier of the current content
* section.
* @param workflowIdentiferParam The identifer of the current workflow.
* @param taskIdentifierParam The identifier of the current task.
* @param blockingTaskParam The identifier of the blocking task.
*
* @return A redirect to the details view of the task.
*/
@POST @POST
@Path( @Path(
"/{workflowIdentifier}/tasks/{taskIdentifier}/blockingTasks/{blockingTaskIdentifier}/@remove") "/{workflowIdentifier}/tasks/{taskIdentifier}/blockingTasks/{blockingTaskIdentifier}/@remove")
@ -1201,6 +1479,16 @@ public class ConfigurationWorkflowController {
); );
} }
/**
* Helper method for retrieving a workflow template.
*
* @param section The current content section.
* @param templateIdentifierParam The identifier of the workflow template.
*
* @return An {@link Optional} with the workflow template or an empty
* {@link Optional} if the content section has not matching workflow
* template.
*/
private Optional<Workflow> findWorkflowTemplate( private Optional<Workflow> findWorkflowTemplate(
final ContentSection section, final String templateIdentifierParam final ContentSection section, final String templateIdentifierParam
) { ) {
@ -1233,6 +1521,14 @@ public class ConfigurationWorkflowController {
} }
} }
/**
* Shows the "workflow template not found" error page.
*
* @param section The current content section.
* @param templateIdentifier The identifier of the workflow template.
*
* @return The template for the "workflow template not found" error page.
*/
private String showWorkflowTemplateNotFound( private String showWorkflowTemplateNotFound(
final ContentSection section, final ContentSection section,
final String templateIdentifier final String templateIdentifier
@ -1270,6 +1566,17 @@ public class ConfigurationWorkflowController {
} }
} }
/**
* Shows the "workflow task template not found" error page.
*
* @param section The current content section.
* @param workflowTemplateIdentifier The identifier of the workflow
* template.
* @param taskTemplateIdentifier The idenfifier of the task template.
*
* @return The template for the "workflow task template not found" error
* page.
*/
private String showWorkflowTaskTemplateNotFound( private String showWorkflowTaskTemplateNotFound(
final ContentSection section, final ContentSection section,
final String workflowTemplateIdentifier, final String workflowTemplateIdentifier,
@ -1281,6 +1588,14 @@ public class ConfigurationWorkflowController {
return "org/librecms/ui/contentsection/configuration/workflow-task-not-found.xhtml"; return "org/librecms/ui/contentsection/configuration/workflow-task-not-found.xhtml";
} }
/**
* Helper method for building a {@link WorkflowTemplateListModel} for a
* {@link Workflow}.
*
* @param workflow The workflow.
*
* @return A {@link WorkflowTemplateListModel} for the {@code workflow}.
*/
private WorkflowTemplateListModel buildWorkflowTemplateListModel( private WorkflowTemplateListModel buildWorkflowTemplateListModel(
final Workflow workflow final Workflow workflow
) { ) {
@ -1299,6 +1614,14 @@ public class ConfigurationWorkflowController {
return model; return model;
} }
/**
* Helper method for building a {@link WorkflowTaskTemplateListModel} for a
* {@link Task}.
*
* @param task The task.
*
* @return A {@link WorkflowTaskTemplateListModel} for the {@code task}.
*/
private WorkflowTaskTemplateListModel buildWorkflowTaskTemplateListModel( private WorkflowTaskTemplateListModel buildWorkflowTaskTemplateListModel(
final Task task final Task task
) { ) {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -17,7 +30,8 @@ import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application; import javax.ws.rs.core.Application;
/** /**
* * JAX-RS application for managing a content section.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ApplicationPath("/@contentsections") @ApplicationPath("/@contentsections")

View File

@ -16,6 +16,7 @@ import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
/** /**
* Controller for managing content sections.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -23,9 +24,17 @@ import javax.ws.rs.core.Response;
@Path("/") @Path("/")
public class ContentSectionController { public class ContentSectionController {
/**
* The current HTTP Servlet request.
*/
@Inject @Inject
private HttpServletRequest request; private HttpServletRequest request;
/**
* Redirect to the list of content sections.
*
* @return A redirect.
*/
@GET @GET
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
@ -51,7 +60,14 @@ public class ContentSectionController {
throw new WebApplicationException(ex); throw new WebApplicationException(ex);
} }
} }
/**
* Redirect to the document folder page of the content section.
*
* @param sectionIdentifier The identifier of the content section.
*
* @return A redirect to the document folders page.
*/
@GET @GET
@Path("/{sectionIdentifier}") @Path("/{sectionIdentifier}")
@AuthorizationRequired @AuthorizationRequired

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -20,6 +33,7 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model for providing data about a {@link ContentSection}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -27,21 +41,43 @@ import javax.inject.Named;
@Named("ContentSectionModel") @Named("ContentSectionModel")
public class ContentSectionModel { public class ContentSectionModel {
/**
* Used to check permissions on the {@link ContentSection}.
*/
@Inject @Inject
private PermissionChecker permissionChecker; private PermissionChecker permissionChecker;
/**
* The content section.
*/
private ContentSection section; private ContentSection section;
/**
* The asset folder tree of the section.
*/
private List<AssetFolderTreeNode> assetFolders; private List<AssetFolderTreeNode> assetFolders;
/**
* The document folder tree of the section.
*/
private List<DocumentFolderTreeNode> documentFolders; private List<DocumentFolderTreeNode> documentFolders;
/**
* Sets the section for the model
*
* @param section The content section.
*/
protected void setSection(final ContentSection section) { protected void setSection(final ContentSection section) {
this.section = Objects.requireNonNull( this.section = Objects.requireNonNull(
section, "Parameter section can't be null" section, "Parameter section can't be null"
); );
} }
/**
* Get the label of the content section.
*
* @return The label of the content section.
*/
public String getSectionName() { public String getSectionName() {
return Optional return Optional
.ofNullable(section) .ofNullable(section)
@ -69,32 +105,60 @@ public class ContentSectionModel {
this.documentFolders = new ArrayList<>(documentFolders); this.documentFolders = new ArrayList<>(documentFolders);
} }
/**
* Can the current user administer the categories of the domains/category
* sytems assigned to the section?
*
* @return
*/
public boolean getCanAdministerCategories() { public boolean getCanAdministerCategories() {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
AdminPrivileges.ADMINISTER_CATEGORIES, section AdminPrivileges.ADMINISTER_CATEGORIES, section
); );
} }
/**
* Can the current user administer the content types assigned to the
* section?
*
* @return
*/
public boolean getCanAdministerContentTypes() { public boolean getCanAdministerContentTypes() {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
AdminPrivileges.ADMINISTER_CATEGORIES, section AdminPrivileges.ADMINISTER_CATEGORIES, section
); );
} }
/**
* Can the current user administer the lifecycle definitions of the section?
*
* @return
*/
public boolean getCanAdministerLifecycles() { public boolean getCanAdministerLifecycles() {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
AdminPrivileges.ADMINISTER_LIFECYLES, section AdminPrivileges.ADMINISTER_LIFECYLES, section
); );
} }
/**
* Can the current user administer the roles of the section?
*
* @return
*/
public boolean getCanAdministerRoles() { public boolean getCanAdministerRoles() {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
AdminPrivileges.ADMINISTER_ROLES, section AdminPrivileges.ADMINISTER_ROLES, section
); );
} }
/**
* Can the current user administer the workflows templates of the section?
*
* @return
*/
public boolean getCanAdministerWorkflows() { public boolean getCanAdministerWorkflows() {
return permissionChecker.isPermitted(AdminPrivileges.ADMINISTER_WORKFLOWS, section return permissionChecker.isPermitted(
AdminPrivileges.ADMINISTER_WORKFLOWS, section
); );
} }

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -20,22 +33,40 @@ import javax.inject.Inject;
import javax.mvc.Models; import javax.mvc.Models;
/** /**
* Provides common functions for controllers working with
* {@link ContentSection}s.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@RequestScoped @RequestScoped
public class ContentSectionsUi { public class ContentSectionsUi {
/**
* Used to retrieve {@link ContentSection}s.
*/
@Inject @Inject
private ContentSectionRepository sectionRepo; private ContentSectionRepository sectionRepo;
/**
* Used to parse the identifier of {@link ContentSection}s.
*/
@Inject @Inject
private IdentifierParser identifierParser; private IdentifierParser identifierParser;
/**
* Used to provided data for views (here: error pages) without a named bean.
*/
private Models models; private Models models;
private PermissionChecker permissionChecker; /**
* Retrieve a content section.
*
* @param identifierParam The identifier of the content section.
*
* @return An {@link Optional} with the content section, or an empty
* {@link Optional} if there is not {@link ContentSection} with the
* provided identifier.
*/
public Optional<ContentSection> findContentSection( public Optional<ContentSection> findContentSection(
final String identifierParam final String identifierParam
) { ) {
@ -64,6 +95,13 @@ public class ContentSectionsUi {
} }
} }
/**
* Show the access denied error page.
*
* @param identifiers The identifiers of the resource.
*
* @return The template of the access denied error page.
*/
public String showAccessDenied(final String... identifiers) { public String showAccessDenied(final String... identifiers) {
if (identifiers.length % 2 != 0) { if (identifiers.length % 2 != 0) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
@ -76,6 +114,13 @@ public class ContentSectionsUi {
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml"; return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
/**
* Show the access denied error page.
*
* @param identifiers The identifiers of the resource.
*
* @return The template of the access denied error page.
*/
public String showAccessDenied(final Map<String, String> identifiers) { public String showAccessDenied(final Map<String, String> identifiers) {
for (final Map.Entry<String, String> entry : identifiers.entrySet()) { for (final Map.Entry<String, String> entry : identifiers.entrySet()) {
models.put(entry.getKey(), entry.getValue()); models.put(entry.getKey(), entry.getValue());
@ -83,46 +128,16 @@ public class ContentSectionsUi {
return "org/librecms/ui/contentsection/access-denied.xhtml"; return "org/librecms/ui/contentsection/access-denied.xhtml";
} }
/**
* Show the "content section not found" error page.
*
* @param sectionIdentifier The identifier of the content section.
*
* @return The template of the "content section not found" error page.
*/
public String showContentSectionNotFound(final String sectionIdentifier) { public String showContentSectionNotFound(final String sectionIdentifier) {
models.put("sectionIdentifier", sectionIdentifier); models.put("sectionIdentifier", sectionIdentifier);
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml"; return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
} }
// public RetrieveResult<ContentSection> retrieveContentSection(
// final String identifierParam
// ) {
// final Identifier sectionIdentifier = identifierParser.parseIdentifier(
// identifierParam
// );
//
// final Optional<ContentSection> sectionResult;
// switch (sectionIdentifier.getType()) {
// case ID:
// sectionResult = sectionRepo.findById(
// Long.parseLong(
// sectionIdentifier.getIdentifier()
// )
// );
// break;
// case UUID:
// sectionResult = sectionRepo.findByUuid(
// sectionIdentifier.getIdentifier()
// );
// break;
// default:
// sectionResult = sectionRepo.findByLabel(
// sectionIdentifier.getIdentifier()
// );
// break;
// }
//
// if (sectionResult.isPresent()) {
// return RetrieveResult.successful(sectionResult.get());
// } else {
// models.put("sectionIdentifier", sectionIdentifier);
// return RetrieveResult.failed(
// "org/librecms/ui/contentsection/contentsection-not-found.xhtml"
// );
// }
// }
} }

View File

@ -1,15 +1,31 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.librecms.contentsection.Asset;
import org.librecms.contentsection.privileges.AssetPrivileges; import org.librecms.contentsection.privileges.AssetPrivileges;
import javax.enterprise.context.Dependent; import javax.enterprise.context.Dependent;
/** /**
* Implementation of {@link AbstractCurrentUserPermissions} for the permissions
* of {@link Asset}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */

View File

@ -1,16 +1,31 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.privileges.ItemPrivileges; import org.librecms.contentsection.privileges.ItemPrivileges;
import javax.enterprise.context.Dependent; import javax.enterprise.context.Dependent;
/** /**
* * Implementation of {@link AbstractCurrentUserPermissions} for the permissions of {@link ContentItem}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@Dependent @Dependent

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -56,6 +69,7 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST; import javax.ws.rs.POST;
/** /**
* Controller for managing doucment folders.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -68,60 +82,127 @@ public class DocumentFolderController {
DocumentFolderController.class DocumentFolderController.class
); );
/**
* Used for actions on {@link ContentItem}s in the folder.
*/
@Inject @Inject
private ContentItemManager itemManager; private ContentItemManager itemManager;
/**
* Used to retrieve {@link ContentItem}s in the folder.
*/
@Inject @Inject
private ContentItemRepository itemRepo; private ContentItemRepository itemRepo;
/**
* Used for localization actions for the items in the folder.
*/
@Inject @Inject
private ContentItemL10NManager itemL10NManager; private ContentItemL10NManager itemL10NManager;
/**
* Model for the current {@link ContentSection}.
*/
@Inject @Inject
private ContentSectionModel contentSectionModel; private ContentSectionModel contentSectionModel;
/**
* Provides common functions for all controllers working with
* {@link ContentSection}s.
*/
@Inject @Inject
private ContentSectionsUi sectionsUi; private ContentSectionsUi sectionsUi;
/**
* Used to retrieve {@link ContentType}s.
*/
@Inject @Inject
private ContentTypeRepository contentTypeRepo; private ContentTypeRepository contentTypeRepo;
/**
* Model for the current document folder.
*/
@Inject @Inject
private DocumentFolderModel documentFolderModel; private DocumentFolderModel documentFolderModel;
/**
* Used for actions on folders.
*/
@Inject @Inject
private FolderManager folderManager; private FolderManager folderManager;
/**
* Used to retrieve and save folders.
*/
@Inject @Inject
private FolderRepository folderRepo; private FolderRepository folderRepo;
/**
* Used for globalization actions.
*/
@Inject @Inject
private GlobalizationHelper globalizationHelper; private GlobalizationHelper globalizationHelper;
/**
* Used to provide data for the views without a named bean.
*/
@Inject @Inject
private Models models; private Models models;
/**
* Used to update the permissions of the folder.
*/
@Inject @Inject
private PermissionManager permissionManager; private PermissionManager permissionManager;
/**
* Used to retrieve roles.
*/
@Inject @Inject
private RoleRepository roleRepo; private RoleRepository roleRepo;
/**
* Used to check permissions on {@link ContentItem}s.
*/
@Inject @Inject
private DocumentPermissions documentPermissions; private DocumentPermissions documentPermissions;
/**
* Model for the document folder tree.
*/
@Inject @Inject
private DocumentFolderTree documentFolderTree; private DocumentFolderTree documentFolderTree;
/**
* Privileges granted to the current for the items in the folder.
*/
@Inject @Inject
private GrantedItemPrivileges grantedPrivileges; private GrantedItemPrivileges grantedPrivileges;
/**
* Privileges granted to the current for the items in the folder.
*/
@Inject @Inject
private CurrentUserDocumentPermissions currentUserPermissions; private CurrentUserDocumentPermissions currentUserPermissions;
/**
* Permission checker for {@link ContentItem}s.
*/
@Inject @Inject
private ItemPermissionChecker itemPermissionChecker; private ItemPermissionChecker itemPermissionChecker;
/**
* List the content items and subfolders of the root folder of a content
* section.
*
* @param sectionIdentifier The identifier of the content section.
* @param filterTerm An optional filter term for filtering the items
* and subfolders.
* @param firstResult The index of the first result to show.
* @param maxResults The maximum number of results to show.
*
* @return The template for showing the content of a document folder.
*/
@GET @GET
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
@ -137,6 +218,18 @@ public class DocumentFolderController {
); );
} }
/**
* List the content items and subfolders of a folder of a content section.
*
* @param sectionIdentifier The identifier of the content section.
* @param folderPath Path of the folder.
* @param filterTerm An optional filter term for filtering the items
* and subfolders.
* @param firstResult The index of the first result to show.
* @param maxResults The maximum number of results to show.
*
* @return The template for showing the content of a document folder.
*/
@GET @GET
@Path("/{folderPath:(.+)?}") @Path("/{folderPath:(.+)?}")
@AuthorizationRequired @AuthorizationRequired
@ -242,10 +335,20 @@ public class DocumentFolderController {
return "org/librecms/ui/contentsection/documentfolder/documentfolder.xhtml"; return "org/librecms/ui/contentsection/documentfolder/documentfolder.xhtml";
} }
/**
* Only for testing, will be removed.
*
* @param sectionIdentifier
*
* @return
*
* @deprecated
*/
@GET @GET
@Path("/create-testdata") @Path("/create-testdata")
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
@Deprecated
public String createTestData( public String createTestData(
@PathParam("sectionIdentifier") final String sectionIdentifier @PathParam("sectionIdentifier") final String sectionIdentifier
) { ) {
@ -315,6 +418,14 @@ public class DocumentFolderController {
} }
} }
/**
* Creates a new subfolder in the root folder of a content section.
*
* @param sectionIdentifier The identifier of the content section.
* @param folderName The name of the new folder.
*
* @return A redirect to the listing of the root folder.
*/
@POST @POST
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
@ -328,6 +439,15 @@ public class DocumentFolderController {
); );
} }
/**
* Create a new subfolder in a folder.
*
* @param sectionIdentifier The identifier of the content section.
* @param parentFolderPath The path of the parent folder.
* @param folderName The name of the new folder.
*
* @return A redirect to the listing of the parent folder.
*/
@POST @POST
@Path("/{parentFolderPath:(.+)?}") @Path("/{parentFolderPath:(.+)?}")
@AuthorizationRequired @AuthorizationRequired
@ -383,6 +503,16 @@ public class DocumentFolderController {
); );
} }
/**
* Updates the permissions of the root folder of a content section.
*
* @param sectionIdentifier The identifier of the content section.
* @param roleParam The identifier of the role for which the
* permissions are updated.
* @param permissions The updated permissions.
*
* @return A redirect to the listing of the folder.
*/
@POST @POST
@Path("/@permissions/{role}/") @Path("/@permissions/{role}/")
@AuthorizationRequired @AuthorizationRequired
@ -397,6 +527,17 @@ public class DocumentFolderController {
); );
} }
/**
* Updates the permissions of afolder of a content section.
*
* @param sectionIdentifier The identifier of the content section.
* @param folderPath The path of the folder.
* @param roleParam The identifier of the role for which the
* permissions are updated.
* @param permissions The updated permissions.
*
* @return A redirect to the listing of the folder.
*/
@POST @POST
@Path("/@permissions/{role}/{folderPath:(.+)?}") @Path("/@permissions/{role}/{folderPath:(.+)?}")
@AuthorizationRequired @AuthorizationRequired
@ -478,6 +619,15 @@ public class DocumentFolderController {
); );
} }
/**
* Renames a folder.
*
* @param sectionIdentifier The identifier of the content section
* @param folderPath The path of the folder.
* @param folderName The new name of the folder.
*
* @return A redirect to the folder.
*/
@POST @POST
@Path("/@rename/{folderPath:(.+)?}") @Path("/@rename/{folderPath:(.+)?}")
@AuthorizationRequired @AuthorizationRequired
@ -538,6 +688,13 @@ public class DocumentFolderController {
); );
} }
/**
* A helper method for building the breadcrumb trail of a folder.
*
* @param folderPath The path of the folder.
*
* @return The breadcrumb trail for the folder.
*/
private List<FolderBreadcrumbsModel> buildBreadcrumbs( private List<FolderBreadcrumbsModel> buildBreadcrumbs(
final String folderPath final String folderPath
) { ) {
@ -564,6 +721,15 @@ public class DocumentFolderController {
return breadcrumbs; return breadcrumbs;
} }
/**
* Helper method for building a {@link DocumentFolderRowModel} for an entry
* in the document folder.
*
* @param section The content section of the folder.
* @param entry The entry from which the row is created.
*
* @return A {@link DocumentFolderRowModel} for the provided {@code entry}.
*/
private DocumentFolderRowModel buildRowModel( private DocumentFolderRowModel buildRowModel(
final ContentSection section, final DocumentFolderEntry entry final ContentSection section, final DocumentFolderEntry entry
) { ) {
@ -688,6 +854,15 @@ public class DocumentFolderController {
return row; return row;
} }
/**
* Helper method for showing the "document folder not found" page if there
* is not folder for the provided path.
*
* @param section The content section.
* @param folderPath The folder path.
*
* @return The template of the "document folder not found" page.
*/
private String showDocumentFolderNotFound( private String showDocumentFolderNotFound(
final ContentSection section, final String folderPath final ContentSection section, final String folderPath
) { ) {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -14,6 +27,7 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model for displaying a document folder.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -21,28 +35,64 @@ import javax.inject.Named;
@Named("DocumentFolderModel") @Named("DocumentFolderModel")
public class DocumentFolderModel { public class DocumentFolderModel {
/**
* Count of items (content items and subfolders) in the folder.
*/
private long count; private long count;
/**
* The index of the first item in the folder shown.
*/
private int firstResult; private int firstResult;
/**
* The maximum number of items shown.
*/
private int maxResults; private int maxResults;
/**
* The rows for the table showing the contents of the folder.
*/
private List<DocumentFolderRowModel> rows; private List<DocumentFolderRowModel> rows;
/**
* The breadcrumb trail of the folder.
*/
private List<FolderBreadcrumbsModel> breadcrumbs; private List<FolderBreadcrumbsModel> breadcrumbs;
/**
* The path of the folder.
*/
private String path; private String path;
/**
* Can the current user create subfolders in the folder.
*/
private boolean canCreateSubFolders; private boolean canCreateSubFolders;
/**
* Can the current user create items in the folder.
*/
private boolean canCreateItems; private boolean canCreateItems;
/**
* Can the current user administer items in the folder.
*/
private boolean canAdminister; private boolean canAdminister;
/**
* Permissions of the current user for the folder.
*/
private List<GrantedPrivilegeModel> currentUserPermissions; private List<GrantedPrivilegeModel> currentUserPermissions;
/**
* Privileges granted to the roles of the content section for the folder.
*/
private List<PrivilegesGrantedToRoleModel> grantedPermissions; private List<PrivilegesGrantedToRoleModel> grantedPermissions;
/**
* A list of the privileges that can be granted for a document folder.
*/
private List<String> privileges; private List<String> privileges;
public long getCount() { public long getCount() {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -9,33 +22,75 @@ import java.util.Collections;
import java.util.SortedSet; import java.util.SortedSet;
/** /**
* Model for a row in the document folder browser.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class DocumentFolderRowModel { public class DocumentFolderRowModel {
/**
* ISO formatted creation date of the item represented by the row. May be
* {@code null}.
*/
private String created; private String created;
/**
* Can the object represented by the row by deleted?
*/
private boolean deletable; private boolean deletable;
/**
* Does the row represent a folder?
*/
private boolean folder; private boolean folder;
/**
* The the row represents a folder: The path of the folder.
*/
private String folderPath; private String folderPath;
/**
* If the row representents a {@link ContentItem}: The languages in which
* the item is available.
*/
private SortedSet<String> languages; private SortedSet<String> languages;
/**
* ISO formatted date of the last edit of the item represented by the row.
* May be {@code null}.
*/
private String lastEdited; private String lastEdited;
/**
* ISO formatted date of the last publication of the item represented by the
* row. May be {@code null}.
*/
private boolean lastEditPublished; private boolean lastEditPublished;
/**
* The name of the entry.
*/
private String name; private String name;
/**
* The row represents a none CMS object does has been assigned to the
* category backing the folder.
*/
private boolean noneCmsObject; private boolean noneCmsObject;
/**
* The title of the item represented by the row.
*/
private String title; private String title;
/**
* The type of the item represented by the row.
*/
private String type; private String type;
/**
* The {@link DocumentPermissionsModel} for the entry.
*/
private DocumentPermissionsModel permissions; private DocumentPermissionsModel permissions;
public String getCreated() { public String getCreated() {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -13,16 +26,21 @@ import javax.inject.Inject;
import javax.transaction.Transactional; import javax.transaction.Transactional;
/** /**
* The document folder tree of a {@link ContentSection}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@Dependent @Dependent
public class DocumentFolderTree public class DocumentFolderTree
extends AbstractFolderTree<DocumentFolderTreeNode, DocumentPermissionsModel>{ extends AbstractFolderTree<DocumentFolderTreeNode, DocumentPermissionsModel> {
/**
* {@link DocumentPermissions} instance used to check permissions on the
* documents.
*/
@Inject @Inject
private DocumentPermissions documentPermissions; private DocumentPermissions documentPermissions;
@Override @Override
public DocumentFolderTreeNode newFolderTreeNode() { public DocumentFolderTreeNode newFolderTreeNode() {
return new DocumentFolderTreeNode(); return new DocumentFolderTreeNode();
@ -39,6 +57,4 @@ public class DocumentFolderTree
return documentPermissions.buildDocumentPermissionsModel(folder); return documentPermissions.buildDocumentPermissionsModel(folder);
} }
} }

View File

@ -1,15 +1,31 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.librecms.contentsection.ContentSection;
/** /**
* A node in the document folder tree of {@link ContentSection}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class DocumentFolderTreeNode public class DocumentFolderTreeNode
extends FolderTreeNode<DocumentFolderTreeNode, DocumentPermissionsModel> { extends FolderTreeNode<DocumentFolderTreeNode, DocumentPermissionsModel> {
} }

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -14,15 +27,28 @@ import javax.enterprise.context.Dependent;
import javax.inject.Inject; import javax.inject.Inject;
/** /**
* Used to determine the priviliges granted on a document/{@link ContentItem}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@Dependent @Dependent
public class DocumentPermissions { public class DocumentPermissions {
/**
* The {@link PermissionChecker} instance used for checking permissions.
*/
@Inject @Inject
private PermissionChecker permissionChecker; private PermissionChecker permissionChecker;
/**
* Builds a {@link DocumentPermissionsModel} for the current user and the
* provided {@code folder}.
*
* @param folder The folder.
*
* @return A {@link DocumentPermissionsModel} for the folder and items in
* the folder.
*/
public DocumentPermissionsModel buildDocumentPermissionsModel( public DocumentPermissionsModel buildDocumentPermissionsModel(
final Folder folder final Folder folder
) { ) {
@ -80,6 +106,15 @@ public class DocumentPermissions {
return model; return model;
} }
/**
* Builds a {@link DocumentPermissionsModel} for the current user and
* specific content item.
*
*
* @param item The {@link ContentItem}.
*
* @return A {@link DocumentPermissionsModel} for the item.
*/
public DocumentPermissionsModel buildDocumentPermissionsModel( public DocumentPermissionsModel buildDocumentPermissionsModel(
final ContentItem item final ContentItem item
) { ) {

View File

@ -1,34 +1,90 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.librecms.contentsection.privileges.ItemPrivileges;
/** /**
* Model for the permissions of a document/{@link ContentItem}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class DocumentPermissionsModel implements PermissionsModel { public class DocumentPermissionsModel implements PermissionsModel {
/**
* Has the {@link ItemPrivileges#ADMINISTER} privilege been granted for the
* content item?
*/
private boolean grantedAdminister; private boolean grantedAdminister;
/**
* Has the {@link ItemPrivileges#APPLY_ALTERNATE_WORKFLOW} privilege been
* granted for the content item?
*/
private boolean grantedApplyAlternateWorkflow; private boolean grantedApplyAlternateWorkflow;
/**
* Has the {@link ItemPrivileges#APPROVE} privilege been granted for the
* content item?
*/
private boolean grantedApprove; private boolean grantedApprove;
/**
* Has the {@link ItemPrivileges#CATEGORIZE} privilege been granted for the
* content item?
*/
private boolean grantedCategorize; private boolean grantedCategorize;
/**
* Has the {@link ItemPrivileges#CREATE_NEW} privilege been granted for the
* content item?
*/
private boolean grantedCreateNew; private boolean grantedCreateNew;
/**
* Has the {@link ItemPrivileges#DELETE} privilege been granted for the
* content item?
*/
private boolean grantedDelete; private boolean grantedDelete;
/**
* Has the {@link ItemPrivileges#EDIT} privilege been granted for the
* content item?
*/
private boolean grantedEdit; private boolean grantedEdit;
/**
* Has the {@link ItemPrivileges#PREVIEW} privilege been granted for the
* content item?
*/
private boolean grantedPreview; private boolean grantedPreview;
/**
* Has the {@link ItemPrivileges#PUBLISH} privilege been granted for the
* content item?
*/
private boolean grantedPublish; private boolean grantedPublish;
/**
* Has the {@link ItemPrivileges#VIEW_PUBLISHED} privilege been granted for
* the content item?
*/
private boolean grantedViewPublished; private boolean grantedViewPublished;
public boolean isGrantedAdminister() { public boolean isGrantedAdminister() {

View File

@ -1,20 +1,51 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.librecms.contentsection.ContentType;
/** /**
* Model for displaying the basic information about a document type
* ({@link ContentType}):
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class DocumentTypeInfoModel { public class DocumentTypeInfoModel {
/**
* The label of the type. This value is determined from
* {@link ContentType#label} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String label; private String label;
/**
* The description of the type. This value is determined from
* {@link ContentType#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String description; private String description;
/**
* The fully qualified name of the class implementing the type.
*/
private String contentItemClass; private String contentItemClass;
public String getLabel() { public String getLabel() {

View File

@ -1,24 +1,60 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.librecms.lifecycle.LifecycleDefinition;
/** /**
* Model for the lifecyles of a {@link ContentType} (document type).
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class DocumentTypeLifecycleModel { public class DocumentTypeLifecycleModel {
/**
* The ID of the lifecycle definition.
*/
private long definitionId; private long definitionId;
/**
* The UUID of the lifecycle definition.
*/
private String uuid; private String uuid;
/**
* The label of the lifecycle definition.This value is determined from
* {@link LifecycleDefinition#label} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String label; private String label;
/**
* The description of the lifecycle definition.This value is determined from
* {@link LifecycleDefinition#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String description; private String description;
/**
* Is the lifecycle the default lifecycle for the type?
*/
private boolean defaultLifecycle; private boolean defaultLifecycle;
public long getDefinitionId() { public long getDefinitionId() {

View File

@ -1,10 +1,24 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -15,23 +29,42 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model for the details view of a document type.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@RequestScoped @RequestScoped
@Named("CmsDocumentTypeModel") @Named("CmsDocumentTypeModel")
public class DocumentTypeModel { public class DocumentTypeModel {
/**
* The display name of the type.
*/
private String displayName; private String displayName;
/**
* The class implementing the type.
*/
private String contentItemClass; private String contentItemClass;
/**
* The localized labels of the type.
*/
private Map<String, String> labels; private Map<String, String> labels;
/**
* The localized descriptions of the type.
*/
private Map<String, String> descriptions; private Map<String, String> descriptions;
/**
* The lifecycles of the type.
*/
private List<DocumentTypeLifecycleModel> lifecycles; private List<DocumentTypeLifecycleModel> lifecycles;
/**
* The workflows of the type.
*/
private List<DocumentTypeWorkflowModel> workflows; private List<DocumentTypeWorkflowModel> workflows;
public String getContentItemClass() { public String getContentItemClass() {
@ -41,37 +74,37 @@ public class DocumentTypeModel {
public void setContentItemClass(final String contentItemClass) { public void setContentItemClass(final String contentItemClass) {
this.contentItemClass = contentItemClass; this.contentItemClass = contentItemClass;
} }
public Map<String, String> getLabels() { public Map<String, String> getLabels() {
return Collections.unmodifiableMap(labels); return Collections.unmodifiableMap(labels);
} }
public void setLabels(final Map<String, String> labels) { public void setLabels(final Map<String, String> labels) {
this.labels = new HashMap<>(labels); this.labels = new HashMap<>(labels);
} }
public Map<String, String> getDescriptions() { public Map<String, String> getDescriptions() {
return Collections.unmodifiableMap(descriptions); return Collections.unmodifiableMap(descriptions);
} }
public void setDescriptions(final Map<String, String> descriptions) { public void setDescriptions(final Map<String, String> descriptions) {
this.descriptions = new HashMap<>(descriptions); this.descriptions = new HashMap<>(descriptions);
} }
public List<DocumentTypeLifecycleModel> getLifecycles() { public List<DocumentTypeLifecycleModel> getLifecycles() {
return Collections.unmodifiableList(lifecycles); return Collections.unmodifiableList(lifecycles);
} }
public void setLifecycles( public void setLifecycles(
final List<DocumentTypeLifecycleModel> lifecyles final List<DocumentTypeLifecycleModel> lifecyles
) { ) {
this.lifecycles = new ArrayList<>(lifecyles); this.lifecycles = new ArrayList<>(lifecyles);
} }
public List<DocumentTypeWorkflowModel> getWorkflows() { public List<DocumentTypeWorkflowModel> getWorkflows() {
return Collections.unmodifiableList(workflows); return Collections.unmodifiableList(workflows);
} }
public void setWorkflows(final List<DocumentTypeWorkflowModel> workflows) { public void setWorkflows(final List<DocumentTypeWorkflowModel> workflows) {
this.workflows = new ArrayList<>(workflows); this.workflows = new ArrayList<>(workflows);
} }
@ -83,7 +116,5 @@ public class DocumentTypeModel {
public void setDisplayName(String displayName) { public void setDisplayName(String displayName) {
this.displayName = displayName; this.displayName = displayName;
} }
} }

View File

@ -1,20 +1,43 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
/** /**
* * Model for the permissions of role for a document type/content type.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class DocumentTypePermissionModel { public class DocumentTypePermissionModel {
/**
* The UUID of the role.
*/
private String roleUuid; private String roleUuid;
/**
* The name of the role.
*/
private String roleName; private String roleName;
/**
* Can a member of the role use the type
*/
private boolean canUse; private boolean canUse;
public String getRoleUuid() { public String getRoleUuid() {

View File

@ -1,24 +1,60 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.workflow.Workflow;
/** /**
* Model for the list of workflows of a content item.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class DocumentTypeWorkflowModel { public class DocumentTypeWorkflowModel {
/**
* The ID of the workflow.
*/
private long workflowId; private long workflowId;
/**
* The UUID of the workflow.
*/
private String uuid; private String uuid;
/**
* The name of the workflow. This value is determined from
* {@link Workflow#name} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String name; private String name;
/**
* The description of the workflow. This value is determined from
* {@link Workflow#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String description; private String description;
/**
* Is the workflow the default workflow for the type?
*/
private boolean defaultWorkflow; private boolean defaultWorkflow;
public long getWorkflowId() { public long getWorkflowId() {

View File

@ -1,10 +1,25 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.librecms.contentsection.ContentSection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -15,6 +30,8 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model for the list view of document types/{@link ContentTypes} of a
* {@link ContentSection}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -22,12 +39,24 @@ import javax.inject.Named;
@Named("CmsDocumentTypesModel") @Named("CmsDocumentTypesModel")
public class DocumentTypesModel { public class DocumentTypesModel {
/**
* The content types assigned to the content section.
*/
private List<DocumentTypesTableRowModel> assignedTypes; private List<DocumentTypesTableRowModel> assignedTypes;
/**
* The available types thare are not assigned to the content section.
*/
private Map<String, DocumentTypeInfoModel> availableTypes; private Map<String, DocumentTypeInfoModel> availableTypes;
/**
* The available lifecycles definitions.
*/
private Map<String, String> availableLifecycles; private Map<String, String> availableLifecycles;
/**
* The available workflow templates.
*/
private Map<String, String> availableWorkflows; private Map<String, String> availableWorkflows;
public List<DocumentTypesTableRowModel> getAssignedTypes() { public List<DocumentTypesTableRowModel> getAssignedTypes() {

View File

@ -1,40 +1,103 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentType;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
* Model for a row in the table of document types/cintent types assigned to a
* {@link ContentSection}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*
* @see ConfigurationDocumentTypesController
* @see ContentType
*/ */
public class DocumentTypesTableRowModel { public class DocumentTypesTableRowModel {
/**
* The display name of the content type.
*/
private String displayName; private String displayName;
/**
* The class implementing the type.
*/
private String contentItemClass; private String contentItemClass;
/**
* The label of the content type. This value is determined from
* {@link ContentType#label} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String label; private String label;
/**
* The description of the content type. This value is determined from
* {@link ContentType#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String description; private String description;
/**
* The mode of the type.
*/
private String mode; private String mode;
/**
* The label of the default lifecycle of the type. This value of determined
* from the label of the default lifecycle using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String defaultLifecycleLabel; private String defaultLifecycleLabel;
/**
* The UUID of the default lifecycle.
*/
private List<String> defaultLifecycleUuid; private List<String> defaultLifecycleUuid;
/**
* The label of the default workflow of the type. This value of determined
* from the label of the default workflow using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String defaultWorkflowLabel; private String defaultWorkflowLabel;
/**
* The UUID of the default workflow.
*/
private List<String> defaultWorkflowUuid; private List<String> defaultWorkflowUuid;
/**
* The UUID of the type.
*/
private String uuid; private String uuid;
/**
* The permissions of the current user for the type.
*/
private List<DocumentTypePermissionModel> permissions; private List<DocumentTypePermissionModel> permissions;
public String getContentItemClass() { public String getContentItemClass() {

View File

@ -1,26 +1,67 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.categorization.Domain;
import org.libreccm.categorization.DomainOwnership;
import org.libreccm.l10n.GlobalizationHelper;
/** /**
* Model for an entry in the list of {@link Domain}s (category system) assigned
* to a {@link ContentSection}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class DomainListEntryModel { public class DomainListEntryModel {
/**
* The context of the assigned domain.
*
* @see DomainOwnership#context
*/
private String context; private String context;
/**
* The key of the domain.
*/
private String domainKey; private String domainKey;
/**
* The URI of the domain.
*/
private String uri; private String uri;
/**
* The title of the domain. This value is determined from
* {@link Domain#title} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String title; private String title;
/**
* The version of the domain.
*/
private String version; private String version;
/**
* The release date of the domain as ISO formatted date.
*/
private String released; private String released;
public String getContext() { public String getContext() {

View File

@ -1,35 +1,67 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
/** /**
* Shows a duration stored in minutes in a human readable way as days, hours and
* minutes.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class Duration { public class Duration {
/**
* Days part of the duration.
*/
private long days; private long days;
/**
* Hours part of the duration.
*/
private long hours; private long hours;
/**
* Minutes part of the duration.
*/
private long minutes; private long minutes;
/**
* Create a {@code Duration} instance from a duration in minutes.
*
* @param value The duration in minutes.
*
* @return A {@code Duration} instance for displaying the duration as days,
* hours and minutes.
*/
public static Duration fromMinutes(final long value) { public static Duration fromMinutes(final long value) {
final long days = value / (24 * 60); final long days = value / (24 * 60);
final long daysReminder = value % (24 * 60); final long daysReminder = value % (24 * 60);
final long hours = daysReminder / 60; final long hours = daysReminder / 60;
final long minutes = daysReminder % 60; final long minutes = daysReminder % 60;
final Duration result = new Duration(); final Duration result = new Duration();
result.setDays(days); result.setDays(days);
result.setHours(hours); result.setHours(hours);
result.setMinutes(minutes); result.setMinutes(minutes);
return result; return result;
} }
public long getDays() { public long getDays() {
return days; return days;
} }
@ -53,10 +85,9 @@ public class Duration {
public void setMinutes(final long minutes) { public void setMinutes(final long minutes) {
this.minutes = minutes; this.minutes = minutes;
} }
public long toMinutes() { public long toMinutes() {
return days * 24 * 60 + hours * 60 + minutes; return days * 24 * 60 + hours * 60 + minutes;
} }
} }

View File

@ -1,20 +1,43 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
/** /**
* * Model for an individual breadcrumb in the breadcrumb trail of a folder.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class FolderBreadcrumbsModel { public class FolderBreadcrumbsModel {
/**
* A path token of the folder.
*/
private String pathToken; private String pathToken;
/**
* The full path of the folder.
*/
private String path; private String path;
/**
* Is the folder the currently selected folder.
*/
private boolean currentFolder; private boolean currentFolder;
public String getPathToken() { public String getPathToken() {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -9,27 +22,55 @@ import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
* Node of a folder tree.
*
* This class is not idented for direct. In most cases the subclasses
* {@link AssetFolderTreeNode} or {@link DocumentFolderTreeNode} should be used.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
* @param <T> * @param <T> The subtype of folder tree node.
* @param <P> * @param <P> The type of the permissions model to use.
*/ */
public class FolderTreeNode<T extends FolderTreeNode, P extends PermissionsModel> { public class FolderTreeNode<T extends FolderTreeNode<T, P>, P extends PermissionsModel> {
/**
* The ID of the folder.
*/
private long folderId; private long folderId;
/**
* The UUID of the folder.
*/
private String uuid; private String uuid;
/**
* The name of the folder.
*/
private String name; private String name;
/**
* The path of the folder.
*/
private String path; private String path;
/**
* The subfolders of the folder.
*/
private List<T> subFolders; private List<T> subFolders;
/**
* Should the folder open (sub folder are visible) in the view.
*/
private boolean open; private boolean open;
/**
* Is the folder the currently selected folder?
*/
private boolean selected; private boolean selected;
/**
* Permissions of the current user for the folder.
*/
private P permissions; private P permissions;
public long getFolderId() { public long getFolderId() {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -10,7 +23,8 @@ import org.librecms.contentsection.privileges.AssetPrivileges;
import javax.enterprise.context.Dependent; import javax.enterprise.context.Dependent;
/** /**
* * Implementation of {@link AbstractGrantedPrivileges} for {@link Asset}s.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@Dependent @Dependent

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -10,6 +23,7 @@ import org.librecms.contentsection.privileges.ItemPrivileges;
import javax.enterprise.context.Dependent; import javax.enterprise.context.Dependent;
/** /**
* Implemention of {@link AbstractGrantedPrivileges} for content items.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */

View File

@ -1,20 +1,43 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
/** /**
* * Model for displaying the privileges granted to a user or a role.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class GrantedPrivilegeModel { public class GrantedPrivilegeModel {
/**
* The privilege.
*/
private String privilege; private String privilege;
/**
* Is the privilege granted?
*/
private boolean granted; private boolean granted;
/**
* The the permission granting the privilege inherited from another object?
*/
private boolean inherited; private boolean inherited;
public String getPrivilege() { public String getPrivilege() {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -15,33 +28,72 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
/** /**
* Used to check permissions on {@link ContentItem}s for the current user.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@RequestScoped @RequestScoped
public class ItemPermissionChecker { public class ItemPermissionChecker {
/**
* The {@link PermissionChecker} instance used to perform the permission
* checks.
*/
@Inject @Inject
private PermissionChecker permissionChecker; private PermissionChecker permissionChecker;
/**
* Can the current user administer the provided content item?
*
* @param item The content item.
*
* @return {@code true} if the current user can administer the item,
* {@code false} otherwise.
*/
public boolean canAdministerItems(final ContentItem item) { public boolean canAdministerItems(final ContentItem item) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.ADMINISTER, item ItemPrivileges.ADMINISTER, item
); );
} }
/**
* Can the current user administer the content items in the provided content
* section?
*
* @param section The content section
*
* @return {@code true} if the current user can administer items of the
* content section, {@code false} otherwise.
*/
public boolean canAdministerItems(final ContentSection section) { public boolean canAdministerItems(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.ADMINISTER, section.getRootDocumentsFolder() ItemPrivileges.ADMINISTER, section.getRootDocumentsFolder()
); );
} }
/**
* Can the current user administer the content items in the provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can administer items of the
* folder, {@code false} otherwise.
*/
public boolean canAdministerItems(final Folder folder) { public boolean canAdministerItems(final Folder folder) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.ADMINISTER, folder ItemPrivileges.ADMINISTER, folder
); );
} }
/**
* Can the current user apply alternate workflows to the content items in
* the provided content section?
*
* @param section The content section
*
* @return {@code true} if the current user can apply alternate workflows to
* the items of the content section, {@code false} otherwise.
*/
public boolean canApplyAlternateWorkflowItems( public boolean canApplyAlternateWorkflowItems(
final ContentSection section final ContentSection section
) { ) {
@ -51,6 +103,15 @@ public class ItemPermissionChecker {
); );
} }
/**
* Can the current user apply alternate workflows to the provided content
* item?
*
* @param item The content item.
*
* @return {@code true} if the current user can apply alternate workflows to
* the item, {@code false} otherwise.
*/
public boolean canApplyAlternateWorkflowItems( public boolean canApplyAlternateWorkflowItems(
final ContentItem item final ContentItem item
) { ) {
@ -59,6 +120,15 @@ public class ItemPermissionChecker {
); );
} }
/**
* Can the current user apply alternate workflow to the content items in the
* provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can apply alternate workflows to
* the items of the folder, {@code false} otherwise.
*/
public boolean canApplyAlternateWorkflowItems( public boolean canApplyAlternateWorkflowItems(
final Folder folder final Folder folder
) { ) {
@ -67,144 +137,332 @@ public class ItemPermissionChecker {
); );
} }
/**
* Can the current user approve the provided content item?
*
* @param item The content item.
*
* @return {@code true} if the current user can approve the item,
* {@code false} otherwise.
*/
public boolean canApproveItems(final ContentItem item) { public boolean canApproveItems(final ContentItem item) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.APPROVE, item ItemPrivileges.APPROVE, item
); );
} }
/**
* Can the current user approve the content items in the provided content
* section?
*
* @param section The content section
*
* @return {@code true} if the current user can approve items of the content
* section, {@code false} otherwise.
*/
public boolean canApproveItems(final ContentSection section) { public boolean canApproveItems(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.APPROVE, section.getRootDocumentsFolder() ItemPrivileges.APPROVE, section.getRootDocumentsFolder()
); );
} }
/**
* Can the current user approve the content items in the provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can approve items of the folder,
* {@code false} otherwise.
*/
public boolean canApproveItems(final Folder folder) { public boolean canApproveItems(final Folder folder) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.APPROVE, folder ItemPrivileges.APPROVE, folder
); );
} }
/**
* Can the current user categorize the provided content item?
*
* @param item The content item.
*
* @return {@code true} if the current user can categorize the item,
* {@code false} otherwise.
*/
public boolean canCategorizeItems(final ContentItem item) { public boolean canCategorizeItems(final ContentItem item) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.CATEGORIZE, item ItemPrivileges.CATEGORIZE, item
); );
} }
/**
* Can the current user categorize the content items in the provided content
* section?
*
* @param section The content section
*
* @return {@code true} if the current user can categorize items of the
* content section, {@code false} otherwise.
*/
public boolean canCategorizeItems(final ContentSection section) { public boolean canCategorizeItems(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.CATEGORIZE, section.getRootDocumentsFolder() ItemPrivileges.CATEGORIZE, section.getRootDocumentsFolder()
); );
} }
/**
* Can the current user categorize the content items in the provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can categorize items of the
* folder, {@code false} otherwise.
*/
public boolean canCategorizeItems(final Folder folder) { public boolean canCategorizeItems(final Folder folder) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.CATEGORIZE, folder ItemPrivileges.CATEGORIZE, folder
); );
} }
public boolean canCreateNewItems(final ContentItem item) { /**
return permissionChecker.isPermitted( * Can the current user create new content items in the provided content
ItemPrivileges.CREATE_NEW, item * section?
); *
} * @param section The content section
*
* @return {@code true} if the current user can create new items in the
* content section, {@code false} otherwise.
*/
public boolean canCreateNewItems(final ContentSection section) { public boolean canCreateNewItems(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.CREATE_NEW, section.getRootDocumentsFolder() ItemPrivileges.CREATE_NEW, section.getRootDocumentsFolder()
); );
} }
/**
* Can the current user create new content items in the provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can create new items in the
* folder, {@code false} otherwise.
*/
public boolean canCreateNewItems(final Folder folder) { public boolean canCreateNewItems(final Folder folder) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.CREATE_NEW, folder ItemPrivileges.CREATE_NEW, folder
); );
} }
/**
* Can the current user delete the provided content item?
*
* @param item The content item.
*
* @return {@code true} if the current user can delete the item,
* {@code false} otherwise.
*/
public boolean canDeleteItems(final ContentItem item) { public boolean canDeleteItems(final ContentItem item) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.DELETE, item ItemPrivileges.DELETE, item
); );
} }
/**
* Can the current user delete content items in the provided content
* section?
*
* @param section The content section
*
* @return {@code true} if the current user can delete items in the content
* section, {@code false} otherwise.
*/
public boolean canDeleteItems(final ContentSection section) { public boolean canDeleteItems(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.DELETE, section.getRootDocumentsFolder() ItemPrivileges.DELETE, section.getRootDocumentsFolder()
); );
} }
/**
* Can the current user delete the content items in the provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can delete items in the folder,
* {@code false} otherwise.
*/
public boolean canDeleteItems(final Folder folder) { public boolean canDeleteItems(final Folder folder) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.DELETE, folder ItemPrivileges.DELETE, folder
); );
} }
/**
* Can the current user edit the provided content item?
*
* @param item The content item.
*
* @return {@code true} if the current user can edit the item, {@code false}
* otherwise.
*/
public boolean canEditItems(final ContentItem item) { public boolean canEditItems(final ContentItem item) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.EDIT, item ItemPrivileges.EDIT, item
); );
} }
/**
* Can the current user edit the content items in the provided content
* section?
*
* @param section The content section
*
* @return {@code true} if the current user can edit items of the content
* section, {@code false} otherwise.
*/
public boolean canEditItems(final ContentSection section) { public boolean canEditItems(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.EDIT, section.getRootDocumentsFolder() ItemPrivileges.EDIT, section.getRootDocumentsFolder()
); );
} }
/**
* Can the current user edit the content items in the provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can administer edit items in the
* folder, {@code false} otherwise.
*/
public boolean canEditItems(final Folder folder) { public boolean canEditItems(final Folder folder) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.EDIT, folder ItemPrivileges.EDIT, folder
); );
} }
/**
* Can the current user preview the provided content item?
*
* @param item The content item.
*
* @return {@code true} if the current user can preview the item,
* {@code false} otherwise.
*/
public boolean canPreviewItems(final ContentItem item) { public boolean canPreviewItems(final ContentItem item) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.PREVIEW, item ItemPrivileges.PREVIEW, item
); );
} }
/**
* Can the current user preview the content items in the provided content
* section?
*
* @param section The content section
*
* @return {@code true} if the current user can preview items of the content
* section, {@code false} otherwise.
*/
public boolean canPreviewItems(final ContentSection section) { public boolean canPreviewItems(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.PREVIEW, section.getRootDocumentsFolder() ItemPrivileges.PREVIEW, section.getRootDocumentsFolder()
); );
} }
/**
* Can the current user preview the content items in the provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can preview items in the folder,
* {@code false} otherwise.
*/
public boolean canPreviewItems(final Folder folder) { public boolean canPreviewItems(final Folder folder) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.PREVIEW, folder ItemPrivileges.PREVIEW, folder
); );
} }
/**
* Can the current user publish the provided content item?
*
* @param item The content item.
*
* @return {@code true} if the current user can publish the item,
* {@code false} otherwise.
*/
public boolean canPublishItems(final ContentItem item) { public boolean canPublishItems(final ContentItem item) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.PUBLISH, item ItemPrivileges.PUBLISH, item
); );
} }
/**
* Can the current user publish the content items in the provided content
* section?
*
* @param section The content section
*
* @return {@code true} if the current user can publish items of the content
* section, {@code false} otherwise.
*/
public boolean canPublishItems(final ContentSection section) { public boolean canPublishItems(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.PUBLISH, section.getRootDocumentsFolder() ItemPrivileges.PUBLISH, section.getRootDocumentsFolder()
); );
} }
/**
* Can the current user publish the content items in the provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can publish items in the folder,
* {@code false} otherwise.
*/
public boolean canPublishItems(final Folder folder) { public boolean canPublishItems(final Folder folder) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.PUBLISH, folder ItemPrivileges.PUBLISH, folder
); );
} }
/**
* Can the current user view the published version the provided content
* item?
*
* @param item The content item.
*
* @return {@code true} if the current user can view the published of the
* item, {@code false} otherwise.
*/
public boolean canViewPublishedItems(final ContentItem item) { public boolean canViewPublishedItems(final ContentItem item) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.VIEW_PUBLISHED, item ItemPrivileges.VIEW_PUBLISHED, item
); );
} }
/**
* Can the current user view publish content items of the provided content
* section?
*
* @param section The content section
*
* @return {@code true} if the current user can view publish items of the
* content section, {@code false} otherwise.
*/
public boolean canViewPublishedItems(final ContentSection section) { public boolean canViewPublishedItems(final ContentSection section) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.VIEW_PUBLISHED, section.getRootDocumentsFolder() ItemPrivileges.VIEW_PUBLISHED, section.getRootDocumentsFolder()
); );
} }
/**
* Can the current user view the published version of content items in the
* provided folder?
*
* @param folder The folder.
*
* @return {@code true} if the current user can view the published version
* of items in the folder, {@code false} otherwise.
*/
public boolean canViewPublishedItems(final Folder folder) { public boolean canViewPublishedItems(final Folder folder) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
ItemPrivileges.VIEW_PUBLISHED, folder ItemPrivileges.VIEW_PUBLISHED, folder

View File

@ -1,22 +1,55 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.librecms.lifecycle.LifecycleDefinition;
/** /**
* Model for the entries in a list of {@link LifecycleDefinition}s.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class LifecycleDefinitionListModel { public class LifecycleDefinitionListModel {
/**
* The ID of the lifecycle definition.
*/
private long definitionId; private long definitionId;
/**
* The UUID of the lifecycle definition.
*/
private String uuid; private String uuid;
/**
* The label of the lifecycle definition. This value is determined from
* {@link LifecycleDefinition#label} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String label; private String label;
/**
* The description of the lifecycle definition. This value is determined
* from {@link LifecycleDefinition#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String description; private String description;
public long getDefinitionId() { public long getDefinitionId() {

View File

@ -1,14 +1,29 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
/** /**
* Used as super interface for {@link AssetPermissionsModel} and
* {@link DocumentPermissionsModel} so that both can be used in the same place.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public interface PermissionsModel { public interface PermissionsModel {
} }

View File

@ -1,24 +1,60 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.librecms.lifecycle.PhaseDefinition;
/** /**
* Model for displaying a {@link PhaseDefinition}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class PhaseDefinitionModel { public class PhaseDefinitionModel {
/**
* The ID of the definition.
*/
private long definitionId; private long definitionId;
/**
* The label of the definition. This value is determined from
* {@link PhaseDefinition#label} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String label; private String label;
/**
* The description of the definition. This value is determined from
* {@link PhaseDefinition#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String description; private String description;
/**
* The default delay of the phase.
*/
private Duration defaultDelay; private Duration defaultDelay;
/**
* The default duration of the phase.
*/
private Duration defaultDuration; private Duration defaultDuration;
public long getDefinitionId() { public long getDefinitionId() {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -10,13 +23,20 @@ import java.util.List;
/** /**
* * Model for displaying the privileges granted to a role.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class PrivilegesGrantedToRoleModel { public class PrivilegesGrantedToRoleModel {
/**
* The name of the role.
*/
private String grantee; private String grantee;
/**
* The privileges granted to the role.
*/
private List<GrantedPrivilegeModel> grantedPrivileges; private List<GrantedPrivilegeModel> grantedPrivileges;
public String getGrantee() { public String getGrantee() {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;

View File

@ -1,22 +1,53 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.Role;
/** /**
* Model for a list of roles assigned to a content section.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class RoleListItemModel { public class RoleListItemModel {
/**
* The ID of the role.
*/
private long roleId; private long roleId;
/**
* The UUID of the role.
*/
private String uuid; private String uuid;
/**
* The name of the role.
*/
private String name; private String name;
/**
* The description of the role. This value is determined from
* {@link Role#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* },
*/
private String description; private String description;
public long getRoleId() { public long getRoleId() {

View File

@ -1,18 +1,39 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
/** /**
*
* Model for the members of a role.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class RoleMembershipModel { public class RoleMembershipModel {
/**
* The name of the member.
*/
private String memberName; private String memberName;
/**
* The UUID of the member.
*/
private String memberUuid; private String memberUuid;
public String getMemberName() { public String getMemberName() {

View File

@ -1,18 +1,40 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.librecms.contentsection.ContentSection;
/** /**
* * Model for the permissions table of a {@link ContentSection}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class RoleSectionPermissionModel { public class RoleSectionPermissionModel {
/**
* The privilege.
*/
private String privilege; private String privilege;
/**
* If the privilege granted?
*/
private boolean granted; private boolean granted;
public String getPrivilege() { public String getPrivilege() {

View File

@ -1,10 +1,27 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.librecms.lifecycle.LifecycleDefinition;
import org.librecms.lifecycle.PhaseDefinition;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -15,6 +32,7 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model for the details view of {@link LifecycleDefinition}s.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -22,20 +40,43 @@ import javax.inject.Named;
@Named("SelectedLifecycleDefinitionModel") @Named("SelectedLifecycleDefinitionModel")
public class SelectedLifecycleDefinitionModel { public class SelectedLifecycleDefinitionModel {
/**
* The UUID of the lifecycle definition.
*/
private String uuid; private String uuid;
/**
* The display label of the lifecycle definition. This value determined from
* {@link LifecycleDefinition#label} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String displayLabel; private String displayLabel;
/**
* The localized labels of the lifecycle definition.
*/
private Map<String, String> label; private Map<String, String> label;
/**
* The locales for which no localized label has been defined yet.
*/
private List<String> unusedLabelLocales; private List<String> unusedLabelLocales;
/**
* The localized descriptions of the lifecycle definition.
*/
private Map<String, String> description; private Map<String, String> description;
private List<PhaseDefinitionModel> phaseDefinitions;
/**
* The locales for which no localized description has been defined yet.
*/
private List<String> unusedDescriptionLocales; private List<String> unusedDescriptionLocales;
/**
* The {@link PhaseDefinition}s of the {@link LifecycleDefinition}.
*/
private List<PhaseDefinitionModel> phaseDefinitions;
public Map<String, String> getLabel() { public Map<String, String> getLabel() {
return Collections.unmodifiableMap(label); return Collections.unmodifiableMap(label);
} }
@ -89,7 +130,7 @@ public class SelectedLifecycleDefinitionModel {
public boolean getHasUnusedLabelLocales() { public boolean getHasUnusedLabelLocales() {
return !unusedLabelLocales.isEmpty(); return !unusedLabelLocales.isEmpty();
} }
public List<String> getUnusedDescriptionLocales() { public List<String> getUnusedDescriptionLocales() {
return Collections.unmodifiableList(unusedDescriptionLocales); return Collections.unmodifiableList(unusedDescriptionLocales);
} }
@ -100,7 +141,7 @@ public class SelectedLifecycleDefinitionModel {
this.unusedDescriptionLocales this.unusedDescriptionLocales
= new ArrayList<>(unusedDescriptionLocales); = new ArrayList<>(unusedDescriptionLocales);
} }
public boolean getHasUnusedDescriptionLocales() { public boolean getHasUnusedDescriptionLocales() {
return !unusedDescriptionLocales.isEmpty(); return !unusedDescriptionLocales.isEmpty();
} }

View File

@ -1,10 +1,27 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.librecms.lifecycle.LifecycleDefinition;
import org.librecms.lifecycle.PhaseDefinition;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -15,6 +32,8 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model for the details view of a {@link PhaseDefinition} of a
* {@link LifecycleDefinition}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -22,20 +41,46 @@ import javax.inject.Named;
@Named("SelectedPhaseDefinitionModel") @Named("SelectedPhaseDefinitionModel")
public class SelectedPhaseDefinitionModel { public class SelectedPhaseDefinitionModel {
/**
* The ID of the phase definition.
*/
private long definitionId; private long definitionId;
/**
* The localized labels of the phase definition.
*/
private Map<String, String> label; private Map<String, String> label;
/**
* The display label for the phase definition. This value is determined from
* {@link PhaseDefinition#label} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String displayLabel; private String displayLabel;
/**
* Locales for which no localized label has been defined yet.
*/
private List<String> unusedLabelLocales; private List<String> unusedLabelLocales;
/**
* The localized descriptions of the phase definition.
*/
private Map<String, String> description; private Map<String, String> description;
/**
* Locales for which no localized description has been defined yet.
*/
private List<String> unusedDescriptionLocales; private List<String> unusedDescriptionLocales;
/**
* The default delay of the phase definition.
*/
private Duration defaultDelay; private Duration defaultDelay;
/**
* The default duration of the phase definition.
*/
private Duration defaultDuration; private Duration defaultDuration;
public long getDefinitionId() { public long getDefinitionId() {
@ -93,13 +138,14 @@ public class SelectedPhaseDefinitionModel {
public void setUnusedDescriptionLocales( public void setUnusedDescriptionLocales(
final List<String> unusedDescriptionLocales final List<String> unusedDescriptionLocales
) { ) {
this.unusedDescriptionLocales = new ArrayList<>(unusedDescriptionLocales); this.unusedDescriptionLocales
= new ArrayList<>(unusedDescriptionLocales);
} }
public boolean getHasUnusedLabelLocales() { public boolean getHasUnusedLabelLocales() {
return !unusedLabelLocales.isEmpty(); return !unusedLabelLocales.isEmpty();
} }
public boolean getHasUnusedDescriptionLocales() { public boolean getHasUnusedDescriptionLocales() {
return !unusedDescriptionLocales.isEmpty(); return !unusedDescriptionLocales.isEmpty();
} }
@ -112,5 +158,4 @@ public class SelectedPhaseDefinitionModel {
this.displayLabel = displayLabel; this.displayLabel = displayLabel;
} }
} }

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -21,6 +34,7 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model for details view of a role providing the data of the selected role.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -28,17 +42,38 @@ import javax.inject.Named;
@Named("SelectedRoleModel") @Named("SelectedRoleModel")
public class SelectedRoleModel { public class SelectedRoleModel {
/**
* Party repository for retrieving parties.
*/
@Inject @Inject
private PartyRepository partyRepository; private PartyRepository partyRepository;
/**
* The name of the role.
*/
private String name; private String name;
/**
* The localized descriptions of the role.
*/
private Map<String, String> description; private Map<String, String> description;
/**
* Locales for which not localized description has been defined yet.
*/
private List<String> unusedDescriptionLocales; private List<String> unusedDescriptionLocales;
/**
* The members of the role.
*/
private List<RoleMembershipModel> members; private List<RoleMembershipModel> members;
/**
* Builds {@link RolePartyFormEntry} objects for all parties. They are used
* to create the form for adding members and removing members from the role.
*
* @return A list of {@link RolePartyFormEntry} objects for all parties.
*/
public List<RolePartyFormEntry> getRolePartyFormEnties() { public List<RolePartyFormEntry> getRolePartyFormEnties() {
return partyRepository return partyRepository
.findAll() .findAll()
@ -100,6 +135,14 @@ public class SelectedRoleModel {
return !unusedDescriptionLocales.isEmpty(); return !unusedDescriptionLocales.isEmpty();
} }
/**
* Helper method for building a {@link RolePartyFormEntry} for the a
* {@link Party}.
*
* @param party The party.
*
* @return A {@link RolePartyFormEntry} for the {@code party}.
*/
private RolePartyFormEntry buildRolePartyFormEntry(final Party party) { private RolePartyFormEntry buildRolePartyFormEntry(final Party party) {
final RolePartyFormEntry entry = new RolePartyFormEntry(); final RolePartyFormEntry entry = new RolePartyFormEntry();
entry.setPartyId(party.getPartyId()); entry.setPartyId(party.getPartyId());

View File

@ -1,10 +1,28 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.workflow.AssignableTask;
import org.libreccm.workflow.Task;
import org.libreccm.workflow.Workflow;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -15,6 +33,13 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model providing the data of the selected task of a workflow template for the
* details view of a task.
*
* @see ConfigurationWorkflowController
* @see Workflow
* @see Task
* @see AssignableTask
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -22,24 +47,56 @@ import javax.inject.Named;
@Named("SelectedWorkflowTaskTemplateModel") @Named("SelectedWorkflowTaskTemplateModel")
public class SelectedWorkflowTaskTemplateModel { public class SelectedWorkflowTaskTemplateModel {
/**
* The ID of the task.
*/
private long taskId; private long taskId;
/**
* The UUID of the task.
*/
private String uuid; private String uuid;
/**
* The display label of the task. This value is determined from
* {@link Task#label} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String displayLabel; private String displayLabel;
/**
* The localized labels of the task.
*/
private Map<String, String> label; private Map<String, String> label;
/**
* The locales for which no localized label has been defined yet.
*/
private List<String> unusedLabelLocales; private List<String> unusedLabelLocales;
/**
* The localized descriptions of the task.
*/
private Map<String, String> description; private Map<String, String> description;
/**
* The locales for which no localized description has been defined yet.
*/
private List<String> unusedDescriptionLocales; private List<String> unusedDescriptionLocales;
/**
* Tasks that block the selected task.
*/
private List<WorkflowTaskTemplateListModel> blockedTasks; private List<WorkflowTaskTemplateListModel> blockedTasks;
/**
* Task that are blocked by the selected tak.
*/
private List<WorkflowTaskTemplateListModel> blockingTasks; private List<WorkflowTaskTemplateListModel> blockingTasks;
/**
* Ohter that don't block the selected task.
*/
private Map<String, String> noneBlockingTasks; private Map<String, String> noneBlockingTasks;
public long getTaskId() { public long getTaskId() {

View File

@ -1,10 +1,25 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.workflow.Workflow;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -15,6 +30,11 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
/** /**
* Model providing the data about the selected workflow template for the
* workflow details view.
*
* @see ConfigurationWorkflowController
* @see Workflow
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -22,20 +42,44 @@ import javax.inject.Named;
@Named("SelectedWorkflowTemplateModel") @Named("SelectedWorkflowTemplateModel")
public class SelectedWorkflowTemplateModel { public class SelectedWorkflowTemplateModel {
/**
* The ID of the selected workflow template.
*/
private long workflowId; private long workflowId;
/**
* The UUID of the selected workflow template.
*/
private String uuid; private String uuid;
/**
* The display name of the selected workflow template.
*/
private String displayName; private String displayName;
/**
* The localized titles of the selected workflow template.
*/
private Map<String, String> name; private Map<String, String> name;
/**
* Locales for which no title value has been definied yet.
*/
private List<String> unusedNameLocales; private List<String> unusedNameLocales;
/**
* The localized descriptions of the selected workflow template.
*/
private Map<String, String> description; private Map<String, String> description;
/**
* The locales for which no localized description has definied yet.
*/
private List<String> unusedDescriptionLocales; private List<String> unusedDescriptionLocales;
/**
* The tasks of the selected workflow template.
*/
private List<WorkflowTaskTemplateListModel> tasks; private List<WorkflowTaskTemplateListModel> tasks;
public long getWorkflowId() { public long getWorkflowId() {
@ -96,11 +140,11 @@ public class SelectedWorkflowTemplateModel {
this.unusedDescriptionLocales this.unusedDescriptionLocales
= new ArrayList<>(unusedDescriptionLocales); = new ArrayList<>(unusedDescriptionLocales);
} }
public boolean getHasUnusedNameLocales() { public boolean getHasUnusedNameLocales() {
return !unusedNameLocales.isEmpty(); return !unusedNameLocales.isEmpty();
} }
public boolean getHasUnusedDescriptionLocales() { public boolean getHasUnusedDescriptionLocales() {
return !unusedDescriptionLocales.isEmpty(); return !unusedDescriptionLocales.isEmpty();
} }
@ -113,5 +157,4 @@ public class SelectedWorkflowTemplateModel {
this.displayName = displayName; this.displayName = displayName;
} }
} }

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
@ -13,15 +26,29 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
/** /**
* Checks permissions on content types.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@RequestScoped @RequestScoped
public class TypePermissionsChecker { public class TypePermissionsChecker {
/**
* {@link PermissionChecker} instance used for performing the permission
* check.
*/
@Inject @Inject
private PermissionChecker permissionChecker; private PermissionChecker permissionChecker;
/**
* Checks if the current user is permitted to use the provided
* {@link ContentType}.
*
* @param type The content type.
*
* @return {@code true} if the current user is permitted to use the provided
* {@code type}, {@code false} otherwise.
*/
public boolean canUseType(final ContentType type) { public boolean canUseType(final ContentType type) {
return permissionChecker.isPermitted( return permissionChecker.isPermitted(
TypePrivileges.USE_TYPE, type TypePrivileges.USE_TYPE, type

View File

@ -1,30 +1,60 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import java.util.ArrayList; import org.libreccm.l10n.GlobalizationHelper;
import java.util.Collections; import org.libreccm.workflow.Task;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* Model for an item in the list tasks of a workflows template.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class WorkflowTaskTemplateListModel { public class WorkflowTaskTemplateListModel {
/**
* The ID of the task.
*/
private long taskId; private long taskId;
/**
* The UUID of the task.
*/
private String uuid; private String uuid;
/**
* The label of the task. This value determined from {@link Task#label}
* using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String label; private String label;
/**
* The description of the task. This value determined from
* {@link Task#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }.
*/
private String description; private String description;
/**
* Does the task have any dependencies?
*/
private boolean hasDependencies; private boolean hasDependencies;
public long getTaskId() { public long getTaskId() {
@ -66,7 +96,5 @@ public class WorkflowTaskTemplateListModel {
public void setHasDependencies(final boolean hasDependencies) { public void setHasDependencies(final boolean hasDependencies) {
this.hasDependencies = hasDependencies; this.hasDependencies = hasDependencies;
} }
} }

View File

@ -1,24 +1,61 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contentsections; package org.librecms.ui.contentsections;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.workflow.Workflow;
/** /**
* Model for displaying data about a {@link Workflow} template in the view for
* managing the workflow templates of a content section.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
public class WorkflowTemplateListModel { public class WorkflowTemplateListModel {
/**
* The ID of the workflow template.
*/
private long workflowId; private long workflowId;
/**
* The UUID of the workflow template.
*/
private String uuid; private String uuid;
/**
* The name of the workflow template. This value is determined from
* {@link Workflow#name} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }
*/
private String name; private String name;
/**
* The description of the workflow template. This value is determined from
* {@link Workflow#description} using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString)
* }
*/
private String description; private String description;
/**
* Does the workflow template have any task templates?
*/
private boolean hasTasks; private boolean hasTasks;
public long getWorkflowId() { public long getWorkflowId() {

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contenttypes; package org.librecms.ui.contenttypes;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contenttypes; package org.librecms.ui.contenttypes;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contenttypes; package org.librecms.ui.contenttypes;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contenttypes; package org.librecms.ui.contenttypes;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.librecms.ui.contenttypes; package org.librecms.ui.contenttypes;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package com.arsdigita.ui.admin.applications; package com.arsdigita.ui.admin.applications;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.libreccm.categorization; package org.libreccm.categorization;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.libreccm.core.api; package org.libreccm.core.api;

View File

@ -1,7 +1,20 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (C) 2021 LibreCCM Foundation.
* To change this template file, choose Tools | Templates *
* and open the template in the editor. * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/ */
package org.libreccm.formbuilder.actions; package org.libreccm.formbuilder.actions;

Some files were not shown because too many files have changed in this diff Show More