Para Desenvolvedores

Exemplo de administração com dois source dados com relacionamento pai-filho

Resolvido

Varias soluções requer cadastro de um conteúdo pai do tipo X e depois abaixo de cada conteúdo do tipo X cadastrar um outro lista de dados do tipo Y.

Tem um exemplo de como estrutura meu servicedefinition.xml e douidefinition.xml que posso usar como base para esses tipos de serviços?

Por Kishnan Nedungadi

Em 01/04/19 19:43

Acompanhar pergunta

1 resposta(s):

Ordenar por:

Nesse exemplo tem um conteúdo pai chamado "Badge Categoria" que é tipo content.  Para cada Badge Categoria tem um cadastro de "Badge".

servicedefinition.xml

<?xml version="1.0" encoding="UTF-8"?>
<serviceDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.lumis.com.br/lumisportal/xsd/servicedefinition.xsd">
  <service name="STR_SERVICE_NAME" type="lum_content">
  	<description>STR_SERVICE_DESCRIPTION</description>
  </service>
  
  <interfaces>
  	
  	<!-- administration de badge categoria -->
  	<interface name="STR_BADGE_CATEGORY_ADMINISTRATION" id="administrationBadgeCategory" type="lum_contentAdministrationList" />
	<interface name="STR_BADGE_CATEGORY_ADD" id="addAdministrationBadgeCategory" type="lum_contentAdministrationAddPropertyPage" />
	<interface name="STR_BADGE_CATEGORY_EDIT" id="editAdministrationBadgeCategory" type="lum_contentAdministrationEditPropertyPage" />
	
  	<!-- administration de badge -->
  	<interface name="STR_BADGE_ADMINISTRATION" id="administrationBadge" type="lum_douiAdministrationList">
  		<isRuntimeOnly>true</isRuntimeOnly>
  		<automaticAdministration>false</automaticAdministration>
  	</interface>
	<interface name="STR_BADGE_ADD" id="addAdministrationBadge" type="lum_douiAdministrationAddPropertyPage" />
	<interface name="STR_BADGE_EDIT" id="editAdministrationBadge" type="lum_douiAdministrationEditPropertyPage" />
	
  </interfaces>
</serviceDefinition>

douidefinition.xml

<?xml version="1.0" encoding="UTF-8"?>
<doui:douiDefinition xmlns:doui="http://www.lumis.com.br/lumisportal/xsd/doui" xmlns:control="http://www.lumis.com.br/douicontrols">
	<service>
	
		<sources>
			<source id="badgecategory" type="contentTable">
				<table>lgm_BadgeCategory</table>
				<fields>
					<field id="id" name="STR_ID" dataType="guid" isPrimaryKey="true" />
					<field id="name" name="STR_NAME" dataType="string" isPrimaryName="true" />
					<field id="image" name="STR_IMAGE" dataType="media" isIntroductionImage="true"/>
					<field id="description" name="STR_DESCRIPTION" dataType="text" isIntroduction="true"/>
					<field id="position" name="STR_POSITION" dataType="integer" isPosition="true" />
				</fields>
				<metaData>
					<workflow />
					<comments/>
					<lock/>
					<multiLanguage/>
					<versioning/>
					<publishStartDate/>
					<publishEndDate/>
				</metaData>
			</source>

			<source id="badge" type="table">
				<table>lgm_Badge</table>
				<fields>
					<field id="id" name="STR_ID" dataType="guid" isPrimaryKey="true" />
					<field id="badgeCategoryContentId" dataType="guid">
						<defaultInputControl>
							<control:lum_inputHidden />
						</defaultInputControl>
					</field>
					<field id="name" name="STR_NAME" dataType="string" isPrimaryName="true" />
					<field id="image" name="STR_IMAGE" dataType="media" isIntroductionImage="true"/>
					<field id="description" name="STR_DESCRIPTION" dataType="text" isIntroduction="true"/>
					<field id="usersegment" name="STR_SEGMENTO" dataType="guid" />
					<field id="priority" name="STR_PRIORITY" dataType="integer" isPosition="true" />
				</fields>
				<relations>
					<relation id="badgecategory">
						<relationField fieldId="badgeCategoryContentId" foreignFieldId="contentId"/>
					</relation>
				</relations>
			</source>
		</sources>
		
	</service>
	
	<interfaces>
		<interface id="administrationBadgeCategory">
			<controls>
				<control:lum_form>
					<control:lum_interfaceHeader />
					<control:lum_autoAdminListButtons>
				 		<additionalButtons>
						 	<control:lum_editButton text="STR_BADGES" interfaceId="administrationBadge" parameterId="badgeCategoryId"/>
				 		</additionalButtons>
					</control:lum_autoAdminListButtons>
					<control:lum_adminList />
				</control:lum_form>
			</controls>
		</interface>
		
		<interface id="administrationBadge">
			<sources>
				<source id="badge">
					<filters>
						<filter id="badgeCategoryContentId" hidden="true" required="true" />
					</filters>
				</source>
				<source id="badgecategory">
					<filters>
						<filter id="id" hidden="true" required="true" requestParameterName="badgeCategoryId" />
					</filters>
				</source>
			</sources>
			<controls>
				<control:lum_form>
					<control:lum_interfaceHeader />
					<!-- filter loads the badge category source -->
					<control:lum_filters id="filterBadgeCategory" sourceId="badgecategory" />
					<!-- input hidden to filter badges by category content id -->
					<control:lum_inputHidden id="contentId" sourceId="badgecategory">
						<setSourceParameter sourceId="badge" parameterName="badgeCategoryContentId" />
					</control:lum_inputHidden>
					<control:lum_autoAdminListButtons>
						<replaceButtons>
							<control:lum_addButton  id="addButton" interfaceId="addAdministrationBadge" isPrimary="true">
								<onClick type="popupRunTimeInterface" keepParentActive="false">
									<interfaceId>addAdministrationBadge</interfaceId>
									<addParameters>
										<parameter name="badgeCategoryContentId">
											<value type="getValue" controlId="contentId" />
										</parameter>
									</addParameters>
								</onClick>
							</control:lum_addButton>
						</replaceButtons>
						<additionalButtons>
							<control:lum_cancelButton text="STR_ADMINISTRAR_CATEGORIAS" />
						</additionalButtons>
					</control:lum_autoAdminListButtons>
					<control:lum_adminList />
				</control:lum_form>
			</controls>
		</interface>
		
		<interface id="addAdministrationBadge">
			<sources>
				<source id="badge" />
			</sources>
		</interface>
		
		<interface id="editAdministrationBadge">
			<sources>
				<source id="badge" />
			</sources>
		</interface>
		
	</interfaces>
</doui:douiDefinition>

Em anexo tem o modulo completo que possui somente esse serviço.

Por Kishnan Nedungadi

Em 01/04/19 19:47

Entrar

Interaja com a comunidade e tenha acesso a conteúdos exclusivos.

Houve algum erro ao acessar o banco de dados. Tente novamente mais tarde.