Skip to content

Entity Web API generation #597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ${CLASS_NAME} extends ${EXTENDS} implements ${IMPLEMENTS_POST}, ${IMPLEMEN

/**
* @param Context $context
* @param DeleteByIdCommand $deleteByIdCommand
* @param ${DELETE_COMMAND} $deleteByIdCommand
*/
public function __construct(
${CONTEXT} $context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class DeleteEntityByIdCommandData {
private final String entityId;
private final String modelName;
private final String resourceModelName;
private final String aclResource;

/**
* Delete Command DTO Constructor.
Expand All @@ -23,19 +24,22 @@ public class DeleteEntityByIdCommandData {
* @param entityId String
* @param modelName String
* @param resourceModelName String
* @param aclResource String
*/
public DeleteEntityByIdCommandData(
final @NotNull String moduleName,
final @NotNull String entityName,
final @NotNull String entityId,
final @NotNull String modelName,
final @NotNull String resourceModelName
final @NotNull String resourceModelName,
final @NotNull String aclResource
) {
this.moduleName = moduleName;
this.entityName = entityName;
this.entityId = entityId;
this.modelName = modelName;
this.resourceModelName = resourceModelName;
this.aclResource = aclResource;
}

/**
Expand Down Expand Up @@ -82,4 +86,13 @@ public String getModelName() {
public String getResourceModelName() {
return resourceModelName;
}

/**
* Get ACL resource.
*
* @return String
*/
public String getAclResource() {
return aclResource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class DeleteEntityControllerFileData {
private final String moduleName;
private final String acl;
private final String entityId;
private final boolean hasDeleteCommandInterface;

/**
* Controller Delete file constructor.
Expand All @@ -21,17 +22,20 @@ public class DeleteEntityControllerFileData {
* @param moduleName String
* @param acl String
* @param entityId String
* @param hasDeleteCommandInterface boolean
*/
public DeleteEntityControllerFileData(
final @NotNull String entityName,
final @NotNull String moduleName,
final @NotNull String acl,
final @NotNull String entityId
final @NotNull String entityId,
final boolean hasDeleteCommandInterface
) {
this.entityName = entityName;
this.moduleName = moduleName;
this.acl = acl;
this.entityId = entityId;
this.hasDeleteCommandInterface = hasDeleteCommandInterface;
}

/**
Expand Down Expand Up @@ -69,4 +73,13 @@ public String getAcl() {
public String getEntityId() {
return entityId;
}

/**
* Check if delete command has Web API interface.
*
* @return boolean
*/
public boolean isHasDeleteCommandInterface() {
return hasDeleteCommandInterface;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class EntityDataMapperData {
private final String modelName;
private final String dtoName;
private final String dtoInterfaceName;
private final boolean dtoWithInterface;
private final boolean hasDtoInterface;

/**
* Magento entity data mapper data constructor.
Expand All @@ -25,22 +25,22 @@ public class EntityDataMapperData {
* @param modelName String
* @param dtoName String
* @param dtoInterfaceName String
* @param isDtoWithInterface boolean
* @param hasDtoInterface boolean
*/
public EntityDataMapperData(
final @NotNull String moduleName,
final @NotNull String entityName,
final @NotNull String modelName,
final @NotNull String dtoName,
final @NotNull String dtoInterfaceName,
final boolean isDtoWithInterface
final boolean hasDtoInterface
) {
this.moduleName = moduleName;
this.entityName = entityName;
this.modelName = modelName;
this.dtoName = dtoName;
this.dtoInterfaceName = dtoInterfaceName;
this.dtoWithInterface = isDtoWithInterface;
this.hasDtoInterface = hasDtoInterface;
}

/**
Expand Down Expand Up @@ -93,7 +93,7 @@ public String getDtoInterfaceName() {
*
* @return boolean
*/
public boolean isDtoWithInterface() {
return dtoWithInterface;
public boolean isHasDtoInterface() {
return hasDtoInterface;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class GetListQueryModelData {
private final String entityName;
private final String modelName;
private final String collectionName;
private final String aclResource;

/**
* Query Model DTO Constructor.
Expand All @@ -21,17 +22,20 @@ public class GetListQueryModelData {
* @param entityName String
* @param modelName String
* @param collectionName String
* @param aclResource String
*/
public GetListQueryModelData(
final @NotNull String moduleName,
final @NotNull String entityName,
final @NotNull String modelName,
final @NotNull String collectionName
final @NotNull String collectionName,
final @NotNull String aclResource
) {
this.moduleName = moduleName;
this.entityName = entityName;
this.modelName = modelName;
this.collectionName = collectionName;
this.aclResource = aclResource;
}

/**
Expand Down Expand Up @@ -69,4 +73,13 @@ public String getModelName() {
public String getCollectionName() {
return collectionName;
}

/**
* Get entity acl resource.
*
* @return String
*/
public String getAclResource() {
return aclResource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class SaveEntityCommandData {
private final String dtoName;
private final String dtoInterfaceName;
private final boolean dtoWithInterface;
private final String aclResource;

/**
* Save Command DTO Constructor.
Expand All @@ -27,6 +28,7 @@ public class SaveEntityCommandData {
* @param dtoName String
* @param dtoInterfaceName String
* @param isDtoWithInterface boolean
* @param aclResource String
*/
public SaveEntityCommandData(
final @NotNull String moduleName,
Expand All @@ -35,7 +37,8 @@ public SaveEntityCommandData(
final @NotNull String resourceModelName,
final @NotNull String dtoName,
final @NotNull String dtoInterfaceName,
final boolean isDtoWithInterface
final boolean isDtoWithInterface,
final @NotNull String aclResource
) {
this.moduleName = moduleName;
this.entityName = entityName;
Expand All @@ -44,6 +47,7 @@ public SaveEntityCommandData(
this.dtoName = dtoName;
this.dtoInterfaceName = dtoInterfaceName;
this.dtoWithInterface = isDtoWithInterface;
this.aclResource = aclResource;
}

/**
Expand Down Expand Up @@ -108,4 +112,13 @@ public String getDtoInterfaceName() {
public boolean isDtoWithInterface() {
return dtoWithInterface;
}

/**
* Get ACL resource.
*
* @return String
*/
public String getAclResource() {
return aclResource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public class SaveEntityControllerFileData {
private final String entityId;
private final String dtoName;
private final String dtoInterfaceName;
private final boolean dtoWithInterface;
private final boolean hasDtoInterface;
private final boolean hasSaveCommandInterface;

/**
* Controller save file constructor.
Expand All @@ -26,7 +27,8 @@ public class SaveEntityControllerFileData {
* @param entityId String
* @param dtoName String
* @param dtoInterfaceName String
* @param isDtoWithInterface boolean
* @param hasDtoInterface boolean
* @param hasSaveCommandInterface boolean
*/
public SaveEntityControllerFileData(
final @NotNull String entityName,
Expand All @@ -35,15 +37,17 @@ public SaveEntityControllerFileData(
final @NotNull String entityId,
final @NotNull String dtoName,
final @NotNull String dtoInterfaceName,
final boolean isDtoWithInterface
final boolean hasDtoInterface,
final boolean hasSaveCommandInterface
) {
this.entityName = entityName;
this.moduleName = moduleName;
this.acl = acl;
this.entityId = entityId;
this.dtoName = dtoName;
this.dtoInterfaceName = dtoInterfaceName;
this.dtoWithInterface = isDtoWithInterface;
this.hasDtoInterface = hasDtoInterface;
this.hasSaveCommandInterface = hasSaveCommandInterface;
}

/**
Expand Down Expand Up @@ -105,7 +109,16 @@ public String getDtoInterfaceName() {
*
* @return boolean
*/
public boolean isDtoWithInterface() {
return dtoWithInterface;
public boolean isHasDtoInterface() {
return hasDtoInterface;
}

/**
* Check if save command has interface.
*
* @return boolean
*/
public boolean isHasSaveCommandInterface() {
return hasSaveCommandInterface;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class UiComponentDataProviderData {
private final String path;
private final String entityName;
private final String entityIdFieldName;
private final boolean hasQueryInterface;

/**
* UiComponentGridDataProviderData constructor.
Expand All @@ -22,7 +23,7 @@ public UiComponentDataProviderData(
final String name,
final String path
) {
this(name, path, null, null);
this(name, path, null, null, false);
}

/**
Expand All @@ -32,17 +33,20 @@ public UiComponentDataProviderData(
* @param path String
* @param entityName String
* @param entityIdFieldName String
* @param hasQueryInterface boolean
*/
public UiComponentDataProviderData(
final String name,
final String path,
final String entityName,
final String entityIdFieldName
final String entityIdFieldName,
final boolean hasQueryInterface
) {
this.name = name;
this.path = path;
this.entityName = entityName;
this.entityIdFieldName = entityIdFieldName;
this.hasQueryInterface = hasQueryInterface;
}

/**
Expand Down Expand Up @@ -80,4 +84,13 @@ public String getEntityName() {
public String getEntityIdFieldName() {
return entityIdFieldName;
}

/**
* Check if query service has Web API interface.
*
* @return boolean
*/
public boolean isHasQueryInterface() {
return hasQueryInterface;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public DataProviderDtoConverter(
newEntityDialogData.getEntityName().concat("DataProvider"),
UiComponentDataProviderFile.DIRECTORY,
newEntityDialogData.getEntityName(),
newEntityDialogData.getIdFieldName()
newEntityDialogData.getIdFieldName(),
newEntityDialogData.hasWebApi()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public DeleteEntityByIdCommandDtoConverter(
newEntityDialogData.getEntityName(),
newEntityDialogData.getIdFieldName(),
newEntityDialogData.getEntityName().concat("Model"),
newEntityDialogData.getEntityName().concat("Resource")
newEntityDialogData.getEntityName().concat("Resource"),
newEntityDialogData.getAclId()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public FormDeleteControllerDtoConverter(
newEntityDialogData.getEntityName(),
generationContextData.getModuleName(),
newEntityDialogData.getAclId(),
newEntityDialogData.getIdFieldName()
newEntityDialogData.getIdFieldName(),
newEntityDialogData.hasWebApi()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public FormSaveControllerDtoConverter(
newEntityDialogData.getIdFieldName(),
newEntityDialogData.getEntityName().concat("Data"),
newEntityDialogData.getEntityName().concat("Interface"),
newEntityDialogData.hasDtoInterface()
newEntityDialogData.hasDtoInterface(),
newEntityDialogData.hasWebApi()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public GetListQueryDtoConverter(
generationContextData.getModuleName(),
newEntityDialogData.getEntityName(),
newEntityDialogData.getEntityName().concat("Model"),
newEntityDialogData.getEntityName().concat("Collection")
newEntityDialogData.getEntityName().concat("Collection"),
newEntityDialogData.getAclId()
);
}
}
Loading