Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2021-2024 FlowCentral Technologies Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.flowcentraltech.flowcentral.studio.web.writers;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.flowcentraltech.flowcentral.application.business.AppletUtilities;
import com.flowcentraltech.flowcentral.application.data.AppletDef;
import com.flowcentraltech.flowcentral.application.util.ApplicationNameUtils;
import com.flowcentraltech.flowcentral.application.web.widgets.AbstractMenuWidget;
import com.flowcentraltech.flowcentral.common.business.CodeGenerationProvider;
import com.flowcentraltech.flowcentral.studio.business.StudioModuleService;
import com.flowcentraltech.flowcentral.studio.constants.StudioAppComponentType;
import com.flowcentraltech.flowcentral.studio.constants.StudioSessionAttributeConstants;
import com.flowcentraltech.flowcentral.studio.web.widgets.StudioMenuWidget;
import com.tcdng.unify.core.UnifyException;
import com.tcdng.unify.core.annotation.Component;
import com.tcdng.unify.core.annotation.Configurable;
import com.tcdng.unify.core.annotation.Writes;
import com.tcdng.unify.core.util.StringUtils;
import com.tcdng.unify.core.util.json.JsonWriter;
import com.tcdng.unify.web.ui.widget.EventHandler;
import com.tcdng.unify.web.ui.widget.ResponseWriter;
import com.tcdng.unify.web.ui.widget.Widget;
import com.tcdng.unify.web.ui.widget.WriteWork;
import com.tcdng.unify.web.ui.widget.writer.AbstractPanelWriter;
/**
* Studio menu writer.
*
* @author FlowCentral Technologies Limited
* @since 1.0
*/
@Writes(StudioMenuWidget.class)
@Component("fc-studiomenu-writer")
public class StudioMenuWriter extends AbstractPanelWriter {
private static final String ORIGINAL_MENU_PATHID = "originalStudio.menu.pathID";
@Configurable
private StudioModuleService studioModuleService;
@Configurable
private AppletUtilities appletUtilities;
@Configurable
private CodeGenerationProvider codeGenerationProvider;
private static final List applicationAppletList = Collections.unmodifiableList(
Arrays.asList("studio.stuManageModule", "studio.manageApplication", "studio.applicationReplication"));
private static final List synchronizationAppletList = Collections
.unmodifiableList(Arrays.asList("studio.delegateCreateSynchronization", "studio.delegateSynchronization"));
private static final List snapshotAppletList = Collections
.unmodifiableList(Arrays.asList("codegeneration.manageSnapshotSettings", "studio.takeSnapshot",
"studio.uploadSnapshot", "studio.snapshots"));
private static final List utilMenuCategoryList = Collections.unmodifiableList(Arrays.asList(
StudioAppComponentType.CODEGENERATION, StudioAppComponentType.SYNCHRONIZATION,
StudioAppComponentType.SNAPSHOT, StudioAppComponentType.APPLICATION));
private static final List collabUtilMenuCategoryList = Collections
.unmodifiableList(Arrays.asList(StudioAppComponentType.COLLABORATION, StudioAppComponentType.CODEGENERATION,
StudioAppComponentType.SYNCHRONIZATION, StudioAppComponentType.SNAPSHOT,
StudioAppComponentType.APPLICATION));
private static final List menuCategoryList = Collections.unmodifiableList(Arrays.asList(
StudioAppComponentType.ENTITY, StudioAppComponentType.REFERENCE, StudioAppComponentType.ENUMERATION,
StudioAppComponentType.WIDGET, StudioAppComponentType.APPLET, StudioAppComponentType.TABLE,
StudioAppComponentType.FORM, StudioAppComponentType.REPORT_CONFIGURATION,
StudioAppComponentType.NOTIFICATION_TEMPLATE, StudioAppComponentType.NOTIFICATION_LARGETEXT,
StudioAppComponentType.WORKFLOW, StudioAppComponentType.CHART_DATASOURCE, StudioAppComponentType.CHART,
StudioAppComponentType.DASHBOARD, StudioAppComponentType.HELP_SHEET));
@Override
protected void doWriteStructureAndContent(ResponseWriter writer, Widget widget) throws UnifyException {
final StudioMenuWidget studioMenuWidget = (StudioMenuWidget) widget;
final boolean searchable = studioMenuWidget.isSearchable();
final String applicationName = (String) getSessionAttribute(
StudioSessionAttributeConstants.CURRENT_APPLICATION_NAME);
final boolean application = !StringUtils.isBlank(applicationName);
writer.write("
");
JsonWriter cjw = new JsonWriter();
cjw.beginArray();
final String categoryId = studioMenuWidget.getCategoryId();
final int catLen = selMenuCategoryList.size();
for (int i = 0; i < catLen; i++) {
final StudioAppComponentType category = selMenuCategoryList.get(i);
writer.write("