I'm trying to use search structurally to find interfaces that could be annotated with #FunctionalInterface since they only contain a single abstract method but aren't annotated yet.
My current structural search template looks like this:
#$TheAnnotation$
interface $Interface$ {
$ReturnType$ $Method$ ($ParameterType$ $Parameter$);
}
I've added the following filters
Parameters: count -> [0, ∞]
TheAnnotation: script -> TheAnnotation.getClass() != FunctionalInterface.class
but that does not seem to work as the result will contain classes annotated with #FunctionalInterface nevertheless.
IntelliJ IDEA has a "Interface may be annotated #FunctionalInterface" inspection, you may want to use instead. It has a quick fix to add the #FunctionalInteface annotation.
But if you insist on using Structural Search, here's a template that should work:
<searchConfiguration name="Unnamed" text="#$TheAnnotation$
interface $Interface$ {
abstract $ReturnType$ $Method$ ($ParameterType$ $Parameter$);
abstract $ReturnType2$ $Method2$ ($ParameterType2$ $Parameter2$);
}" recursive="false" caseInsensitive="false" type="JAVA" pattern_context="default">
<constraint name="__context__" within="" contains="" />
<constraint name="TheAnnotation" regexp="FunctionalInterface" minCount="0" maxCount="0" within="" contains="" />
<constraint name="Method" within="" contains="" />
<constraint name="Interface" within="" contains="" />
<constraint name="ReturnType" within="" contains="" />
<constraint name="ReturnType2" within="" contains="" />
<constraint name="ParameterType" within="" contains="" />
<constraint name="ParameterType2" within="" contains="" />
<constraint name="Parameter" minCount="0" maxCount="2147483647" within="" contains="" />
<constraint name="Parameter2" minCount="0" maxCount="2147483647" within="" contains="" />
<constraint name="Method2" minCount="0" maxCount="0" within="" contains="" />
</searchConfiguration>
(copy the xml and using the "Import Template from Clipboard" action under the tool button in the Structural Search dialog)
Related
Now I have a motion with two elements. When first is 50% duration then second starts. But I want to rotate second element in half transition to the end. I tryed to do this in KeyCycle but it Doesnt work. Maybe I need to do this in KeyAttribute? But it doesn't work too. Maybe someone give me a tip?
Scene:
<Transition
motion:autoTransition="animateToEnd"
motion:constraintSetEnd="#+id/end"
motion:constraintSetStart="#id/start"
motion:duration="1500">
<KeyFrameSet>
<KeyPosition
motion:framePosition="50"
motion:keyPositionType="pathRelative"
motion:motionTarget="#id/imageView"
motion:percentX="1" />
<KeyPosition
motion:framePosition="50"
motion:keyPositionType="pathRelative"
motion:motionTarget="#id/cardYes"
motion:percentX="0" />
<KeyCycle
android:translationY="50dp"
motion:framePosition="300"
motion:motionTarget="#+id/imageView"
motion:waveOffset="50dp"
motion:wavePeriod="2"
motion:waveShape="sin" />
</KeyFrameSet>
</Transition>
<ConstraintSet android:id="#+id/start">
<Constraint
android:id="#+id/imageView"
android:layout_width="0dp"
android:layout_height="10dp"
android:layout_marginTop="15dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="#+id/cardYes"
android:layout_width="100dp"
android:layout_height="100dp"
motion:layout_constraintRight_toLeftOf="parent"
motion:layout_constraintTop_toBottomOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="#+id/end">
<Constraint
android:id="#+id/imageView"
android:layout_width="400dp"
android:layout_height="290dp"
android:layout_marginTop="15dp"
motion:layout_constraintRight_toRightOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="#+id/cardYes"
android:layout_width="100dp"
android:layout_height="100dp"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toBottomOf="#+id/imageView" />
</ConstraintSet>
must have 3 KeyCycle can work well.
In your case, maybe you need code like this:
<KeyFrameSet>
<KeyAttribute
android:rotation="0"
motion:framePosition="50"
motion:motionTarget="#id/view"
/>
<KeyAttribute
android:rotation="360"
motion:framePosition="100"
motion:motionTarget="#id/view"
/>
</KeyFrameSet>
I'm trying to create an inspection based on Structural Search
to avoid initializing ExecutorService to Executor Variables.
The below is my template:
<searchConfiguration name="Use an ExecutorService variable to initialize instead of Executor" text="Executor $x$ = $y$;" recursive="true" caseInsensitive="true" type="JAVA" >
<constraint name="__context__" within="" contains="" />
<constraint name="x" nameOfExprType="java\.util\.concurrent\.Executor" within="" contains="" />
<constraint name="y" nameOfExprType="java\.util\.concurrent\.ExecutorService" within="" contains="" />
The code which I want to avoid such initializations:
private final Executor exec = Execs.singleThreaded("test-%s");
The structural search is not working as I expected. What's wrong with my template?
I removed "nameOfExprType" of x. It worked.
<searchConfiguration name="Use an ExecutorService variable to initialize instead of Executor" text="Executor $x$ = $y$;" recursive="true" caseInsensitive="true" type="JAVA" >
<constraint name="__context__" within="" contains="" />
<constraint name="x" within="" contains="" />
<constraint name="y" nameOfExprType="java\.util\.concurrent\.ExecutorService" exprTypeWithinHierarchy="true" within="" contains="" />
</searchConfiguration>
I am new to JPOS. I want to add a set of sub fields into a single field with a bitmap. I tried with following URL but I didn't get any good result.
PISO 8583 subfield using JPOS
What I want to do :
I have to send a "0100" request. In this case I want to put CVV value into "126.10" field. Field "126" has many sub fields and field "126" has a bit map.
Is it possible to do this kind of case using JPOS? If it is possible how can we do that. If you have any sample please help me to complete this task.
Thank you.
With jPos it is possible to configure an isofieldpackager in the packager XML file as shown in the example below. The "emitBitmap" property determines if field 56 will have a bitmap.
Sample packager MXL file with SubFieldPackager in field 56:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager PUBLIC
"-//jPOS/jPOS Generic Packager DTD 1.0//EN"
"http://jpos.org/dtd/generic-packager-1.0.dtd">
<isopackager>
<isofield id="0" length="4" name="MESSAGE TYPE INDICATOR" pad="true" class="org.jpos.iso.IFB_NUMERIC" />
<isofield id="1" length="8" name="BIT MAP" class="org.jpos.iso.IFB_BITMAP" />
<isofield id="2" length="99" name="?" class="org.jpos.iso.IFB_LLNUM" />
<isofield id="3" length="6" name="PROCESSING CODE" class="org.jpos.iso.IFB_NUMERIC" />
<isofield id="11" length="6" name="?" class="org.jpos.iso.IFB_NUMERIC" />
<isofield id="12" length="6" name="?" class="org.jpos.iso.IFB_NUMERIC" />
<isofield id="13" length="4" name="?" class="org.jpos.iso.IFB_NUMERIC" />
<isofield id="14" length="4" name="?" class="org.jpos.iso.IFB_NUMERIC" />
<isofield id="24" length="3" name="?" class="org.jpos.iso.IFB_NUMERIC" />
<isofield id="39" length="2" name="?" class="org.jpos.iso.IF_CHAR" />
<isofield id="41" length="8" name="?" class="org.jpos.iso.IF_CHAR" />
<isofield id="42" length="999" name="?" class="org.jpos.iso.IFB_LLLBINARY" />
<isofieldpackager id="56" length="999" name="ADDITIONAL TRANSACTION DATA" class="org.jpos.iso.IFB_LLLBINARY"
packager="org.jpos.iso.packager.GenericSubFieldPackager" emitBitmap="true">
<isofield id="1" length="2" name="PHONE PREFIX" pad="true" class="org.jpos.iso.IFB_NUMERIC" />
<isofield id="2" length="9" name="PHONE" pad="true" class="org.jpos.iso.IFB_NUMERIC" />
<isofield id="3" length="99" name="?" class="org.jpos.iso.IFB_LLBINARY" />
</isofieldpackager>
<isofield id="61" length="999" name="SERVER INFORMATIONS" class="org.jpos.iso.IFB_LLLCHAR" />
</isopackager>
The projects of this file can be found in the repositories of the links below. They are simple projects that send and respond ISO 8583 messages.
Repositories of ISO 8583 projects:
https://github.com/alexlirio/iso-sender
https://github.com/alexlirio/iso-responder
In my case I need to include the bitmap field like this.
<isofield
id="0"
length="8"
name="BIT MAP"
class="org.jpos.iso.IFA_BITMAP" />
Also set this two attributes on the isofieldpackager tag.
emitBitmap="true"
bitmapField="0"
<isofieldpackager
id="56"
length="999"
name="ADDITIONAL TRANSACTION DATA"
class="org.jpos.iso.IFA_LLLNUM"
packager="org.jpos.iso.packager.GenericSubFieldPackager"
emitBitmap="true"
bitmapField="0">
<isofield
id="0"
length="8"
name="BIT MAP"
class="org.jpos.iso.IFA_BITMAP" />
<isofield
id="1"
length="2"
name="???"
pad="true"
class="org.jpos.iso.IFA_NUMERIC" />
<isofield
id="2"
length="9"
name="???"
pad="true"
class="org.jpos.iso.IFA_NUMERIC" />
<isofield
id="3"
length="99"
name="???"
class="org.jpos.iso.IFA_NUMERIC" />
</isofieldpackager>
I've inherited a report spec subsystem that needs to be tweaked. The mission is to add a date column to the tReports table, and populate it with the CreateDate that is (supposed to be) contained in the XML Code Spec. The problem is that some of the older reports don't have the CREATEDATE attribute, or as in one example below, the XML is valid but poorly formed, and the CREATEDATE cannot be retrieved using the xQuery that works for most of the other reports. Since I don't have an explicit creation date included in the spec, I'm using interpolation to estimate a reasonable date. One factor of the interpolation is to look at the date strings contained in the report spec--some will be useful, others not.
There are too many reports (over 1,200) to visually skim each report spec for date strings. These date strings can appear in any location in the report spec, and there are a very large number of combinations of elements and attributes that can contain a date string.
The ideal solution would be a listing of the reportID's and the date string ready to use in an UPDATE, but because date format varies (m/d/yy, mm/dd/yy, m/dd/yy ...) I'd be grateful to get a vew spurious characters surrounding the date string that I could clean up later.
All the date strings will be from 2000 or later, so the search string I'v been using is '/20' which has provided good results.
I've looked at many sites that discuss this kind of issue, and found only one solution by Mikael Eriksson that is something like what I'm describing, but I can't make it work after several hours of playing with it. How to extract multiple strings from single rows in SQL Server
Is there a way, without using a cursor nor WHILE loop, to extract these embedded dates?
-- Some representative data: (I'm using SQL Server 2008 R2)
CREATE TABLE #ReportSpecs (ReportID INT, ReportSpec VARCHAR(MAX))
INSERT INTO #ReportSpecs
( ReportID, ReportSpec )
VALUES
(136,
'<ReportID>136</ReportID>
<EmpIDCreator>23816</EmpIDCreator>
<EmpName>Blanc, Melvin J</EmpName>
<ReportType>0</ReportType>
<ReportName>PSST Sys Spec</ReportName>
<ReportData>
<REPORT>
<COLUMNS>
<Column Name="JobNumber" Position="1" />
<Column Name="TaskType" Position="2" />
<Column Name="Assignees" Position="3" />
<Column NAME="JobDueDate" Position="4" />
<Column Name="ReferenceNumber" Position="5" />
<Column Name="Deliverable" Position="6" />
<Column Name="Priority" Position="7" />
</COLUMNS>
<FILTERS>
<FILTER NAME="TYPE" VALUE="To_Me" />
<FILTER NAME="Status" VALUE="All" />
<FILTER NAME="DateOptions" VALUE="DateRange" From="8/16/2002" To="8/23/2002" />
<FILTER NAME="FromDate" VALUE="8/16/2002" />
<FILTER NAME="ToDate" VALUE="8/23/2002" />
<FILTER NAME="Role" VALUE="All" />
</FILTERS>
<parameters>
<PARAMETER NAME="#Cascading" TYPE="integer" VALUE="0" />
<PARAMETER NAME="#EmpID" SYSTEM="true" TYPE="integer" VALUE="#Request.EmployeeIDAlias#" />
<PARAMETER NAME="#FromOrgs" TYPE="varchar(250)" VALUE="" />
<PARAMETER NAME="#ToOrgs" TYPE="varchar(250)" VALUE="" />
</parameters>
<NAME>PSST Sys Spec</NAME>
<OWNER>
<ID>23816</ID>
</OWNER>
<source id="8" useinternalid="True" />
</REPORT>
</ReportData>'),
(311,
'<ReportID>311</ReportID>
<EmpIDCreator>7162</EmpIDCreator>
<EmpName>Potter, Harry J</EmpName>
<ReportType>0</ReportType>
<ReportName>CPVC Synch Test</ReportName>
<ReportData>
<REPORT>
<COLUMNS>
<Column Name="JobNumber" Position="1" />
<Column Name="TaskType" Position="2" />
<Column Name="Subject" Position="3" />
<Column Name="CurrentAssignee" Position="4" />
<Column NAME="JobDueDate" Position="5" />
<Column Name="Deliverable" Position="6" />
<Column Name="Category" Position="7" />
<Column Name="Priority" Position="8" />
</COLUMNS>
<FILTERS>
<FILTER NAME="TYPE" VALUE="By_Orgs_6098,By_Orgs_6123" />
<FILTER NAME="Status" VALUE="Open" />
<FILTER NAME="DateOptions" VALUE="DateRange" From="3/25/2002" To="4/4/2002" />
<FILTER NAME="ReviewFromDate" VALUE="3/25/2002" />
<FILTER NAME="ReviewToDate" VALUE="4/4/2002" />
<FILTER NAME="Role" VALUE="All" />
</FILTERS>
<parameters>
<PARAMETER NAME="#Act" TYPE="integer" VALUE="0" />
<PARAMETER NAME="#MgrID" SYSTEM="true" TYPE="integer" VALUE="#Request.EmployeeIDAlias#" />
<PARAMETER NAME="#MgrIDActing" TYPE="integer" VALUE="" />
<PARAMETER NAME="#FromDept" TYPE="varchar(250)" VALUE="" />
<PARAMETER NAME="#FromEmp" TYPE="varchar(250)" VALUE="" />
<PARAMETER NAME="#ToDept" TYPE="varchar(250)" VALUE="" />
</parameters>
<NAME>CPVC Synch Test</NAME>
<OWNER>
<ID>7162</ID>
</OWNER>
<source id="17" useinternalid="True" />
</REPORT>
</ReportData>'),
(1131,
'<ReportID>1131</ReportID>
<EmpIDCreator>13185</EmpIDCreator>
<EmpName>Reed, Alan</EmpName>
<ReportType>0</ReportType>
<ReportName>
''"><script>alert(''hello'')</script>
</ReportName>
<ReportData>
<Report NAME="''">
<script>alert(''hello'')</script>" CREATEDATE="12/7/2009">
<DESCRIPTION>sfasf</DESCRIPTION>
<OWNER ID="13185"/>
<SOURCE ID="1" USEINTERNALID="TRUE"/>
<COLUMNS>
<COLUMN NAME="JobNumber" POSITION="1" SORTORDER="asc"/>
</COLUMNS>
<FILTERS>
<FILTER NAME="TYPE" VALUE="By_Me,To_Me" />
<FILTER NAME="ASGSTATUS" VALUE="Open" />
<FILTER NAME="DATEOPTIONS" VALUE="All" />
<FILTER NAME="STATUS" VALUE="Open" />
<FILTER NAME="ASGDATEOPTIONS" VALUE="All" />
<FILTER NAME="ROLE" VALUE="All" />
</FILTERS>
<PARAMETERS>
<PARAMETER NAME="#Me" TYPE="integer" VALUE="3" />
<PARAMETER NAME="#FromCost" TYPE="varchar(250)" VALUE=""/>
<PARAMETER NAME="#ToCost" TYPE="varchar(250)" VALUE="" />
</PARAMETERS>
<ADVANCEDSORT SortByA="JobNumber" SortOrderA="asc" SortByB="" SortOrderB="" SortByC="" SortOrderC="" />
</Report>
</ReportData>');
/*
Desired Output (A DISTINCT list would be better, but just getting this output would be GREAT.)
ReportID DateString
-------- ----------
136 8/16/2002
136 8/23/2002
136 8/16/2002
136 8/23/2002
311 3/25/2002
311 4/4/2002
311 3/25/2002
311 4/4/2002
1131 12/7/2009
*/
DROP TABLE #ReportSpecs
Thanks for your time.
select R.ReportID,
D.V as DateString
from #ReportSpecs as R
cross apply (select cast(R.ReportSpec as xml)) as X(R)
cross apply X.R.nodes('//#*, //*/text()') as T(X)
cross apply (select T.X.value('.', 'varchar(max)')) as D(V)
where charindex('/20', D.V) > 0
Result:
ReportID DateString
----------- --------------------------
136 8/16/2002
136 8/23/2002
136 8/16/2002
136 8/23/2002
311 3/25/2002
311 4/4/2002
311 3/25/2002
311 4/4/2002
1131 " CREATEDATE="12/7/2009">
I use Tiles 2 in my web application, and the basic setup I've got in my tiles.xml file is this:
<tiles-definitions>
<definition name="mainLayout" template="/jsp/layout.jsp">
<put-attribute name="header" value=""/>
<put-attribute name="menu" value="/jsp/defaultMenu.jsp" />
<put-attribute name="content" value="" />
<put-attribute name="footer" value="/jsp/footer.jsp" />
</definition>
<definition name="HomePage" extends="mainLayout">
<put-attribute name="content" type="template" value="/jsp/home.jsp"/>
<put-attribute name="homeClass" value="active" />
</definition>
... rest omitted for brevity.
In layout.jsp, which defines the layout, I include the menu in the appropriate place.
<tiles:insertAttribute name="menu" />
So, then inside my menu template, I wanted to use the homeClass attribute defined in tiles.xml.
<tiles:insertAttribute name='homeClass'/>
but I get an error about the homeClass attribute not being defined. If I do an insertAttribute in my layout.jsp, the value is defined properly, but I need it defined in the menu JSP, included from my layout.
So, my question is: How can I have the homeClass attribute passed correctly not just to my layout template, but to the menu template which is included from the layout template?
I believe you could use nested template definitions:
<definition name="mainLayout" template="/jsp/layout.jsp">
<put-attribute name="header" value=""/>
<put-attribute name="menu">
<definition template="/jsp/defaultMenu.jsp">
<put-attribute name="homeClass" value="active"/>
</definition>
</put-attribute>
<put-attribute name="content" value="" />
<put-attribute name="footer" value="/jsp/footer.jsp" />
</definition>