- Neues Asset und Tab für GenericOrganizationalUnit (und damit SciInstitute,
SciDepartment und SciProject) mit dem zusätzliche Text-Tabs erzeugt werden können. Die verfügbaren Text-Bezeichner müssen konfiguriert werden. - Dazu war eine kleine Änderung im Interface GenericOrgaUnitTab notwendig, und damit eine Anpassung aller Implementierungen des Interfaces. Der Key für den Tab wird jetzt an die Klasse übergeben. - Einige Formatierungen und gegänzte Override-Annotionen in einigen Klassen. git-svn-id: https://svn.libreccm.org/ccm/trunk@2372 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
8f32e2fa15
commit
66c17cbddd
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
|
name="ccm-cms-assets-orgaunittext"
|
||||||
|
prettyName="LibreCCM GenericOrganizationalUnit Additional Text Asset"
|
||||||
|
version="6.6.0"
|
||||||
|
release="1"
|
||||||
|
webapp="ROOT">
|
||||||
|
<ccm:dependencies>
|
||||||
|
<ccm:requires name="ccm-core" version="6.6.6" relation="ge"/>
|
||||||
|
<ccm:requires name="ccm-cms" version="6.6.10" relation="ge"/>
|
||||||
|
</ccm:dependencies>
|
||||||
|
<ccm:directories>
|
||||||
|
<ccm:directory name="pdl"/>
|
||||||
|
<ccm:directory name="sql"/>
|
||||||
|
<ccm:directory name="src"/>
|
||||||
|
</ccm:directories>
|
||||||
|
<ccm:contacts>
|
||||||
|
<ccm:contact uri="http://www.libreccm.org" type="website"/>
|
||||||
|
<ccm:contact uri="mailto:help@libreccm.org" type="support"/>
|
||||||
|
</ccm:contacts>
|
||||||
|
<ccm:description>
|
||||||
|
An asset for assigning additional texts to an GenericOrganizationalUnit (displayed as
|
||||||
|
additional tabs)
|
||||||
|
</ccm:description>
|
||||||
|
</ccm:application>
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 2013 Jens Pelzetter
|
||||||
|
//
|
||||||
|
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
|
||||||
|
model com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
//import com.arsdigita.auditing.BasicAuditTrail;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
|
||||||
|
object type GenericOrgaUnitTextAsset extends ACSObject {
|
||||||
|
String[1..1] textAssetName = ca_genericorgaunit_textasset.text_asset_name VARCHAR(100);
|
||||||
|
String[0..1] content = ca_genericorgaunit_textasset.content CLOB;
|
||||||
|
|
||||||
|
reference key(ca_genericorgaunit_textasset.textasset_id);
|
||||||
|
|
||||||
|
// Basic Auditing info
|
||||||
|
//unversioned BasicAuditTrail[0..1] auditing =
|
||||||
|
// qualias { filter(all(com.arsdigita.auditing.BasicAuditTrail),
|
||||||
|
// id == this.id) };
|
||||||
|
//aggressive load(auditing.id,
|
||||||
|
// auditing.creationDate,
|
||||||
|
// auditing.creationIP,
|
||||||
|
// auditing.lastModifiedDate,
|
||||||
|
// auditing.lastModifiedIP);
|
||||||
|
}
|
||||||
|
|
||||||
|
association {
|
||||||
|
composite GenericOrganizationalUnit[1..1] orgaunit = join ca_genericorgaunit_textasset.orgaunit_id
|
||||||
|
to cms_organizationalunits.organizationalunit_id;
|
||||||
|
|
||||||
|
component GenericOrgaUnitTextAsset[0..n] textassets = join cms_organizationalunits.organizationalunit_id
|
||||||
|
to ca_genericorgaunit_textasset.orgaunit_id;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
@@ ddl/oracle-se/create.sql
|
||||||
|
@@ ddl/oracle-se/deferred.sql
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
begin;
|
||||||
|
\i ddl/postgres/create.sql
|
||||||
|
\i ddl/postgres/deferred.sql
|
||||||
|
commit;
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<xrd:adapters
|
||||||
|
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||||
|
|
||||||
|
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||||
|
<xrd:adapter objectType="com.arsdigita.cms.contentassets.GenericOrgaUnitTextAsset">
|
||||||
|
|
||||||
|
<xrd:attributes rule="include">
|
||||||
|
<xrd:property name="/object/textAssetName"/>
|
||||||
|
<xrd:property name="/object/content"/>
|
||||||
|
</xrd:attributes>
|
||||||
|
|
||||||
|
</xrd:adapter>
|
||||||
|
</xrd:context>
|
||||||
|
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<registry>
|
||||||
|
<config class="com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetConfig"
|
||||||
|
storage="ccm-cms-assets/orgaunit_textasset.properties"/>
|
||||||
|
</registry>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<load>
|
||||||
|
<requires>
|
||||||
|
<table name="inits"/>
|
||||||
|
<table name="acs_objects"/>
|
||||||
|
<table name="cms_items"/>
|
||||||
|
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||||
|
</requires>
|
||||||
|
<provides>0
|
||||||
|
<table name="ca_genericorgaunit_textasset"/>
|
||||||
|
<initializer class="com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetInitializer"/>
|
||||||
|
</provides>
|
||||||
|
<scripts>
|
||||||
|
<schema directory="ccm-cms-assets-orgaunittext"/>
|
||||||
|
<data class="com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetLoader"/>
|
||||||
|
</scripts>
|
||||||
|
</load>
|
||||||
|
|
@ -0,0 +1,163 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.auditing.AuditingObserver;
|
||||||
|
import com.arsdigita.auditing.BasicAuditTrail;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.domain.DomainObjectInstantiator;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.kernel.User;
|
||||||
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class GenericOrgaUnitTextAsset extends ACSObject {
|
||||||
|
|
||||||
|
public static final String BASE_DATA_OBJECT_TYPE
|
||||||
|
= "com.arsdigita.cms.contentassets.GenericOrgaUnitTextAsset";
|
||||||
|
|
||||||
|
// static {
|
||||||
|
// DomainObjectFactory.registerInstantiator(
|
||||||
|
// BASE_DATA_OBJECT_TYPE,
|
||||||
|
// new DomainObjectInstantiator() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public DomainObjectInstantiator resolveInstantiator(final DataObject dataObject) {
|
||||||
|
// return this;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// protected DomainObject doNewInstance(final DataObject dataObject) {
|
||||||
|
// return new GenericOrgaUnitTextAsset(dataObject);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static final String TEXT_ASSET_NAME = "textAssetName";
|
||||||
|
public static final String CONTENT = "content";
|
||||||
|
public static final String ORGAUNIT = "orgaunit";
|
||||||
|
public static final String TEXT_ASSETS = "textAssets";
|
||||||
|
// public static final String AUDIT = "auditing";
|
||||||
|
// public static final String CREATION_DATE = AUDIT + "." + BasicAuditTrail.CREATION_DATE;
|
||||||
|
// private BasicAuditTrail auditTrail;
|
||||||
|
// private boolean isNew = false;
|
||||||
|
|
||||||
|
private GenericOrgaUnitTextAsset() {
|
||||||
|
super(BASE_DATA_OBJECT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericOrgaUnitTextAsset(final DataObject dataObject) {
|
||||||
|
super(dataObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GenericOrgaUnitTextAsset create(final GenericOrganizationalUnit orgaunit,
|
||||||
|
final String textAssetName) {
|
||||||
|
final GenericOrgaUnitTextAsset textAsset = new GenericOrgaUnitTextAsset();
|
||||||
|
textAsset.set(ORGAUNIT, orgaunit);
|
||||||
|
textAsset.set(TEXT_ASSET_NAME, textAssetName);
|
||||||
|
|
||||||
|
return textAsset;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// protected void initialize() {
|
||||||
|
// super.initialize();
|
||||||
|
|
||||||
|
// final DataObject dataObject = (DataObject) get(AUDIT);
|
||||||
|
// if (dataObject == null) {
|
||||||
|
// auditTrail = BasicAuditTrail.retrieveForACSObject(this);
|
||||||
|
// } else {
|
||||||
|
// auditTrail = new BasicAuditTrail(dataObject);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// addObserver(new AuditingObserver(auditTrail));
|
||||||
|
// }
|
||||||
|
|
||||||
|
public String getTextAssetName() {
|
||||||
|
return (String) get(TEXT_ASSET_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextAssetName(final String textAssetName) {
|
||||||
|
set(TEXT_ASSET_NAME, textAssetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return (String) get(CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(final String content) {
|
||||||
|
set(CONTENT, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericOrganizationalUnit getOwner() {
|
||||||
|
final DataObject dataObject = (DataObject) get(ORGAUNIT);
|
||||||
|
Assert.exists(dataObject, DataObject.class);
|
||||||
|
|
||||||
|
return (GenericOrganizationalUnit) DomainObjectFactory.newInstance(dataObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public User getTextAssetAuthor() {
|
||||||
|
// return auditTrail.getCreationUser();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Date getCreationDate() {
|
||||||
|
// return auditTrail.getCreationDate();
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static DataCollection getTextAssets(final GenericOrganizationalUnit orgaunit) {
|
||||||
|
Assert.exists(orgaunit, GenericOrganizationalUnit.class);
|
||||||
|
|
||||||
|
final DataCollection textAssets = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
||||||
|
textAssets.addEqualsFilter(ORGAUNIT, orgaunit.getID());
|
||||||
|
|
||||||
|
return textAssets;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// protected void beforeSave() {
|
||||||
|
// super.beforeSave();
|
||||||
|
//
|
||||||
|
// if (isNew()) {
|
||||||
|
// isNew = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// protected void afterSave() {
|
||||||
|
// super.afterSave();
|
||||||
|
//
|
||||||
|
// if (isNew) {
|
||||||
|
// PermissionService.setContext(this, getOwner());
|
||||||
|
// isNew = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
|
import com.arsdigita.util.parameter.IntegerParameter;
|
||||||
|
import com.arsdigita.util.parameter.Parameter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class GenericOrgaUnitTextAssetConfig extends AbstractConfig {
|
||||||
|
|
||||||
|
private static GenericOrgaUnitTextAssetConfig INSTANCE;
|
||||||
|
|
||||||
|
private final Parameter assetStepSortKey = new IntegerParameter(
|
||||||
|
"com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
5);
|
||||||
|
|
||||||
|
public GenericOrgaUnitTextAssetConfig() {
|
||||||
|
|
||||||
|
super();
|
||||||
|
|
||||||
|
register(assetStepSortKey);
|
||||||
|
|
||||||
|
loadInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final GenericOrgaUnitTextAssetConfig getInstance() {
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
INSTANCE = new GenericOrgaUnitTextAssetConfig();
|
||||||
|
INSTANCE.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAssetStepSortKey() {
|
||||||
|
return (Integer) get(assetStepSortKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey.title = Sort key for the generic organizational unit text asset step
|
||||||
|
com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey.purpose = Sort key for the generic organizational unit text asset step
|
||||||
|
com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey.example = 5
|
||||||
|
com.arsdigita.cms.contentassets.orgaunit_textasset.asset_step_sortkey.format = [Integer]
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class GenericOrgaUnitTextAssetGlobalizationUtil {
|
||||||
|
|
||||||
|
public static final String BUNDLE_NAME
|
||||||
|
= "com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetResources";
|
||||||
|
|
||||||
|
public static GlobalizedMessage globalize(String key) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GlobalizedMessage globalize(String key, Object[] args) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.contentassets.ui.GenericOrgaUnitTextAssetStep;
|
||||||
|
import com.arsdigita.cms.contenttypes.ContentAssetInitializer;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||||
|
import com.arsdigita.domain.DomainObjectTraversal;
|
||||||
|
import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class GenericOrgaUnitTextAssetInitializer extends ContentAssetInitializer {
|
||||||
|
|
||||||
|
public GenericOrgaUnitTextAssetInitializer() {
|
||||||
|
super("ccm-cms-assets-orgaunittext.pdl.mf");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final DomainInitEvent event) {
|
||||||
|
super.init(event);
|
||||||
|
|
||||||
|
DomainObjectTraversal.registerAdapter(GenericOrgaUnitTextAsset.BASE_DATA_OBJECT_TYPE,
|
||||||
|
new SimpleDomainObjectTraversalAdapter(),
|
||||||
|
SimpleXMLGenerator.ADAPTER_CONTEXT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBaseType() {
|
||||||
|
return GenericOrganizationalUnit.BASE_DATA_OBJECT_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTraversalXML() {
|
||||||
|
return TRAVERSAL_ADAPTER_BASE_DIR + "GenericOrgaUnitTextAsset.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProperty() {
|
||||||
|
return GenericOrgaUnitTextAsset.TEXT_ASSETS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class getAuthoringStep() {
|
||||||
|
return GenericOrgaUnitTextAssetStep.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GlobalizedMessage getAuthoringStepLabel() {
|
||||||
|
return new GlobalizedMessage(
|
||||||
|
"com.arsdigita.cms.contentassets.orgaunit_textasset_step_label",
|
||||||
|
"com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetResources");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GlobalizedMessage getAuthoringStepDescription() {
|
||||||
|
return new GlobalizedMessage(
|
||||||
|
"com.arsdigita.cms.contentassets.orgaunit_textasset_step_description",
|
||||||
|
"com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetResources");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAuthoringStepSortKey() {
|
||||||
|
return GenericOrgaUnitTextAssetConfig.getInstance().getAssetStepSortKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.ScriptContext;
|
||||||
|
import com.arsdigita.loader.PackageLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class GenericOrgaUnitTextAssetLoader extends PackageLoader {
|
||||||
|
|
||||||
|
public void run(final ScriptContext ctx) {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
# To change this license header, choose License Headers in Project Properties.
|
||||||
|
# To change this template file, choose Tools | Templates
|
||||||
|
# and open the template in the editor.
|
||||||
|
|
||||||
|
com.arsdigita.cms.contentassets.orgaunit_textasset_step_label=Further texts
|
||||||
|
com.arsdigita.cms.contentassets.orgaunit_textasset_step_description=Add more texts here
|
||||||
|
cms.orgaunit.textassets.empty=No texts
|
||||||
|
cms.orgaunit.textasset.edit=Edit
|
||||||
|
cms.orgaunit.textasset.text_asset_name.label=Label
|
||||||
|
cms.orgaunit.textasset.content.label=Text
|
||||||
|
cms.orgaunit.textasset.name=Label
|
||||||
|
cms.orgaunit.textasset.add=Add text
|
||||||
|
cms.orgaunit.textasset.delete=Remove
|
||||||
|
cms.orgaunit.textasset.delete.confirm=Are you sure to delete this text?
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
# To change this license header, choose License Headers in Project Properties.
|
||||||
|
# To change this template file, choose Tools | Templates
|
||||||
|
# and open the template in the editor.
|
||||||
|
|
||||||
|
com.arsdigita.cms.contentassets.orgaunit_textasset_step_label=Weitere Texte
|
||||||
|
com.arsdigita.cms.contentassets.orgaunit_textasset_step_description=Weitere Texte hier hinzuf\u00fcgen
|
||||||
|
cms.orgaunit.textassets.empty=Keine Texte
|
||||||
|
cms.orgaunit.textasset.edit=Bearbeiten
|
||||||
|
cms.orgaunit.textasset.text_asset_name.label=Bezeichnung
|
||||||
|
cms.orgaunit.textasset.content.label=Text
|
||||||
|
cms.orgaunit.textasset.name=Bezeichnung
|
||||||
|
cms.orgaunit.textasset.add=Text hinzuf\u00fcgen
|
||||||
|
cms.orgaunit.textasset.delete=L\u00f6schen
|
||||||
|
cms.orgaunit.textasset.delete.confirm=Sind Sie sicher, dass Sie diesen Text l\u00f6schen wollen?
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||||
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
|
import com.arsdigita.bebop.form.DHTMLEditor;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
|
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.RelationAttribute;
|
||||||
|
import com.arsdigita.cms.RelationAttributeCollection;
|
||||||
|
import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAsset;
|
||||||
|
import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
import java.util.TooManyListenersException;
|
||||||
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class GenericOrgaUnitTextAssetEdit extends BasicItemForm implements FormSubmissionListener {
|
||||||
|
|
||||||
|
private final static String TEXT_ASSET_NAME = "textAssetName";
|
||||||
|
private final static String CONTENT = "content";
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
private final ACSObjectSelectionModel selectionModel;
|
||||||
|
|
||||||
|
public GenericOrgaUnitTextAssetEdit(final ItemSelectionModel itemModel,
|
||||||
|
final ACSObjectSelectionModel selectionModel) {
|
||||||
|
super("GenericOrgaUnitTextAssetEditForm", itemModel);
|
||||||
|
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
this.selectionModel = selectionModel;
|
||||||
|
addSubmissionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize(
|
||||||
|
"cms.orgaunit.textasset.text_asset_name.label")));
|
||||||
|
final SingleSelect nameSelect = new SingleSelect(TEXT_ASSET_NAME);
|
||||||
|
nameSelect.addOption(new Option("", ""));
|
||||||
|
try {
|
||||||
|
nameSelect.addPrintListener(new PrintListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prepare(final PrintEvent event) {
|
||||||
|
final SingleSelect target = (SingleSelect) event.getTarget();
|
||||||
|
|
||||||
|
final RelationAttributeCollection names = new RelationAttributeCollection(
|
||||||
|
"GenericOrgaUnitTextAssetName");
|
||||||
|
names.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage());
|
||||||
|
while (names.next()) {
|
||||||
|
target.addOption(new Option(names.getKey(), names.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
} catch (TooManyListenersException ex) {
|
||||||
|
throw new UncheckedWrapperException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
nameSelect.addValidationListener(new NotEmptyValidationListener());
|
||||||
|
add(nameSelect);
|
||||||
|
|
||||||
|
add(new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize(
|
||||||
|
"cms.orgaunit.textasset.content.label")));
|
||||||
|
final DHTMLEditor contentEditor = new DHTMLEditor(
|
||||||
|
new StringParameter(CONTENT), ContentSection.getConfig().getDHTMLEditorConfig());
|
||||||
|
contentEditor.setRows(40);
|
||||||
|
add(contentEditor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
if (selectionModel.getSelectedObject(state) != null) {
|
||||||
|
final GenericOrgaUnitTextAsset textAsset = (GenericOrgaUnitTextAsset) selectionModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
|
data.put(TEXT_ASSET_NAME, textAsset.getTextAssetName());
|
||||||
|
data.put(CONTENT, textAsset.getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final GenericOrgaUnitTextAsset textAsset;
|
||||||
|
if (selectionModel.getSelectedObject(state) == null) {
|
||||||
|
final GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
textAsset = GenericOrgaUnitTextAsset.create(orgaunit, data.getString(TEXT_ASSET_NAME));
|
||||||
|
} else {
|
||||||
|
textAsset = (GenericOrgaUnitTextAsset) selectionModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
selectionModel.clearSelection(state);
|
||||||
|
|
||||||
|
textAsset.setTextAssetName(data.getString(TEXT_ASSET_NAME));
|
||||||
|
}
|
||||||
|
|
||||||
|
textAsset.setContent(data.getString(CONTENT));
|
||||||
|
|
||||||
|
textAsset.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitted(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
if (getSaveCancelSection().getCancelButton().isSelected(state)) {
|
||||||
|
selectionModel.clearSelection(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class GenericOrgaUnitTextAssetStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
private ACSObjectSelectionModel selectionModel;
|
||||||
|
private BigDecimalParameter textAssetParam;
|
||||||
|
|
||||||
|
private static final String EDIT = "edit";
|
||||||
|
|
||||||
|
public GenericOrgaUnitTextAssetStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericOrgaUnitTextAssetStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
textAssetParam = new BigDecimalParameter("textAsset");
|
||||||
|
selectionModel = new ACSObjectSelectionModel(textAssetParam);
|
||||||
|
|
||||||
|
final GenericOrgaUnitTextAssetTable table = new GenericOrgaUnitTextAssetTable(
|
||||||
|
this, selectionModel, itemModel);
|
||||||
|
setDisplayComponent(table);
|
||||||
|
|
||||||
|
final GenericOrgaUnitTextAssetEdit edit = new GenericOrgaUnitTextAssetEdit(itemModel,
|
||||||
|
selectionModel);
|
||||||
|
add(EDIT,
|
||||||
|
GenericOrgaUnitTextAssetGlobalizationUtil.globalize("cms.orgaunit.textasset.add"),
|
||||||
|
new WorkflowLockedComponentAccess(edit, itemModel),
|
||||||
|
edit.getSaveCancelSection().getCancelButton());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(final Page page) {
|
||||||
|
super.register(page);
|
||||||
|
|
||||||
|
page.addComponentStateParam(this, textAssetParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setEditVisible(final PageState state) {
|
||||||
|
showComponent(state, EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,282 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.RelationAttribute;
|
||||||
|
import com.arsdigita.cms.RelationAttributeCollection;
|
||||||
|
import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAsset;
|
||||||
|
import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAssetGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
|
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class GenericOrgaUnitTextAssetTable extends Table {
|
||||||
|
|
||||||
|
private final static String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final static String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private final GenericOrgaUnitTextAssetStep parent;
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
private final ACSObjectSelectionModel selectionModel;
|
||||||
|
|
||||||
|
public GenericOrgaUnitTextAssetTable(final GenericOrgaUnitTextAssetStep parent,
|
||||||
|
final ACSObjectSelectionModel selectionModel,
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
|
|
||||||
|
super();
|
||||||
|
this.parent = parent;
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
this.selectionModel = selectionModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize(
|
||||||
|
"cms.orgaunit.textassets.empty")));
|
||||||
|
|
||||||
|
final TableColumnModel colModel = getColumnModel();
|
||||||
|
colModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize(
|
||||||
|
"cms.orgaunit.textasset.name"))));
|
||||||
|
colModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize(
|
||||||
|
"cms.orgaunit.textasset.edit")),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
colModel.add(new TableColumn(
|
||||||
|
2,
|
||||||
|
new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize(
|
||||||
|
"cms.orgaunit.textasset.delete")),
|
||||||
|
TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new ModelBuilder(itemModel));
|
||||||
|
|
||||||
|
colModel.get(1).setCellRenderer(new EditCellRenderer());
|
||||||
|
colModel.get(2).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(new ActionListener());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ModelBuilder extends LockableImpl implements TableModelBuilder {
|
||||||
|
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public ModelBuilder(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
final GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
return new AssetsTableModel(table, state, orgaunit);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AssetsTableModel implements TableModel {
|
||||||
|
|
||||||
|
private final Table table;
|
||||||
|
private final DataCollection textAssets;
|
||||||
|
private GenericOrgaUnitTextAsset textAsset;
|
||||||
|
|
||||||
|
public AssetsTableModel(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final GenericOrganizationalUnit orgaunit) {
|
||||||
|
this.table = table;
|
||||||
|
|
||||||
|
textAssets = GenericOrgaUnitTextAsset.getTextAssets(orgaunit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if ((textAssets != null) && textAssets.next()) {
|
||||||
|
textAsset = new GenericOrgaUnitTextAsset(textAssets.getDataObject());
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getElementAt(final int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
final RelationAttributeCollection names = new RelationAttributeCollection(
|
||||||
|
"GenericOrgaUnitTextAssetName");
|
||||||
|
names.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage());
|
||||||
|
names.addKeyFilter(textAsset.getTextAssetName());
|
||||||
|
final String label;
|
||||||
|
if (names.next()) {
|
||||||
|
label = names.getName();
|
||||||
|
names.close();
|
||||||
|
} else {
|
||||||
|
label = textAsset.getTextAssetName();
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
case 1:
|
||||||
|
return new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize(
|
||||||
|
"cms.orgaunit.textasset.edit"));
|
||||||
|
case 2:
|
||||||
|
return new Label(GenericOrgaUnitTextAssetGlobalizationUtil.globalize(
|
||||||
|
"cms.orgaunit.textasset.delete"));
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getKeyAt(final int columnIndex) {
|
||||||
|
return textAsset.getID();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
public EditCellRenderer() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(), com.arsdigita.cms.SecurityManager.EDIT_ITEM, orgaunit);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
return new ControlLink((Label) value);
|
||||||
|
} else {
|
||||||
|
return (Label) value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
public DeleteCellRenderer() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(), com.arsdigita.cms.SecurityManager.EDIT_ITEM, orgaunit);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
final ControlLink link = new ControlLink((Label) value);
|
||||||
|
link.setConfirmation(GenericOrgaUnitTextAssetGlobalizationUtil.globalize(
|
||||||
|
"cms.orgaunit.textasset.delete.confirm"));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
return (Label) value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ActionListener implements TableActionListener {
|
||||||
|
|
||||||
|
public ActionListener() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final DataObject dataObject = SessionManager.getSession().retrieve(new OID(
|
||||||
|
GenericOrgaUnitTextAsset.BASE_DATA_OBJECT_TYPE,
|
||||||
|
new BigDecimal(event.getRowKey().toString())));
|
||||||
|
final GenericOrgaUnitTextAsset textAsset = new GenericOrgaUnitTextAsset(dataObject);
|
||||||
|
|
||||||
|
final GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
final TableColumn col = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(col.getHeaderKey().toString())) {
|
||||||
|
selectionModel.setSelectedObject(state, textAsset);
|
||||||
|
parent.setEditVisible(state);
|
||||||
|
} else if (TABLE_COL_DEL.equals(col.getHeaderKey().toString())) {
|
||||||
|
textAsset.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.cms.contentassets.GenericOrgaUnitTextAsset;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.GenericOrgaUnitTab;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A tab for {@link GenericOrgaunizationalUnit}s which displays additional texts. Can be used more
|
||||||
|
* than once in the configuration for the tabs, which different keys. The key is used to find the
|
||||||
|
* correct text to display.
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class GenericOrgaUnitTextTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
|
final PageState state) {
|
||||||
|
final DataCollection texts = GenericOrgaUnitTextAsset.getTextAssets(orgaunit);
|
||||||
|
texts.addEqualsFilter(GenericOrgaUnitTextAsset.TEXT_ASSET_NAME, key);
|
||||||
|
final boolean empty = texts.isEmpty();
|
||||||
|
texts.close();
|
||||||
|
return !empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateXml(GenericOrganizationalUnit orgaunit,
|
||||||
|
Element parent,
|
||||||
|
PageState state) {
|
||||||
|
final DataCollection texts = GenericOrgaUnitTextAsset.getTextAssets(orgaunit);
|
||||||
|
texts.addEqualsFilter(GenericOrgaUnitTextAsset.TEXT_ASSET_NAME, key);
|
||||||
|
if (texts.isEmpty()) {
|
||||||
|
parent.newChildElement("noText");
|
||||||
|
} else {
|
||||||
|
texts.next();
|
||||||
|
final GenericOrgaUnitTextAsset text = new GenericOrgaUnitTextAsset(texts.getDataObject());
|
||||||
|
final Element textElem = parent.newChildElement("text");
|
||||||
|
textElem.addAttribute("key", key);
|
||||||
|
textElem.setText(text.getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
texts.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,18 @@ import com.arsdigita.xml.Element;
|
||||||
*/
|
*/
|
||||||
public class GenericOrgaUnitContactsTab implements GenericOrgaUnitTab {
|
public class GenericOrgaUnitContactsTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ public abstract class GenericOrgaUnitExtraXmlGenerator
|
||||||
final String tabName = tokens[0];
|
final String tabName = tokens[0];
|
||||||
final String tabClassName = tokens[1];
|
final String tabClassName = tokens[1];
|
||||||
final GenericOrgaUnitTab tab = createTabInstance(tabClassName);
|
final GenericOrgaUnitTab tab = createTabInstance(tabClassName);
|
||||||
|
tab.setKey(tabName);
|
||||||
tabs.put(tabName, tab);
|
tabs.put(tabName, tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,17 @@ public abstract class GenericOrgaUnitMembersTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final static Logger logger =
|
private final static Logger logger =
|
||||||
Logger.getLogger(GenericOrgaUnitMembersTab.class);
|
Logger.getLogger(GenericOrgaUnitMembersTab.class);
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
|
|
@ -39,6 +50,7 @@ public abstract class GenericOrgaUnitMembersTab implements GenericOrgaUnitTab {
|
||||||
return !orgaunit.getPersons().isEmpty();
|
return !orgaunit.getPersons().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,19 @@ import org.apache.log4j.Logger;
|
||||||
public abstract class GenericOrgaUnitSubordinateTab
|
public abstract class GenericOrgaUnitSubordinateTab
|
||||||
implements GenericOrgaUnitTab {
|
implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final static Logger logger =
|
private final static Logger logger = Logger.getLogger(
|
||||||
Logger.getLogger(
|
|
||||||
GenericOrgaUnitSubordinateTab.class);
|
GenericOrgaUnitSubordinateTab.class);
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
|
|
@ -31,18 +41,16 @@ public abstract class GenericOrgaUnitSubordinateTab
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
final GenericOrganizationalUnitSubordinateCollection subOrgaUnits =
|
final GenericOrganizationalUnitSubordinateCollection subOrgaUnits = getData(orgaunit,
|
||||||
getData(orgaunit,
|
|
||||||
state);
|
state);
|
||||||
|
|
||||||
processFilters(subOrgaUnits, state);
|
processFilters(subOrgaUnits, state);
|
||||||
|
|
||||||
final Element subOrgaUnitsElem =
|
final Element subOrgaUnitsElem = parent.newChildElement(getXmlElementName());
|
||||||
parent.newChildElement(getXmlElementName());
|
|
||||||
|
|
||||||
if (getPageSize() != 0) {
|
if (getPageSize() != 0) {
|
||||||
final GenericOrgaUnitPaginator<GenericOrganizationalUnitSubordinateCollection> paginator =
|
final GenericOrgaUnitPaginator<GenericOrganizationalUnitSubordinateCollection> paginator
|
||||||
new GenericOrgaUnitPaginator<GenericOrganizationalUnitSubordinateCollection>(
|
= new GenericOrgaUnitPaginator<GenericOrganizationalUnitSubordinateCollection>(
|
||||||
subOrgaUnits, state, getPageSize());
|
subOrgaUnits, state, getPageSize());
|
||||||
paginator.setRange(subOrgaUnits);
|
paginator.setRange(subOrgaUnits);
|
||||||
paginator.generateXml(subOrgaUnitsElem);
|
paginator.generateXml(subOrgaUnitsElem);
|
||||||
|
|
@ -78,8 +86,8 @@ public abstract class GenericOrgaUnitSubordinateTab
|
||||||
|
|
||||||
protected GenericOrganizationalUnitSubordinateCollection getData(
|
protected GenericOrganizationalUnitSubordinateCollection getData(
|
||||||
final GenericOrganizationalUnit orgaunit) {
|
final GenericOrganizationalUnit orgaunit) {
|
||||||
final GenericOrganizationalUnitSubordinateCollection subOrgaUnits =
|
final GenericOrganizationalUnitSubordinateCollection subOrgaUnits = orgaunit.
|
||||||
orgaunit.getSubordinateOrgaUnits();
|
getSubordinateOrgaUnits();
|
||||||
subOrgaUnits.addFilter(
|
subOrgaUnits.addFilter(
|
||||||
String.format("%s = '%s'",
|
String.format("%s = '%s'",
|
||||||
GenericOrganizationalUnitSubordinateCollection.LINK_ASSOCTYPE,
|
GenericOrganizationalUnitSubordinateCollection.LINK_ASSOCTYPE,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,19 @@ import com.arsdigita.xml.Element;
|
||||||
*/
|
*/
|
||||||
public interface GenericOrgaUnitTab {
|
public interface GenericOrgaUnitTab {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @returns The key identifing this tab.
|
||||||
|
*/
|
||||||
|
String getKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the key which identifies the tab.
|
||||||
|
*
|
||||||
|
*@param key
|
||||||
|
*/
|
||||||
|
void setKey(String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param orgaunit
|
* @param orgaunit
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,8 @@ public class LibrarySignaturesAddForm extends BasicItemForm {
|
||||||
private final ItemSelectionModel itemModel;
|
private final ItemSelectionModel itemModel;
|
||||||
private final ACSObjectSelectionModel signatureModel;
|
private final ACSObjectSelectionModel signatureModel;
|
||||||
|
|
||||||
public LibrarySignaturesAddForm(final ItemSelectionModel itemModel, final ACSObjectSelectionModel signatureModel) {
|
public LibrarySignaturesAddForm(final ItemSelectionModel itemModel,
|
||||||
|
final ACSObjectSelectionModel signatureModel) {
|
||||||
super("LibrarySignaturesAddForm", itemModel);
|
super("LibrarySignaturesAddForm", itemModel);
|
||||||
|
|
||||||
this.itemModel = itemModel;
|
this.itemModel = itemModel;
|
||||||
|
|
@ -55,26 +56,34 @@ public class LibrarySignaturesAddForm extends BasicItemForm {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.library")));
|
add(new Label(LibrarySignaturesGlobalizationUtil.globalize(
|
||||||
|
"scipublications.librarysignatures.form.library")));
|
||||||
final TextField library = new TextField(LIBRARY);
|
final TextField library = new TextField(LIBRARY);
|
||||||
library.addValidationListener(new NotNullValidationListener(LibrarySignaturesGlobalizationUtil.globalize(
|
library.addValidationListener(new NotNullValidationListener(
|
||||||
|
LibrarySignaturesGlobalizationUtil.globalize(
|
||||||
"scipublications.librarysignatures.form.library.not_null")));
|
"scipublications.librarysignatures.form.library.not_null")));
|
||||||
library.addValidationListener(new NotEmptyValidationListener(LibrarySignaturesGlobalizationUtil.globalize(
|
library.addValidationListener(new NotEmptyValidationListener(
|
||||||
|
LibrarySignaturesGlobalizationUtil.globalize(
|
||||||
"scipublications.librarysignatures.form.library.not_empty")));
|
"scipublications.librarysignatures.form.library.not_empty")));
|
||||||
add(library);
|
add(library);
|
||||||
|
|
||||||
add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.signature")));
|
add(new Label(LibrarySignaturesGlobalizationUtil.globalize(
|
||||||
|
"scipublications.librarysignatures.form.signature")));
|
||||||
final TextField signature = new TextField(SIGNATURE);
|
final TextField signature = new TextField(SIGNATURE);
|
||||||
signature.addValidationListener(new NotNullValidationListener(LibrarySignaturesGlobalizationUtil.globalize(
|
signature.addValidationListener(new NotNullValidationListener(
|
||||||
|
LibrarySignaturesGlobalizationUtil.globalize(
|
||||||
"scipublications.librarysignatures.form.signature.not_null")));
|
"scipublications.librarysignatures.form.signature.not_null")));
|
||||||
library.addValidationListener(new NotEmptyValidationListener(LibrarySignaturesGlobalizationUtil.globalize(
|
library.addValidationListener(new NotEmptyValidationListener(
|
||||||
|
LibrarySignaturesGlobalizationUtil.globalize(
|
||||||
"scipublications.librarysignatures.form.signature.not_empty")));
|
"scipublications.librarysignatures.form.signature.not_empty")));
|
||||||
add(signature);
|
add(signature);
|
||||||
|
|
||||||
add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.link")));
|
add(new Label(LibrarySignaturesGlobalizationUtil.globalize(
|
||||||
|
"scipublications.librarysignatures.form.link")));
|
||||||
add(new TextField(LINK));
|
add(new TextField(LINK));
|
||||||
|
|
||||||
add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.misc")));
|
add(new Label(LibrarySignaturesGlobalizationUtil.globalize(
|
||||||
|
"scipublications.librarysignatures.form.misc")));
|
||||||
add(new TextField(MISC));
|
add(new TextField(MISC));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,7 +92,8 @@ public class LibrarySignaturesAddForm extends BasicItemForm {
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
if (signatureModel.getSelectedObject(state) != null) {
|
if (signatureModel.getSelectedObject(state) != null) {
|
||||||
final LibrarySignature signature = (LibrarySignature) signatureModel.getSelectedObject(state);
|
final LibrarySignature signature = (LibrarySignature) signatureModel.getSelectedObject(
|
||||||
|
state);
|
||||||
final FormData data = event.getFormData();
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
data.put(LIBRARY, signature.getLibrary());
|
data.put(LIBRARY, signature.getLibrary());
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class LibrarySignaturesStep extends SimpleEditStep {
|
||||||
|
|
||||||
public LibrarySignaturesStep(final ItemSelectionModel itemModel,
|
public LibrarySignaturesStep(final ItemSelectionModel itemModel,
|
||||||
final AuthoringKitWizard parent,
|
final AuthoringKitWizard parent,
|
||||||
final String prefix ) {
|
final String prefix) {
|
||||||
|
|
||||||
super(itemModel, parent, prefix);
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
|
@ -61,7 +61,8 @@ public class LibrarySignaturesStep extends SimpleEditStep {
|
||||||
new WorkflowLockedComponentAccess(addForm, itemModel),
|
new WorkflowLockedComponentAccess(addForm, itemModel),
|
||||||
addForm.getSaveCancelSection().getCancelButton());
|
addForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
final LibrarySignaturesTable table = new LibrarySignaturesTable(itemModel, signatureModel, this);
|
final LibrarySignaturesTable table = new LibrarySignaturesTable(itemModel, signatureModel,
|
||||||
|
this);
|
||||||
setDisplayComponent(table);
|
setDisplayComponent(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,5 +55,5 @@ com.arsdigita.cms.contenttypes.sciproject.permitted_person_type.format = [String
|
||||||
|
|
||||||
com.arsdigita.cms.contenttypes.sciproject.tabs.title = Tabs for SciDepartment detail view
|
com.arsdigita.cms.contenttypes.sciproject.tabs.title = Tabs for SciDepartment detail view
|
||||||
com.arsdigita.cms.contenttypes.sciproject.tabs.purpose = Defines which tabs are shown in the detail view of a SciDepartment
|
com.arsdigita.cms.contenttypes.sciproject.tabs.purpose = Defines which tabs are shown in the detail view of a SciDepartment
|
||||||
com.arsdigita.cms.contenttypes.sciproject.tabs.example = summary:coma.arsdigita.cms.contenttypes.ui.SciDepartmentSummaryTab;members:SciDepartmentMembersTab
|
com.arsdigita.cms.contenttypes.sciproject.tabs.example = summary:com.arsdigita.cms.contenttypes.ui.SciDepartmentSummaryTab;members:com.arsdigita.cms.contenttypes.ui.SciDepartmentMembersTab
|
||||||
com.arsdigita.cms.contenttypes.sciproject.tabs.format = [String]
|
com.arsdigita.cms.contenttypes.sciproject.tabs.format = [String]
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,17 @@ import org.apache.log4j.Logger;
|
||||||
public class SciDepartmentDescTab implements GenericOrgaUnitTab {
|
public class SciDepartmentDescTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
public final Logger logger = Logger.getLogger(SciDepartmentDescTab.class);
|
public final Logger logger = Logger.getLogger(SciDepartmentDescTab.class);
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,8 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final Logger logger =
|
private final Logger logger = Logger.getLogger(SciDepartmentMembersTab.class);
|
||||||
Logger.getLogger(SciDepartmentMembersTab.class);
|
private static final SciDepartmentMembersTabConfig config = new SciDepartmentMembersTabConfig();
|
||||||
private static final SciDepartmentMembersTabConfig config =
|
|
||||||
new SciDepartmentMembersTabConfig();
|
|
||||||
private static final String STATUS_PARAM = "memberStatus";
|
private static final String STATUS_PARAM = "memberStatus";
|
||||||
private static final String SURNAME_PARAM = "memberSurname";
|
private static final String SURNAME_PARAM = "memberSurname";
|
||||||
private final CompareFilter statusFilter = new CompareFilter(
|
private final CompareFilter statusFilter = new CompareFilter(
|
||||||
|
|
@ -44,9 +42,9 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false);
|
false);
|
||||||
private final TextFilter surnameFilter =
|
private final TextFilter surnameFilter = new TextFilter(SURNAME_PARAM,
|
||||||
new TextFilter(SURNAME_PARAM,
|
|
||||||
GenericPerson.SURNAME);
|
GenericPerson.SURNAME);
|
||||||
|
private String key;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
|
|
@ -61,6 +59,16 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
@ -157,6 +165,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class MembersData {
|
protected class MembersData {
|
||||||
|
|
||||||
private final DataCollection members;
|
private final DataCollection members;
|
||||||
private final Map<String, String> membersRoles;
|
private final Map<String, String> membersRoles;
|
||||||
private final Map<String, String> membersStatus;
|
private final Map<String, String> membersStatus;
|
||||||
|
|
@ -180,6 +189,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
||||||
public Map<String, String> getMembersStatus() {
|
public Map<String, String> getMembersStatus() {
|
||||||
return Collections.unmodifiableMap(membersStatus);
|
return Collections.unmodifiableMap(membersStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MembersData getData(final GenericOrganizationalUnit orgaunit,
|
protected MembersData getData(final GenericOrganizationalUnit orgaunit,
|
||||||
|
|
@ -198,8 +208,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
||||||
final List<String> orgaUnitIds = new ArrayList<String>();
|
final List<String> orgaUnitIds = new ArrayList<String>();
|
||||||
|
|
||||||
if (config.isMergingMembers()) {
|
if (config.isMergingMembers()) {
|
||||||
final DataQuery subDepartmentsQuery =
|
final DataQuery subDepartmentsQuery = SessionManager.getSession().retrieveQuery(
|
||||||
SessionManager.getSession().retrieveQuery(
|
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||||
subDepartmentsQuery.setParameter("orgaunitId",
|
subDepartmentsQuery.setParameter("orgaunitId",
|
||||||
orgaunit.getContentBundle().getID().toString());
|
orgaunit.getContentBundle().getID().toString());
|
||||||
|
|
@ -285,7 +294,6 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
||||||
// System.currentTimeMillis() - start));
|
// System.currentTimeMillis() - start));
|
||||||
// generateMemberXml(member, parent, state);
|
// generateMemberXml(member, parent, state);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
protected void generateMemberXml(final GenericPerson member,
|
protected void generateMemberXml(final GenericPerson member,
|
||||||
final String role,
|
final String role,
|
||||||
final String status,
|
final String status,
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final Logger logger = Logger.getLogger(
|
private final Logger logger = Logger.getLogger(
|
||||||
SciDepartmentProjectsTab.class);
|
SciDepartmentProjectsTab.class);
|
||||||
private static final SciDepartmentProjectsTabConfig config =
|
private static final SciDepartmentProjectsTabConfig config
|
||||||
new SciDepartmentProjectsTabConfig();
|
= new SciDepartmentProjectsTabConfig();
|
||||||
private static final String STATUS_PARAM = "projectStatus";
|
private static final String STATUS_PARAM = "projectStatus";
|
||||||
private static final String TITLE_PARAM = "projectTitle";
|
private static final String TITLE_PARAM = "projectTitle";
|
||||||
private final CompareFilter statusFilter = new CompareFilter(STATUS_PARAM,
|
private final CompareFilter statusFilter = new CompareFilter(STATUS_PARAM,
|
||||||
|
|
@ -51,6 +51,7 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
||||||
true);
|
true);
|
||||||
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
||||||
ContentPage.TITLE);
|
ContentPage.TITLE);
|
||||||
|
private String key;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
|
|
@ -73,6 +74,16 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
@ -206,8 +217,7 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
||||||
final List<String> orgaunitIds = new ArrayList<String>();
|
final List<String> orgaunitIds = new ArrayList<String>();
|
||||||
|
|
||||||
if (config.isMergingProjects()) {
|
if (config.isMergingProjects()) {
|
||||||
final DataQuery subDepartmentsQuery =
|
final DataQuery subDepartmentsQuery = SessionManager.getSession().retrieveQuery(
|
||||||
SessionManager.getSession().retrieveQuery(
|
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||||
subDepartmentsQuery.setParameter("orgaunitId",
|
subDepartmentsQuery.setParameter("orgaunitId",
|
||||||
orgaunit.getContentBundle().getID().toString());
|
orgaunit.getContentBundle().getID().toString());
|
||||||
|
|
@ -242,14 +252,20 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
||||||
if (Kernel.getConfig().languageIndependentItems()) {
|
if (Kernel.getConfig().languageIndependentItems()) {
|
||||||
final FilterFactory filterFactory = projectsQuery.getFilterFactory();
|
final FilterFactory filterFactory = projectsQuery.getFilterFactory();
|
||||||
final Filter filter = filterFactory.or().
|
final Filter filter = filterFactory.or().
|
||||||
addFilter(filterFactory.equals("language", GlobalizationHelper.getNegotiatedLocale().getLanguage())).
|
addFilter(filterFactory.equals("language", GlobalizationHelper.
|
||||||
|
getNegotiatedLocale().getLanguage())).
|
||||||
addFilter(filterFactory.and().
|
addFilter(filterFactory.and().
|
||||||
addFilter(filterFactory.equals("language", GlobalizationHelper.LANG_INDEPENDENT)).
|
addFilter(filterFactory.equals("language",
|
||||||
addFilter(filterFactory.notIn("parent", "com.arsdigita.navigation.getParentIDsOfMatchedItems").set(
|
GlobalizationHelper.LANG_INDEPENDENT)).
|
||||||
"language", GlobalizationHelper.getNegotiatedLocale().getLanguage())));
|
addFilter(filterFactory.notIn("parent",
|
||||||
|
"com.arsdigita.navigation.getParentIDsOfMatchedItems").
|
||||||
|
set(
|
||||||
|
"language", GlobalizationHelper.getNegotiatedLocale().
|
||||||
|
getLanguage())));
|
||||||
projectsQuery.addFilter(filter);
|
projectsQuery.addFilter(filter);
|
||||||
} else {
|
} else {
|
||||||
projectsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().getLanguage());
|
projectsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().
|
||||||
|
getLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(String.format(
|
logger.debug(String.format(
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final Logger logger = Logger.getLogger(
|
private final Logger logger = Logger.getLogger(
|
||||||
SciDepartmentPublicationsTab.class);
|
SciDepartmentPublicationsTab.class);
|
||||||
private static final SciDepartmentPublicationsTabConfig config =
|
private static final SciDepartmentPublicationsTabConfig config
|
||||||
new SciDepartmentPublicationsTabConfig();
|
= new SciDepartmentPublicationsTabConfig();
|
||||||
private static final String YEAR_PARAM = "yearOfPublication";
|
private static final String YEAR_PARAM = "yearOfPublication";
|
||||||
private static final String TITLE_PARAM = "title";
|
private static final String TITLE_PARAM = "title";
|
||||||
private static final String AUTHOR_PARAM = "author";
|
private static final String AUTHOR_PARAM = "author";
|
||||||
|
|
@ -52,6 +52,7 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab {
|
||||||
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
||||||
ContentPage.TITLE);
|
ContentPage.TITLE);
|
||||||
private final TextFilter authorFilter;
|
private final TextFilter authorFilter;
|
||||||
|
private String key;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
|
|
@ -63,6 +64,17 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab {
|
||||||
authorFilter = new TextFilter(AUTHOR_PARAM, "authorsStr");
|
authorFilter = new TextFilter(AUTHOR_PARAM, "authorsStr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
|
|
@ -87,6 +99,7 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
@ -202,13 +215,12 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
final DataQuery publicationBundlesQuery;
|
final DataQuery publicationBundlesQuery;
|
||||||
|
|
||||||
publicationBundlesQuery =
|
publicationBundlesQuery = SessionManager.getSession().retrieveQuery(
|
||||||
SessionManager.getSession().retrieveQuery("com.arsdigita.cms.contenttypes.getIdsOfPublicationsForOrgaUnit");
|
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsForOrgaUnit");
|
||||||
final List<String> orgaunitIds = new ArrayList<String>();
|
final List<String> orgaunitIds = new ArrayList<String>();
|
||||||
|
|
||||||
if (config.isMergingPublications()) {
|
if (config.isMergingPublications()) {
|
||||||
final DataQuery subDepartmentsQuery =
|
final DataQuery subDepartmentsQuery = SessionManager.getSession().retrieveQuery(
|
||||||
SessionManager.getSession().retrieveQuery(
|
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||||
subDepartmentsQuery.setParameter("orgaunitId",
|
subDepartmentsQuery.setParameter("orgaunitId",
|
||||||
orgaunit.getContentBundle().getID().toString());
|
orgaunit.getContentBundle().getID().toString());
|
||||||
|
|
@ -243,14 +255,20 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab {
|
||||||
if (Kernel.getConfig().languageIndependentItems()) {
|
if (Kernel.getConfig().languageIndependentItems()) {
|
||||||
final FilterFactory filterFactory = publicationsQuery.getFilterFactory();
|
final FilterFactory filterFactory = publicationsQuery.getFilterFactory();
|
||||||
final Filter filter = filterFactory.or().
|
final Filter filter = filterFactory.or().
|
||||||
addFilter(filterFactory.equals("language", GlobalizationHelper.getNegotiatedLocale().getLanguage())).
|
addFilter(filterFactory.equals("language", GlobalizationHelper.
|
||||||
|
getNegotiatedLocale().getLanguage())).
|
||||||
addFilter(filterFactory.and().
|
addFilter(filterFactory.and().
|
||||||
addFilter(filterFactory.equals("language", GlobalizationHelper.LANG_INDEPENDENT)).
|
addFilter(filterFactory.equals("language",
|
||||||
addFilter(filterFactory.notIn("parent", "com.arsdigita.navigation.getParentIDsOfMatchedItems").set(
|
GlobalizationHelper.LANG_INDEPENDENT)).
|
||||||
"language", GlobalizationHelper.getNegotiatedLocale().getLanguage())));
|
addFilter(filterFactory.notIn("parent",
|
||||||
|
"com.arsdigita.navigation.getParentIDsOfMatchedItems").
|
||||||
|
set(
|
||||||
|
"language", GlobalizationHelper.getNegotiatedLocale().
|
||||||
|
getLanguage())));
|
||||||
publicationsQuery.addFilter(filter);
|
publicationsQuery.addFilter(filter);
|
||||||
} else {
|
} else {
|
||||||
publicationsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().getLanguage());
|
publicationsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().
|
||||||
|
getLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(String.format(
|
logger.debug(String.format(
|
||||||
|
|
@ -306,8 +324,8 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab {
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
final ContentPage publication =
|
final ContentPage publication = (ContentPage) DomainObjectFactory.newInstance(new OID(
|
||||||
(ContentPage) DomainObjectFactory.newInstance(new OID(objectType, publicationId));
|
objectType, publicationId));
|
||||||
logger.debug(String.format("Got domain object for publication '%s' "
|
logger.debug(String.format("Got domain object for publication '%s' "
|
||||||
+ "in %d ms.",
|
+ "in %d ms.",
|
||||||
publication.getName(),
|
publication.getName(),
|
||||||
|
|
|
||||||
|
|
@ -23,21 +23,32 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
|
public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final Logger logger =
|
private final Logger logger = Logger.getLogger(SciDepartmentSummaryTab.class);
|
||||||
Logger.getLogger(SciDepartmentSummaryTab.class);
|
private final static SciDepartmentSummaryTabConfig config = new SciDepartmentSummaryTabConfig();
|
||||||
private final static SciDepartmentSummaryTabConfig config =
|
private String key;
|
||||||
new SciDepartmentSummaryTabConfig();
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
//Some of the the data shown by this tab will ever be there
|
//Some of the the data shown by this tab will ever be there
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
@ -144,8 +155,7 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
|
|
||||||
final GenericOrganizationalUnitSubordinateCollection subDepartments =
|
final GenericOrganizationalUnitSubordinateCollection subDepartments = department.
|
||||||
department.
|
|
||||||
getSubordinateOrgaUnits();
|
getSubordinateOrgaUnits();
|
||||||
subDepartments.addFilter(
|
subDepartments.addFilter(
|
||||||
String.format("%s = '%s'",
|
String.format("%s = '%s'",
|
||||||
|
|
@ -265,8 +275,7 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getContactTypeName(final String contactTypeKey) {
|
private String getContactTypeName(final String contactTypeKey) {
|
||||||
final RelationAttributeCollection relAttrs =
|
final RelationAttributeCollection relAttrs = new RelationAttributeCollection();
|
||||||
new RelationAttributeCollection();
|
|
||||||
relAttrs.addFilter(String.format("attribute = '%s'",
|
relAttrs.addFilter(String.format("attribute = '%s'",
|
||||||
"GenericContactTypes"));
|
"GenericContactTypes"));
|
||||||
relAttrs.addFilter(String.format("attr_key = '%s'", contactTypeKey));
|
relAttrs.addFilter(String.format("attr_key = '%s'", contactTypeKey));
|
||||||
|
|
@ -297,5 +306,6 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
|
||||||
protected ContentItem getContentItem(final PageState state) {
|
protected ContentItem getContentItem(final PageState state) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,19 @@ import org.apache.log4j.Logger;
|
||||||
public class SciInstituteDescTab implements GenericOrgaUnitTab {
|
public class SciInstituteDescTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
public final Logger logger = Logger.getLogger(SciInstituteDescTab.class);
|
public final Logger logger = Logger.getLogger(SciInstituteDescTab.class);
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
|
|
@ -38,6 +50,7 @@ public class SciInstituteDescTab implements GenericOrgaUnitTab {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
@ -98,5 +111,6 @@ public class SciInstituteDescTab implements GenericOrgaUnitTab {
|
||||||
public void setDesc(final String desc) {
|
public void setDesc(final String desc) {
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,7 @@ import org.apache.log4j.Logger;
|
||||||
public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final Logger logger = Logger.getLogger(SciInstituteMembersTab.class);
|
private final Logger logger = Logger.getLogger(SciInstituteMembersTab.class);
|
||||||
private static final SciInstituteMembersTabConfig config =
|
private static final SciInstituteMembersTabConfig config = new SciInstituteMembersTabConfig();
|
||||||
new SciInstituteMembersTabConfig();
|
|
||||||
private static final String STATUS_PARAM = "memberStatus";
|
private static final String STATUS_PARAM = "memberStatus";
|
||||||
private static final String SURNAME_PARAM = "memberSurname";
|
private static final String SURNAME_PARAM = "memberSurname";
|
||||||
private final CompareFilter statusFilter = new CompareFilter(
|
private final CompareFilter statusFilter = new CompareFilter(
|
||||||
|
|
@ -58,6 +57,7 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
||||||
false,
|
false,
|
||||||
false);
|
false);
|
||||||
private final TextFilter surnameFilter = new TextFilter(SURNAME_PARAM, GenericPerson.SURNAME);
|
private final TextFilter surnameFilter = new TextFilter(SURNAME_PARAM, GenericPerson.SURNAME);
|
||||||
|
private String key;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
|
|
@ -72,6 +72,17 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
if ((orgaunit.getPersons() != null) && orgaunit.getPersons().size() > 0) {
|
if ((orgaunit.getPersons() != null) && orgaunit.getPersons().size() > 0) {
|
||||||
|
|
@ -84,6 +95,7 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
@ -154,8 +166,7 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
||||||
final List<String> orgaunitsIds = new ArrayList<String>();
|
final List<String> orgaunitsIds = new ArrayList<String>();
|
||||||
|
|
||||||
if (config.isMergingMembers()) {
|
if (config.isMergingMembers()) {
|
||||||
final DataQuery departmentsQuery =
|
final DataQuery departmentsQuery = SessionManager.getSession().retrieveQuery(
|
||||||
SessionManager.getSession().retrieveQuery(
|
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||||
departmentsQuery.setParameter("orgaunitId",
|
departmentsQuery.setParameter("orgaunitId",
|
||||||
orgaunit.getContentBundle().getID().toString());
|
orgaunit.getContentBundle().getID().toString());
|
||||||
|
|
@ -179,7 +190,8 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
||||||
}
|
}
|
||||||
filterBuilder.append(personBundlesQuery.get("memberId").toString());
|
filterBuilder.append(personBundlesQuery.get("memberId").toString());
|
||||||
}
|
}
|
||||||
final DataCollection membersQuery = SessionManager.getSession().retrieve(GenericPerson.BASE_DATA_OBJECT_TYPE);
|
final DataCollection membersQuery = SessionManager.getSession().retrieve(
|
||||||
|
GenericPerson.BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
||||||
if (filterBuilder.length() == 0) {
|
if (filterBuilder.length() == 0) {
|
||||||
//No members, return null to indicate
|
//No members, return null to indicate
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,8 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final Logger logger =
|
private final Logger logger = Logger.getLogger(SciInstituteProjectsTab.class);
|
||||||
Logger.getLogger(SciInstituteProjectsTab.class);
|
private final static SciInstituteProjectsTabConfig config = new SciInstituteProjectsTabConfig();
|
||||||
private final static SciInstituteProjectsTabConfig config =
|
|
||||||
new SciInstituteProjectsTabConfig();
|
|
||||||
private static final String STATUS_PARAM = "projectStatus";
|
private static final String STATUS_PARAM = "projectStatus";
|
||||||
private static final String TITLE_PARAM = "projectTitle";
|
private static final String TITLE_PARAM = "projectTitle";
|
||||||
private final CompareFilter statusFilter = new CompareFilter(STATUS_PARAM,
|
private final CompareFilter statusFilter = new CompareFilter(STATUS_PARAM,
|
||||||
|
|
@ -53,6 +51,7 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
||||||
true);
|
true);
|
||||||
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
||||||
ContentPage.TITLE);
|
ContentPage.TITLE);
|
||||||
|
private String key;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
|
|
@ -75,6 +74,17 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
|
|
@ -101,6 +111,7 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
@ -210,8 +221,7 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
||||||
final List<String> orgaunitIds = new ArrayList<String>();
|
final List<String> orgaunitIds = new ArrayList<String>();
|
||||||
|
|
||||||
if (config.isMergingProjects()) {
|
if (config.isMergingProjects()) {
|
||||||
final DataQuery subDepartmentsQuery =
|
final DataQuery subDepartmentsQuery = SessionManager.getSession().retrieveQuery(
|
||||||
SessionManager.getSession().retrieveQuery(
|
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||||
subDepartmentsQuery.setParameter("orgaunitId",
|
subDepartmentsQuery.setParameter("orgaunitId",
|
||||||
orgaunit.getContentBundle().getID().toString());
|
orgaunit.getContentBundle().getID().toString());
|
||||||
|
|
@ -246,14 +256,20 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
||||||
if (Kernel.getConfig().languageIndependentItems()) {
|
if (Kernel.getConfig().languageIndependentItems()) {
|
||||||
final FilterFactory filterFactory = projectsQuery.getFilterFactory();
|
final FilterFactory filterFactory = projectsQuery.getFilterFactory();
|
||||||
final Filter filter = filterFactory.or().
|
final Filter filter = filterFactory.or().
|
||||||
addFilter(filterFactory.equals("language", GlobalizationHelper.getNegotiatedLocale().getLanguage())).
|
addFilter(filterFactory.equals("language", GlobalizationHelper.
|
||||||
|
getNegotiatedLocale().getLanguage())).
|
||||||
addFilter(filterFactory.and().
|
addFilter(filterFactory.and().
|
||||||
addFilter(filterFactory.equals("language", GlobalizationHelper.LANG_INDEPENDENT)).
|
addFilter(filterFactory.equals("language",
|
||||||
addFilter(filterFactory.notIn("parent", "com.arsdigita.navigation.getParentIDsOfMatchedItems").set(
|
GlobalizationHelper.LANG_INDEPENDENT)).
|
||||||
"language", GlobalizationHelper.getNegotiatedLocale().getLanguage())));
|
addFilter(filterFactory.notIn("parent",
|
||||||
|
"com.arsdigita.navigation.getParentIDsOfMatchedItems").
|
||||||
|
set(
|
||||||
|
"language", GlobalizationHelper.getNegotiatedLocale().
|
||||||
|
getLanguage())));
|
||||||
projectsQuery.addFilter(filter);
|
projectsQuery.addFilter(filter);
|
||||||
} else {
|
} else {
|
||||||
projectsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().getLanguage());
|
projectsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().
|
||||||
|
getLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(String.format(
|
logger.debug(String.format(
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final Logger logger = Logger.getLogger(
|
private final Logger logger = Logger.getLogger(
|
||||||
SciInstitutePublicationsTab.class);
|
SciInstitutePublicationsTab.class);
|
||||||
private static final SciInstitutePublicationsTabConfig config =
|
private static final SciInstitutePublicationsTabConfig config
|
||||||
new SciInstitutePublicationsTabConfig();
|
= new SciInstitutePublicationsTabConfig();
|
||||||
private static final String YEAR_PARAM = "yearOfPublication";
|
private static final String YEAR_PARAM = "yearOfPublication";
|
||||||
private static final String TITLE_PARAM = "title";
|
private static final String TITLE_PARAM = "title";
|
||||||
private static final String AUTHOR_PARAM = "author";
|
private static final String AUTHOR_PARAM = "author";
|
||||||
|
|
@ -54,6 +54,7 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
||||||
private final TextFilter authorFilter;
|
private final TextFilter authorFilter;
|
||||||
private boolean excludeWorkingPapers = false;
|
private boolean excludeWorkingPapers = false;
|
||||||
private boolean onlyWorkingPapers = false;
|
private boolean onlyWorkingPapers = false;
|
||||||
|
private String key;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
|
|
@ -73,6 +74,17 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
||||||
this.onlyWorkingPapers = onlyWorkingPapers;
|
this.onlyWorkingPapers = onlyWorkingPapers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
|
|
@ -97,6 +109,7 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
@ -226,16 +239,14 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
||||||
orgaunit.getClass().getName()));
|
orgaunit.getClass().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final DataQuery publicationBundlesQuery;
|
final DataQuery publicationBundlesQuery;
|
||||||
publicationBundlesQuery =
|
publicationBundlesQuery = SessionManager.getSession().retrieveQuery(
|
||||||
SessionManager.getSession().retrieveQuery("com.arsdigita.cms.contenttypes.getIdsOfPublicationsForOrgaUnit");
|
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsForOrgaUnit");
|
||||||
|
|
||||||
final List<String> orgaunitIds = new ArrayList<String>();
|
final List<String> orgaunitIds = new ArrayList<String>();
|
||||||
|
|
||||||
if (config.isMergingPublications()) {
|
if (config.isMergingPublications()) {
|
||||||
final DataQuery departmentsQuery =
|
final DataQuery departmentsQuery = SessionManager.getSession().retrieveQuery(
|
||||||
SessionManager.getSession().retrieveQuery(
|
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||||
departmentsQuery.setParameter("orgaunitId",
|
departmentsQuery.setParameter("orgaunitId",
|
||||||
orgaunit.getContentBundle().getID().toString());
|
orgaunit.getContentBundle().getID().toString());
|
||||||
|
|
@ -270,14 +281,20 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
||||||
if (Kernel.getConfig().languageIndependentItems()) {
|
if (Kernel.getConfig().languageIndependentItems()) {
|
||||||
final FilterFactory filterFactory = publicationsQuery.getFilterFactory();
|
final FilterFactory filterFactory = publicationsQuery.getFilterFactory();
|
||||||
final Filter filter = filterFactory.or().
|
final Filter filter = filterFactory.or().
|
||||||
addFilter(filterFactory.equals("language", GlobalizationHelper.getNegotiatedLocale().getLanguage())).
|
addFilter(filterFactory.equals("language", GlobalizationHelper.
|
||||||
|
getNegotiatedLocale().getLanguage())).
|
||||||
addFilter(filterFactory.and().
|
addFilter(filterFactory.and().
|
||||||
addFilter(filterFactory.equals("language", GlobalizationHelper.LANG_INDEPENDENT)).
|
addFilter(filterFactory.equals("language",
|
||||||
addFilter(filterFactory.notIn("parent", "com.arsdigita.navigation.getParentIDsOfMatchedItems").set(
|
GlobalizationHelper.LANG_INDEPENDENT)).
|
||||||
"language", GlobalizationHelper.getNegotiatedLocale().getLanguage())));
|
addFilter(filterFactory.notIn("parent",
|
||||||
|
"com.arsdigita.navigation.getParentIDsOfMatchedItems").
|
||||||
|
set(
|
||||||
|
"language", GlobalizationHelper.getNegotiatedLocale().
|
||||||
|
getLanguage())));
|
||||||
publicationsQuery.addFilter(filter);
|
publicationsQuery.addFilter(filter);
|
||||||
} else {
|
} else {
|
||||||
publicationsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().getLanguage());
|
publicationsQuery.addEqualsFilter("language", GlobalizationHelper.getNegotiatedLocale().
|
||||||
|
getLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(String.format(
|
logger.debug(String.format(
|
||||||
|
|
@ -333,8 +350,8 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
final ContentPage publication =
|
final ContentPage publication = (ContentPage) DomainObjectFactory.newInstance(new OID(
|
||||||
(ContentPage) DomainObjectFactory.newInstance(new OID(objectType, publicationId));
|
objectType, publicationId));
|
||||||
logger.debug(String.format("Got domain object for publication '%s' "
|
logger.debug(String.format("Got domain object for publication '%s' "
|
||||||
+ "in %d ms.",
|
+ "in %d ms.",
|
||||||
publication.getName(),
|
publication.getName(),
|
||||||
|
|
|
||||||
|
|
@ -27,21 +27,32 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class SciInstituteSummaryTab implements GenericOrgaUnitTab {
|
public class SciInstituteSummaryTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
private final Logger logger =
|
private final Logger logger = Logger.getLogger(SciInstituteSummaryTab.class);
|
||||||
Logger.getLogger(SciInstituteSummaryTab.class);
|
private final static SciInstituteSummaryTabConfig config = new SciInstituteSummaryTabConfig();
|
||||||
private final static SciInstituteSummaryTabConfig config =
|
private String key;
|
||||||
new SciInstituteSummaryTabConfig();
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
//Some of the the data shown by this tab will ever be there
|
//Some of the the data shown by this tab will ever be there
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
@ -185,8 +196,10 @@ public class SciInstituteSummaryTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
public int compare(final GenericPerson person1,
|
public int compare(final GenericPerson person1,
|
||||||
final GenericPerson person2) {
|
final GenericPerson person2) {
|
||||||
final String name1 = String.format("%s %s", person1.getSurname(), person1.getGivenName());
|
final String name1 = String.format("%s %s", person1.getSurname(), person1.
|
||||||
final String name2 = String.format("%s %s", person2.getSurname(), person2.getGivenName());
|
getGivenName());
|
||||||
|
final String name2 = String.format("%s %s", person2.getSurname(), person2.
|
||||||
|
getGivenName());
|
||||||
return name1.compareTo(name2);
|
return name1.compareTo(name2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,8 +224,8 @@ public class SciInstituteSummaryTab implements GenericOrgaUnitTab {
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
|
|
||||||
final GenericOrganizationalUnitSubordinateCollection departments =
|
final GenericOrganizationalUnitSubordinateCollection departments = institute.
|
||||||
institute.getSubordinateOrgaUnits();
|
getSubordinateOrgaUnits();
|
||||||
departments.addFilter(
|
departments.addFilter(
|
||||||
String.format("%s = '%s'",
|
String.format("%s = '%s'",
|
||||||
GenericOrganizationalUnitSubordinateCollection.LINK_ASSOCTYPE,
|
GenericOrganizationalUnitSubordinateCollection.LINK_ASSOCTYPE,
|
||||||
|
|
@ -331,12 +344,12 @@ public class SciInstituteSummaryTab implements GenericOrgaUnitTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getContactTypeName(final String contactTypeKey) {
|
private String getContactTypeName(final String contactTypeKey) {
|
||||||
final RelationAttributeCollection relAttrs =
|
final RelationAttributeCollection relAttrs = new RelationAttributeCollection();
|
||||||
new RelationAttributeCollection();
|
|
||||||
relAttrs.addFilter(String.format("attribute = '%s'",
|
relAttrs.addFilter(String.format("attribute = '%s'",
|
||||||
"GenericContactTypes"));
|
"GenericContactTypes"));
|
||||||
relAttrs.addFilter(String.format("attr_key = '%s'", contactTypeKey));
|
relAttrs.addFilter(String.format("attr_key = '%s'", contactTypeKey));
|
||||||
relAttrs.addFilter(String.format("lang = '%s'", GlobalizationHelper.getNegotiatedLocale().getLanguage()));
|
relAttrs.addFilter(String.format("lang = '%s'", GlobalizationHelper.getNegotiatedLocale().
|
||||||
|
getLanguage()));
|
||||||
|
|
||||||
if (relAttrs.isEmpty()) {
|
if (relAttrs.isEmpty()) {
|
||||||
return contactTypeKey;
|
return contactTypeKey;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,17 @@ import org.apache.log4j.Logger;
|
||||||
public class SciProjectDescTab implements GenericOrgaUnitTab {
|
public class SciProjectDescTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
public final Logger logger = Logger.getLogger(SciProjectDescTab.class);
|
public final Logger logger = Logger.getLogger(SciProjectDescTab.class);
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
|
||||||
|
|
@ -35,17 +35,31 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
||||||
private final Logger logger = Logger.getLogger(SciProjectSummaryTab.class);
|
private final Logger logger = Logger.getLogger(SciProjectSummaryTab.class);
|
||||||
private final static SciProjectSummaryTabConfig config =
|
private final static SciProjectSummaryTabConfig config =
|
||||||
new SciProjectSummaryTabConfig();
|
new SciProjectSummaryTabConfig();
|
||||||
|
private String key;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKey(final String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
public boolean hasData(final GenericOrganizationalUnit orgaunit,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
//Some of the data shown by this tab will ever be there
|
//Some of the data shown by this tab will ever be there
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue