Boolean isAdmin = false;
if (paramId != null)
{
id = Integer.parseInt(paramId);
}
Project grant = getApplicationService().get(Project.class, id);
Context context = UIUtil.obtainContext(request);
if (!AuthorizeManager.isAdmin(context))
{
throw new AuthorizeException("Only system admin can edit");
}
else
{
isAdmin = true;
}
Integer areaId;
if (paramTabId == null)
{
if (paramFuzzyTabId == null)
{
List<EditTabProject> tabs = getApplicationService()
.getTabsByVisibility(EditTabProject.class, isAdmin);
if (tabs.isEmpty())
{
throw new AuthorizeException("No tabs defined!!");
}
areaId = tabs.get(0).getId();
}
else
{
EditTabProject fuzzyEditTab = (EditTabProject) ((ApplicationService) getApplicationService())
.<BoxProject, TabProject, EditTabProject>getEditTabByDisplayTab(
Integer.parseInt(paramFuzzyTabId),
EditTabProject.class);
areaId = fuzzyEditTab.getId();
}
}
else
{
areaId = Integer.parseInt(paramTabId);
}
EditTabProject editT = getApplicationService().get(
EditTabProject.class, areaId);
List<BoxProject> propertyHolders = new LinkedList<BoxProject>();
if (editT.getDisplayTab() != null)
{
for (BoxProject box : editT.getDisplayTab().getMask())
{
propertyHolders.add(box);
}
}
else
{
propertyHolders = getApplicationService().findPropertyHolderInTab(
getClazzTab(), areaId);
}
List<IContainable> tipProprietaInArea = new LinkedList<IContainable>();
for (BoxProject iph : propertyHolders)
{
if (editT.getDisplayTab() != null)
{
tipProprietaInArea
.addAll(getApplicationService()
.<BoxProject, it.cilea.osd.jdyna.web.Tab<BoxProject>> findContainableInPropertyHolder(
BoxProject.class, iph.getId()));
}
else
{
tipProprietaInArea
.addAll(getApplicationService()
.<BoxProject, it.cilea.osd.jdyna.web.Tab<BoxProject>> findContainableInPropertyHolder(
getClazzBox(), iph.getId()));
}
}
ProjectAdditionalFieldStorage dynamicObject = grant.getDynamicField();
ProjectAnagraficaObjectDTO anagraficaObjectDTO = new ProjectAnagraficaObjectDTO(
grant);
anagraficaObjectDTO.setTabId(areaId);
anagraficaObjectDTO.setObjectId(grant.getId());
anagraficaObjectDTO.setParentId(grant.getId());
List<ProjectPropertiesDefinition> realTPS = new LinkedList<ProjectPropertiesDefinition>();
List<IContainable> structuralField = new LinkedList<IContainable>();
for (IContainable c : tipProprietaInArea)
{