Skip to content

Instantly share code, notes, and snippets.

View obedmhg's full-sized avatar

Obed Murillo obedmhg

View GitHub Profile
@obedmhg
obedmhg / designer.html
Last active August 29, 2015 14:15
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
@obedmhg
obedmhg / DeploymentServerMonitor.java
Last active May 18, 2016 21:45
DeploymentServerMonitor.java
package com.ocorputil;
import atg.deployment.common.DeploymentException;
import atg.deployment.server.DeploymentServer;
import atg.deployment.server.Target;
import atg.service.scheduler.SchedulableService;
import atg.service.scheduler.Schedule;
import atg.service.scheduler.ScheduledJob;
import atg.service.scheduler.Scheduler;
@obedmhg
obedmhg / findBorkenSequenceChildSkus.sql
Created May 19, 2016 14:32
With this PL/SQL you can find which records on your DCS_PRD_CHLDSKU table are missing a sequence, is is an edge case, but when it happens you need to go and find them and fix them otherwise your deployment will be stuck, this will help you to do it for all your products.
DECLARE
CURSOR c_get_all_products
IS
SELECT DISTINCT(product_id) FROM DCS_PRD_CHLDSKU;
seq_max NUMBER;
seq_count NUMBER;
broken_count NUMBER;
BEGIN
broken_count := 0;
FOR product_id IN c_get_all_products
package com.mycompany.commerce.order;
import atg.commerce.order.OrderImpl;
import atg.commerce.order.CreditCard;
import atg.commerce.order.GiftCertificate;
import com.sparkred.paypal.PayPalPaymentGroup;
public class MyCompanyOrderImpl extends OrderImpl {
@obedmhg
obedmhg / CompareValuesPropertyDescriptor.java
Created May 19, 2016 14:44
Property descriptor that will compare 2 values that will be set as attribute tags, along with the comparison to do, it will return the boolean with the result of the operation.
package com.common.propertydescriptor;
import atg.adapter.gsa.GSAPropertyDescriptor;
import atg.core.util.StringUtils;
import atg.nucleus.logging.ApplicationLogging;
import atg.nucleus.logging.ClassLoggingFactory;
import atg.repository.RepositoryItemImpl;
import com.common.Constants;
@obedmhg
obedmhg / CompareValuesPropertyDescriptorInAction.xml
Created May 19, 2016 14:46
CompareValuesPropertyDescriptor in action on xml repository definition
<property name="isNewArrival" data-type="boolean" property-type="com.common.propertydescriptor.CompareValuesPropertyDescriptor">
<attribute name="compareOperator" value="lt" />
<attribute name="leftSideValue" value="daysAvailable" />
<attribute name="leftSideType" value="property" />
<attribute name="rightSideValue" value="30" />
<attribute name="rightSideType" value="int" />
</property>
<property name="onSale" data-type="boolean" property-type="com.common.propertydescriptor.CompareValuesPropertyDescriptor">
@obedmhg
obedmhg / ConcatenateValuesPropertyDescriptor.java
Last active May 19, 2016 14:49
PropertyDescriptor to Concatenate properties
package com.common.propertydescriptor;
import org.apache.commons.lang3.StringUtils;
import atg.adapter.gsa.GSAPropertyDescriptor;
import atg.nucleus.logging.ApplicationLogging;
import atg.nucleus.logging.ClassLoggingFactory;
import atg.repository.RepositoryItemImpl;
import com.common.Constants;
@obedmhg
obedmhg / CocaenateValuesPropertyDescriptorInAction.xml
Created May 19, 2016 14:55
CocaenateValuesPropertyDescriptor in action
<property name="pName" data-type="string" property-type="com.common.propertydescriptor.CocaenateValuesPropertyDescriptor">
<attribute name="separator" value=" - " />
<attribute name="properties" value="displayName,colorName,colorCode" />
</property>
<!-- If property sent in properties does not exist it will be concatenated as string, meaning that separator can be sent as property as
follows:
-->
<attribute name="properties" value="this, ,color, ,[,colorCode,], ,size,,[,sizeCode,]"/>
SELECT product_id
FROM (SELECT product_id, MAX(sequence_num) AS "MAX_SEQ", count(*) -1 AS "COUNT"
FROM (SELECT DISTINCT dcc.product_id, dcc.sequence_num, dcc.sku_id
FROM dcs_product dc
INNER JOIN dcs_prd_chldsku dcc ON (dcc.product_id = dc.product_id)
WHERE dc.asset_version = dcc.asset_version
AND dc.is_head = 1
)
GROUP BY product_id
)
SELECT product_id
FROM (SELECT product_id, MAX(sequence_num) AS "MAX_SEQ", count(*) -1 AS "COUNT"
FROM (SELECT DISTINCT dcc.product_id, dcc.sequence_num, dcc.sku_id
FROM dcs_product dc
INNER JOIN dcs_prd_chldsku dcc ON (dcc.product_id = dc.product_id)
WHERE dc.asset_version = dcc.asset_version
AND dc.is_head = 1
)
GROUP BY product_id
)