Added @author and @since for the class

This commit is contained in:
Silviu Dinuta
2016-04-14 15:24:30 +03:00
parent 0007fc3013
commit 0d52abc77e

View File

@@ -4,93 +4,99 @@
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* - * -
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* - * -
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* - * -
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* - * -
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.module.org_alfresco_module_rm.model.rma.type; package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService; import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.annotation.Behaviour; import org.alfresco.repo.policy.annotation.Behaviour;
import org.alfresco.repo.policy.annotation.BehaviourBean; import org.alfresco.repo.policy.annotation.BehaviourBean;
import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.repo.policy.annotation.BehaviourKind;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@BehaviourBean(defaultType = "rma:nonElectronicDocument") /**
public class NonElectronicRecordType extends BaseBehaviourBean implements NodeServicePolicies.OnUpdateNodePolicy * rma:nonElectronicDocument behaviour bean.
{ *
* @author silviudinuta
/** record service */ * @since 2.4
protected RecordService recordService; */
@BehaviourBean(defaultType = "rma:nonElectronicDocument")
/** public class NonElectronicRecordType extends BaseBehaviourBean implements NodeServicePolicies.OnUpdateNodePolicy
* @param recordService record service {
*/
public void setRecordService(RecordService recordService) /** record service */
{ protected RecordService recordService;
this.recordService = recordService;
} /**
* @param recordService record service
@Behaviour(kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.FIRST_EVENT) */
@Override public void setRecordService(RecordService recordService)
public void onUpdateNode(final NodeRef nodeRef) {
{ this.recordService = recordService;
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() }
{
@Override @Behaviour(kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.FIRST_EVENT)
public Void doWork() @Override
{ public void onUpdateNode(final NodeRef nodeRef)
final NodeRef child = nodeRef; {
if (nodeService.exists(child)) AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{ {
QName childType = nodeService.getType(child); @Override
NodeRef parentRef = nodeService.getPrimaryParent(child).getParentRef(); public Void doWork()
QName parentType = nodeService.getType(parentRef); {
boolean isContentSubType = dictionaryService.isSubClass(childType, ContentModel.TYPE_CONTENT); final NodeRef child = nodeRef;
boolean isUnfiledRecordContainer = parentType if (nodeService.exists(child))
.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); {
boolean isUnfiledRecordFolder = parentType QName childType = nodeService.getType(child);
.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); NodeRef parentRef = nodeService.getPrimaryParent(child).getParentRef();
if (isContentSubType && (isUnfiledRecordContainer || isUnfiledRecordFolder)) QName parentType = nodeService.getType(parentRef);
{ boolean isContentSubType = dictionaryService.isSubClass(childType, ContentModel.TYPE_CONTENT);
if (!nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT)) boolean isUnfiledRecordContainer = parentType
{ .equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER);
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); boolean isUnfiledRecordFolder = parentType
} .equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER);
if (!nodeService.hasAspect(child, ASPECT_RECORD)) if (isContentSubType && (isUnfiledRecordContainer || isUnfiledRecordFolder))
{ {
recordService.makeRecord(child); if (!nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT))
} {
} nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null);
} }
return null; if (!nodeService.hasAspect(child, ASPECT_RECORD))
} {
}); recordService.makeRecord(child);
} }
}
} }
return null;
}
});
}
}